Skip to content

37177 跟进:资料包校验对平台注入字段(owner_id)误报 ai-context-field-unknown #37415

Done
1 of 1 issue completed

Description

@objectstack-fleet

repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

Filing gate: ② follow-up out of #37177. The source is the os-dev report on PR #37409 (comment 7181165779), acceptance note "Possible defect, not fixed here". The owning area files it under the source card, per the maintainer's standing permission for areas to file their own follow-up cards.
Grading: area:ai · Bug · p3 · reach: authors whose ai_context pack names a platform-injected column (owner_id and the other injected system columns) · evidence: measured (the warning) + read (the cause).

维护者速读

  • 做什么:资料包里写了平台自动加的字段(比如负责人 owner_id),校验却警告「字段不存在」。查清运行时是否真的带出这个字段,再让校验和运行时说同一句话。
  • 谁受益:写资料包的作者,不会被误报干扰。
  • 不做会怎样:作者看到误报,可能删掉其实有用的字段。
  • 需要你做的:无。

What

Measured on the #37409 scratch stack: os validate warns ai-context-field-unknown for owner_id in a pack's fields on an object that does not declare owner_id itself. Read: packages/lint/src/validate-ai-context.ts fieldMapOf builds the map from the object's declared fields only; it does not apply applyInjectedSystemColumns (packages/metadata-core/src/injected-system-columns.ts), which other lint paths use (see authored-site-expression.test.ts, the applyInjectedSystemColumns(FLOW_EXT) case).

  1. Measure first: does get_record_context carry an injected column named in fields (or a related entry's fields / where / orderBy) at run time?
  2. If yes, judge the pack's names against the object with injected columns applied, in every place the rule reads a field map. If no, keep the warning and say in its message that the column is not served to the pack.

Acceptance

  • A test pins the lint verdict for owner_id on an object that does not declare it, and that verdict matches the measured runtime answer.
  • Clause-②: no, Metadata-protocol: none.

Parent: #37177
Size: S
Dedupe (objectstack, is:issue): ai-context-field-unknown owner_id 0 · validate-ai-context injected 0.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    pm:queue
    area:ai
    on Nov 26, 2026
  2. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Claim: PM loop round 5 · area ai-36996 (topic #36996 non-cloud rows; the maintainer, verbatim, 2026-11-25T12:57Z project thread: 「开一个 36996 专题,接手剩余任务」; concurrency per area 3, 2026-11-25T23:33Z) · 2026-11-26T03:00Z
    Session: session_01Utp6CbeF2saT6wUBV4E9uc
    Account: os-bill
    Area: ai-36996
    Branch: claude/issue-37415-ai-context-injected-columns
    Worktree: objectstack-issue-37415
    Domain: domain:server
    Seat: repo:objectstack#5
    File surface: packages/lint/src/validate-ai-context.ts and packages/lint/src/validate-ai-context.test.ts; a measuring test under packages/services/service-record-context/src/__tests__/ (a new file only, read-only use of the service); root .changeset/. Stop on breach and report.
    Container & model: S, mode:subagent, model: default — dispatch-gates --tier: "no path-derived mandate", effort: medium
    Clause-②: no
    Metadata-protocol: none
    Responsibility: packages/lint (validate-ai-context fieldMapOf reads declared fields only) produces the warning | no platform path covers it | authors whose pack names an injected system column, at save and os validate
    Premise: holds — on origin/main ecbe854bd: fieldMapOf builds the map from object.fields only; @objectstack/lint already depends on @objectstack/metadata-core (applyInjectedSystemColumns).
    Serial constraints cleared: sibling #37361 (in flight) owns record-context-tools.ts, door.ts, sentences.ts and the existing service tests; this card adds a new test file only and never edits them. #37364 (PR #37396) owns body-outline.ts and the spec citation files; not touched.
    Pre-claim deps: none
    Prior rulings read: none on this rule; source PR #37409 report 7181165779 and contract review 7181290305 ③.

  3. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 26, 2026
  4. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Scope note, from PR #37412 (#37361) and seat 5's L2 record 7181694279: the same defect shows on a related entry's orderBy with the registry-injected created_at. Measured on PR #37412's real-kernel harness: the executor and both MCP doors read the list ordered by created_at on an object that does not declare it, while validateAiContext warns ai-context-field-unknown and says the list is left out of every answer. So for created_at in orderBy the runtime answer is "carried", and the lint must agree. The in-flight dev already has this; it rides the same PR.

  5. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    Triage: lands in area:ai · Bug · priority:p3 · pm:dispatched · size S; rationale: pack validation reports ai-context-field-unknown for platform-injected columns such as owner_id. It is a false warning to authors with nothing refused, so p3.

    Confirmed as filed. Seat 5 holds it.

  6. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc
    os-dev-report

    {
      "issue": 37415,
      "status": "done",
      "branch": "claude/issue-37415-ai-context-injected-columns",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37426",
      "head": "83f809e905c3ad3d202495a7d304a23ad595662c",
      "session": "session_01Utp6CbeF2saT6wUBV4E9uc",
      "premise_still_valid": true,
      "summary": "Measured first: on one real kernel (the /mcp door, real protocol, SqlDriver, sys_user registered) an object that declares neither owner_id nor created_at is served with both, and get_record_context carries owner_id and created_at in root fields and related fields, honours a related where on owner_id (r2 of owner usr_other filtered out) and an orderBy on created_at; under ownership org no owner_id is served and the tool leaves it out. Corroborated for created_at in orderBy by sibling PR #37412's real-kernel harness. So the runtime carries injected columns: validate-ai-context.ts fieldMapOf now returns declared fields plus injectedColumnDefsFor(object) (the spec's injectedSystemColumnDefs, the same tables applySystemFields and applyInjectedSystemColumns spread; declared wins), read by every field-map consumer (root fields, body.field, related fields, where, orderBy and its sortability projection, related link). A column not injected on that object (ownership org/none, systemFields false) is still reported.",
      "files_changed": [
        ".changeset/37415-ai-context-injected-columns.md",
        "packages/lint/src/validate-ai-context.ts",
        "packages/lint/src/validate-ai-context.test.ts",
        "packages/services/service-record-context/src/__tests__/injected-system-columns.test.ts"
      ],
      "line_budget": "205 changed lines (+201 / -4, 4 files) per dispatch-gates; no skills/** touched, no ratchet ledger touched",
      "readings": [
        "real-kernel scratch (copy of packages/runtime/src/mcp-record-context-tools-bridge.test.ts real-protocol harness, run 3 times at base ecbe854bd plus this branch's lint, deleted, never committed): served listing of rcm_policy = organization_id,created_at,created_by,updated_at,updated_by,owner_id,owning_business_unit_id,queue,title; rcm_orgdoc (ownership org) = organization_id,created_at,created_by,updated_at,updated_by,title",
        "pack fields title,owner_id,created_at + related version,owner_id where owner_id usr_member orderBy created_at desc, sys_user registered: fields title value, owner_id lookup entry (notVisible: harness caller cannot open the sys_user row), created_at value; related rows r1 only",
        "related fields version,created_at where owner_id orderBy created_at desc: rows r1 only, created_at carried",
        "ownership org pack naming owner_id: answer carries title only",
        "control: pack naming owner_id with sys_user NOT registered: whole call PERMISSION_DENIED 403 (unreadable lookup target, as for any lookup); the platform always registers sys_user",
        "sibling PR #37412 (#37361) real-kernel harness: related list ordered by created_at on an object not declaring it is read by the executor and both MCP doors (coordinator's citation)"
      ],
      "acceptance": [
        "A test pins the lint verdict for owner_id on an object that does not declare it, matching the measured runtime answer: PASS, validate-ai-context.test.ts 'an injected system column the object does not declare is no unknown field (owner_id, created_at)' (no finding in fields, related fields, where, orderBy), with the measured runtime answer stated in its comment; negative pin 'owner_id under ownership org' keeps the warning where the runtime leaves the column out; executor half pinned in service-record-context injected-system-columns.test.ts",
        "Clause-②: no, Metadata-protocol: none: PASS, both lines at line start in the PR body and the changeset body; Check Changeset success"
      ],
      "tests": "At head 83f809e90 under os-verify-lock (VERDICT command-exit 0, 129 s): pnpm --filter @objectstack/service-record-context test = Test Files 3 passed (3), Tests 102 passed (102); typecheck exit 0; pnpm --filter @objectstack/lint test = Test Files 235 passed (235), Tests 9637 passed (9637); typecheck exit 0; validate-ai-context.test.ts alone 22 passed. Ablation (one): scripts/ablation-replace.mjs deleted the injected-column merge line in fieldMapOf (anchor x1 -> x0, blob c2119a56ce9c -> 2c8b47c54ad1): validate-ai-context.test.ts 3 failed / 18 passed (injected-column case, ownership-org case via created_at, body case); restored, blob == HEAD c2119a56ce9c, git diff HEAD empty. No build leg: the lint test imports the rule from src.",
      "gates": "local: node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 64 families at 83f809e90; all 64 run with exit captured before any pipe: 62 exit 0, 2 exit 3 PREREQUISITE NOT MET = NOT MEASURED (node scripts/check-plugin-teardown-shape.mjs --self-test: pinned control needs unshallow; pnpm check:dual-build-cjs-loads: reads every package dist, only the runtime closure built); --ran reconciliation: 64 derived, 62 run, 2 NOT-MEASURED, 0 UNRUN. Closure build: pnpm --workspace-concurrency=2 --filter '@objectstack/runtime^...' build VERDICT command-exit 0 (includes lint and service-record-context). overlap-check VERDICT clean before each push. CI on PR head 83f809e90, all completed: 57 success, 11 skipped, 0 failed; required: Lint & Repo Gates success, TypeScript Type Check success, Test Core success (10/10 shards success), Build Core success, Governed Surface Queue Guard success, Lint UI skipped (path filter), Type Check UI success, Test UI success (16/16), Build & E2E UI success, Live E2E UI success, Dogfood Regression Gate success; Check Changeset success.",
      "dogfood_battery": "n/a: no ! in the PR title and Clause-②: no without a (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "2 relay strokes: (1) pr_create via fleet-write dispatch (POST /repos/objectstack-ai/objectstack/dispatches; relay executed POST /repos/objectstack-ai/objectstack/pulls -> #37426 draft, POST /repos/objectstack-ai/objectstack/issues/37426/assignees os-bill; read-back body 9543 bytes identical); (2) this os-dev-report comment via post-stamped (POST /repos/objectstack-ai/objectstack/issues/37415/comments). git push x3 (empty branch, two WIP/final pushes) are not REST writes.",
      "deviations": [
        "Measurement scratch test lived temporarily as an untracked file in packages/runtime/src (fenced directory) for three runs, then deleted; never committed, git status clean after each run. No fenced file was edited.",
        "AGENTS.md says a new pin for a component with a shared harness file goes into that file as a top-level describe; the dispatch order and claim file surface direct a new file (the shared executor test is owned by sibling #37361). Followed the dispatch; flagged here.",
        "Used injectedColumnDefsFor (lint's system-fields.ts indirection over the spec's injectedSystemColumnDefs) rather than calling applyInjectedSystemColumns: same tables, same declared-wins direction, and total over both fields shapes the rule reads (applyInjectedSystemColumns returns an array-shaped fields document untouched).",
        "os-dev.md says never wait on CI; the dispatch order explicitly asked to wait for check-runs, the per-card exception; waited by foreground polling only.",
        "test:repo (vitest repo project) not run locally; CI Test Core success covers it."
      ],
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed: an ADR-0015 external object carries injected columns with no storage; this rule now lets a pack name one (the executor plans it from the published definition) while the read degrades at query time; the unprovisioned-anchor warning other lint rules give is not wired into validate-ai-context. No producer measured, so no class-c card.",
        "carrier: none · noted, not filed: the os explain text for ai-context-field-unknown (rule-explanations.ts) still reads 'a name the object does not define'; outside this card's file surface and correct in substance.",
        "carrier: none · noted: on a related list whose root is a sys_* object, injected child references (owner_id, created_by, updated_by to sys_user) now count as links in the lint rule, matching resolveRelatedLink over the published definition; pinned in the PR, read not measured."
      ]
    }

    Generated by Claude Code

  7. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    ACCEPT → PR #37426 comment 7182715779

  8. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Merged: PR #37426 at ec46903cd1 closed this card by Fixes. Delivered: validateAiContext judges names against the object with injected system columns merged (declared wins), pinned against the measured runtime answer; executor pin in injected-system-columns.test.ts. Left: #37432 (external-object provenance warning, explain text, test fold; still blocked on PR #37412). pm:dispatched removed.

  9. removed
    pm:dispatched
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:aipriority:p3

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions