Skip to content

refactor(ui): derive config draft state from its scope - #174118

Merged
steipete merged 1 commit into
mainfrom
solid2/w-idiom-components-config-drafts
Oct 16, 2026
Merged

steipete merged 1 commit into
mainfrom
solid2/w-idiom-components-config-drafts

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Config form drafts still reset local fields by copying reactive inputs from effects. Collection drafts also query their own DOM whenever focus or validation changes.

User Impact

No behavior or visual design change. Invalid partial values and rejected commits stay editable across unchanged inputs and autosave acknowledgements. A changed source or field identity resets the local draft; native focus and validity keep their existing behavior.

Why This Change Was Made

Use a writable derived signal for structured edits and a writable derived store for collection fields. Their scope memos preserve the existing identity/equality rules, including unchanged absent sources and equal JSON clones. Ref callbacks own the collection inputs. The one remaining effect synchronizes native validity and focus; the one deliberate untracked read snapshots the initial structured value for its identity.

Config mutation and rejection remain synchronous in the existing domain owner. This removes two copying effects, one redundant snapshot, two DOM queries, and nine production lines. No CSS, markup, tag, route, dependency, or lazy import boundary changes.

Evidence

Proof Result
Codemod dry-run Both components: no diagnostics or unresolved markers
Focused draft lifetime tests Three cases passed: absent-source retention, equal-clone retention and reset/focus/validity, rejected structured edits and identity reset
UI typecheck Passed
Targeted lint, format, diff check Passed
Production Knip Passed
Independent review Scoped-clean through P2; no actionable findings
Startup build/performance CI comparison; startup imports and lazy boundaries unchanged

The initial collection assertion was corrected to account for the existing rejected automatic-default attempt before opening the editor; the collection cases were rerun after fixing that fixture setup and its parameter rows. No broad local suite, E2E battery, or startup build was run for this state-only refactor. Full UI CI is selected with ci:full.

Touched production metric Before After
LOC 402 393
Controller-pattern references 0 0
createEffect 3 1
createRenderEffect 0 0
untrack 2 1
addEventListener 0 0
DOM queries (including generic calls) 2 0
Hand-built class strings 0 0
flush 0 0
Owner captures 0 0

The focused test file adds 120 lines and uses the real config renderers; no test-only production API was added.

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 16, 2026
@steipete
steipete marked this pull request as ready for review October 16, 2026 10:37
@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Oct 16, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 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-16T10:42:39.428475Z e71f83e Draft marked ready
ℹ️ 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.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR replaces effect-driven config draft resets with writable derivations and captures collection inputs through refs.

Example: Enter "x" in the names collection draft, then receive an unchanged empty-array snapshot.

  • Before: The draft retains "x" and its validation error through an effect-based lifetime check.
  • After: The draft retains the same value and error through scope equality and a writable derived store.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source-consistent, with useful renderer coverage; available behavioral evidence remains harness-based.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored internal refactor is outside the ordinary contributor proof gate; supplied validation exercises the changed draft owners through real renderer harnesses, without a shipped-entry-point capture.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes
User problem: No new user-visible problem is claimed; existing partial edits and rejected saves must survive unchanged source refreshes.
Reason: Maintainer authorship establishes direction, and the narrow simplification removes copying effects and DOM searches without changing product contracts.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored PR open: it provides a focused Solid refactor, and review found no actionable correctness or security defects.

Priority: P3
Reviewed head: e71f83e5376abecabf49b05373edca67bf73fcfd

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Supplied evidence does not demonstrate these lifetime scenarios through the shipped Settings UI; the added cases protect existing behavior rather than establish a base-failing bug.
Agent review details

How this fits together

Settings and plugin forms pass schema, source identity, and values into local draft editors, which validate edits and submit candidates to the existing synchronous mutation owner.

flowchart LR
  A[Settings and plugin forms] --> B[Schema field renderers]
  B --> C[Draft scope memo]
  C --> D[Local writable draft]
  D --> E[Validation and native controls]
  E --> F[Synchronous mutation owner]
  F --> A
Loading

Technical review

Best possible solution:

Retain this focused refactor while preserving the existing draft lifetime and synchronous mutation contracts.

Do we have a high-confidence way to reproduce the issue?

This PR claims a behavior-preserving refactor rather than a bug fix; source inspection traced the existing lifetime contracts, and no target code was executed.

Is this the best way to solve the issue?

The change follows the documented Solid primitives, removes superseded synchronization, and preserves the existing validation and mutation boundaries.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against fd1511568e81.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned introduced change: The introduced diff replaces two copying effects, preserves collection content equality and structured identity equality, and leaves validation and synchronous commit acceptance with their existing owners. (ui/src/components/config-form-collection-draft.tsx:101, e71f83e5376a)
  • Current main retains the prior implementation: Both production files match their merge-base versions on fetched main, so this refactor remains distinct work rather than an already implemented change. (ui/src/components/config-form-structured-draft.tsx:13, fd1511568e81)
  • Behavioral harness coverage: The added cases exercise real config renderers for absent and equal-cloned sources, native validity and focus, rejected structured commits, and source replacement. (ui/src/components/config-form-draft-lifecycle.test.ts:23, e71f83e5376a)
  • Policy applied: Read the complete root and UI policies and applicable Solid and test guidance; no deeper ancestor AGENTS.md or maintainer-notes directory was present. (ui/AGENTS.md:1, e71f83e5376a)
  • Exact-head GitHub status: GitHub reports the reviewed head as open, ready, and mergeable; UI unit shards and nine UI E2E shards passed, while one real-Gateway shard was still running at inspection. (e71f83e5376a)
  • Feature history and inspection limits: History across TSX components and earlier TypeScript names identifies the Solid migration, subsequent draft simplifications, and earlier autosave retention work. Some older blob searches failed because promisor objects were unavailable; available current blobs and merged PR descriptions establish the relevant intent. (ui/src/components/config-form-collection-draft.tsx:149, fd1511568e81)

Likely related people:

  • Peter Steinberger: Raw commit b8b6e2c adds ui/src/components/config-form-collection-draft.tsx:127 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b8b6e2c4927c; files: ui/src/components/config-form-collection-draft.tsx)

PR surface

Source -9, Tests +120. Total +111 across 3 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 2 89 98 -9
Tests 1 120 0 +120
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 209 98 +111

Review metrics

Metric Value Why it matters
Production versus test LOC Production −9; tests +120 Production shrinks while focused renderer cases protect draft lifetime, rejection, focus, and native validity without adding a production testing seam.

Labels

Label changes:

  • add P3: This is a behavior-preserving internal UI simplification with no established user-facing defect.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a behavior-preserving internal UI simplification with no established user-facing defect.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 16, 2026, 6:53 AM ET / 10:53 UTC.

@steipete
steipete merged commit 0d11881 into main Oct 16, 2026
150 of 153 checks passed
@steipete
steipete deleted the solid2/w-idiom-components-config-drafts branch October 16, 2026 11:05
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant