Skip to content

feat(lint): warn when a select option colour renders neutral on the option badge - #37986

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-ciejge
Nov 28, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-ciejge

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread
Fixes #37435
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:搭建者(人或 AI)给下拉选项写了 teal、amber、大写的 Red 这类界面画不出来的颜色时,校验命令和保存时都会收到一条提示,说明这个颜色会显示成灰色、该怎么改;写九个色系名或十六进制色的不受影响。
  • 为什么做:上一张卡已经定下"选项颜色只认作者声明、没配就灰",但写错的颜色也会静默变灰,作者不知道自己写错了。
  • 出错会怎样:只是提示、从不拒绝保存,误报最多多一条警告;平台和示例里现有的选项颜色没有一条会触发,可直接撤回。
  • 要你做的:无。

What changes

  • New advisory rule field/option-color-renders-neutral (lintOptionColors in packages/lint/src/data-model-rules.ts). It warns on a select option color the option badge does not paint: anything that is not one of the nine palette families (gray red orange yellow green blue indigo purple pink, lowercase, as BADGE_COLOR_MAP matches them) and not # + 3 or 6 hex digits. The warning names the option; the fix line names the spelling the value already points at (lowercase family, the hex with its #, the hex without alpha digits), otherwise the families and the hex form. It never maps a colour name to a family.
  • Route (a) as a warning, not (b) a name-to-family map: (b) is consumer-side tolerance that invents a colour the author did not pick, close to the value-derived colour ruling A on Select options with no declared colour: render neutral instead of a semantic-table / hash-assigned colour #36882 removed (「A 全部去掉,没配就灰」). Not a refusal: SelectOption.color stays z.string(), and charts and gantt bars paint a CSS colour name.
  • Registered in AUTHORING_RULES as tier: 'advisory', on os validate / os build / os lint, and on the runtime publish gate for object and object_extension writes, where findings ride back as 2xx advisories (the save door Studio, REST /meta and MCP authors share). Judges object fields, object-extension fields, picklists and picklist extensions; picklists are CLI-only because picklist is not runtime-creatable.
  • os explain field/option-color-renders-neutral entry in rule-explanations.ts, with the measured per-surface reading.
  • Root barrel publishes FIELD_OPTION_COLOR_RENDERS_NEUTRAL, OPTION_COLOR_FAMILIES, isBadgePaintableOptionColor, lintOptionColors, type OptionColorPicklist.
  • Object and object-extension door roster pins gain the rule (three test files), and the four docs CLI transcripts print 87 author-time rules (check:docs-transcript-drift).

Tests

  • New pin packages/lint/src/data-model-rules.option-color-37435.test.ts: teal warned (rule, severity, path, where, fix names all nine families) and amber, Red, bare hex, alpha hex, rgb(), hsl(), leading-space hex all warned; every declared family and #abc / #14b8a6 not warned; blank colour not judged; extension and picklist paths; all three commands; at the save door teal comes back as an advisory with zero errors, and red / a hex with none.

Acceptance notes

  • Door crossing: this is an advisory-tier rule at the object door. The five fenced advisory rules ([P2] 运行时授权门扩到 object 写入 + 全量 runtime-safe 规则快照(#4463 P1 之后) #4716 adjudication, RUNTIME_OBJECT_ADVISORY_VOLUME) stay fenced and untouched; that fence prices advisory VOLUME. Measured volume for this rule: 0 firings. Census of option-level colour literals: objectstack at 6e11ff2 (*.object.ts, picklists, extensions; non-test) is every one a family name or a 6-digit hex; the only out-of-family names (teal, amber, 9 sites) are OBJECT-level color, which this rule does not read. hotcrm at 08a7451: 170 colour literals, all 6-digit hex. The one out-of-family option colour in the tree is a test fixture (ui/e2e/list-condition-row-35549.spec.ts:87, amber).
  • Single source of the family list: @objectstack/lint cannot import @object-ui/fields (lint depends on spec only and runs in the kernel's save door), and a lint test reading the renderer source would need a scripts/cross-package-test-inputs.mjs + turbo.json declaration outside this claim's file surface. The list is therefore spelled once in lint (OPTION_COLOR_FAMILIES) with a comment naming BADGE_COLOR_MAP; the shared home both sides could read is @objectstack/spec, left as an open question in the report rather than taken here.
  • Not judged: a form view's own option list, and an object extension's fieldPatches.
  • The runtime advisory has no localized userMessage (no .user-text.ts catalog); Studio renders the English message.

Verification

  • Two-minute check: pnpm --filter @objectstack/lint exec vitest run src/data-model-rules.option-color-37435.test.ts → 9 passed.
  • Read first: packages/lint/src/data-model-rules.ts (isBadgePaintableOptionColor, must match the renderer's reading), packages/lint/src/authoring-rules.ts (the lintOptionColors entry and its door comment), packages/lint/src/rule-explanations.ts (the per-surface paragraph).
Local readings (HEAD after the docs commit)
  • pnpm --filter @objectstack/lint test → Test Files 244 passed (244), Tests 9816 passed, 5 skipped; pnpm --filter @objectstack/lint typecheck (tsc + test layer) green.
  • Ablation: isBadgePaintableOptionColor forced to true on disk → 5 of 9 pins red (the out-of-family pin included); restored with git checkout HEAD.
  • node scripts/pm/overlap-check.mjs --branch=claude/project-thread-ciejge → VERDICT clean exit 0, feat(spec)!: action locations say what an action acts on #37929 (shares rule-explanations.ts) merges cleanly.
  • Derived gate families run locally; check:dual-build-cjs-loads and check-plugin-teardown-shape --self-test are NOT MEASURED here (no full build; shallow clone) and are left to CI.

Generated by Claude Code

@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 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/lint, touching 16 documentable anchor(s). ⚠️ 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.

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

  • content/docs/api/metadata-api.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/data-modeling/object-extensions.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/deployment/cli.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/deployment/install-modes.mdx (via picklistExtensions (literal, a string literal in AUTHORING_RULES))
  • content/docs/deployment/validating-metadata.mdx (via AUTHORING_RULES (symbol, a top-level const object), runtimeTypes (symbol, a field of const object AUTHORING_RULES), object_extension (literal, a string literal in runtimeTypes))
  • content/docs/kernel/cluster.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/ui/actions.mdx (via object_extension (literal, a string literal in runtimeTypes))

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

  • content/docs/releases/v17/17-6.mdx (via picklistExtensions (literal, a string literal in AUTHORING_RULES))
  • content/docs/releases/v18/18-3.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/releases/v18/18-4.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/releases/v18/18-5.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/releases/v18/18-6.mdx (via object_extension (literal, a string literal in runtimeTypes))
  • content/docs/releases/v19/index.mdx (via object_extension (literal, a string literal in runtimeTypes))

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
  • 1 changed file(s) yielded no anchor (packages/lint/src/index.ts) — pages documenting those are invisible to this run
  • 7 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 f72f335393f40e27194c56911e6de46052cb6f4c → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json f72f335393f40e27194c56911e6de46052cb6f4c

⚠️ 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 f72f335393f40e27194c56911e6de46052cb6f4c → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

objectstack-fleet Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibx7DSQZnugnuX8CpCM

Red-check reading · zone o3-ux · 2026-11-28T00:18Z

  • Run 46013507104 (head e3423ab81d, read 2026-11-28T00:16Z): only Test UI (1/16) and its aggregate Test UI are red.
  • Signature: ui/scripts/__tests__/check-pending-changeset-literals.test.ts:172 "exits 0 through the CLI" — Error: Test timed out in 15000ms.
  • Not this diff: that gate reads ui/.changeset/** only; this PR touches packages/lint, content/docs and a root .changeset file, nothing under ui/. The same test passes locally in 8.8s on this head.
  • K = 60 (≥ 15), so per landing-operations the next step is merging origin/main into the head (relay pr_update_branch, in this same stroke) and reading the rerun, not a bare rerun.

Generated by Claude Code

@objectstack-fleet

objectstack-fleet Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibx7DSQZnugnuX8CpCM

Final head for L1 · zone o3-ux · 2026-11-28T00:50Z


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1
2026-11-28T00:51Z

L1 ACCEPT at eef5d1c1760f956fbb30d15345668cda17189c48 (L1-a, the L1 of record for zone o3-ux). The diff touches packages/lint and prose only: no spec, no governed rules text, no narrowing (the rule warns, and never refuses or rewrites). So no L2 is owed, and Clause-②: no and Metadata-protocol: none hold. Face: l1-face clean (13 of 13). CI at this head is 60 success, 10 expected skip, 0 failed, 0 pending, and mergeable_state is clean.

The rule against the renderer. I read it against ui/packages/fields/src/index.tsx at this head.

  • resolveColorName passes a name only when BADGE_COLOR_MAP[color] holds it, so the lookup is exact and case-sensitive. OPTION_COLOR_FAMILIES is the map's nine keys in the same spelling.
  • A hex is painted only when color.charAt(0) === '#' and /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/ matches the trimmed value. isBadgePaintableOptionColor asks the same two questions in the same order, so a leading space, a missing #, alpha digits, rgb(…) and Red are judged exactly as the badge renders them.
  • The rule is advisory at the object / object_extension door, and the four roster pins move with it.
  • The os explain text describes how each surface reads the colour. The calendar, chart and gantt readings are stated as differences, never judged.
  • The docs edits change only the rule count, from 86 to 87.

The open question: the nine families duplicated from BADGE_COLOR_MAP. I decide A: no change in this PR, and the seat files a p3 card after landing to define the families once, in @objectstack/spec, imported by both the badge renderer and this rule.

  • B, an equality test here, would have to read a ui/ source file from packages/lint. That reaches across the package boundary the docblock names, and it moves the head to guard a map that has not changed.
  • C leaves the drift unguarded beyond the docblock's "added here in the same change".
  • A removes the copy instead of policing it. Until A lands, the docblock's instruction is the guard, and drift fails safe: an unknown new family is warned, never refused.

Nits (not blocking).

  • N1: for a family with stray whitespace (' red'), the fix line says "Write the family in lowercase" when the problem is the whitespace. The fix it proposes, color: 'red', is still right.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibx7DSQZnugnuX8CpCM

Landing · zone o3-ux · head eef5d1c1760f956fbb30d15345668cda17189c48 · L1 ACCEPT 7231247834 (L1-a), no L2 owed · 2026-11-28T00:52Z

reading result
check-governed-merges.mjs --pr 37986 NOT governed; 395 changed lines (+385 / -10) ≤ 3000
landing-k.mjs --pr 37986 K = 2 < 15 (PRBASE 27ee984); no new locale pack; no shared book moved under this PR
checks at this head 60 success, 10 expected skip, 0 failed, 0 pending; mergeable_state clean (read 2026-11-28T00:52Z)
generated artifacts no merge=os-regen path in the file list

State: pr_ready + automerge_enable now; #37435 closes on merge via Fixes.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 28, 2026 00:53
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 46090302888 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test Core (9/10) — 失败步骤: Run this shard's tests

    @objectstack/service-knowledge:test:  FAIL  src/__tests__/knowledge-settings-contribution.test.ts > embedderSettings: false keeps the embedder section off the ai page > the knowledge page, its test bu
      ↳ 失败原因: (这条 FAIL 之后 12 行内没有可识别的原因行 —— 点进 job 看)
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 23 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 46090935046 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test Core (9/10) — 失败步骤: Run this shard's tests

    @objectstack/service-knowledge:test:  FAIL  src/__tests__/knowledge-settings-contribution.test.ts > embedderSettings: false keeps the embedder section off the ai page > the knowledge page, its test bu
      ↳ 失败原因: (这条 FAIL 之后 12 行内没有可识别的原因行 —— 点进 job 看)
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • ⚠️ 本 PR 过去 24h 已在队列失败 1 次(不含本次)。 内容未变而反复失败 ⇒ 高度怀疑 flaky 测试或与同组 PR 的语义冲突,重排不解决。
  • 过去 24h 队列共有 33 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@objectstack-fleet

objectstack-fleet Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibx7DSQZnugnuX8CpCM

Queue reading · zone o3-ux · 2026-11-28T01:29Z


Generated by Claude Code

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 28, 2026
 both land (#37435)

PR #37971 and this PR each add one authoring rule and each moved the same
four transcript lines from 86 to 87. The edits were byte-identical, so the
merge of main was clean, but the registry now derives 88.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibx7DSQZnugnuX8CpCM
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibx7DSQZnugnuX8CpCM

Delta for L1 · zone o3-ux · 2026-11-28T02:15Z


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1
2026-11-28T02:16Z

L1 ACCEPT (delta) at cf91efd19326524775254d4078756fb9b8fb3e4d (L1-a, the L1 of record for zone o3-ux). This carries forward ACCEPT 7231247834 at eef5d1c1. No L2 is owed.

The delta. Two commits on eef5d1c1.

Face. CI at this head: 60 success, 10 expected skip, 0 failed, 0 pending. mergeable_state is clean. The PR has been out of the queue since 01:41Z and can be requeued.

The open-question ruling (A: a p3 card defines the nine families once in @objectstack/spec, filed after landing) and the N1 nit stand as written in 7231247834.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibx7DSQZnugnuX8CpCM

Requeue · zone o3-ux · head cf91efd19326524775254d4078756fb9b8fb3e4d · L1 ACCEPT (delta) 7232254947 (L1-a), carrying 7231247834, no L2 owed · 2026-11-28T02:17Z

reading result
check-governed-merges.mjs --pr 37986 NOT governed; under the 3000-line limit
landing-k.mjs --pr 37986 K = 2 < 15
checks at this head 60 success, 10 expected skip, 0 failed, 0 pending (read 2026-11-28T02:15Z)
queue out since the 01:41Z ejection, which was the semantic conflict with #37971 (7231702376), fixed in cf91efd1

State: automerge_enable now; #37435 closes on merge via Fixes.

@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit 9548be2 Nov 28, 2026
70 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-ciejge branch November 28, 2026 02:46
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…and the search gates that need no caller, also at publish (objectstack-ai#37971)

repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP
Fixes objectstack-ai#37307

Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: objectstack-ai#37310 (amendment 7221575164: the five rule ids and their
fixes)

Premise corrected: card objectstack-ai#37307 item 3 ("follow the refuse-or-warn
verdict the `ai_context` row took") conflicts with ADR-0161 K4; K4 wins,
so this rule is `gating` at publish (refuses), not advisory. Seat 1
ruling on this PR: keep gating (seat record: objectstack-ai#37307 comment 7221816104).
Ruling-ref:
`docs/adr/0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md`
K4 — "It defines no object, extends none, and is refused when the object
or a named field does not exist (the lint and `os validate` checks are
row 4)." and "An object whose package is disabled, that the API exposure
refuses for search, or that is a system object without
`enable.aiReadable`, and a field the author may not query, each refuse
the save with a coded refusal that names the object or the field. A
packaged item meets the gates that need no principal in `os validate`
and at publish (row 4)."

## 维护者速读
- 用户能看到什么变化:写应用包的作者和用 AI 搭建的作者,在 `os validate`
和发布知识源时,就能看到知识源写错的对象名、字段名,或指向不允许检索的对象(API 不开放检索、系统对象未开放 AI
读取),报错写明是哪个对象、哪个字段。
- 为什么做:属于「知识平台」专题第三阶段第 4 行,让知识源的错误在发布前暴露,而不是等到检索时才发现「怎么搜不到」。
-
出错会怎样:带这几类错误的知识源,发布会被拒(以前能发布,但对象不存在时无内容可索引、字段写错时该字段读不到、对象不开放检索时永远搜不到);已存储的知识源不受影响,可以直接撤回本改动。
- 要你做什么:无。

## What changes

ADR-0161 K4, row 4: a knowledge source is checked against the objects it
names, by `os validate` / `build` / `lint` and by the runtime publish
gate, with one set of rule ids and messages.

- **`packages/lint/src/validate-knowledge-source.ts`** (new):
`validateKnowledgeSource`, five rule ids, exported from
`packages/lint/src/index.ts`.
- `knowledge-source-object-unknown` — **error**. `source.object` names
no object of the stack, of a package of its artifact (`packages[]`), or
at the door of the objects the host serves. Under a stated package
closure it is worded for the closure with `closureDependencyRemedy`; at
the door with no closure (the whole collection the host serves) it is an
error too, and an empty served collection is no universe. On the CLI,
while the manifest declares a dependency the artifact does not carry, it
is a **warning** with the hedge (the build cannot see that package's
objects; the publish judges the source against the closure, which holds
them), the `flow-trigger-unknown-object` split. The ladder
`validateObjectReferences` uses: a known platform object
(`isPlatformProvidedObjectName`) is not judged when the stack does not
carry its definition; a platform-prefixed name no known package
registers is a **warning**.
- `knowledge-source-field-unknown` — **error**. A `source.content` /
`source.metadataFields` member names no field of the object: declared
(the stack's own extensions folded in, `objectsAsServed`) or addressable
without a declaration (`injectedColumnsFor`: `id`, which the driver
provisions, and the injected system columns).
- `knowledge-source-object-not-searchable` — **error**.
`canServeApiOperation(enable, 'search')` is false (the admission
module's gate 2): `enable.apiEnabled: false`, an `enable.apiMethods`
list that does not grant `list` (search derives from it; `search` itself
is a retired list value the parse strips), or one that grants `list`
beside `enable.searchable: false`. With no `apiMethods` list,
`searchable: false` does not refuse it. The fix prescribed: keep
`apiEnabled` true and, where the object declares `apiMethods`, include
`list` with `searchable` not false; or index another object.
- `knowledge-source-system-object-not-ai-readable` — **error**. A `sys_`
object for which `isAiReadExposed` is false (the admission module's gate
3).
- `knowledge-source-field-never-indexed` — **warning**. A member names a
credential-class field (`isMaskedOnReadFieldType`, the spec declaration
the service's withheld set asks) or an `internal: true` field. The index
never carries either (K5). This addition goes past the Execution row,
under ADR-0078.
- **`authoring-rules.ts`**: one entry, `tier: 'gating'`, all three
commands, `surfaces: CLI_AND_RUNTIME`, `runtimeTypes:
['knowledge_source']`, with the package scope passed through, and
`wholeCollection` set at the door when no scope is stated.
- **`runtime-gate.ts`**: `knowledge_source: 'knowledgeSources'`.
- **`rule-explanations.ts`**: one `os explain` entry for each of the
five ids.
-
**`packages/spec/src/migrations/entries/semantic/19.knowledge-source-publish-refuses-missing-references-and-gated-objects.ts`**:
the upgrade-guide entry. `check:adr-0087-registration` requires it:
`Metadata-protocol: narrowed` refuses `no-migration-prescription`
outright. This file is outside the claim's declared file surface.
- **Changeset** `.changeset/37307-knowledge-source-references.md`:
`@objectstack/lint` minor, `@objectstack/spec` patch, BREAKING,
registered disposition.

### The at-publish verdict: refuse, not advise, against the `ai_context`
precedent

The `ai_context` row (`validateAiContext`) is advisory at publish. Its
reason is that a pack still reads what resolves (ADR-0160 D1). This row
departs from it, for three reasons. ADR-0161 K4 says an item "is refused
when the object or a named field does not exist (the lint and `os
validate` checks are row 4)". It also says that "a packaged item meets
the gates that need no principal in `os validate` and at publish". And
each of the four errors defeats retrieval (a missing object leaves
nothing to index, a missing field indexes no text for that member, a
gated object is never searched for a caller the service judges), so the
card's severity section (all four are errors) has the same reading. The
rule is therefore `gating`: its errors refuse the publish (422 with the
rule id, path, message and hint), and its warnings ride the 2xx
`advisories`. The card's sentence "follow the refuse-or-warn verdict the
`ai_context` row took" and its severity section cannot both hold. The
ADR text decides between them, and the departure is stated in the rule
header, the registry entry and the runtime-gate row.

What this narrows at publish, measured on the code paths:
- For a non-system author with the knowledge service mounted, the save
door already refuses the two gates `403`
(`authoredKnowledgeSourceRefusal`), before this gate runs. Where no
author judgement is reached, the publish is now refused `422`: a host
with no knowledge service, or a system-context write.
- A missing object or a missing field is now refused at publish. The
save admission accepted a missing object
(`canServeApiOperation(undefined)` is true, and with no security service
the field gate is masked-only).
- `os validate` / `build` / `lint` exit 1 on the same source.

Declarations: the claim expected `Clause-②: no` / `Metadata-protocol:
none`. The measured reading is `Clause-②: yes (narrowing)`, because five
new exports widen `@objectstack/lint`'s public surface and a new refusal
narrows the accept set, and `Metadata-protocol: narrowed`, because a
requirement is tightened. So the lint bump is `minor` and the title
carries `!`.

## Tests

`packages/lint/src/validate-knowledge-source.test.ts` (44 cases):
- every Acceptance family through `runAuthoringRules('validate')`: a
missing object, content field or metadata field; `apiEnabled: false`; an
`apiMethods` list that does not grant search; `searchable: false`; a
`sys_` object without `aiReadable`. Each prints exactly one finding,
with its rule id, severity, path, and the object or field named. A clean
source prints none.
- the credential-class and `internal` warnings.
- the same families at the door (`runRuntimeAuthoringRules` with `type:
'knowledge_source'`). Errors land in `errors` (refused) and warnings in
`advisories`, and the face (rule, severity, where, message, hint) equals
the `os validate` face.
- closure wording and remedy under `packageScope`, with a non-vacuous
control: declaring the dependency clears it.
- injected columns, stack extensions, artifact `packages[]`, a known
platform object skipped, an unknown platform-prefixed name as a warning,
`list` granting `search`.
- `metadataFields: ['id']` and `content: ['id']` resolve (CLI and door);
`enable.searchable: false` with no `apiMethods` list is clean.
- the object-unknown split: on the CLI a warning while the manifest
declares a dependency `packages[]` does not carry, an error when every
declared dependency is carried or none is declared; against the whole
collection an error beside the same unseen dependency; an empty served
collection at the door judges no object.
- `explainRule` answers all five ids.

<details><summary>Readings (lint suite at 73441db; the head
3ea6b3c adds only the four docs transcript counts)</summary>

- `pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2` (with
spec and lint rebuilt, then lint `typecheck`): lock VERDICT command-exit
0, **Test Files 243 passed (243), Tests 9836 passed (9836)**; typecheck
exit 0 (`check:test-typecheck` included; `tsc -p tsconfig.test.json
--listFiles` lists the new test file, 1 hit).
- `pnpm --filter @objectstack/spec exec vitest run src/migrations` after
the spec build: 5 files, 206 tests passed.
- Ablation, one per new pin, each with the anchor proven on disk by
`scripts/ablation-replace.mjs`, a trap restore, and `git diff HEAD`
empty after restore. Every leg went red: the runtime-gate row removed
(12 red); the object-unknown error made a warning (3); the API gate off
(6); the system-object gate off (2); the withheld warning off (4); the
injected-column merge off (1); the artifact `packages[]` resolution off
(1); the closure branch off (1); the platform-object skip off (1); the
stack extensions not folded (1).
- Public door: `objectstack validate` in `examples/app-showcase` exits 0
with zero `knowledge-source-*` findings, so the shipped corpus is clean.
The same command with `content` mutated to `['title', 'notez',
'secret_note']` exits 1 with two `knowledge-source-field-unknown`
findings at `knowledgeSources[0].source.content[1]` and `[2]`, and the
file is restored. `objectstack explain knowledge-source-object-unknown`
and `objectstack explain knowledge-source-system-object-not-ai-readable`
both answer.
- Full dogfood battery (`pnpm --filter @objectstack/dogfood test`, lock
VERDICT command-exit 1, head 73441db): Test Files 14 failed / 476
passed / 3 skipped (493); Tests 20 failed / 4113 passed / 79 skipped
(4212). The failures were 17 `Test timed out in 5000ms`, 2 hook
timeouts, the cascading `already has a live bootStack kernel` errors,
and 1 assertion inside a timed-out file. None names a
`knowledge-source-*` rule. The 14 failed files re-run alone on the same
head: **14 passed (14), 164 passed (164)**, VERDICT command-exit 0. Read
as shared-box contention, not this diff.

</details>

<details><summary>Rework readings (review 7221784031: M1, S1, S2, N1,
N2; head 8301509)</summary>

- At 15b32e6, under the lock (VERDICT command-exit 0): `turbo run
build --filter='@objectstack/lint...'` 5/5 tasks; the lint suite **Test
Files 244 passed (244), Tests 9856 passed (9856)**; spec
`src/migrations` 5 files, 206 tests passed;
`check:docs-transcript-drift` exit 0 against the built registry (4
declared values, 87).
- At 2677e83 (only the test file changed after 15b32e6), a
declared narrowing run outside the lock after three lock queue-timeouts
behind another seat's dogfood battery: the knowledge-source file 44
passed (44); `pnpm --filter @objectstack/lint typecheck` exit 0
(`check:test-typecheck` included).
- Ablations, each anchor proven by `scripts/ablation-replace.mjs` with a
trap restore and `git diff HEAD` empty after: the `injectedColumnsFor`
existence check off (2 red, `id` among them); the CLI dependency hedge
off (2 red); the whole-collection reading off in the rule (1 red); the
registry's `wholeCollection` pass set false (1 red); the empty-universe
skip off (2 red).
- After merging origin/main (bfc0dd0, no lint or transcript file
touched): `check:docs-transcript-drift` exit 0 (87; objectstack-ai#37986 still open),
`check-adr-0087-registration` exit 0, `check:nul-bytes` exit 0,
`overlap-check` VERDICT clean.

</details>

<details><summary>Derived gates (dispatch-gates --commands, then
--ran)</summary>

- 94 families derived at 73441db, all run locally. 90 exited 0. Of
the rest: `check:docs-transcript-drift` was red (four CLI transcripts
printed 85 author-time rules, and this rule makes 86); the four counts
were fixed in 3ea6b3c, and the gate now exits 0 (4 declared values
equal the derived count). `check:exported-any` returned exit 3 while the
dogfood build was rebuilding `packages/spec/dist`; re-run after that
build, it exits 0. `check:dual-build-cjs-loads` returned exit 3 because
the `studio`, `client-react` and `scenarios` dist are not built here:
NOT MEASURED, CI. `check:type-check-debt` returned exit 3 on a lock
queue-timeout (another seat's hold): NOT MEASURED, CI.
- The docs commit derived 23 more families. 22 exit 0.
`check:skill-examples` returned exit 3 because the `client-react` dist
is not built: NOT MEASURED, CI.
- `check:api-surface` and `check:docs` exit 0 after the spec rebuild.
`overlap-check` VERDICT clean before every push; objectstack-ai#37910 and objectstack-ai#37870 merge
cleanly. objectstack-ai#37870 bumps the same four transcript counts, so whichever
lands second needs 87.

</details>

## Acceptance notes

- The search gate follows the exposure derivation: `apiMethods: ['get',
'list']` **grants** `search` (`list` grants it unless
`enable.searchable` is false). The save-door refusal text in
`service-knowledge` (`admitAuthoredSource`, `object-api-not-served`)
reads "its `enable.apiMethods` list does not include `search`". For
`searchable: false` with `list` granted, that wording names the wrong
cause. Wording only; the PM files it as a card with the S2 wording.
- On the CLI, a platform object the stack does not carry (for example
`sys_user`) is not judged, because its declaration is not in hand. The
publish door judges it against the live definition.
- Fences held: the spec predicates and the admission module are
unchanged, there is no adapter work for objectstack-ai#37306, and there is no
unknown-adapter refusal for objectstack-ai#37479.

## Verification

Read first, by risk:
1. `packages/lint/src/authoring-rules.ts`, the `validateKnowledgeSource`
entry (`tier: 'gating'` on the publish door is the narrowing).
2. `packages/lint/src/validate-knowledge-source.ts`, the object ladder
and the two gates.
3. `.changeset/37307-knowledge-source-references.md`.

Two-minute check: in
`examples/app-showcase/src/ai/task-notes.knowledge-source.ts`, change
`content: ['title', 'notes']` to `['title', 'notez']` and run `pnpm exec
objectstack validate` in `examples/app-showcase`. Expected: exit 1 and
`rule: knowledge-source-field-unknown at
knowledgeSources[0].source.content[1]`. Unchanged, the showcase
validates with zero `knowledge-source-*` findings.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP

---------

Co-authored-by: Claude <noreply@anthropic.com>
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

2 participants