Skip to content

fix(statuses): remove WS workarounds - part 2#2512

Open
rmnbrd wants to merge 5 commits intostagingfrom
fix/ws/remove-workarounds-part-2
Open

fix(statuses): remove WS workarounds - part 2#2512
rmnbrd wants to merge 5 commits intostagingfrom
fix/ws/remove-workarounds-part-2

Conversation

@rmnbrd
Copy link
Copy Markdown
Contributor

@rmnbrd rmnbrd commented Mar 19, 2026

Summary

Issue: QOV-1727

This PR finishes what #2510 started:

  • removing checkRunningStatusClosed queries and associated hooks.
  • updating the onMessage callback of the useStatusWebSockets hook to prevent the queries' data from being reset or updated unnecessarily.
  • removing the now-useless onClose callback from the useStatusWebSockets hook.
  • replacing JSON.stringify change detection with fast-deep-equal for both environment and service running status comparisons in useStatusWebSockets, avoiding repeated serialization on every WS message and eliminating sensitivity to property-order differences.
  • persisting triggered_action from the WS payload to the environment running status cache (it was previously dropped, causing consumers to always see triggered_action: undefined).

Testing

  • Changes tested locally in the relevant Console's pages and Storybooks
  • yarn test or yarn test -u (if you need to regenerate snapshots)
  • yarn format
  • yarn lint

PR Checklist

  • I followed naming, styling, and TypeScript rules (see .cursor/rules)
  • I performed a self-review (diff inspected, dead code removed)
  • I titled the PR using Conventional Commits with a scope when possible (e.g. feat(service): add new Terraform service) - required for semantic-release
  • I only kept necessary comments, written in English (watch for useless AI comments)
  • I involved a designer to validate UI changes if I am not a designer
  • I covered new business logic with tests (unit)
  • I confirmed CI is green (Codecov red can be accepted)
  • I reviewed and executed locally any AI-assisted code

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

@jul-dan
Copy link
Copy Markdown
Contributor

jul-dan commented Mar 19, 2026

Qovery Preview

Qovery can create a Preview Environment for this PR.
To trigger its creation, please post a comment with one of the following command.

Command Blueprint environment
/qovery preview 964984c5-fba6-4371-88d3-a5daf99642ab test-prod
/qovery preview 28c47145-c8e7-4b9d-8d9e-c65c95b48425 staging
/qovery preview cc1de7de-94e5-40f8-8e45-bc8986d9dfec storybook
/qovery preview {all|UUID1,UUID2,...} To preview multiple environments

This comment has been generated from Qovery AI 🤖.
Below, a word from its wisdom :

You are going to thank you later if it contains tests

@rmnbrd rmnbrd self-assigned this Mar 19, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.08%. Comparing base (7a3b674) to head (bc89944).

Additional details and impacted files
@@             Coverage Diff             @@
##           staging    #2512      +/-   ##
===========================================
- Coverage    47.30%   47.08%   -0.23%     
===========================================
  Files         1274     1231      -43     
  Lines        23705    23062     -643     
  Branches      6991     6857     -134     
===========================================
- Hits         11214    10858     -356     
+ Misses       10347    10121     -226     
+ Partials      2144     2083      -61     
Flag Coverage Δ
unittests 47.08% <ø> (-0.23%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rmnbrd rmnbrd marked this pull request as ready for review March 19, 2026 17:11
@rmnbrd rmnbrd requested a review from RemiBonnet March 19, 2026 17:11
@rmnbrd
Copy link
Copy Markdown
Contributor Author

rmnbrd commented Mar 19, 2026

/qovery preview 28c47145-c8e7-4b9d-8d9e-c65c95b48425

@RemiBonnet
Copy link
Copy Markdown
Member

Qovery Preview

A preview environment was automatically created via Qovery.
Click on the link below to follow its deployment and use it.
👉 [PR] staging - fix(statuses): remove WS workarounds - part 2 - 2026-03-19T17:11:50Z

Another comment will be posted when deployments are finished

@RemiBonnet
Copy link
Copy Markdown
Member

Qovery Preview

Your preview environment has been successfully deployed !
Click on the link below to open your service:
👉 console

Copy link
Copy Markdown
Member

@RemiBonnet RemiBonnet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've got a feeling we have a regression between prod and the fixes, running status goes from RUNNING -> STOPPED-> RUNNING - you can check the video!

https://www.loom.com/share/66dc0d135f424578bbed7dfbb1caaad6?focus_title=1&muted=1&from_recorder=1

Copilot AI review requested due to automatic review settings March 27, 2026 08:52
@rmnbrd rmnbrd force-pushed the fix/ws/remove-workarounds-part-2 branch from bc89944 to 10584e2 Compare March 27, 2026 08:52
@jul-dan
Copy link
Copy Markdown
Contributor

jul-dan commented Mar 27, 2026

Qovery Preview

A preview environment was automatically created via Qovery.
Click on the link below to follow its deployment and use it.
👉 [PR] test-prod - fix(statuses): remove WS workarounds - part 2 - 2026-03-27T08:54:04Z

Another comment will be posted when deployments are finished

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Completes the removal of the “WS closed / status unavailable” workaround introduced earlier by deleting the checkRunningStatusClosed query keys/hooks and simplifying status rendering, while adjusting the WebSocket onMessage behavior to reduce unnecessary React Query cache writes.

Changes:

  • Removed checkRunningStatusClosed query keys and feature hooks from services/environments domains.
  • Updated services/environments UI components to stop rendering the “Status unavailable” fallback based on the removed workaround.
  • Updated useStatusWebSockets to only write React Query cache when statuses change, and removed the onClose handler.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
libs/shared/util-web-sockets/src/lib/use-status-web-sockets/use-status-web-sockets.ts Removes WS close workaround and adds “only update on change” cache writes for env/service statuses.
libs/domains/services/feature/src/lib/service-list/service-list.tsx Removes UI + hook usage for the “status unavailable” workaround in the service list.
libs/domains/services/feature/src/lib/hooks/use-check-running-status-closed/use-check-running-status-closed.ts Deletes the now-unused hook.
libs/domains/services/data-access/src/lib/domains-services-data-access.ts Removes the checkRunningStatusClosed query key from services query factory.
libs/domains/environments/feature/src/lib/hooks/use-check-running-status-closed/use-check-running-status-closed.ts Deletes the now-unused hook.
libs/domains/environments/feature/src/lib/environment-state-chip/environment-state-chip.tsx Removes workaround logic that forced STOPPED when WS was “unavailable”.
libs/domains/environments/feature/src/lib/environment-list/environment-list.tsx Removes “status unavailable” fallback UI from environment list.
libs/domains/environments/data-access/src/lib/domains-environments-data-access.ts Removes the checkRunningStatusClosed query key from environments query factory.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

… in useStatusWebSockets

Agent-Logs-Url: https://github.com/Qovery/console/sessions/0f5de3f9-43a6-4026-baaf-d53f9796dcfa

Co-authored-by: rmnbrd <426749+rmnbrd@users.noreply.github.com>
@Astach
Copy link
Copy Markdown
Contributor

Astach commented Mar 27, 2026

/qovery preview 28c47145-c8e7-4b9d-8d9e-c65c95b48425

@RemiBonnet
Copy link
Copy Markdown
Member

Qovery Preview

A preview environment was automatically created via Qovery.
Click on the link below to follow its deployment and use it.
👉 [PR] staging - fix(statuses): remove WS workarounds - part 2 - 2026-03-27T10:05:20Z

Another comment will be posted when deployments are finished

@RemiBonnet
Copy link
Copy Markdown
Member

Qovery Preview

Your preview environment failed to be deployed !
Click on the link below to check the deployment logs.
👉 [PR] staging - fix(statuses): remove WS workarounds - part 2 - 2026-03-27T10:05:20Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants