Repository navigation
Use isUserVisibleField in task-schema-form (closes #2414) - #2421
Conversation
task-schema-form was the last surface open-coding `protection !== 'system'` instead of the shared `isUserVisibleField` predicate, which the table view, the generic detail form and the relationship column service already use. Behavior is unchanged — this closes the drift vector, so a future second condition on "user-visible" reaches this call site too. The CORE_FIELD_NAMES half of the filter is left alone: excluding core fields is a separate concern from user-visibility, since core fields render through their own controls. Adds a test covering a system-protected field on the task schema, which no existing case reached. It asserts alongside a user-protected sibling so the absence proves the filter ran rather than an empty form. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01T35Xv5uqSM5e2DSk19HqDo
Pragmatic Code Review — PR #2421Review Type: Initial Review Scope: 2 files, 1 commit ( Requirements Check (issue #2414)
All four criteria met. Verification performed
Code Review Findings🟢 Suggestion — the comment above the predicate is now slightly stale📁 "mirroring GenericSchemaForm's protection filter" was an accurate description of the old line: it was a hand-copied duplicate of a rule that lived somewhere else, and the comment existed to tell the reader where the original was. After this change the two call sites don't mirror each other — they call the same function, and the reader can now follow the import. The word that named the duplication outlives the duplication. Nit-level rewrite: The engineering principle is that a comment's job is to carry the why that the code can't; once 🟢 Observation — the test duplicates fixture shapes that
|
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
The comment said the filter mirrored "GenericSchemaForm's protection filter", which described the hand-copied duplicate this PR removed. The two call sites no longer mirror each other — they call the same function, and the reader can follow the import — so that clause pointed at an arrangement that no longer exists. Replaced it with the why the code cannot carry: that the two conjuncts answer different questions and are deliberately separate, so a later reader does not "simplify" CORE_FIELD_NAMES into the shared predicate. The system-field rationale now lives in isUserVisibleField's own docblock. Comment-only; no behavior or test change. Skipped the reviewer's second 🟢 note (inline SchemaField literals vs schema-fixtures.ts) — it was explicitly raised as an observation rather than a recommendation, and its reasoning holds: the fixtures model whole core schemas, while this test needs two throwaway fields bolted onto realTaskSchema(). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01T35Xv5uqSM5e2DSk19HqDo
Address Review — SummaryReview verdict was APPROVE with two 🟢 items and no 🔴/🟡 findings. ✅ Addressed (1)🟢 Stale comment above The reviewer was right that "mirroring GenericSchemaForm's protection filter" described the hand-copied duplicate this PR removed — the two call sites no longer mirror each other, they call the same function. Rather than only deleting the stale clause, I replaced it with the why the code genuinely cannot carry: that the two conjuncts answer different questions and are deliberately separate. That is the non-obvious fact a future reader is most likely to get wrong — the tempting "cleanup" here is to fold ⏭️ Skipped (1)🟢 Inline Verification
Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: The only change since the reviewed commit is a five-line source comment. No logic, control flow, types, tests, or public surface were touched — The PR is ready for merge, pending the author's decision. 🤖 Generated with Claude Code |
Closes #2414.
What
task-schema-form.sveltewas the last surface open-coding the system-field check instead of the sharedisUserVisibleFieldpredicate, which the table view, the generic detail form and the relationship column service already use.Behavior is unchanged — this closes the drift vector, so a future second condition on "user-visible" reaches this call site too rather than silently keeping the old rule.
The
CORE_FIELD_NAMEShalf of the filter is deliberately left alone: excluding core fields is a separate concern from user-visibility, since core fields render through their own dedicated controls.Test
Added a case covering a system-protected field on the task schema — no existing case reached one. It asserts against a user-protected sibling field in the same schema, so the system field's absence proves the filter ran rather than the form having rendered nothing. Verified it is a real guard: removing the predicate makes it fail.
Verification
bun run test:all— unit 4864 passed (baseline 4863 + the new test), browser 55 passed, all Rust crates greenbun run quality:fix— clean, no changes producedgrep -rn "protection !== 'system'" packages/desktop-app/srcreturns onlyschema-field-visibility.ts✅Note: the pre-push gate first failed on a flaky timing assertion (
avgScalingFactor < 2.0) insrc/tests/performance/architecture-benchmarks.test.ts, unrelated to this change; it passed on re-run.Acceptance criteria
task-schema-form.svelteusesisUserVisibleFieldfor the protection half of the conditionCORE_FIELD_NAMESfiltering is unchangedtask-schema-form.test.tsstill passes; extended with a system-protected field casegrep -rn "protection !== 'system'" packages/desktop-app/srcreturns onlyschema-field-visibility.ts🤖 Generated with Claude Code
https://claude.ai/code/session_01T35Xv5uqSM5e2DSk19HqDo