Skip to content

task-schema-form open-codes the system-field predicate instead of isUserVisibleField #2414

Closed

Description

@malibio

Problem

task-schema-form.svelte open-codes the system-field check instead of using the shared predicate:

<!-- packages/desktop-app/src/lib/components/property-forms/task-schema-form.svelte:121 -->
return schema.fields.filter((f) => !CORE_FIELD_NAMES.includes(f.name) && f.protection !== 'system');

isUserVisibleField ($lib/utils/schema-field-visibility.ts) now exists for exactly this predicate and is used by the table view, the generic detail form, and the relationship column service. This is the last open-coded copy.

Behavior is correct today, so this is not a bug — it is the drift vector the helper was extracted to close. If the definition of "user-visible" ever gains a second condition, this call site silently keeps the old rule.

Why it wasn't folded into the earlier PRs

It was deliberately left alone twice, and the reasoning was sound both times: only one of the two conjuncts is isUserVisibleField, so the change is a readability gain rather than a correctness fix, and it means touching an unrelated file in a PR scoped to a different surface. Now that three call sites share the helper, the remaining inline copy is worth closing on its own.

Fix

import { isUserVisibleField } from '$lib/utils/schema-field-visibility';

return schema.fields.filter((f) => !CORE_FIELD_NAMES.includes(f.name) && isUserVisibleField(f));

Acceptance criteria

  • task-schema-form.svelte uses isUserVisibleField for the protection half of the condition
  • CORE_FIELD_NAMES filtering is unchanged — it is a separate concern, not part of user-visibility
  • Existing task-schema-form.test.ts still passes; extend it if no case currently covers a system-protected field on the task schema
  • grep -rn "protection !== 'system'" packages/desktop-app/src returns only schema-field-visibility.ts

Context

Found during the /pragmatic-code-review of #2411. Related: #2376 (table view), #2408 (relationship column picker) — the same predicate applied to two other surfaces.

Activity

  1. malibio commented on Sep 7, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 232 test files passed, 4863 tests passed (Duration 78.12s)

  2. self-assigned this
    on Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions