Skip to content

Derive settings category and relationship selection; harden confirmation card and name dialog effects - #4413

Merged
mstomar125 merged 1 commit into
mainfrom
c6cb44c4-effects
Dec 2, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
c6cb44c4-effects

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

NodeSpace task: c6cb44c4 (Remove dead editor workarounds and state-writing effects the reactivity rule forbids). Partial: the task stays open for the effects listed under "Left".

What changed

Per effect:

  • settings-pane: the corrective effect that reset activeCategory is gone. requestedCategory is state, activeCategory is $derived (falls back to Database while the requested one is hidden). Side effect: if the hidden category becomes visible again (Labs flag back on) the pane returns to it; a test covers this.
  • relationship-viewer-modal: the effect that kept a relationship selected is gone. chosenKey is state, selectedKey is $derived (the choice if the rail still offers it, else the first rail entry, else null).
  • remote-tool-confirmation-card: the digest check keys on the credentials by value (credentialsKey), so a message update that rebuilds the credentials list does not restart the check, arming delay or buttons. The stale guard now compares summary, arguments, digest and credentials, not just the first two. Browser test added.
  • database-name-dialog: the seeding effect reads initialValue untracked, so typed text survives an initialValue change while open; it still seeds on open. New test file.
  • scripts/check-effect-allowlist.ts: removed the settings-pane and selectedKey entries; MAX_STATE_WRITING_EFFECTS 15 -> 13 (the test ties it to the real count).

Tests were mutation-checked: each new test fails with its fix reverted.

Left (still on the allowlist with their reasons)

remote-tool-confirmation-card (the async digest check and the arming timer still write intact/armed; the digest is async so it stays an effect), database-name-dialog (seeding on open writes name), person-schema-form, kanban-view, node-ref-preview, relationship-viewer-modal (expandedRows prune, closeAdd, load/reset effects), import-options-modal, collection-move-dialog, pane-content. These need a design choice (reset on mount vs. event, measuring after layout) or are larger refactors; not attempted here. Imported-class writes (typed-form-shell relationships.load, code-block-node renderer, ai-chat-pty-session listener callback) are not detected by the checker and were not touched.

Not in this PR: the docs-repo statement checks and the remaining criteria of the task.

🤖 Generated with Claude Code

@mstomar125

Copy link
Copy Markdown
Contributor Author

APPROVE at 567b513

Reviewed the diff and the five changed components in full. No blocking issues.

Verified

  • settings-pane: activeCategory is derived from requestedCategory with a 'database' fallback. Initial value, navigate(), sidebar clicks and initialCategory all behave as before, and the only remaining readers (sidebar prop, the if-chain, activeSection) use the derived value. Hidden surfaces never render.
  • relationship-viewer-modal: selectedKey derived from chosenKey with fallback to the first populated rail entry. The check is against populatedGroups, so the declared-but-empty group case is kept. All readers (rail aria-current/active class, selectedGroup) use the derived value. Select, add (chosenKey = group.key) and reset paths are intact.
  • remote-tool-confirmation-card: the effect tracks summary, arguments, digest and credentialsKey, so a change to any of them re-runs it, sets intact=null synchronously and disarms the buttons. The late-result guard compares all four. JSON.stringify of a string array is injective and round-trips through JSON.parse, so the by-value credential key cannot conflate two different credential lists. A same-value rebuild of the list does not invalidate the derived string, so check, arming and buttons are kept. answer() sends the current digest and is gated on intact === true. I found no path where a changed credential or digest leaves the old confirmation armed. A→B→A while a check is in flight is also fine, because the result was computed for A.
  • database-name-dialog: untrack leaves open as the only dependency. It still seeds on open and re-seeds on reopen, and typed text survives an initialValue change.
  • check-effect-allowlist: cap 13 matches the real count. bun run test:scripts passes 1729/0. The three removed entries match the three removed effects, and the dialog reason is accurate. Nothing was raised.

Mutation checks (fix reverted in my worktree, test must fail)

  • dialog 'keeps typed text': fails without untrack.
  • settings 'returns to requested ai-models': fails with the old effect.
  • modal 'rail selection' (and 2 existing inbound tests): fail with the derived fallback removed.
  • card 'message update ... unchanged': ran in the Chromium config, 27/27 pass with the fix, and this test fails against the pre-PR component.

Findings
Blocking: none.
Should-fix: none.
Nits

  1. remote-tool-confirmation-card.test.ts: no test covers a post-intact change of credentials or digest resetting the check and disarming. Existing tests cover static summary, arguments and short-credential tampering only. The code is correct by reading. Since this card gates remote execution, a regression test for each would be good, as a follow-up.
  2. settings-pane.svelte:30: behavior is slightly different, and arguably better. After a fallback, the user's request is remembered, so when the flag flips back on the pane returns to e.g. 'ai-models' (previously it stayed on 'database'). The new test pins this. Intentional, just noting it.
  3. relationship-viewer-modal.svelte:197: for the same reason, if the chosen relationship leaves the rail and later gains an edge again, it is re-selected instead of staying on the fallback. Harmless.

🤖 Generated with Claude Code

…iting them in effects

settings-pane and relationship-viewer-modal compute the effective category and
selected relationship with $derived from the requested/chosen value, replacing
corrective effects. The confirmation card's digest check keys on the credentials
by value and its stale guard compares summary, arguments, digest and credentials,
so a message update with unchanged confirmation fields no longer resets the check
or the buttons. The database name dialog seeds on open and reads initialValue
untracked, so typed text survives an initialValue change. The effect allowlist
drops the two removed effects and MAX_STATE_WRITING_EFFECTS goes from 15 to 13.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@mstomar125
mstomar125 merged commit 3d66345 into main Dec 2, 2026
@mstomar125
mstomar125 deleted the c6cb44c4-effects branch December 2, 2026 06:24
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.

1 participant