Description
Problem
fetchTargetSchemaFields derives the relationship modal's target-column candidate set from schema.fields with no protection filter:
// packages/desktop-app/src/lib/services/relationship-viewer-service.ts:106-109
export async function fetchTargetSchemaFields(targetType: string): Promise<string[]> {
const schema = await backendAdapter.getSchema(targetType);
return (schema.fields ?? []).map((field) => field.name);
}Its own doc comment describes the result as "the candidate set for offering target-node columns in the modal's per-group view settings". Those names flow to relationship-viewer-modal.svelte → candidatesFor() → the per-group "Columns" checkbox picker.
This is the same class of bug as #2376 (fixed in #2404), on a different surface: a user-facing column offering built from unfiltered schema.fields. A relationship group whose target type is person offers "Possible duplicate" as a column; one targeting ai-chat offers all six system fields, capture:transcript included.
Why it's lower severity than #2376
Narrower exposure — an opt-in checkbox rather than a default-visible column, and it requires a relationship group whose target type declares system fields. That is why it was split out of #2404's review rather than folded into it.
Fix
#2404 added a shared predicate for exactly this:
import { isUserVisibleField } from '$lib/utils/schema-field-visibility';
return (schema.fields ?? []).filter(isUserVisibleField).map((field) => field.name);Acceptance criteria
-
fetchTargetSchemaFieldsfilters throughisUserVisibleField - Regression test covering a target type with system fields (
personand/orai-chat), asserting those names are absent from the candidate set and non-system names survive in schema order - Verified the modal's per-group "Columns" picker no longer offers system fields
Context
Found during the /pragmatic-code-review sweep of PR #2404, which checked every schema.fields consumer in the desktop app. Two others were checked and deliberately left alone:
kanban-grouping.ts(eligibleGroupByFields) — no leak today, but only incidentally: itstype === 'enum'filter excludes every current system field. A future system-protected enum field would surface a "group by" option for a field the user can't set.query-editor.svelte— offers all schema fields as query filter properties. Arguably intentional; filtering on a backend-owned field is a legitimate query even when displaying it as a column is not. Different question, not a bug.
Activity
Address review: correct two comments that misstate the invariant
Filter system-protected fields out of table columns (closes #2376) (#…
malibio commentedon Sep 7, 2026
Baseline (worktree issue-2408-relationship-system-fields): Frontend: 4857 passed (231 test files)
Filter system-protected fields out of relationship columns (closes #2408