Skip to content

Relationship modal offers protection:system fields as target columns #2408

Closed

Description

@malibio

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

  • fetchTargetSchemaFields filters through isUserVisibleField
  • Regression test covering a target type with system fields (person and/or ai-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: its type === '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

  1. added
    bug
    on Sep 7, 2026
  2. malibio commented on Sep 7, 2026

    @malibio
    CollaboratorAuthor

    Baseline (worktree issue-2408-relationship-system-fields): Frontend: 4857 passed (231 test files)

  3. self-assigned this
    on Sep 7, 2026
  4. added a commit that references this issue on Sep 7, 2026
    827e113
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugfrontend

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions