Repository navigation
[backport core/1.57] FE-3441 test(billing): pin cross-user capability guards after dropping the user-id check - #21058
comfy-pr-bot wants to merge 1 commit into
Conversation
…g the user-id check (#21006) ## Summary Stacked on #21004 (base `fix/billing-capability-read-unified-off`). #21004 drops the `resolved_for.user_id` check from the capabilities reader, which was the safety net that stopped one member's rights (an owner's `can_manage_members` / `can_cancel`) being published as another's. These tests pin the guards that remain, for the case the user-id check covered: two accounts in the same team workspace. Test-only, no production change. No AS IS/TO BE screenshots (no UI change). Each remaining guard is pinned by a test that fails when **only that guard** is removed (owner A, member B, team workspace W; A's answer carries `can_manage_members` / `can_cancel: true`): | Guard | Pinned by | | --- | --- | | core `sameBillingScope` uid comparison | uid-only switch at the same role (owner → second owner): A's answer is `SUPERSEDED`, cached snapshot dropped | | core scope `generation` | A → B → A before A's first answer lands: still `SUPERSEDED` | | composable `authUid` key on read state | A resolved, B signs in: rights hidden synchronously, before the switch watcher runs | | composable stale-result fence (try path) | B answers first, A's late answer must not clobber B; A's refresh `SUPERSEDED` on the SDK rail after the switch must not restore A's snapshot | | composable catch path (fence + abort check) | A's refresh fails with an outage after the switch: B stays ready on its own answer | The composable cases run on both the legacy client and the SDK rail, through a typed `BillingReadRail`. ## Verification - `useBillingCapabilities.crossUser.test.ts` 17 passed; `capabilitiesCrossUser.test.ts` 8 passed; full `useBillingCapabilities*` (241) and `account-core/src/core/billing` (755) pass. - Mutation check, run locally one guard at a time (not committed): - uid compare off → 2 core failures; generation check off → 1 core failure. - `authUid` key off → 2 composable failures; try-path fence off → 3 composable failures. - catch-path fence alone off → 0 failures: on an account switch the watcher aborts the request, so the `controller.signal.aborted` check covers the same case. Removing the fence and the abort check together → 2 failures. - The earlier version of this PR passed with each composable guard removed on its own and with the core uid compare removed; this revision closes those gaps (independent review finding).
📦 Bundle: ⏳ Size data collection in progress…🔬 E2E Coverage:
|
| Status | ✅ Passed |
| Report | View Report |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## core/1.57 #21058 +/- ##
=============================================
- Coverage 87.16% 86.34% -0.82%
=============================================
Files 2612 3665 +1053
Lines 146878 175105 +28227
Branches 40269 48309 +8040
=============================================
+ Hits 128021 151194 +23173
- Misses 18469 21895 +3426
- Partials 388 2016 +1628
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 3 Pipeline jobs failed
Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 7557b40 | Docs | View more details | Give us feedback! |
dante01yoon
left a comment
There was a problem hiding this comment.
LGTM — approving backport.
|
Closing — this backport cannot go green on The pin asserts the behaviour that lands with #21004 ("accept the server's own user id on the capabilities read"), which replaced the two-part This carrier exists only because the Closing loses no coverage. Both pins are already on every train that has the fix:
If the capabilities fix is ever wanted on |
Pull request was closed
Backport of #21006 to
core/1.57Automatically created by backport workflow.