Documentation

Docs / Reference

ADR 0066 - Precision labels: a central rule table, file labels for language structure, scope labels for fact families

Status: Accepted (delegated review, 2026-11-16)

Context

Contract v1 gives every file record a precision of precise or best_effort (docs/contract/v1.md "File"), and the indexer copies it to the file node's attributes.precision. The scanner writes best_effort for every file (internal/scan/scan.go:366); no API view or UI reads it (the T020 task record (internal) §4). Milestone M2 of the project plan asks for precise where a language earns it, shown in the UI; VISION principle 6 asks for honesty about precision per language, and "Target languages" says every file and node carries its language's label.

The developer fixed the bar (2026-11-09): every extractor and linker ships with a claim contract, golden fixtures, corpus checks, one independent review and an oracle where cheap; unknowns, oracle / mapped verification, assumptions and confidence carry the rest. A Java/C#/Dart tier (T021) will be labelled best_effort throughout.

The inventory (§2) finds that the full bar is met today by fact families, not by languages: SQL migration schema (ADR 0047, 0051), the seven ORM front ends (ADR 0054, 0057, 0059, 0061-0064) and code-to-table links (ADR 0060) have claim contracts with 1:1 tests, goldens, corpus checks, oracles and recorded independent reviews. The first-tier languages' structural extraction (declarations, imports, calls) has goldens and corpus checks but no claim contract and no recorded independent review; routes, client calls, Angular, Tauri and OpenAPI have goldens and corpus checks, some independent reviews, and no claim contract.

A single TypeScript file can hold facts from several scopes (structure, Express routes, fetch calls, Drizzle tables, table-access edges), so "the file's precision" and "the precision of a fact in it" differ.

Options considered

Definition of precise.

  1. The full v1 bar per scope, checked by a test from named evidence (contract test, goldens, corpus record, review entry, oracle or a stated reason none is cheap) and pinned to the extractor version. Selected.
  2. "Has a dedicated extractor with goldens and corpus checks": would make the first-tier languages precise at once without the contract and the review the bar requires. Rejected as not precision-safe.

Granularity.

  1. File label only (contract v1 as is). Cannot say that a Prisma table is precise while its schema file and the TypeScript that queries it are not.
  2. File label for the language's structural scope, plus scope labels for fact families computed by the server from the same table and attached to the views that already know their family. No contract or store change. Selected.
  3. Per node and edge, stamped by the indexer. Node attributes are open, so a node attribute needs no contract_version bump; edges have no attribute map, so an optional edge field changes the contract docs and schemas and makes older consumers report unknown_field. Stamped attributes also change synthetic node hashes, so a label flip would expire dispositions. Rejected for v1.
  4. File label as the weakest scope found in the file: almost every application file would read best effort whatever its language earns, and the label would change with content. Rejected.

Where the label is decided.

  1. The scanner switches per language: no link to evidence, nothing keeps it honest.
  2. Each extractor declares its label: no single table to keep 1:1 with the task and docs.
  3. A central package internal/precision with the rule table (rows that earn precise, the default branch best_effort), used by the scanner for file labels and by the server for scope labels, and a test that checks every row's evidence and keeps table, task file and docs 1:1. Selected.

Decision

Consequences

Known gaps

Implementation notes (T020)

Implementation notes (T020)

Implementation notes (T020 F1, review fixes)

Review notes (2026-11-16)

Accepted after delegated review on 2026-11-16.

Report a problem with this pageSource: docs/adr/0066-precision-labels.md