Skip to content

feat(scenarios): the door rules arm has a built-in corpus, the hosted build door's authoring rules ported as data - #35267

Merged
objectstack-fleet[bot] merged 11 commits into
mainfrom
claude/issue-34780-rules-corpus
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 11 commits into
mainfrom
claude/issue-34780-rules-corpus

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Part of #34780

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:场景卡评测的 door 模式规则 arm 新增内置语料 --door-rules builtin:把托管产品 MCP 构建门交给客户端的作者规则(54 条规则 + 2 段前言)以数据形式搬进 @objectstack/scenarios,带 5 个可省略的命名集合。
  • 为什么改:你在卡上点了「Yes, port it now」并在线程里回复「同意你执行」;有了内置语料,跑每组 5 次的评测不再需要你在仓库外另备规则文件。
  • 风险与回滚:只动评测工具包,产品包零改动;不传 --door-rules 时行为与之前完全相同,--door-rules FILE 仍可用。语料里删掉了 1 条只适用于托管运行时的规则,并去掉了 13 处 cloud 工单号引用,其余逐字保留。回滚即还原本 PR。
  • 先看:packages/qa/scenarios/src/runner/door-rules-corpus.ts 头部注释(来源路径、cloud 提交号、删掉了什么);src/runner/door.ts 的 readDoorRules(builtin 分支,与规则文件走同一套校验);test/runner/door.test.ts 末尾的内容扫描用例。
  • 两分钟验证:pnpm --filter @objectstack/scenarios exec vitest run --maxWorkers=2 test/runner/door.test.ts,预期 27 个用例全绿。
  • 需要你做的:合并后按 README「One round, five reps per arm」跑一轮,RULES=builtin 即可。

What changes

@objectstack/scenarios only. No product package is touched, and no hosted-service code is ported, only data.

  • One data module, src/runner/door-rules-corpus.ts. It holds the authoring rules the hosted product's MCP build door hands its client, in exactly the { rules: [{ id, text }], sets } shape the rules arm already reads: 54 rules plus the two corpora's preambles (metadata-authoring-preamble, solution-design-preamble), 56 entries.
  • Five named sets for --door-rules-omit:
    • metadata-authoring (45) and solution-design (11): each corpus, its preamble included.
    • inline (27) and ondemand (29): what the hosted door hands its client up front, and what it serves only when the client asks for a rule by id. --door-rules-omit ondemand is the closest a file of texts comes to the hosted delivery.
    • names-build-door-tools (38): the rules whose own text, before any published section, names a tool the hosted build door registers (PLATFORM_TOOLS_BY_PACKAGE['service-ai-studio'] in @objectstack/spec).
  • Wiring (src/runner/door.ts, src/runner/cli.ts). --door-rules builtin, or OS_SCENARIOS_DOOR_RULES=builtin, reads the built-in corpus. It goes through the same judge as a rules file: shape, unique ids, sets, selector. The record states it as file: builtin with the sha256 of its JSON. --door-rules FILE is kept unchanged. With no --door-rules, the arm has no rules, as before, so the bare arm and its records keep their meaning. A file literally named builtin is given with a path (./builtin).
  • README: the door-mode section documents the built-in corpus and its sets, and the one-round loop now reads RULES=builtin. The quick-reference command list gains one --door-rules builtin line.

Where the text comes from

The text was rendered, not retyped, from objectstack-ai/cloud at c9b6664d9ac8cdc16df61a40febe3b5c71f41f11. The call was authoringCorporaAt(authoringTierFor('mcp', undefined, undefined, { status: 'none' }), undefined, 'mcp'), which takes the door-mode text of each rule from corpusAt. The cloud source files, all under packages/service-ai-studio/src/:

  • tools/get-authoring-rules.tool.ts (authoringCorporaAt)
  • authoring-whitelist.ts (authoringTierFor)
  • skills/authoring-rule.ts (corpusAt, ruleOffered)
  • skills/authoring-source.ts (restriction-profile reading none)
  • skills/metadata-authoring-skill.ts
  • skills/solution-design-skill.ts
  • skills/published-skills.ts, skills/published-refs.ts

Each rule ends with the published sections it cites. Those were read from this repository's own skills/ catalog, built at this branch's base on main (cdb327fdf03). Cloud itself pins the framework at 958ee035, so a published section may differ from what cloud serves today by whatever skills/ changed between those commits.

Acceptance notes

  • Ported: 54 rules + 2 preambles = 56 entries, out of the 55 rules the tier offers.
  • Dropped (1): 14b-tier. It describes the hosted runtime's timer lifecycle: a clock trigger runs inside a per-environment kernel that the hosting builds on demand. That is control-plane only.
  • Not offered at the MCP door's tier, so not ported (5): flow-node-types, 13, 14b, 14c, process-approval-flow.
  • Scrub: the port holds no secret, key, tenant data, hosted endpoint, hostname or private security material. The only addresses are example.com samples already public in skills/, plus the placeholder url:'https://…'. A test enforces this.
  • Deviation from verbatim (declared): 13 tracker citations (cloud# plus a number) across 12 rules are struck, with the brackets or comma around them. Example: Live failure (cloud#972): … becomes Live failure: …. pnpm check:doc-authoring refuses a tracker id in a runtime string, and a baseline entry is maintainer-only. Nothing else in any text differs from what the hosted door serves.
  • Deviation from the dispatch wording (declared): the dispatch said the corpus is the arm's default "when no --door-rules FILE is given". It is selected explicitly with --door-rules builtin rather than switched on whenever the flag is absent. Reason: an implicit default would make the bare arm (no rules) unreachable without a new none spelling, and would change what existing door-mode records mean.
  • Size: the whole corpus renders to about 115,000 characters of the client's CLAUDE.md; the inline set alone, about 21,000.
  • Open MCP server overlap: it serves a few of the hosted tool names too (list_objects, describe_object, validate_expression). So names-build-door-tools means "names a hosted build-door tool", not "names only tools the client lacks".

Tests

  • test/runner/door.test.ts has a new top-level describe with 6 cases:
    • the corpus's JSON read as a file judges identically to builtin (same rules, same sha256);
    • 56 unique ids, the two preambles, and the 6 absent ids;
    • the sets partition the corpus twice, each set omits as a selector, and omit ondemand leaves exactly inline;
    • names-build-door-tools equals its derivation from PLATFORM_TOOLS_BY_PACKAGE['service-ai-studio'];
    • a content scan for URLs, hostnames other than example.com, localhost, IPs and key-shaped strings, with planted positives proving the scan can fail;
    • --door-rules builtin parses, makeDriver accepts it, and the arm text and refusal wording are right.
  • Ablation, one run: the builtin branch of readDoorRules was disabled (if (path === BUILTIN_DOOR_RULES && false)). The tests import src directly, so no build was involved. Result: 3 of 27 failed, the 3 cases that read through builtin. The file was restored from HEAD byte-identical (blob 7b80f58d2dc1), and git diff HEAD is empty.
Readings at bdcf01e
  • pnpm --filter @objectstack/scenarios build && pnpm --filter @objectstack/scenarios exec vitest run --maxWorkers=2 (under the verify lock): VERDICT command-exit 0, Test Files 40 passed (40), Tests 1182 passed (1182).
  • pnpm --filter @objectstack/scenarios typecheck: exit 0 (at 52d808b; the only later change is the corpus data module's strings).
  • Ablation run: Tests 3 failed | 24 passed (27), the 3 builtin cases; restored.
  • pnpm check:doc-authoring: exit 0 after the strike. Before it, the gate named 10 (file, id) pairs in the data module.

Verification

Derived gate families at bdcf01e (`dispatch-gates --repo objectstack-ai/objectstack --commands`, 67 families)
  • 65 exited 0 in one sequential run.
  • pnpm check:dts-closure exited 1 once, naming packages/objectql/dist/*.d.ts. A concurrent rebuild of @objectstack/objectql in this worktree was in progress at that moment (its dist is stamped mid-run). The standalone re-run exited 0: 260/260 declaration files present.
  • pnpm check:dual-build-cjs-loads: NOT MEASURED, exit 3, PREREQUISITE NOT MET. It needs every package's dist/, and only the scenarios closure was built here. CI owns it.
  • dispatch-gates --ran: 67 derived, 67 run, 0 unrun.
  • node scripts/pm/overlap-check.mjs --repo=objectstack-ai/objectstack: VERDICT clean exit 0 (origin/main merges cleanly, 0 open PR heads overlap).

Generated by Claude Code

…sal is a publish finding

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbaX2qDxUq9sF93EqqL
…our-mode refusal

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbaX2qDxUq9sF93EqqL
…s a door finding

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbaX2qDxUq9sF93EqqL
… build door's authoring rules ported as data

Claude-Session: https://claude.ai/code/session_01JQwxbaX2qDxUq9sF93EqqL
Co-authored-by: Claude <noreply@anthropic.com>
…d content scan; changeset

Claude-Session: https://claude.ai/code/session_01JQwxbaX2qDxUq9sF93EqqL
Co-authored-by: Claude <noreply@anthropic.com>
…hosted text's citations are struck

Claude-Session: https://claude.ai/code/session_01JQwxbaX2qDxUq9sF93EqqL
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l 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 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/scenarios, touching 38 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/qa/scenarios/README.md), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

72 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json f4dbcc2153566226f283c79c73255369c2c97587.

⛔ 19 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/qa/scenarios/README.md) — pages documenting those are invisible to this run
  • 2 anchor(s) matched too much of the corpus to be a work list: current_user (literal, 44 pages), sys_user (literal, 56 pages)
  • 3 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 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; 123 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 — 1 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 f4dbcc2153566226f283c79c73255369c2c97587 → packageMentionDocs.

Which tree this was computed on

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

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

⚠️ 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 f4dbcc2153566226f283c79c73255369c2c97587 → 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

repo:objectstack#1 · os-warren · session_01JQwxbXr9wLAH24MEgxaLud

席位核对

L1 full · ACCEPT · Head-sha: 6e244858be3dcfd43422aff2f5dbd64a5a74f972 · card #34780 (Part of #34780) · full read at bdcf01ec, then the delta bdcf01ec..6e244858 · read 2026-11-19T01:29Z

Net diff against merge base cdb327fdf03: 6 files, +474 / -28, all of them in @objectstack/scenarios plus one changeset. The door mode rules arm gains a built-in corpus, --door-rules builtin, ported as one data module.

The maintainer's word

  • The port is on the maintainer's own word, in two records. The decision card chose "Yes, port it now" (2026-11-18 17:44Z), and his own reply was 「同意你执行」 (2026-11-19 00:12Z). I read both in the area's thread, not as relays. This supersedes the earlier constraint that no hosted text be copied.

Against the card

  • Part of is right. The card is done when a five-reps round is on record. This PR removes the need for a rules file kept outside the repository for that round. The round itself is still the maintainer's.

Read at the head

  • The source is named. The PR body and the module header both name objectstack-ai/cloud at c9b6664d9ac8cdc16df61a40febe3b5c71f41f11, the rendering call, and the eight source files under packages/service-ai-studio/src/. The published sections each rule ends with are read from this repository's own skills/ at the base commit, and both texts say so.
  • The scrub, read entry by entry. I extracted all 56 texts and scanned each one, and read every hit in context:
    • Addresses. The only URLs are the example.com samples already public in skills/ and the placeholder url:'https://…'. There is no hostname, no localhost and no IP address.
    • Secrets and keys. There is no key-shaped string. Every hit on "secret", "token", "credential" or "password" is authoring guidance: never put a credential in a flow, secret vs password field types, and credentialRef. None of them is a value.
    • Tenant and customer data. The "live failure" anecdotes are generic, with no organization, person or environment named. One cites a masked sample phone number from a build's own sample rows.
    • Control-plane-only text. 14b-tier (the hosted runtime's timer lifecycle) is the one rule left out, and the five rules the door's tier does not offer are absent. What remains describes authoring behaviour, the build door's tools and the platform's published rules.
    • Tracker ids. No cloud# id remains. The 13 struck citations are declared as the one deviation from verbatim.
    • The new test. It scans for these kinds of content and holds planted positives that prove it can fail.
  • Wiring.
    • --door-rules builtin (or OS_SCENARIOS_DOOR_RULES=builtin) goes through the same judge as a rules file. The record states the arm as builtin with the sha256 of its JSON.
    • A rules file is still read as before. With no --door-rules the arm has no rules, so existing door records keep their meaning. A file literally named builtin is passed with a path.
  • Sets. There are five named sets, each pinned. names-build-door-tools is derived from PLATFORM_TOOLS_BY_PACKAGE['service-ai-studio'], and omit ondemand leaves exactly inline.
  • Changeset, read sentence by sentence. It is one file for @objectstack/scenarios, at patch, opening on its title line. Clause-②: no and Metadata-protocol: none are right: no product package and no authorable surface moves. Each statement matches the code.
  • Merges cleanly onto origin/main f4dbcc2153.
  • Check-runs at this head: 49 in total, all completed, none failed (33 success, 16 skipped).

Delta bdcf01ec..6e244858

  • One test line changed in door.test.ts, the fix for the Test Core 5/10 red at bdcf01ec. The CLI-wiring case no longer builds the live claude driver, whose version probe needs the CLI on PATH. It now asserts that makeDriver('claude', { doorRules: 'builtin', doorRulesOmit: 'rule-z' }) throws DoorRulesRefusedError. That pins that makeDriver reads and judges the built-in corpus before it builds the driver. The accepting path is still pinned directly through readDoorRules(BUILTIN_DOOR_RULES, { omit: 'ondemand' }) in the same case. No source file moved.

Not mine, still owed

  • Landing, through the seat. After merge, the five-reps round is the maintainer's (RULES=builtin).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbaX2qDxUq9sF93EqqL

Landing · 2026-11-19T01:29Z. Head 6e244858be3dcfd43422aff2f5dbd64a5a74f972 (Part of #34780; the card stays pm:awaiting-maintainer for the five-reps-per-arm round):

  • Maintainer's word: decision card "Yes, port it now" (2026-11-18T17:44Z) and his reply 「同意你执行」 (2026-11-19T00:12Z), both in the area's own thread.
  • L1: full ACCEPT 6996856758 (scrub read entry by entry; source repo, sha and paths named in the body and the module header), including the delta that fixed the Test Core 5/10 red.
  • Contract review: not owed. @objectstack/scenarios plus one changeset, Clause-②: no, Metadata-protocol: none, no spec or governed path.
  • Seat call on the open question: the built-in corpus is selected explicitly with --door-rules builtin; a flagless door run stays the bare arm, so existing door records keep their meaning.
  • Check-runs: 49, with 33 success, 16 skipped and 0 failed.
  • Shape: not governed, 6 files, +474/−28.

Marked ready, and auto-merge is armed.

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/l 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.

2 participants