Skip to content

fix(core): the import resolves a lookup cell by the target object's stored title field - #25033

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-24981-import-lookup-title-field
Oct 21, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-24981-import-lookup-title-field

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Part of #24981

Clause-②: no

The import door now honours the title rule ADR-0079 already declares; no schema, export or published accept set moves, and nothing narrows.

What this delivers (the decision-independent half)

The import's lookup resolution (resolveRef, packages/core/src/utils/import-runner.ts) now asks the target object's title field after the id and the lookup's own displayField, and before the fallback keys. The title is resolved by ADR-0079's one rule, resolveDisplayField from @objectstack/spec/data. Only a STORED title is asked.

  • Wren (target title displayNameField: 'nickname', a stored text field) now resolves. On main it answered reference_not_found, because nickname was never asked.
  • A formula title (John Smith against nameField: 'full_name', Acme (EMEA) against nameField: 'display_title') is not asked by where. The swallowed INVALID_FIELD query is gone, and the cell still answers reference_not_found.
  • Two records sharing a stored title answer the existing reference_ambiguous. Neither is linked.
  • The fallback key list (name, title, label, full_name, email, username) and its order are unchanged. The exposure check from security(import): an import's reference resolution matches a lookup cell against a target whose exposure refuses reads (census row 7 of #22661) #22739 still runs first and still withholds a target whose declared exposure does not serve list.

What is left (with the maintainer)

Q1 on the card asks how a FORMULA title should be matched (options A, B-cap, C and D in the first dev report and in the seat's analysis). Nothing is built for it here: no scan, no search door, no new refusal code. The card's second Wanted bullet ("A formula title is matched by the engine's own record-title resolution") is not delivered by this PR, so #24981 remains open after it merges.

Mechanism (measured in this run)

  • H1 holds. servesReferenceTarget already read the target's getMetaItem item for its enable block. It now also returns the title field (resolveDisplayField(item)) and the field map from that same read. No extra metadata read is made. Pinned: two rows asking one target cost one getMetaItem call.
  • The export reads the same seam. withReferenceTitleFields (packages/rest/src/export-format.ts) resolves a lookup cell's title with resolveDisplayField over the getMetaItem item (readObjectSchema in packages/rest/src/data-action-routes.ts). So the import asks the field the export wrote the cell from.
  • H2 holds. "Stored" is decided by isVirtualSearchField (@objectstack/spec/data, over SEARCH_VIRTUAL_TYPES, which holds formula). It is the same predicate the engine's filter seam assertFilterIsMaterializable (packages/objectql/src/filter-comparand-shape.ts) uses to refuse a where, so there is no second list. packages/core cannot import objectql, because objectql depends on core. The spec-level predicate the engine itself reads is the one reused.
  • The skip covers every candidate the target declares as a formula, not only the title rung. The formula pin needs this: the card's formula title full_name is also on the fallback list, so skipping only the rung would still send where full_name. The skip changes no verdict. The engine refuses every where over a formula at that seam, which its own comment calls "the one place EVERY caller-supplied where passes through". The resolver's catch read that refusal as "field absent" and moved on.

Pins (packages/core/src/utils/import-runner-reference-title.test.ts)

The fake findData answers like the engine: equality over the stored row, and a recorded INVALID_FIELD / 400 refusal for a where over a formula field.

  1. Wren resolves through a stored displayNameField: 'nickname', and through nameField: 'nickname' (the alias as the registry normalizes it). The asked keys are id, then the lookup's displayField (first_name), then nickname.
  2. A real (non-dry) run stores the matched id. getMetaItem is called once for two rows.
  3. John Smith (formula full_name) and Acme (EMEA) (formula display_title) answer reference_not_found. The find calls never name the formula field. The asked keys are exactly id plus the fallback list minus the formula member, and no refusal was produced.
  4. Two records sharing a stored title answer code: 'reference_ambiguous'.
  5. For security(import): an import's reference resolution matches a lookup cell against a target whose exposure refuses reads (census row 7 of #22661) #22739: a target with enable: { apiEnabled: false } and a stored title answers reference_not_found for a match and for a miss. findData is never called, and getMetaItem is called once.

Ablations

The fix was committed first. Both mutations went through scripts/ablation-replace.mjs: the anchor hit 1 and fell to 0, and the blob moved. Each restore is proven by blob hash equal to HEAD and an empty git diff HEAD. The subject is imported by relative path from src/, so no dist/ leg applies.

  • Rung removed (the line ...(target.titleField ? [target.titleField] : []), deleted): 4 failed, 3 passed. Both Wren pins went red with reference_not_found for person. The stored-id pin went red. The ambiguity pin went red with reference_not_found in place of reference_ambiguous. Restored: blob d9b249d961d4 equals HEAD.
  • Virtual filter removed (the isVirtualSearchField filter on the candidate list dropped): 2 failed, 5 passed. Both formula pins went red: "expected [ 'id', 'full_name', ... ] to not include 'full_name'", and the same for display_title. Restored: blob d9b249d961d4 equals HEAD.

Tests and gates (final head 9a67cf4ce)

  • pnpm --filter @objectstack/core typecheck: exit 0. The test layer compiles under tsconfig.test.json (the new file is in that program), with 4 of 4 pinned signatures held.
  • pnpm --filter @objectstack/core exec vitest run --project local --maxWorkers=2: 109 files, 2630 tests passed.
  • The node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derivation gave 68 commands. All 68 were run at 9a67cf4ce, and every one exited 0. --ran reconciliation: "68 derived famil(ies) accounted for — 68 run, 0 NOT-MEASURED (a DERIVED zero — all 68 recorded an exit code and none of them is 3)".
  • An earlier battery at 745620fac went red on check:error-code-casing. The new test spelled a field-addressed code with a shorthand field key, which the gate does not read as field-addressed. 9a67cf4ce spells field: column.
  • eslint --no-inline-config over the two touched source files: exit 0. The repo-wide pnpm lint is CI's.

Acceptance notes

  • Takeover. This PR continues an interrupted dev run. The inherited uncommitted change to import-runner.ts (+63/-16) was read hunk by hunk and kept unchanged as the first commit. Every claim above was measured again in this run.
  • The refusal wording. For a formula-titled target, the reference_not_found text does not say why the cell cannot match. The first dev measured Contact: no record matches "John Smith". No wording changes here. Whether the refusal should name the formula title belongs with Q1's answer; the seat's analysis lists it as a confidence gap.
  • Carried from the first dev report, not filed. When the declared title misses, the fallback key list can still link a cell by an unrelated column (VP of Engineering links a contact by its job title). This PR leaves that unchanged, by ruling.
  • Carried, not filed. resolveRef's catch reads every findData throw as "field absent". Only the INVALID_FIELD path is measured.
  • Declared to CI, not run locally. Some consumer suites drive runImport through @objectstack/core: packages/rest/src/import-integration.test.ts, packages/plugins/plugin-auth/src/admin-import-users.test.ts and the dogfood import-reference pins. No export, type or wire shape of @objectstack/core changed, so CI's Test Core carries them.
  • Base. origin/main was merged at 73432299c before this PR opened. Two later commits on main touch neither packages/core nor packages/spec.

Generated by Claude Code

… field

resolveRef asks the lookup target's ADR-0079 title field
(resolveDisplayField, read off the same getMetaItem declaration the
exposure check already reads) after the id and the lookup's own
displayField. A candidate the target declares virtual (a formula) is
never asked by where: the engine's filter seam refuses it by the same
spec predicate (isVirtualSearchField), so the query could only answer a
refusal the resolver read as "field absent".

Claude-Session: https://claude.ai/code/session_01QK6pdbxKZiHdFApL8RYVh9
Co-authored-by: Claude <noreply@anthropic.com>
Wren resolves through a stored displayNameField / nameField after the id
and the lookup's displayField; a formula title (John Smith, Acme (EMEA))
is never asked by where and still answers reference_not_found; two
records sharing a stored title answer reference_ambiguous; a target
whose exposure refuses list is still never read.

Claude-Session: https://claude.ai/code/session_01QK6pdbxKZiHdFApL8RYVh9
Co-authored-by: Claude <noreply@anthropic.com>
…reads it as field-addressed

Claude-Session: https://claude.ai/code/session_01QK6pdbxKZiHdFApL8RYVh9
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling labels Oct 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/core, touching 12 documentable anchor(s).

7 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/client-sdk.mdx (via /:object/import (route, bridged from symbol runImport — its route source's handler names it))
  • content/docs/api/wire-format.mdx (via /:object/import (route, bridged from symbol runImport — its route source's handler names it))
  • content/docs/data-modeling/fields.mdx (via /:object/import (route, bridged from symbol runImport — its route source's handler names it))
  • content/docs/data-modeling/import-mappings.mdx (via /:object/import (route, bridged from symbol runImport — its route source's handler names it), /:object/import/jobs (route, bridged from symbol runImport — its route source's handler names it))
  • content/docs/permissions/system-context.mdx (via /:object/import (route, bridged from symbol runImport — its route source's handler names it), /:object/import/jobs (route, bridged from symbol runImport — its route source's handler names it))
  • content/docs/protocol/objectql/state-machine.mdx (via /:object/import (route, bridged from symbol runImport — its route source's handler names it), /:object/import/jobs (route, bridged from symbol runImport — its route source's handler names it))
  • content/docs/ui/views.mdx (via titleField (symbol, a field of interface ServedReferenceTarget))

⛔ 3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v12.mdx (via /:object/import (route, bridged from symbol runImport — its route source's handler names it))
  • content/docs/releases/v17/17-1.mdx (via titleField (symbol, a field of interface ServedReferenceTarget))
  • content/docs/releases/v17/17-6.mdx (via runImport (symbol, a top-level function), /:object/import (route, bridged from symbol runImport — its route source's handler names it))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • the SDK route bridge reached 54 of 206 client-bound route-ledger rows — the other 152 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 152: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 97 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 28 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 4d991588ffcdedce1b79fc96ba2779c67c4f8d62 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 22bbec1fd962b90bd7c40a6b1ea284dc32cecdde — the merge of head 9a67cf4cee9f26f8f2fa934db729a13ced60e3af into base 4d991588ffcdedce1b79fc96ba2779c67c4f8d62, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 22bbec1fd962b90bd7c40a6b1ea284dc32cecdde && git checkout 22bbec1fd962b90bd7c40a6b1ea284dc32cecdde
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 4d991588ffcdedce1b79fc96ba2779c67c4f8d62 9a67cf4cee9f26f8f2fa934db729a13ced60e3af && git checkout -B drift-repro 4d991588ffcdedce1b79fc96ba2779c67c4f8d62 && git merge --no-ff 9a67cf4cee9f26f8f2fa934db729a13ced60e3af

node scripts/docs-audit/affected-docs.mjs --json 4d991588ffcdedce1b79fc96ba2779c67c4f8d62

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 4d991588ffcdedce1b79fc96ba2779c67c4f8d62 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对

Seat review · domain:engine seat 2 · session_01QK6pdbxKZiHdFApL8RYVh9 · 2026-10-21T03:01Z · head 9a67cf4ce · verdict: ACCEPT (TIER_DEFAULT, this lane seat's own review; no contract face is touched)

  • Shape: a draft PR to main from the claimed branch claude/issue-24981-import-lookup-title-field. The body's only card keyword is Part of #24981, so the merge does not close the card, which keeps its open half (Q1, with the maintainer, analysis 6303968754).
  • Premise, measured: the first dev's probe through the real import route (6303928508) showed Wren never asked by nickname. The pins on this head show it resolving, while John Smith and Acme (EMEA) still answer reference_not_found and send no INVALID_FIELD query.
  • Diff, read by the seat: servesReferenceTarget returns the served declaration in place of a boolean, so the title costs no second read. resolveRef adds resolveDisplayField's title after the lookup's displayField, and filters out every candidate the target declares virtual (isVirtualSearchField, the predicate the engine's filter seam refuses by). The fallback keys and security(import): an import's reference resolution matches a lookup cell against a target whose exposure refuses reads (census row 7 of #22661) #22739's exposure order are unchanged.
  • Gates on this head: 41 check-runs, 34 success and 7 skipped, all 7 in main's roster (check-expected-skips.mjs --pr 25033: OK). check-governed-merges.mjs --pr 25033: NOT governed, 253 changed lines. Clause-②: no is right: nothing narrows. The filter that skips a formula candidate changes no verdict, because the engine refused every such where.
  • Accepted deviations: the formula skip covers every candidate, not only the new title rung (full_name is on the fallback list too). main was not re-merged after 73432299c; the queue builds on current main.
  • Out of scope: the fallback list's unrelated-column match and the formula-title miss's unexplained sentence both stay with import: a lookup cell that names the record by the target object's title field answers reference_not_found — resolveRef never reads nameField, and a formula title is not matchable #24981's Q1. The resolver's broad catch is noted in the dev report and has no carrier.
  • Landing: this seat flips the PR to ready and arms auto-merge through the relay now. At the merge the card is released to needs-user-decision for Q1, in the same act as the Part of close-out.

Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants