Skip to content

refactor(ui): settle page component lifetimes - #179744

Merged
steipete merged 1 commit into
mainfrom
solid2/w-s2-page-lifetimes
Oct 21, 2026
Merged

steipete merged 1 commit into
mainfrom
solid2/w-s2-page-lifetimes

Conversation

@steipete

@steipete steipete commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

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.

Family Files LOC 1 handler expressions 2 cleanup 3 async memos 4 actions 5 imports 6 structured seeds 7 factories 8 contexts 9 Reveal 10 roots
solid 59 7847 4 10 0 0 3 0 0 0 0 1
config 23 5031 0 0 0 0 0 1 0 0 0 0
menus 46 8248 0 5 0 0 3 2 2 0 0 0
rest 135 19926 4 23 2 0 6 2 0 2 0 0
pagesA 112 25428 3 3 6 6 6 1 0 0 0 0
pagesB 198 42233 1 13 1 0 21 4 0 1 0 0
pagesC 268 54434 4 35 1 3 42 13 20 0 0 0
app 191 31564 2 3 0 0 67 1 0 1 0 0
lib 346 54479 0 5 0 0 12 1 3 1 0 2
plugins 19 3987 0 3 0 1 13 1 0 0 0 2
api 12 2104 0 0 0 0 2 0 0 0 0 0
total 1409 255281 18 100 10 10 175 26 25 5 0 5

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:

Checklist item Before After Classification
1 intrinsic handler suspects 0 0 No handler binding changes
2 component onCleanup 4 0 Four settled lifecycle cutovers
3 async memos 0 0 Existing read/status flows remain for the canonical async recipe
4 actions 0 0 Existing synchronous mutation owners remain for that recipe
5 runtime imports 1 1 Profile preference-request utility boundary retained
6 structured signal seeds 2 2 Devices server snapshots belong with its read migration
7 component factories 0 0 JSX unchanged
8 context definitions 0 0 No wrappers
9 Reveal 0 0 No independent sibling reads introduced
10 root/owner APIs 0 0 No extra roots or restored owners

The 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.md recipe 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

Proof Result
Frozen install Passed; pinned Solid rc.16
pnpm tsgo:ui Passed with tsrs
Debug view, Devices page, Profile reconnect 61/61 passed with the root wrapper and default pinned Bun, one worker, 39.95 s total; each file run once on that runtime
Scoped lint and format; diff whitespace Passed
Independent Codex review (P0–P2) Scoped clean; frozen candidate tree verified
Production Knip Same three unused files on exact base and head; no UI finding
Paired base/head ui:build, strict performance Passed; startup +22 B, within the 64 B allowance
Full PR CI Requested with ci:full

The 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 c04c3511af85ce88d5504b9e7cfd6bcfcaf79a2c base and head each exit 1 with identical output: src/cron/heartbeat-monitor.ts, src/cron/system-monitor-jobs.ts, and src/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 unit on 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 802d165bb4b6b71e71e5adf6d6d80369b917ac13 merged with main d79cee56e675ee4604062ddbdc7cdc38d3e66c0e. The current result is failed; local green tests do not relabel it.

Failing test Evidence status
src/pages/chat/chat-page-pending-retention.test.ts > keeps the previous chat mounted without redundant startup through creation and admission Same name and initial Previous transcript assertion 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 selections Same name and 60-second timeout at line 51 reproduced on exact CI main parent d79cee5 with default pinned Bun (3 failed / 2 skipped, 237.21 s).
src/pages/usage/usage-page-exports.test.ts > exports the displayed session scope: selection intersected with a query Same name and 60-second timeout at line 51 reproduced on exact CI main parent d79cee5 with default pinned Bun (3 failed / 2 skipped, 237.21 s).
src/pages/usage/usage-page-exports.test.ts > exports the displayed session scope: quoted label retained while selecting a provider Same name and 60-second timeout at line 51 reproduced on exact CI main parent d79cee5 with default pinned Bun (3 failed / 2 skipped, 237.21 s).
ui/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 chrome Same name and display-none assertion at line 465 fail on latest completed scheduled main 39644558400.
ui/src/e2e/compact-identity-menu.e2e.test.ts > compact identity menu > keeps common actions visible with nine native gateways and opens an unclipped keyboard switcher Same name and unclipped assertion at lines 45/94 fail on latest completed scheduled main 39644558400.

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

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 21, 2026
@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review ended

ClawSweeper stopped reviewing this revision because the pull request closed.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T17:51:36.777090Z 802d165 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 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(() => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@steipete
steipete merged commit 4247a09 into main Oct 21, 2026
138 of 148 checks passed
@steipete
steipete deleted the solid2/w-s2-page-lifetimes branch October 21, 2026 19:36
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

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

Labels

app: web-ui App: web-ui ci:full Keep ordinary native-locale CI selection on the next PR run. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant