Skip to content

fix(lint): warn when a context pack reads an injected column with no storage on an external object - #37699

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-37432-ai-context-unprovisioned
Nov 26, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-37432-ai-context-unprovisioned

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #37432

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:给外部数据源对象写资料包的作者,在校验和保存时会多看到一条提醒,指出某个平台自动添加的字段(负责人、创建时间等)在外部库里没有存储;解释文本也说明了平台自动添加的字段算作已定义。
  • 为什么做:属于资料包(让助手读懂一条记录)专题的收尾,替给外部对象写资料包的作者解决「校验通过但助手读不到」的问题。
  • 出错会怎样:最坏是作者多看到一条只提醒、不拦截的警告,保存照常成功,可以直接撤回。
  • 要你做什么:无。

What changes

  • validateAiContext (packages/lint/src/validate-ai-context.ts) gains ai-context-field-unprovisioned, a warning. It fires where a pack names an injected system column of an ADR-0015 external object. It covers every place the rule reads a field map: the root's fields, body.field, and each related entry's fields, where, orderBy and link field (named or implied). Each object is judged by its own provenance, through unprovisionedInjectedColumnsFor (system-fields.ts), the spec derivation every other unprovisioned-anchor rule reads. No second copy of the predicate exists. The message is the shared short clause (unprovisionedAnchorVerdict) plus a consequence for the position, and the fix is the shared unprovisionedAnchorFix. A column the author declares on the external object is never judged.
  • body.field on an injected column keeps its ai-context-body-not-long-text finding, and the new warning is added beside it. No injected column is long text, so both findings always appear together, and each one states an independent fact.
  • os explain: a new ai-context-field-unprovisioned entry (shared cause paragraph, cost by position, shared remedy). The ai-context-field-unknown entry is rewritten to say that injected columns count as defined, that a column the platform does not inject is still unknown, and that the external case belongs to the new id. The new id is exported from @objectstack/lint and joins the two anchor-id lists in the UNPROVISIONED_ANCHOR_* doc comments.
  • service-record-context: injected-system-columns.test.ts is folded into record-context-tools.test.ts as a top-level describe. All three cases are kept, and the separate file is deleted. Per the card's scope note (comment 7182743879), one nested describe pins link resolution on a sys_* root, where the child carries injected sys_user references: a named owner_id or created_by is the link and reads its own rows; with no name, the three injected references leave the list out silently; a door serving declared fields alone has no link.

Tests

  • packages/lint/src/validate-ai-context.test.ts: a new describe with 7 cases. The warning appears at all five paths on an external root and child. The same pack on non-external objects is clean. An external child under a local root is judged per object. An author-declared column is not judged. body.field gets both findings. A related list linked through an external child's injected owner_id is reported. The explain entry is checked for its named facts. There is also an explain check for ai-context-field-unknown, and the new id joins the "every emitted id has an explain entry" list.
  • packages/services/service-record-context/src/__tests__/record-context-tools.test.ts: the folded describe (3 original cases plus 4 link cases).

Acceptance notes

  • First read, by risk: (1) validate-ai-context.ts, the link hunk (the link resolution rewritten from an early return into a value, the only reshaped control flow); (2) the same file, the body hunk (two findings on one path); (3) rule-explanations.ts, the two ai-context entries.
  • Not changed, fenced out of this card: skills/objectstack-ai/references/context-packs.md has a table of the ai-context rule ids. No gate reads that table, and it does not list the new id. Carrier: the area seat.
  • The where / orderBy / link consequences in the messages ("no rows", "an arbitrary order") repeat the siblings' measured readings (page-field-unprovisioned, sort-field-unprovisioned). They were not measured again for get_record_context over a remote table.

Verification

Two-minute check: pnpm --filter @objectstack/lint exec vitest run src/validate-ai-context.test.ts. Expected: 30 tests pass, including the describe "an injected column with no storage on an external object (ADR-0015)".

Local runs at 30b09f6
  • pnpm --filter @objectstack/lint typecheck and vitest run --maxWorkers=2: Test Files 239 passed (239), Tests 9707 passed | 5 skipped (9712); lock VERDICT command-exit 0.
  • pnpm --filter @objectstack/service-record-context test and typecheck: Test Files 3 passed (3), Tests 178 passed (178); lock VERDICT command-exit 0.
Ablation (one, on the provenance call)

