Skip to content

FRONT-4079 test(billing): cover a return to the tab during a pending capabilities read - #23469

Merged
dante01yoon merged 1 commit into
mainfrom
1.61-local-billing/front-4079-return-during-pending-read
Nov 16, 2026
Merged

dante01yoon merged 1 commit into
mainfrom
1.61-local-billing/front-4079-return-during-pending-read

Conversation

@dante01yoon

Copy link
Copy Markdown
Collaborator
graph LR
  A["PR 23427 (merged): one account read per return to the tab"] --> C["this PR: a test runs a return to the tab through the real capabilities store"]
  B["PR 23437 (merged): with local_billing_web on, refresh() reads again after a read already in flight"] --> C
  style C stroke-width:3px
Loading
Item Ticket PR Status
One account read per return to the tab FRONT-4058 #23427 merged
With local_billing_web on, refresh() is not satisfied by a capabilities read that started before the call FRONT-4079 #23437 merged
A case for a later return during a pending capabilities read FRONT-4079 this PR open

Part of FRONT-4079. This is the case #23437 listed as "to do, after #23427 merges". Test only.

Summary

Why. #23437 made refresh() read capabilities once more when a read was already in flight at the call. Its cases call refresh() on the store directly. #23427's cases run refreshBillingAccount against a mocked store. No test ran the two together: a return to the tab, through refreshBillingAccount, to the store's later read.

How. One case in useBillingCapabilities.test.ts, in the block for local with local_billing_web on. A first return starts a capabilities read and the test holds it. A second return arrives while it is pending. The case asserts:

  • one read so far, so the second return joined the read in flight;
  • after the held read settles and the second return's promise resolves, two reads in total;
  • the store shows the second read's answer (canTopUp is true; the held read answered false).

Where it lives. #23437 planned this case for billingAccountRefresh.test.ts. It is in useBillingCapabilities.test.ts instead. The real store needs the auth, API and read-rail doubles that file already sets up, and billingAccountRefresh.test.ts mocks the store for all of its cases. The cost here is one import line.

No production code changes.

Feature gate

None needed. The diff is one test file, so nothing changes for a user with local_billing_web on or off. The case itself runs with the flag on. The flag-off behaviour of refresh() is already pinned by "issues no later read for refresh() during a read with local_billing_web off".

AS IS / TO BE

No UI change, so there is nothing to screenshot.

AS IS TO BE
A return to the tab during a pending capabilities read, run through the real store not tested 2 reads, and the store holds the second one's answer

Verification

  • pnpm test:unit src/platform/billing/composables/useBillingCapabilities.test.ts src/platform/billing/billingAccountRefresh.test.ts: Test Files 2 passed (2), Tests 633 passed (633).

  • Mutation checks, each reverted after the run. Both turn the new case red with expected "vi.fn()" to be called 2 times, but got 1 times:

    Mutation File
    refresh() returns without the later read useBillingCapabilities.ts
    A later return reuses the read in flight (if (!latest) in place of the per-event check) billingAccountRefresh.ts
  • The commit hook ran oxfmt, oxlint, lint:server-facts and typecheck:app on the file.

  • Not added: the same case with nothing else holding the store. Here the test's own scope keeps the store alive, as a mounted component does in the app. "holds capabilities only until the read settles" covers the release of the return's scope, against the mocked store.

  • Not run: the full unit suite, the Playwright suites, and a real return to the tab against Cloud.

…s read

PR 23437 left one case to do: the path from a return to the tab, through
refreshBillingAccount, to the capabilities store's later read. Its other
cases call refresh() on the store directly, and billingAccountRefresh.test.ts
runs against a mocked store, so nothing ran the two together.

The case lives in useBillingCapabilities.test.ts, not in
billingAccountRefresh.test.ts as that PR planned. The real store needs the
auth, API and rail doubles this file already sets up, and the other file
mocks the store for all of its cases.
@comfy-greenlight-bot

comfy-greenlight-bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Swarmhost agentic review

The detailed evaluation is available to employees in the internal Slack review thread.

Evaluation budget remaining for this pull request: 98 automatic and 99 manual.

Updated by Swarmhost's agentic review process.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 11/16/2026, 06:16:38 PM UTC

Links

🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measure

No verdict is available. Open the workflow run to confirm the check was intentionally skipped, or fix the collection failure and re-run it.

Findings and check details

Executes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight ecosystem-matrix shard checks are a harness self-test; the pack verdict is matrix-verdict.

The matrix runs on same-repository version-bump PRs with relevant changes, main-branch pushes, and manual dispatches. This candidate does not qualify, so every expensive stage was skipped.

Full docs: scripts/registry-census/README.md

Reproduce locally
# build one shard's fixture, then run it
python3 scripts/registry-census/build_matrix.py --shard 1/4
MATRIX_RENDERER=vue MATRIX_VUE=1 \
  npx vitest run --config vitest.matrix.config.mts

🌾 Fallow: ✅ Passed

Findings and check details

Fallow audits the diff for duplication, complexity and dead code. It gates on new findings only, so when the audit completes, a red is something this PR introduced or moved — never inherited backlog. A red can also mean the audit itself did not finish; the details below say which happened.

No new findings in the changed files.

Full docs: ADR-DEVEX-LINT-0015

Reproduce locally
# the base the gate compared against
npx fallow audit --root . --quiet --format json \
  --changed-since 642a4d95c76f94ce7501878e6e0d9c47f5af57fb

🏛️ Architecture: ✅ Passed

Findings and check details

Warnings (518)

  • error-handling path matches no source files: src/utils/errorUtil.ts. Remove or update it in docs/architecture/domains/records/error-handling.domain.json.
  • graph-model path matches no source files: src/types/linkTopology.ts. Remove or update it in docs/architecture/domains/records/graph-model.domain.json.
  • graph-model path matches no source files: src/types/nodeState.ts. Remove or update it in docs/architecture/domains/records/graph-model.domain.json.
  • job-queue path matches no source files: src/platform/remote/comfyui/jobs/**. Remove or update it in docs/architecture/domains/records/job-queue.domain.json.
  • linear-mode path matches no source files: src/utils/appMode.ts. Remove or update it in docs/architecture/domains/records/linear-mode.domain.json.
  • link-connection path matches no source files: src/lib/litegraph/src/infrastructure/LinkConnectorEventMap.ts. Remove or update it in docs/architecture/domains/records/link-connection.domain.json.
  • node-widgets path matches no source files: src/types/widgetState.ts. Remove or update it in docs/architecture/domains/records/node-widgets.domain.json.
  • subgraphs path matches no source files: src/lib/litegraph/src/infrastructure/SubgraphEventMap.ts. Remove or update it in docs/architecture/domains/records/subgraphs.domain.json.
  • vue-node-widgets path matches no source files: src/types/positionConfig.ts. Remove or update it in docs/architecture/domains/records/vue-node-widgets.domain.json.
  • workspace path matches no source files: src/platform/workspace/fixtures/**. Remove or update it in docs/architecture/domains/records/workspace.domain.json.
  • packages/api-client/src/abortSignal.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/api-client/src/abortSignal.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/api-client/src/fetchRouteTemplate.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/api-client/src/fetchWithRetry.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/api-client/src/fetchWithRetry.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/api-client/src/retryPolicy.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/api-client/src/retryPolicy.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/api-client/src/statusRetryTelemetry.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/api-client/src/statusRetryTelemetry.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/comfyui-api-types/src/generated/index.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/comfyui-api-types/src/generated/types.gen.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/comfyui-api-types/src/index.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/formatUtil.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/formatUtil.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/geometry.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/loadExternalScript.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/networkUtil.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/telemetry.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/telemetry.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/urlSafety.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/shared-frontend-utils/src/urlSafety.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • packages/tailwind-utils/src/index.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/TopbarActions.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/searchbox/v2/filterChip.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/videoConcat/VideoConcatClipStrip.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/videoConcat/VideoConcatClipTile.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/videoConcat/VideoConcatPanel.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/videoConcat/VideoConcatPanel.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/videoConcat/VideoConcatPlaybackBar.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/videoConcat/WidgetVideoConcat.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/videoConcat/WidgetVideoConcat.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/videoConcat/__fixtures__/clipTiles.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/widgetHistory/WidgetHistoryButtons.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/components/widgetHistory/WidgetHistoryButtons.vue is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/graph/menuOption.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useAgentExtensionActions.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useAgentExtensionActions.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useAgentExtensionNotices.test.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useAgentExtensionNotices.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • src/composables/useAgentSidebarTabs.ts is not claimed by any domain. Add it to a module in docs/architecture/domains/records.
  • …and 468 more

Full docs: Frontend domain catalog

Reproduce locally
pnpm architecture:check

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The billing capability tests now cover two refresh calls while the first capability read is pending. The test checks that a second read occurs and that the updated top-up capability is applied.

Changes: Billing capability refresh test

Layer / File(s) Summary
Pending-read refresh test
src/platform/billing/composables/useBillingCapabilities.test.ts
Adds a test that calls refreshBillingAccount twice during a pending read. After the first read completes, the test checks for a second read and the updated top-up capability.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Suggested reviewers: drjkl, christian-byrne

Merge Risk: Minimal · up to a249f

This change only adds a test for billing capability refresh behavior and does not change production code. Merge risk is minimal.

Pre-merge checks: Passed 6

Check name Status Explanation
Title check Passed The title names the change: a test for a return to the tab while a capabilities read is pending, scoped to billing. It matches the changeset, which adds one test case to useBillingCapabilities.test.ts…
Description check Passed The description follows the template. The Summary explains the problem, the gap in coverage, and the design choice of placing the test in useBillingCapabilities.test.ts. It gives a Verification sectio…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
End-To-End Test Suggestion For User-Facing Changes Passed This check passes because the PR changes only tests. Per the check's instructions, I used only the PR title, the commit subject, the changed-file list, and the diff content in the review context, with…
Adr Compliance For Entity/Litegraph Changes Passed This check applies only when the PR changes files under src/lib/litegraph/, src/ecs/, or graph-entity files (nodes, links, widgets, slots, reroutes, groups, subgraphs). The check limits evidence t…
Full details: Title check

Explanation

The title names the change: a test for a return to the tab while a capabilities read is pending, scoped to billing. It matches the changeset, which adds one test case to useBillingCapabilities.test.ts and no production code. The ticket prefix is noise but does not make the title misleading.

Full details: Description check

Explanation

The description follows the template. The Summary explains the problem, the gap in coverage, and the design choice of placing the test in useBillingCapabilities.test.ts. It gives a Verification section with test commands, results, mutation checks, and gaps not run. The template's Fixes line is optional and not needed for a test-only PR. The Verification section lists no after-release signals, but the template marks that item as applicable only when relevant.

Full details: End-To-End Test Suggestion For User-Facing Changes

Explanation

This check passes because the PR changes only tests. Per the check's instructions, I used only the PR title, the commit subject, the changed-file list, and the diff content in the review context, without shell commands. - Changed files: The raw summary lists one changed file, src/platform/billing/composables/useBillingCapabilities.test.ts (+22/-0). It adds one test case that calls refreshBillingAccount twice while a capabilities read is pending. - Production code: The PR description says "No production code changes." The summary reports no changes outside that test file. - Title and commit: The title and the single commit subject are both test(billing): .... This matches the test-only diff. Condition 1 fails to hold. The diff does not fix a bug or add or change a feature. It only adds test coverage. The check states that a change exclusively in tests passes. Because condition 1 is not met, the check does not fail, and no browser test suggestion is required. Caveat: I relied on the summary and the PR description for the file list and the absence of production changes. I did not inspect the patch directly, since the instructions bar shell use.

Full details: Adr Compliance For Entity/Litegraph Changes

Explanation

This check applies only when the PR changes files under src/lib/litegraph/, src/ecs/, or graph-entity files (nodes, links, widgets, slots, reroutes, groups, subgraphs). The check limits evidence to the changed-file list, the PR description, and the diff content, and it does not allow shell commands. The changed-file evidence in the review context shows one file: src/platform/billing/composables/useBillingCapabilities.test.ts (+22/-0). The raw summary and PR description both say the diff is a single test file with no production code changes. That path is billing, not litegraph, ECS, or a graph entity. The check's trigger therefore does not apply, and the four ADR-LAYOUT/ADR-ECS patterns (spatial mutation, god-object growth, component behavior, extension callbacks) cannot appear in this diff. Result: the check is not applicable, so it passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 642a4d9 and a249fa2.

Files selected for processing: 1

  • src/platform/billing/composables/useBillingCapabilities.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@vqt123

vqt123 commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Starting review at a249fa2.

@github-actions github-actions Bot added the risk:xhigh PR risk grade (advisory shadow check; grader-owned) label Nov 16, 2026
@vqt123

vqt123 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Approving at a249fa2.

Clean: Correctness, Resilience, Access, Words, Contract, Vendor, Rollout, Rules, Cause.

Not covered:

  • Tests: unit / test-shards (1) through (8) remain pending. Targeted command: pnpm test:unit src/platform/billing/composables/useBillingCapabilities.test.ts src/platform/billing/billingAccountRefresh.test.ts.
  • Claims: pr-risk / Grade PR risk remains pending; the reported execution and mutation results were not independently rerun.
  • Browser behavior: pnpm test:browser:local browser_tests/tests/billing/localWebBillingHandoff.spec.ts.

Checked: Read, not run: event deduplication in src/platform/billing/billingAccountRefresh.ts:21, subsequent-read handling in src/platform/billing/composables/useBillingCapabilities.ts:597, and VueUse 14.4.0 shared-scope disposal.

~702k effective tokens for this review (3.2M raw; cache reads weighted 0.1x, cache writes 1.25-2x)

@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main   #23469      +/-   ##
==========================================
- Coverage   88.03%   87.94%   -0.09%     
==========================================
  Files        3173     3057     -116     
  Lines      169943   166193    -3750     
  Branches    43839    42538    -1301     
==========================================
- Hits       149608   146158    -3450     
+ Misses      19363    19232     -131     
+ Partials      972      803     -169     
Flag Coverage Δ
billing-web-unit ?
unit 87.47% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 116 files with indirect coverage changes

🚀 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.

@dante01yoon

Copy link
Copy Markdown
Collaborator Author

recheck

@dante01yoon dante01yoon reopened this Nov 16, 2026

@comfy-greenlight-bot comfy-greenlight-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This pull request at head commit a249fa2 has been reviewed and approved by Swarmhost's agentic review process.

The detailed evaluation is available to employees in the internal Slack review thread.

@dante01yoon
dante01yoon added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit 6321901 Nov 16, 2026
172 checks passed
@dante01yoon
dante01yoon deleted the 1.61-local-billing/front-4079-return-during-pending-read branch November 16, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

greenlight risk:xhigh PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants