Skip to content

A tracker source that lacks a feature column reads it as a default, so its PR-file reads no longer fail - #477

Merged
zlareb1 merged 2 commits into
mainfrom
fix/tracker-feature-column-defaults
Nov 10, 2026
Merged

zlareb1 merged 2 commits into
mainfrom
fix/tracker-feature-column-defaults

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in a release)

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

A tracker source whose github_prs lacks affected_file_paths or diff no longer fails every read of a PR's files (pr_files, prs_touching_paths, pr_change and the bisect scans) with Unknown expression or function identifier. The contract check reports the columns as defaulted, and the reads answer as for a PR that touched no file.

Why

On a source whose github_prs has neither column, every statement that names them fails: tracker pr_files failed, tracker prs_touching_paths failed, tracker pr_change failed with Code: 47 ... Unknown expression or function identifier affected_file_paths.

Where the column comes from:

  • It is not a Loom table, and no migration has ever created or renamed it.
  • github_prs is the tracker source's own table (the record contract, docs/features/tracker/record-contract.md). Loom reads it through the source's credential.
  • The contract lists diff and affected_file_paths as the optional bisect feature. The contract check reported the feature absent, but did not alias or default its columns, as it does for a missing triage or src_components column. So the table reference got no projection for them, while the statements still named them.
  • CI has no schema for this table: the unit tests describe it with a fixture that holds every feature column, so no test saw a source without them.

The fix, in the contract check (diff in server/tracker/domain/contract.py): a feature column the source lacks now goes through the aliases first, as a missing contract column does, and else reads its type's default ('', [], the defaults the contract already uses). A default lands in defaulted like any other, so:

  • The statements run. pr_files returns no paths, prs_touching_paths no PR, and pr_change no files or hunk contexts.
  • The feature and its capability stay absent (has_column is False for a default), and the report says defaulted github_prs.{diff, affected_file_paths}.

merged_at gets an alias instead of a default: if(is_merged = 1, closed_at, toDateTime64(0, 3)), which a mapped tracker already derives (mapping.py). Every source has both columns. A default at epoch 0 would have turned the merge-window reads (link_pr_candidates, cause_statements, backport_wanted_prs) into silent empty answers.

A missing embedding reads []. The vector reads already skip a zero vector (arraySum(arrayMap(x -> abs(x), embedding)) > 0), so the vector leg answers no neighbour.

A deployment upgraded from an older release needs nothing. The report is computed in process from system.columns at each contract check, so the first check after the upgrade carries the defaults. No migration or stored state is involved.

Scope and risk

  • Touches the contract check, one alias, its tests and the record-contract page.
  • The rule covers every feature column (bisect's, merge_time's merged_at through its alias, and vector's embedding).
  • A source that has the columns is unchanged: nothing is defaulted, and a statement keeps its table reference unless another alias already wrapped it.
  • A source that lacks a feature column but no other column now has its table references wrapped in the alias projection. Sources with any alias already read through it (the analyzer prunes it to the columns a statement reads, table_expr).

Compatibility, rollout and rollback

  • Wire: the contract report's defaulted names the feature columns a source lacks; features and capabilities are unchanged.
  • Operator steps: none.
  • Rollback: reverting brings back the failures; nothing is stored.

Tests

  • tests/unit/test_tracker_contract_aliases.py:
    • A source without the two columns meets the contract with both defaulted. The bisect feature and capability stay absent, and the summary names them.
    • pr_files, prs_touching_paths and pr_change run on clickhouse-local against a github_prs without the columns, through the contract check and _rows' rewrite, and answer empty. On main the first fails with the deployment's Code: 47.
    • A source without merged_at aliases it, and on clickhouse-local backport_wanted_prs finds the PR merged in its window and not the one closed unmerged.
    • A source without embedding: similar_vector on clickhouse-local answers no neighbour.
  • tests/unit/test_tracker*.py, test_cli_tracker_contract_check.py, the bisect tests and doc links: 847 passed.
  • Gates: make format lint typecheck.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. The failing statement was reproduced on clickhouse-local with the source's shape.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed. (Format, lint, typecheck and the tracker and bisect unit tests were run; CI runs the rest.)
  • Generated files are regenerated in this PR, not by hand. (None affected.)
  • A new migration is additive and numbered after the latest on main; no merged migration is edited. (No migration.)
  • A behaviour change to any file a plugin ships bumps both plugin manifests' version. (No plugin files.)
  • The frontend builds and its tests pass, if frontend/ changed. (Unchanged.)
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers.
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

🤖 Generated with Claude Code

zlareb1 and others added 2 commits November 10, 2026 12:22
…o its PR-file reads no longer fail

The record contract lists `github_prs.diff` and `affected_file_paths` as
the optional `bisect` feature, but a source that lacked them got no
projection for them, so every statement that names them (pr_files,
prs_touching_paths, pr_change, the bisect scans) failed with Code 47. A
feature column the source lacks now reads its type's default and is
reported as defaulted: the reads answer as for a PR that touched no file,
and the feature and its capability stay absent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…ed_at, feature columns resolve aliases first

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 force-pushed the fix/tracker-feature-column-defaults branch from 6a0a777 to 199247b Compare November 10, 2026 12:32
@zlareb1
zlareb1 merged commit ec05d4c into main Nov 10, 2026
36 of 38 checks passed
@zlareb1
zlareb1 deleted the fix/tracker-feature-column-defaults branch November 10, 2026 13:11
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.

1 participant