Repository navigation
refactor(ui): settle page component lifetimes - #179744
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review endedClawSweeper stopped reviewing this revision because the pull request closed. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 802d165bb4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| lifecycle.dispose(); | ||
| onSettled(() => { | ||
| // Every connection transition aborts diagnostics and retires RPC results before reconnect. | ||
| const stopGateway = gateway.subscribe(() => { |
There was a problem hiding this comment.
Reconcile the current gateway before the initial load
When Debug mounts while a connection completes, deferring this registration to onSettled creates a gap: gateway.subscribe() does not replay the snapshot sampled when it connects, so lifecycle can retain the construction-time connecting state even though the Gateway is now connected. Consequently, syncPolling() stops and loadDiagnostics() returns without a scope, leaving diagnostics unloaded until another Gateway transition occurs. Reconcile gateway.read().snapshot into the lifecycle immediately after subscribing and before starting polling or the initial load.
AGENTS.md reference: ui/AGENTS.md:L16-L17
Useful? React with 👍 / 👎.
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
Whole assigned-scope raw syntax at
de67c8ec499a80d60832d035ff515de4e74073cc. COMP-A/B components are excluded; all assigned non-chat pages plus app/lib/plugins/API are included. Raw syntax is not outstanding debt: stable handler factories, primitive cleanup, imperative integrations, active lane ownership and foreign-DOM roots are classified separately. Items 3–4 still await the canonical recipe.Additional owner calls: 3 getOwner and 8 runWithOwner.
What Problem This Solves
This PR removes four component-body cleanup registrations from Debug, Devices, Profile, and the approvals ledger. Their settled lifetimes retain synchronous request retirement, Gateway subscriptions, dialog cancellation, authorization checks, and rejection of obsolete responses. Debug and Profile pair their setup with returned teardown; Devices joins the existing settled config subscription. The Gateway binding still owns its synchronous disposal.
Exact touched-file counts against
c04c3511af85ce88d5504b9e7cfd6bcfcaf79a2c:onCleanupThe four production files retain 1 effect, 0 untrack calls, 0 direct native listeners, and 0 DOM queries. Production LOC is 2,370 → 2,377 (+7); the growth pairs setup/teardown and formats the nested subscription. Tests add 23 lines for the observable pending-read/unmount boundary. No abstraction, dependency, markup, stylesheet, tag, selector, or lazy boundary changes.
Three inspected cleanup survivors remain outside this focused diff: New Session connects before the first reconciled draft snapshot and disconnects retained draft/handoff custody; Portals registers its model synchronously for native bridge callbacks; Custodian’s committed-DOM effect also performs synchronous alert-send admission, so moving that effect behind settlement would delay allowed sends; its paired foreign Markdown/textarea cleanup stays with the existing lifetime. Moving effect creation into a settled callback would require restoring an owner. These are named contracts, not a blanket exemption for mounted async presentation.
The canonical
async-and-actions.mdrecipe was absent on this base. This PR completes the safe lifecycle family and leaves read/action adoption to a focused follow-up. It does not claim all raw syntax in the scope table is migration debt or that this snapshot is the current final scope census.Evidence
pnpm tsgo:uiui:build, strict performanceci:fullThe new preservation case unmounts a pending Profile read, resolves it, and publishes a replacement identity. It verifies neither the late response nor the retired subscription starts another identity/preference request. Existing Debug and Devices cases exercise reconnects, scope revocation, stale read cancellation, and polling after disposal. This is a behavior-preserving refactor, so existing behavior is expected to pass on the base.
Paired startup is 325,234 → 325,256 B gzip (+22 B). The base is above the current 325,000 B cap before tolerance; the head is within the campaign's 64 B no-growth allowance. CSS stays 40,794 B / 1 request, Chat 1,497,765 → 1,497,742 B (-23 B), and New Session 1,020,679 → 1,020,694 B (+15 B). All strict performance checks pass; no budgets or baselines changed.
Screenshots are not applicable: this change preserves markup, styles, copy and visible states. No live data or external test lease was used. Release-note context: internal Solid lifecycle cleanup; no intended user-facing behavior change.
Production Knip attribution: the exact
c04c3511af85ce88d5504b9e7cfd6bcfcaf79a2cbase and head each exit 1 with identical output:src/cron/heartbeat-monitor.ts,src/cron/system-monitor-jobs.ts, andsrc/gateway/server-cron-system-jobs.ts. No ignore or baseline was changed. The published source was restored after the base comparison.Runtime correction: the earlier 61/61 run (102.57 s) used the UI package's Node entrypoint. The required pinned-Bun proof above uses
node scripts/run-vitest.mjs run --config ui/vitest.config.ts --project uniton the exact published head, with no runtime override. This single correction run closes that material runtime gap; the earlier Node result is supplemental.Current-head CI attribution
CI run 39643046259 tested head
802d165bb4b6b71e71e5adf6d6d80369b917ac13merged with maind79cee56e675ee4604062ddbdc7cdc38d3e66c0e. The current result is failed; local green tests do not relabel it.src/pages/chat/chat-page-pending-retention.test.ts > keeps the previous chat mounted without redundant startup through creation and admissionPrevious transcriptassertion reproduced with pinned Bun on exact CI main parent d79cee5 (shared baseline log; 1 failed / 1 skipped).src/pages/usage/usage-page-exports.test.ts > exports the displayed session scope: multiple selectionssrc/pages/usage/usage-page-exports.test.ts > exports the displayed session scope: selection intersected with a querysrc/pages/usage/usage-page-exports.test.ts > exports the displayed session scope: quoted label retained while selecting a providerui/src/e2e/native-nav-sidebar-toggle.e2e.test.ts > Control UI native-nav sidebar toggle E2E > hosts navigation, search, sessions, and history in web titlebar chromeui/src/e2e/compact-identity-menu.e2e.test.ts > compact identity menu > keeps common actions visible with nine native gateways and opens an unclipped keyboard switcherThe first two exact-parent Usage attempts stopped at the wrapper no-output watchdog before any assertion; neither is product attribution. A bounded retry uses the supported 300-second no-output allowance and verbose reporting, with the default pinned Bun runtime unchanged.
All six failing CI names are now attributed to the exact CI main parent or the latest completed scheduled main run. The native inherited-failure route retains the failed CI result; this PR is not claimed fully green.