Repository navigation
Description
Background
core#2102 investigated the state of typed property forms for packaged schemas (person, project) after core#2013 (isCustomSchemaType → plugin-registry-based predicates) and core#2116 (person duplicate-convergence UI) landed. That investigation found the two user-visible bugs the issue was originally filed for already fixed by core#2013:
- Opening a
projectnode now renders a real, schema-driven properties form (status/priority/start_date/end_date) viaGenericSchemaForm's no-hardcoded-form fallback, which core#2013 made unconditional instead of gated on a hand-maintained core-type list. person's classification (hardcoded form vs. generic) is now correctly plugin-registry-derived, not allowlist-derived.
core#2102 landed the remaining small, safe cleanup (deleted dead schema-property-form.svelte, fixed stale comments referencing it and a nonexistent DateSchemaForm, added regression coverage for GenericSchemaForm rendering the real project schema). It deliberately did not attempt the larger architectural refactor the original issue's "Approach" section sketched, because it is large, high-risk (touches the most actively-used property form in production), and separable from the bug fixes. This issue tracks that remaining work.
Scope
task-schema-form.svelte (~695 lines) still duplicates code that already exists elsewhere in the codebase:
STATUS_OPTIONS/PRIORITY_OPTIONShardcoded enum constants duplicate what thetaskschema already carries ascore_values/user_values(SchemaFieldLeaf.getEnumValuesalready readscoreValues ∪ userValuescorrectly and is unused here).- Inline date-picker (Popover + Calendar) markup duplicates
schema-field-leaf.svelte's date case. formatEnumLabel-equivalent formatting and date-parsing helpers duplicateschema-field-leaf.svelte's.- The Collapsible/trigger/badge/
filled of totalshell, and the Relationships-button +RelationshipViewerModal+NestedPropertyModalwiring, duplicate whatGenericSchemaFormalready owns.
Extract a shared TypedFormShell (owns the Collapsible shell, trigger row, Relationships button gated on non-empty groups — GenericSchemaForm already does this, TaskSchemaForm currently shows it unconditionally — and the shared NestedPropertyModal), have TaskSchemaForm supply only its genuinely task-specific field grid and business logic (there is none today beyond field writes — updateStatus does not set completedAt/startedAt on transition, which is out of scope here unless separately requested), and drive its hardcoded enum/date fields through SchemaFieldLeaf instead of bespoke markup.
person-schema-form.svelte was deliberately left hardcoded (not converted to schema-driven field iteration) during core#2102, for two reasons worth preserving here:
- Both of
person's two real fields (name,email) already carry non-trivial, actively-used, recently-built UX (name→content sync; a blur-triggered adopt-existing suggestion with a monotonic-generation staleness guard; a convergence "possible duplicate" badge that re-runs the same lookup, from core#2116/Surface the person._possible_duplicate marker in the desktop UI #2125) that a generic per-field loop would still need to special-case — the practical benefit of iteratingschema.fieldsgenerically was judged low relative to the risk of the next point. - The person schema's third field,
_possible_duplicate, isprotection: system— system-managed, never meant to be user-editable.GenericSchemaFormdoes not currently filter fields byprotectionlevel at all — it iteratesschema.fieldsunconditionally. Ifperson(or any future core type) were rendered through a generic per-field loop without that filter, a system-managed field would render as a raw, user-editableSchemaFieldLeafcontrol (e.g., a checkbox for_possible_duplicate), which would be a real regression. This is not currently reachable in production — the only two other core types withsystem-protected schema fields (ai-chat,collection) both have their own dedicated full-page viewer components that bypassBaseNodeViewer's generic-form branch entirely — but it is a latent gap worth closing as part of this work, before anything relies on generic per-field iteration for a type with system fields.
Suggested acceptance criteria
-
TypedFormShell(or equivalent composition) extracted;TaskSchemaFormuses it; task node property editing behavior unchanged (no regression — this is the most heavily-used property form in the app, needs real scrutiny) -
STATUS_OPTIONS/PRIORITY_OPTIONShardcoded enum constants removed fromtask-schema-form.sveltein favor of schemacoreValues/userValues - Date-picker and enum-label duplication in
task-schema-form.sveltecollapsed ontoSchemaFieldLeaf -
GenericSchemaForm(and any future generic per-field iteration) filters outprotection: 'system'fields, so a system-managed field can never render as a user-editable control - Decide, and apply consistently: does a
requiredfield need any visible affordance (e.g., an asterisk)? Note the backend already applies schemadefaults at node-creation time (apply_schema_defaults_with_fields,crud.rs), so this is about display/edit-time consistency, not making required-ness enforceable — no submission-blocking validation exists anywhere in this form family today, and this issue does not need to add any if not already decided as in-scope - If, after this refactor, converting
person-schema-form.svelteto schema-driven field iteration is judged worthwhile, do so — preserving name→content sync and the full core#2116 adopt-existing/possible-duplicate-badge UX, and applying the new protection-level filter so_possible_duplicateis never rendered as an editable control. If not, leave it hardcoded and close this checklist item as "decided: not worth it," with the reasoning recorded on the issue.
Explicitly out of scope
- Task status-transition business logic (
completedAt/startedAtauto-set) — not present today, not required by this issue. - Full email-uniqueness enforcement — already suggest-don't-block by design (ADR-065); not changing.
project's user-creatability / slash command — tracked separately, needs product confirmation (see linked follow-up).
Activity
Address review: fix test schema fidelity, restore boolean coverage, e…
Delete dead SchemaPropertyForm, fix stale generic-form comments (closes
mstomar125 commentedon Aug 18, 2026
person-schema-form.sveltedecision: kept hardcoded, not convertedPer the issue's own fallback option — closing this checklist item as "decided: not worth it" with reasoning recorded here, now that the protection-level filter (below) exists as a safety net independent of this decision.
What was evaluated: converting
person-schema-form.svelteto schema-driven field iteration through the newTypedFormShell/SchemaFieldLeafcomposition, now thatTaskSchemaFormhas been converted and theprotection: 'system'filter has been added toGenericSchemaForm.Why it's not worth it:
SchemaFieldLeafis a pure controlled component (valuein,onChange(newValue)out, usingoninputfor text fields). Both of person's two real fields carry behavior that doesn't fit that contract without special-casing the exact same amount of code it would remove:nameneeds a second side effect beyond the property write — syncing tonode.contentso the display name renders inline. No other field on any schema-driven form writes outside its own property.emailneeds blur-commit semantics with an async, staleness-guarded duplicate lookup (checkForDuplicate, a monotoniccheckGenerationcounter,checkedForEmailde-dup), not per-keystrokeoninput. ReusingSchemaFieldLeafhere would mean adding anonBlurmode and a hook for arbitrary field-specific side effects — machinery built for exactly one field, on exactly one type, that every other consumer ofSchemaFieldLeafwould carry but never use.The convergence "Possible duplicate" badge and adopt-existing
Alert(core#2116/Surface the person._possible_duplicate marker in the desktop UI #2125) are additional UI bolted onto the form, not a per-field rendering concern. There's no equivalent slot inTypedFormShell's composition model for "extra async, stateful UI attached to one specific field's value" — it would have to stay a person-specific addition regardless of how the two fields themselves render.Regression surface.
person-schema-form.test.tshas 28 tests locking down exact race/staleness/non-destructive-navigation semantics across the blur-triggered suggestion and the badge-triggered recheck (two independent async paths that must not clobber each other — see the monotonic-generation-counter tests). Touching this file's rendering risks all of it for a refactor whose only real win would be replacing two<Input>elements with twoSchemaFieldLeafcalls that would immediately need person-specific overrides layered back on anyway.The safety gap this issue was actually worried about is closed independently of this decision. The issue's second reason for leaving
personhardcoded during core#2102 was "GenericSchemaFormdoesn't filterprotection: systemfields, so_possible_duplicatewould render as editable ifpersonwere ever genericized." That filter is now inGenericSchemaForm(visibleFields = schema.fields.filter(f => f.protection !== 'system'), with new coverage ingeneric-schema-form-protection-filter.test.ts), independent of whetherpersonitself uses it. If a future refactor does convertperson, the filter is already there.Net: the two real fields' UX would still need to be as special-cased after "converting" as before it, for a form with no hardcoded enum/date-picker duplication to remove in the first place (person has no enum or date fields — the actual duplication this issue is about doesn't exist here). Converting would trade a small, well-tested, self-contained 360-line component for the same complexity spread across a shared abstraction not designed for it, with real regression risk to recently-shipped (core#2116/#2125) duplicate-detection UX and no offsetting dedup win. Left as-is.
Address review findings: enum dedup, label-lookup unification, date-u…
mstomar125 commentedon Aug 18, 2026
Resolved
Merged via #2141 (squash commit
794c20b9).What shipped:
TypedFormShell(packages/desktop-app/src/lib/components/schema/typed-form-shell.svelte) — owns the Collapsible shell, trigger row, the Relationships button (gated on the node's type actually having a typed relationship), and the sharedNestedPropertyModalwiring. BothGenericSchemaFormandTaskSchemaFormnow compose through it.TaskSchemaForm's hardcodedSTATUS_OPTIONS/PRIORITY_OPTIONSare gone — status/priority/due_date/started_at/completed_at now render throughSchemaFieldLeaf, driven by the real task schema'scoreValues/userValues. Core-field writes are unchanged (stillsharedNodeStore.updateTaskNode());SchemaFieldLeafonly supplies markup.GenericSchemaFormalready gated it (andperson-schema-form.svelte's Relationships button, which was the one remaining unconditional case, is now gated too).GenericSchemaFormnow filtersprotection: 'system'fields out of rendering, field-count stats, and the "show the Collapsible at all" decision.schema-enum-values.tsandschema-date-values.tsso enum-label and date-parsing logic exist in one place, not duplicated per form.person-schema-form.sveltedecision: kept hardcoded, not converted to schema-driven field iteration. Reasoning posted in the earlier comment on this issue — its two real fields carry side effects (name→content sync, blur-committed async duplicate detection with a staleness-guarded generation counter) thatSchemaFieldLeaf's plain controlled-component contract doesn't fit without re-introducing the same special-casing elsewhere, for a form that has no enum/date-picker duplication to remove in the first place.Testing:
bun run test(cold vitest cache): 4743/4743 passed across 222 files.bun run quality:fix: clean (eslint, svelte-check, tsc,cargo fmt,cargo clippy --all-targets -D warnings -D clippy::unused-async). Two independent review passes (a general/code-review --level highsweep and a dedicated adversarial pass focused on task-form regression risk) ran before merge; every real finding from both was addressed in a second commit (enum dedup, a label-lookup unification bug, a schema-load-failure fallback so a core field never goes silently blank forever, a defense-in-depth guard restore, and theperson-schema-form.svelteRelationships gate) — full detail in the PR's self-review comment.