node scripts/ablation-replace.mjs replaced (anchors = unprovisionedInjectedColumnsFor(objects.get(object))) with (anchors = new Set...). The anchor count went from 1 to 0 and the blob from 67957ee3b5f5 to 7fa2a74d5075. Then vitest run src/validate-ai-context.test.ts gave Tests 4 failed | 26 passed (30). The four red cases were the external-root warning, the per-object case, the body case and the link case, and the non-external clean case stayed green. After restore the blob equals HEAD (67957ee3b5f5) and git diff HEAD is empty. The test imports the source by a relative path, so no dist rebuild was needed.


Generated by Claude Code

…storage on an external object

ai-context-field-unprovisioned joins validateAiContext: a name in a pack's
fields, body.field, or a related entry's fields, where, orderBy or link
that resolves only as an injected system column of an ADR-0015 external
object. Provenance is unprovisionedInjectedColumnsFor, the spec derivation
every unprovisioned-anchor rule reads. os explain gains the new entry and
ai-context-field-unknown's text says injected columns count as defined.

The service-record-context injected-column executor pins move into the
shared harness as a top-level describe, with a sys_* root related-list
link pin beside them.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

5 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. ⚠️ 1 changed file(s) yielded no anchor (packages/lint/src/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/lint/src/index.ts) — pages documenting those are invisible to this run
  • 3 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 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 — 4 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 9476092c7ee64915749c2146a9ecbe5e139a7126 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 9440da95de44b93cbc1fa4ebd1b2fda27cbee22e — the merge of head 3551f0736f8e2485e2bc6b3ac45f780d189a5380 into base 9476092c7ee64915749c2146a9ecbe5e139a7126, 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 9440da95de44b93cbc1fa4ebd1b2fda27cbee22e && git checkout 9440da95de44b93cbc1fa4ebd1b2fda27cbee22e
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 9476092c7ee64915749c2146a9ecbe5e139a7126 3551f0736f8e2485e2bc6b3ac45f780d189a5380 && git checkout -B drift-repro 9476092c7ee64915749c2146a9ecbe5e139a7126 && git merge --no-ff 3551f0736f8e2485e2bc6b3ac45f780d189a5380

node scripts/docs-audit/affected-docs.mjs --json 9476092c7ee64915749c2146a9ecbe5e139a7126

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

Test UI (2/16) on head 3551f0736f (run 45899743940, job 140183953126): one failure out of 450 files, read from the full job log. ui/apps/console/src/components/FormPage.sharedWidgets-10179.test.tsx › "submits a date string, a number, a multiselect array and a lookup id" fails with Found a label with the text of: Due, however no form control was found associated to that label.

This PR's tree does not reach that test. The diff is packages/lint/** and packages/services/service-record-context/** only. The same test was green on the previous head 30b09f6711 (Test UI 1–16/16 success), and 3551f0736f differs from it by one changeset line. The merge ref has since picked up #37671 and #37672 (named-form layout on FormPage), and both passed the merge queue. The area judges the failure as not this PR's and re-runs the failed jobs once through rerun-failed.mjs. If the same test fails again, the area reads it as a real red on main and files it there.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 3551f07 · 2026-11-26T22:27Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 3551f0736f8e2485e2bc6b3ac45f780d189a5380
Local-runs: none

Inputs read: card #37432 body and all 6 comments (claim 7202779669, amendment 7203965629, scope note 7182743879, os-dev-report 7203921910), the PR #37699 body and its 7-file list, git diff origin/main...pr-37699-a, and the check-runs on the head, latest attempts and the superseded ones.

① Derived judgments

