Skip to content

Delete dead SchemaPropertyForm, fix stale generic-form comments (closes #2102) - #2135

Merged
mstomar125 merged 2 commits into
mainfrom
issue-2102-typed-property-forms
Aug 18, 2026
Merged

mstomar125 merged 2 commits into
mainfrom
issue-2102-typed-property-forms

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Closes #2102

What this issue turned out to need

core#2102 was filed before core#2013 (isCustomSchemaType → plugin-registry-based node-type predicates, merged 2026-08-17) and core#2116/PR#2125 (person duplicate-convergence UI, merged 2026-08-18). Re-investigating against current main found the two user-visible bugs the issue was originally filed for already fixed:

  • project renders no property form — fixed by core#2013. GenericSchemaForm's no-hardcoded-form fallback is now unconditional (schema-form-loader.svelte.ts), instead of gated on the old hand-maintained CORE_NODE_TYPES allowlist that incorrectly excluded project from ever reaching the generic form despite having no hardcoded one. Opening a project node today renders a real, schema-driven form (status/priority/start_date/end_date), reads/writes the namespaced properties.project.* shape correctly (schema-field-resolution.ts), and gates its Relationships button on non-empty groups exactly as the issue asked.
  • person classified as a custom type — moot. CORE_NODE_TYPES was deleted entirely by core#2013; classification is now plugin-registry-derived (hasInlineNodeComponent/needsGenericSchemaForm), which is correct for person without any list to maintain.

This PR verifies that and lands the remaining, safe cleanup:

  • Deleted schema-property-form.svelte — a third, fully redundant schema-form implementation. It had zero production imports (referenced only by its own dedicated test) and was made entirely redundant once GenericSchemaForm gained namespace-aware read/write via schema-field-resolution.ts (core#2013) — the two behaviors that used to distinguish it (writing the namespaced shape, migrating an un-migrated flat value) are things GenericSchemaForm now does too.
  • Ported that dead file's regression coverage onto GenericSchemaForm (property-form-field-dispatch.test.ts) rather than just deleting it — namespaced nested-field writes, and un-migrated-flat-property reads/writes, are now proven against the component that actually owns that behavior.
  • Added generic-schema-form-project.test.ts — end-to-end coverage of GenericSchemaForm rendering the real project schema (mirrors core_schemas.rs exactly: status/priority/start_date/end_date), closing the gap between core#2013's loader/predicate-level tests and the actual rendered form: field labels, the backend-applied default status, filled/total counting, and a real write round-tripping through the namespaced shape without dropping a sibling field.
  • Fixed stale comments in base-node-viewer.svelte, plugins/types.ts, plugin-registry.ts, and task-node-viewer.svelte that referenced the now-deleted SchemaPropertyForm (one of them introduced by core#2013 itself, still saying "generic SchemaPropertyForm" when the actual wired-in fallback is GenericSchemaForm) and a DateSchemaForm that has never existed.

Deliberately not done here (filed as follow-ups)

  • Compose task/person schema forms through a shared TypedFormShell; remove hardcoded enum/date-picker duplication #2132 — the original issue's "Approach" section sketched a larger refactor: extract a shared TypedFormShell, remove task-schema-form.svelte's (~695 lines) hardcoded STATUS_OPTIONS/PRIORITY_OPTIONS enum constants and duplicated date-picker markup in favor of SchemaFieldLeaf, and decide whether person-schema-form.svelte is worth converting to schema-driven field iteration. This is real, valuable work, but it's large, separable, and touches the most actively-used property form in the app (task editing) — bundling it here risked shipping something half-scrutinized. That issue also captures a latent gap found during this investigation: GenericSchemaForm doesn't filter fields by protection level, so a system-managed field (e.g., person's _possible_duplicate) would render as a raw editable control if a type were ever rendered through generic per-field iteration without that filter — not currently reachable in production (the two other core types with system fields, ai-chat and collection, both have dedicated full-page viewers that bypass BaseNodeViewer's generic-form branch), but worth closing before anything relies on that path.
  • Decide: should project be user-creatable via slash command (needs product confirmation) #2133 — project has no plugin registration, so there is no slash command / user-facing way to create one today (AI/MCP only). This is a product decision (is project meant to be user-creatable the way task/person are, or agent-managed only?), not a mechanical fix, so it's filed for confirmation rather than resolved unilaterally.
  • person kept hardcoded, not converted to schema-driven field iteration — deliberate, not an oversight. Both of person's two real fields already carry non-trivial, actively-used UX from core#2116 (name→content sync; blur-triggered adopt-existing suggestion with a monotonic-generation staleness guard; a convergence "possible duplicate" badge) that a generic loop would still need to special-case, and the schema's third field (_possible_duplicate) is system-managed and must never be user-editable — see the protection-level filtering gap above. Net benefit of converting now was judged low relative to the regression risk; Compose task/person schema forms through a shared TypedFormShell; remove hardcoded enum/date-picker duplication #2132 revisits this after the shell/dedup work lands.
  • required/default enum semantics — the backend already applies schema defaults at node-creation time (apply_schema_defaults_with_fields, crud.rs), so a new project node's status is never actually empty in practice; verified via the new project schema tests. No submission-blocking validation exists anywhere in this form family today (task included), so required stays informational metadata for now — tracked in Compose task/person schema forms through a shared TypedFormShell; remove hardcoded enum/date-picker duplication #2132 if a visible affordance is wanted later.

Testing

  • bun run test (cold vitest cache): 4730/4731 passed. The one failure (architecture-benchmarks.test.ts, a timing threshold) is a pre-existing flaky perf test unrelated to this change — passes in isolation, confirmed before and unaffected by this diff.
  • bunx svelte-check: 0 errors.
  • bun run quality:fix: clean (eslint, svelte-check, tsc, cargo fmt, cargo clippy --all-targets -D warnings -D clippy::unused-async) — no Rust files touched by this PR; ran to confirm the sidecar-build/workspace still compiles clean.
  • No backend (.rs) files changed.

…2102)

core#2013 already fixed the two user-visible bugs core#2102 was filed
for: project now renders a schema-driven properties form via
GenericSchemaForm's no-hardcoded-form fallback (previously gated on a
hand-maintained core-type allowlist that incorrectly excluded it), and
person's form-availability classification is now plugin-registry-
derived instead of allowlist-derived. This commit lands the remaining,
verified-safe cleanup:

- Delete schema-property-form.svelte: fully superseded once
  GenericSchemaForm gained namespace-aware read/write via
  schema-field-resolution.ts (core#2013) — it had zero production
  imports, referenced only by its own dedicated test.
- Port that test file's namespaced-write and un-migrated-flat-
  properties coverage onto GenericSchemaForm, which now owns that
  behavior, instead of just deleting it.
- Add end-to-end regression coverage for GenericSchemaForm rendering
  the real `project` schema (status/priority/start_date/end_date,
  mirroring core_schemas.rs exactly) — closing the gap between the
  existing loader/predicate-level tests and the actual rendered form.
- Fix stale comments left pointing at the deleted SchemaPropertyForm
  and a DateSchemaForm that has never existed, across
  base-node-viewer.svelte, plugins/types.ts, plugin-registry.ts, and
  task-node-viewer.svelte.

The larger architectural refactor the original issue sketched
(TypedFormShell extraction, task-schema-form.svelte's hardcoded enum/
date-picker duplication) and the open question about project's
user-creatability are filed as separate follow-ups (#2132, #2133) —
both large and separable from the bug-fix-and-cleanup scope here.

Co-Authored-By: Claude <[email protected]>
…num label-for

Adversarial review of PR #2135 found no blockers but three real gaps:

- generic-schema-form-project.test.ts's hand-mirrored project schema didn't
  match core_schemas.rs's real protection/extensible values for status/
  priority. Nothing reads those today, but the PR's own follow-up (#2132) is
  about adding protection-based field filtering, and a fixture claiming to
  mirror the real schema "exactly" needs to actually do so or the first
  attempt at that filtering gets a false-green test.
- The SchemaPropertyForm deletion dropped its two boolean-field tests
  (checkbox rendering + persisted write) without a GenericSchemaForm
  equivalent, leaving that leaf type with zero coverage. Restored.
- A test comment claimed an un-migrated flat write "lands flat, not
  namespaced" without scoping that to the payload this component sends —
  the backend's own normalize-to-namespace step is a separate concern.
  Reworded to say so explicitly.

Also fixed a real, small, in-scope bug the review surfaced: SchemaFieldLeaf's
enum control never set `id={fieldId}` on its Select.Trigger, so `<label for>`
pointed at nothing for every enum field — now directly relevant since
project's status/priority (both enum) render through this control as of
this PR. One-line fix, matching the pattern the date case already uses on
its Popover.Trigger.

Co-Authored-By: Claude <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

Adversarial review (self-requested, independent sub-agent)

Spawned a fresh review agent against this PR's diff, given no prior context, with explicit instructions to be skeptical of this PR's own narrative and verify every claim against actual code (not the PR description). Full report below; verdict: no blockers, one should-fix, several non-blocking notes — all addressed in the follow-up commit 9b6a8933.

Verified correct:

  • schema-property-form.svelte deletion — confirmed zero remaining production references repo-wide (dynamic imports, glob registration, string-keyed lookups all checked, not just static imports).
  • task-schema-form.svelte / person-schema-form.svelte are byte-identical to main — no accidental behavior change to task/person editing.
  • The _possible_duplicate reasoning for keeping person-schema-form.svelte hardcoded holds: it's genuinely SchemaProtectionLevel::System in core_schemas.rs, and no component filters by protection today — SchemaFieldLeaf renders boolean unconditionally as a checkbox.
  • The bits-ui Calendar interaction test (generic-schema-form-project.test.ts) is not vacuous — verified the waitFor/expect structure retries and throws on no match, and both data-bits-day/data-outside-month attributes are real, confirmed against the vendored bits-ui source.
  • The vi.restoreAllMocks()-wipes-a-factory-vi.fn() fix is a correct diagnosis of a real vitest gotcha, not papering over a different bug.
  • All four stale-comment fixes are accurate.

Addressed (commit 9b6a8933):

  • Should-fix: the hand-mirrored project schema in the new test claimed to match core_schemas.rs "exactly" but had status as protection: 'user' (real: Core) and both enum fields missing extensible: true. Fixed — this matters because follow-up Compose task/person schema forms through a shared TypedFormShell; remove hardcoded enum/date-picker duplication #2132 is specifically about adding protection-level filtering, and a fixture claiming fidelity needs to actually have it or the first filtering attempt gets a false-green test.
  • Coverage gap: deleting schema-property-form.svelte silently dropped its two boolean-field tests (checkbox render + persisted write) with no GenericSchemaForm equivalent. Restored as a new GenericSchemaForm — boolean fields block.
  • Comment accuracy: a test comment claimed an un-migrated flat write "lands flat, not namespaced" without scoping that to what this component actually sends — the backend's own subsequent normalize-to-namespace step is real but separate. Reworded.
  • Small in-scope a11y fix: SchemaFieldLeaf's enum control never set id={fieldId} on its Select.Trigger, so <label for> dangled for every enum field. Pre-existing, but now directly relevant since project's status/priority (both enum) render through this control for the first time as of this PR. One-line fix, matching the date case's existing Popover.Trigger pattern.

Deferred (correctly, not silently dropped): stale docs in the separate nodespace-docs repo still describing SchemaPropertyForm as the generic form — out of this repo's scope, noting here rather than actioning.

Full frontend suite re-run cold after fixes: 219 files / 4733 tests, all green. svelte-check/tsc/eslint clean. Pushed as 9b6a8933, gate (cargo test + e2e) passed.

Self-approving and merging.

@mstomar125
mstomar125 merged commit 8a2947f into main Aug 18, 2026
@mstomar125
mstomar125 deleted the issue-2102-typed-property-forms branch August 18, 2026 08:27
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.

Add typed property forms for packaged schemas person and project, following the task form pattern

1 participant