The diff makes these accept-set and public-surface changes:

  1. New export AI_CONTEXT_FIELD_UNPROVISIONED from @objectstack/lint's main entry (packages/lint/src/index.ts, +1 line). This is an additive public export. Right.
  2. New rule id ai-context-field-unprovisioned, emitted by validateAiContext. It is registered at the advisory tier (authoring-rules.ts, "the save is never refused for them"), and AiContextSeverity is the type 'warning' alone, so the rule cannot emit an error. No app that builds today stops building. Right.
    • Judged sites: the root's fields, each related list's fields (both through unknownFields), body.field, where, orderBy, and the link field, named or implied. Each site first requires the name to resolve in the merged field map, then requires it to be in unprovisionedOf(object).
    • On a non-external object that set is empty, so the sites stay silent. An author-declared column is excluded by the spec. sys_* objects are never judged. The link is judged only when it resolves (a named reference to the root, or exactly one implied reference). Malformed links stay ai-context-related-link-unknown, and a missing name stays ai-context-field-unknown. No site warns on a name that has storage. The one edge case is inherited from the shared predicate; see N2.
    • Faithful reuse: unprovisionedInjectedColumnsFor(objects.get(object)) is called once per object and cached. It runs on the authored definition, the input the spec's unprovisionedInjectedColumns expects, and it handles both pre-injection and post-injection shapes. The predicate is not copied. The message is unprovisionedAnchorVerdict plus a consequence for the position, and the hint is unprovisionedAnchorFix. That matches the sibling shape (validate-searchable-fields.ts, validate-sortable-fields.ts).
  3. RULE_EXPLANATIONS gains the ai-context-field-unprovisioned key, and the ai-context-field-unknown paragraphs are rewritten. Accurate and consistent with each other.
    • "owner_id under ownership: 'org'" and "any of them under systemFields: false" match the resolveInjectedSystemColumns table: the ownership: 'org' | 'none' row gets no ownership anchors, and systemFields: false gets nothing.
    • The unknown entry hands the external case to the new id, and the new entry hands an undefined name back to the unknown id.
    • The new entry reuses UNPROVISIONED_ANCHOR_CAUSE and UNPROVISIONED_ANCHOR_REMEDY. Its costs for each position ("empty on every record", "no body", "no rows", "arbitrary order") match the noRows and orderBy message clauses word for word.
    • The new id joins both UNPROVISIONED_ANCHOR_* doc lists.
  4. Metadata accept set: unchanged. No packages/spec/** path is touched and nothing new becomes authorable, so Metadata-protocol: none is right.
  5. Test-only change: service-record-context folds injected-system-columns.test.ts into record-context-tools.test.ts. Nothing publishes.
    • All three original cases are kept and their assertions are byte-identical. The only differences are the rename CALL → BRIEF_CALL, sys_user hoisted to SYS_USER, and the helpers scoped inside the describe.
    • The deleted file has no remaining reference anywhere in the tree. The lint test's cross-reference comment now points at the shared harness.
    • The scope-note pin (7182743879) is real. The registered task carries owner_id, created_by and updated_by, each pointing at sys_user. Named owner_id reads [t1] and named created_by reads [t2]: two distinct rows, which proves the named link is the one used. Omitted, the list is left out silently. A door serving declared fields only resolves no link.
  6. Removed or renamed: none. No export, rule id or explain key is removed or renamed.

Findings:

  • N1 (nit): the where, orderBy, link and fields consequence clauses ("no rows", "an arbitrary order", "empty on every record") were not measured for get_record_context over a remote table. They repeat the measured readings of page-field-unprovisioned and sort-field-unprovisioned. The PR body declares this, and the executor maps an absent value to null, which agrees with "empty". Accepted as declared, no change owed.
  • N2 (nit, inherited, not introduced here): an external object whose external.columnMap maps a remote column onto an injected name, without declaring that field, is still warned. The cause is that the spec's unprovisionedInjectedColumns does not read columnMap; only isOwnerAnchorUnprovable adds that check. Every sibling *-field-unprovisioned rule shares this, the rule's own hint resolves it (declare the column), and the finding is a warning. If anyone owns it, it is a spec-predicate follow-up, not this card.
  • N3 (nit): skills/objectstack-ai/references/context-packs.md (the rule table, lines 108-113) does not list ai-context-field-unprovisioned. skills/** is fenced off this card and no gate reads the table. The carrier is the area seat, which should file it as a follow-up card per filing-gate.md rather than leave it "noted, not filed".

② Semver level

  • The changeset .changeset/37432-ai-context-field-unprovisioned.md moves @objectstack/lint at patch and names only that package. It carries both declaration lines at line start: Clause-②: yes (widening) and Metadata-protocol: none. The PR body carries the same pair.
  • The Clause-②: yes (widening) declaration is right. The diff widens the public surface by one exported constant and one emitted advisory rule id, and narrows nothing.
  • patch is right. AGENTS.md Post-Task Checklist step 3: with Metadata-protocol: none, a non-protocol widening ships patch. The level agrees with the seat's precedent on 37364 跟进:引用核对器区分「拒绝」和「故障」,故障不再静默丢失引用 #37418 / PR feat(record-context): citation verifier reports failures apart from refusals #37438.
  • service-record-context changes only a test file, so it rightly has no changeset entry.
  • The card body's Clause-②: no is superseded by amendment 7203965629. The two carriers the readers use, the PR body and the changeset, both read yes (widening).

③ Boundary flags

  • open_questions: none, so there is nothing to answer.
  • Dev deviation 1 (judged sites widened to where, orderBy and the link): accepted. The card's own words cover it ("every place the rule reads a field map"), and amendment 7203965629 records it.
  • Dev deviations 2 to 5 (CI polling, background builds, worker-capped vitest, PR-body footer): process only, with no contract effect. Accepted.
  • Out-of-scope finding (skills table): see N3, escalated to the area seat as the carrier.
  • security_findings: none: concur. No changed hunk teaches permission, sharing, credential, token or authentication behaviour.
  • Claim line: the claim 7202779669 still reads Clause-②: no at line start. The correction lives in amendment 7203965629, and the PR body, which is the owed-face reader's carrier, reads yes (widening). Consistent, and nothing owed.
  • SQL push-down (Prime Directive 5): no finding. validate-ai-context.ts is an author-time check over metadata. It runs no query, materialises no ids and does no in-app join. The fold adds only test code.
  • CI:
    • On the head's latest attempts: 59 success, 13 skipped, 0 failure.
    • Test UI (2/16) failed on its first attempt (job 140183953126) at ui/apps/console/src/components/FormPage.sharedWidgets-10179.test.tsx:194: a label "Due" with no associated form control. On the rerun the shard (job 140194533944) and the Test UI aggregate (job 140198585086) went green; the superseded aggregate was 140190289726.
    • The diff cannot reach that test. FormPage.tsx imports only @object-ui/*, @objectstack/spec/api, @objectstack/spec/ui and ./submitRedirect, which imports only @objectstack/spec/ui.
    • The diff changes @objectstack/lint, which the console reaches only through app-shell's lazy capabilityLint.ts import, and a service-record-context test file. Neither is in that test's import graph, and packages/spec is untouched.
  • PR author: objectstack-fleet[bot], so there is no further login to name.

Implemented-by: claude/issue-37432-ai-context-unprovisioned
Reviewed-by: session_01Utp6CYtTDvfPQDzMbZnN5X

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

席位核对

Head-sha: 3551f0736f8e2485e2bc6b3ac45f780d189a5380
ACCEPT — L1, seat repo:objectstack#5

  1. Shape: draft against main. 7 files, +359/−115. Not governed, not security-touching. @objectstack/lint patch, Clause-②: yes (widening) for the new export AI_CONTEXT_FIELD_UNPROVISIONED, Metadata-protocol: none: right. No other export, rule id or explain key changed.
  2. Premise: the new ai-context-field-unprovisioned warning fires at every site the claim amendment 7203965629 widened to, and only for a resolved name in an external object's set of columns with no storage. It reuses unprovisionedInjectedColumnsFor and the shared wording. It is advisory, so nothing that builds today stops building. The os explain entries hand off to each other. The folded test file keeps all three cases with identical assertions, and the sys_user pin is real.
  3. Gates: contract record 7204792725 (TIER_DEFAULT, declaration face) reads PASS, with no must-fix or should-fix. CI on this head, latest attempts: 59 success, 13 skipped, 0 failed. Test UI (2/16) failed once on FormPage.sharedWidgets-10179, which this diff cannot reach: its import graph excludes @objectstack/lint and service-record-context. Under the flake rule it got one rerun, which was green.
  4. Accepted deviations: N1 (the cost clauses were copied from the measured sibling rules and not measured for a remote table) and N2 (inherited: columnMap is not read by the spec predicate; every sibling rule has the same edge).
  5. Out of scope and where it went: N3 (the skills context-packs.md rule table lacks the new id) rides 37611 跟进:评测第 12 题的必含词比标准答案严,并修正 SKILL.md 一处差一行的源码引用 #37688, which is Blocked-by this PR. N2, if anyone takes it, is a follow-up on the spec predicate, at the area's choice. Please also report the FormPage.sharedWidgets-10179 flake to the queue-flake lane if it repeats.
  6. Landing terms: Tier S. The area lands it through the queue with --land.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

Landing: ACCEPT 7204800437 (contract record 7204792725, PASS) at head 3551f0736f8e2485e2bc6b3ac45f780d189a5380.

Probe Reading
Check-runs on head latest attempts 59 success, 13 skipped, 0 failed, 0 in progress; Test UI (2/16) re-run once (reason 7204205389), attempt 2 green; mergeable_state clean
Governed / size check-governed-merges --pr 37699: NOT governed, 474 changed lines ≤ 3000
landing-k OK — K = 3 < 15, no locale leg, no shared book moved under this PR

Status: ready + auto-merge (merge queue). On MERGED, #37432 closes by Fixes; N3 (the skills context-packs.md rule table) rides #37688, which is Blocked-by this PR.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 26, 2026 22:35
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit 302cfda Nov 26, 2026
116 of 118 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-37432-ai-context-unprovisioned branch November 26, 2026 22:59
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 Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

37415 跟进:资料包校验对外部对象的注入字段给出「无存储」提醒,并合并测试文件

2 participants