Skip to content

feat(spec)!: strict defineStack judges a packages[] stack per body and counts only the top-level apps no body declares against its manifest - #33074

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-77f6jr
Nov 13, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-77f6jr

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Fixes #32978

Clause-②: yes (narrowing) — one face narrows and one widens. Narrowed: a stack carrying packages[] whose top level holds an app that no package body declares, beside an app of the package body with the manifest's id (or two such apps), is refused by strict defineStack, where it was accepted. Widened: a stack carrying packages[] whose top level repeats apps that different package bodies declare (an additive artifact, such as resolveArtifactCollections output) is accepted, where it was refused.
Metadata-protocol: narrowed
Skills-docs: none — the taught rule (at most one app per package; compose a suite with composeStacks(stacks, { manifest: 'preserve' })) is unchanged, and no skill or docs page teaches handing a packages[] stack to defineStack; what moves is which top-level apps strict defineStack counts on such a stack. The single-app teaching follow-up of #32898 is #32977.

维护者速读

  • 改了什么:严格模式 defineStack 判带 packages[] 的栈时,改用 composeStacks 已有的同一个判法(同一份实现,两道门共用):每个包体按自己的类型和应用判;只有「没有包体声明的顶层应用」才和 manifest id 那个包体自己的应用一起算到栈的 manifest 下,与加载路径的残余规则一致。
  • 为什么改:feat(spec)!: composeStacks refuses a flat composition that puts two or more apps under one app or module package id, and every packages[] body is held to one app #32898 让 composeStacks 按加载路径的读法判,defineStack 还是把全部顶层应用都算到栈自己的 manifest 下,两道门对同一形状判法不同:把 resolveArtifactCollections 的输出交回 defineStack 会被误拒;手搭一个多出一个未声明顶层应用的栈却会通过,启动时变成一个包两个应用。
  • 风险与回滚:一收一放(Clause-②: yes (narrowing))。实测本仓与 HotCRM 没有任何产品代码把带 packages[] 的栈交给严格 defineStack(HotCRM 是每包 defineStack 后 composeStacks preserve)。不带 packages[] 的栈判法不变。回滚即 revert。
  • 先看:packages/spec/src/stack.zod.ts 的 validateSingleApp(新分支)与 residualSingleAppFinding(抽成两门共用、按门传入残余应用的来源与改法);packages/spec/src/stack.test.ts 新 describe;packages/runtime/src/artifact-collections.public-reader.test.ts 新 describe。
  • 两分钟验证:pnpm --filter @objectstack/spec exec vitest run src/stack.test.ts -t "judged per body",预期 4 条全绿,其中一条是「手搭栈的未声明顶层应用与 manifest id 包体的应用一起被拒(422 STACK_SINGLE_APP_VIOLATION)」。
  • 需要你做的:无,席位落地。

What changes

One judge for both doors. residualSingleAppFinding (packages/spec/src/stack.zod.ts), added by #32898 for composeStacks, is now shared. It reads a packages[] stack the way the load path registers it: the apps of the body whose id is the manifest's, plus every top-level app no body declares (the residual rule, unclaimedTopLevel in @objectstack/metadata, mirrored by the existing isResidualTopLevelItem; packages/metadata is read, not changed). Two or more of them, at least one residual, are refused. A ResidualSingleAppDoor argument carries only what differs per door: the finding's subject, where each residual app came from, and the remedy. The composeStacks finding is byte-identical to before (its pins are unchanged and green).

validateSingleApp (the strict defineStack pass):

  • No packages[]: unchanged. Every app counts against the stack's own package.
  • packages[] with an app or module manifest: the top level goes through the shared judge, the residual apps named as 'NAME' at its top level (apps[i]), which no package body declares; every body is still judged by collectPackageBodySingleAppErrors as before.

Example finding: "A 'module' package must define at most one app, but the stack gives package 'com.example.crm.service' 2 ('crm_service' from its package body (packages[1]), 'crm_field_service' at its top level (apps[0]), which no package body declares): an app that no package body declares is registered under the artifact's manifest id, beside the apps of that package's own body. Keep one app per package: declare each such app inside the package body it belongs to, or give it a 'module' package of its own and compose with composeStacks(stacks, { manifest: 'preserve' }), which registers each package body under its own id — ADR-0019 (app-as-consumer-unit) D3 as amended (a suite may surface several apps, one per package)."

Docblocks. validateSingleApp's docblock no longer says composeStacks judges by "the same rule" loosely: it states the two readings (no packages[] / packages[]) and that composeStacks shares the residual judge. StackSingleAppViolationError's defineStack raise-site line and collectComposedSingleAppErrors's docblock say the same.

ADR-0087. New semantic entry define-stack-packages-residual-second-app-refused (packages/spec/src/migrations/entries/semantic/18.define-stack-packages-residual-second-app-refused.ts), no D2 conversion (which package an app belongs to is the author's call). The changeset registers it.

Changeset. .changeset/32978-define-stack-packages-single-app.md, @objectstack/spec minor, both declaration lines, BREAKING banner with Before / Now / Unchanged / Fix.

No error code added: the refusal is the existing STACK_SINGLE_APP_VIOLATION (422).

Tests

New top-level describe in packages/spec/src/stack.test.ts ("defineStack — a packages[] stack is judged per body, and its top level by the residual rule composeStacks reads"):

  1. accepts an additive artifact whose top level repeats the apps two bodies declare (the reader's shape), under a module manifest;
  2. refuses a hand-built stack (a preserve artifact plus one undeclared top-level app): code STACK_SINGLE_APP_VIOLATION, status 422, the defineStack header, the package, both apps with where each sits;
  3. one residual app is accepted when the manifest id's body declares none, two are refused;
  4. CONTROL: a stack without packages[] is judged unchanged (two apps refused naming the package, one accepted).

New top-level describe in packages/runtime/src/artifact-collections.public-reader.test.ts (file surface amended by the seat, comment 6846967975): defineStack(resolveArtifactCollections(composeStacks([app, module], { manifest: 'preserve' }))) passes, with anti-vacuity (two top-level apps under a module manifest). The packages share one namespace so the namespace-prefix rule is not what answers (see #33069).

Both arms were reproduced on origin/main 157051ce before the fix with a built probe: the reader round trip was refused STACK_SINGLE_APP_VIOLATION 422, and the hand-built stack was accepted.

Ablations (each committed first, mutated through `scripts/ablation-replace.mjs`, restored to the HEAD blob)

Taken at f649a494 (pre-merge head; the merge of origin/main touched no line these mutate). Each mutation landed (anchor 1 → 0, blob changed) and each restore read blob == HEAD (6d75946920d3) and git diff HEAD is empty.

# Mutation in stack.zod.ts Expected Observed
1 validateSingleApp back to the old reading (const own = true || !Array.isArray(config.packages)) additive, hand-built and one/two-residual pins red; control green 3 failed, control passed
2 residual predicate ignored in the defineStack door (every top-level app residual) additive pin red 1 failed (additive)
3 shared judge stops counting the manifest-id body's apps hand-built pin red 1 failed (hand-built)
4 the no-packages[] branch judges nothing control red 1 failed (control)
5 as 1, read by the runtime round-trip pin (artifact-collections.public-reader.test.ts) round-trip red 1 failed, 2 passed

The runtime suite resolves @objectstack/spec to src/ (packages/runtime/vitest.config.ts alias), and so does stack.test.ts (./stack.zod), so no dist rebuild was owed per leg.

Acceptance notes

  • Measurement (order step 1): no first-party production code hands a packages[] stack to strict defineStack. In-repo defineStack( call sites on a stack value are tests (all strict: false or per-package inputs) and authored configs without packages[]; HotCRM (0009f58, read-only) builds each package with defineStack and composes with composeStacks(packageStacks, { manifest: 'preserve' }), never re-judging the artifact. The consumer suites below are the empirical half.
  • Out of scope, filed by the seat as spec: strict defineStack refuses an additive packages[] artifact of differently-namespaced packages with STACK_NAMESPACE_PREFIX_INVALID, judging body objects against the stack manifest's namespace #33069: with packages of different namespaces (the usual case), the same reader round trip is refused earlier by STACK_NAMESPACE_PREFIX_INVALID, because validateNamespacePrefix judges the merged top-level copies of body objects against the stack manifest's namespace. Not touched here.
  • Ruling-surface grep (ruling|Ruling-ref|maintainer|⛔) over stack.zod.ts: 68 hits file-wide, one inside the edited regions (the validateUnmanagedInstallMode docblock, untouched). No ruling sits on the edited lines.
  • Contract-review nits (record 6848214183), noted and not pushed for:
    • N1 · the "(or two such apps)" clause of the declaration line and the entry surface's "or two or more such apps" name no newly refused shape: two undeclared top-level apps were already refused before this change, with the same code and status. Over-inclusive, in the safe direction.
    • N2 · a packages[] stack that was already refused (two undeclared top-level apps, or packages: [] with two apps) now reads the residual sentence instead of "package 'X' defines N …", and on that path an app manifest loses the "fold them into one app" remedy. Code, status and header are unchanged; the changeset does not mention the rewording.
    • N3 · the "refuses two" half of the one/two-residual pin does not discriminate by verdict (the old rule refuses it too; only its wording assertion turns red). No pin covers copies of other bodies' apps beside one residual app, or a manifest-id body of an unjudged type.
    • N4 · the changeset's Widened line names resolveArtifactCollections output as accepted without the spec: strict defineStack refuses an additive packages[] artifact of differently-namespaced packages with STACK_NAMESPACE_PREFIX_INVALID, judging body objects against the stack manifest's namespace #33069 limit (differently-namespaced packages are still refused earlier, by the namespace-prefix rule). This body states the limit.
    • N5 · residualSingleAppFinding's docblock says door "only names" the residual apps, but door.residual also enumerates them, so the count comes from the door. The two doors agree today; a third could differ.
  • Serial: PR feat(plugin-security): a position declares its earlier names in renamedFrom, and its holders move with it at boot #33008 (renamedFrom) edits another region of stack.zod.ts; this PR touches validateSingleApp (:2690–2760), the StackSingleAppViolationError docblock (:3825) and collectComposedSingleAppErrors / residualSingleAppFinding (~:8836–8990).

Verification

Readings at head 0d2b8278 (after merging origin/main 12b14462, which brought #33008), after pnpm install --frozen-lockfile and pnpm turbo run build --concurrency=2 --filter='./packages/**' --filter='@objectstack/dogfood^...' (81/81 tasks), every heavy command under scripts/pm/os-verify-lock.sh (VERDICT command-exit 0 on each), exit codes captured before any pipe:

  • pnpm --filter @objectstack/spec check:generated: all 14 generated artefacts up to date; tree clean.
  • pnpm --filter @objectstack/spec test: Test Files 840 passed (840), Tests 26827 passed, 1 todo. typecheck: exit 0.
  • Consumers of the changed schema door (run by hand; dispatch-gates does not derive them):
    • @objectstack/runtime test: Test Files 596 passed (596), Tests 10562 passed, 19 skipped; typecheck exit 0.
    • @objectstack/metadata test (the unclaimedTopLevel load path): Test Files 76 passed (76), Tests 2178 passed.
    • @objectstack/metadata-protocol test: Test Files 337 passed, 7 skipped (344); Tests 22799 passed, 36 skipped.
    • @objectstack/core test: Test Files 146 passed (146), Tests 3368 passed.
    • @objectstack/lint test: Test Files 202 passed (202), Tests 8610 passed.
    • @objectstack/cli unit (vitest run --project unit): Test Files 416 passed (416), Tests 5933 passed. The integration layer is CI's (no spawn entry or integration file in the diff).
  • Full dogfood battery (Clause-② carries a (narrowing) arm): pnpm --filter @objectstack/dogfood test at 0d2b8278, lock VERDICT command-exit 0, Test Files 458 passed, 3 skipped (461); Tests 3844 passed, 42 skipped; no failure.
  • Derived gates: node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack → 91 families, each run with </dev/null. 90 exited 0 on the first pass; node scripts/check-plugin-teardown-shape.mjs --self-test exited 3 (PREREQUISITE: its pinned fixture commit 621a4876 was outside the shallow clone), and after git fetch origin 621a487607881c66b2899b7e3477115229a156b4 --depth=1 it exited 0 (48 cases). Reconciliation --ran: 91 derived famil(ies) accounted for — 91 run, 0 NOT-MEASURED.
  • CI at 0d2b8278: 67 check-runs, all success or skipped, none failed or pending (the eleven required contexts that ran on the PR: Lint & Repo Gates, TypeScript Type Check, Test Core, Build Core, Governed Surface Queue Guard, Test UI, Build & E2E UI, Type Check UI, Live E2E UI, Dogfood Regression Gate success; Lint UI skipped by its path filter). Check Changeset success.
  • Contract review: record 6848214183, CONTRACT_REVIEW_TIER, head 0d2b8278, PASS, no must-fix or should-fix.

Generated by Claude Code

…d counts only undeclared top-level apps against its manifest

Strict defineStack now reads a stack that carries packages[] through the
judge composeStacks uses for its result (residualSingleAppFinding, one
implementation for both doors): each body by its own type, id and apps,
and the manifest id with the apps of its own body plus every top-level
app no body declares, mirroring the load path's residual rule
(unclaimedTopLevel). A hand-built stack whose undeclared top-level app the
boot would register beside the manifest-id body's app is refused; an
additive artifact whose top level repeats body-declared apps is accepted.
A stack without packages[] is judged as before.

Claude-Session: https://claude.ai/code/session_01L9qibyebbesu5rXZGhyF6z
Co-Authored-By: Claude <noreply@anthropic.com>
…defineStack's single-app rule

Claude-Session: https://claude.ai/code/session_01L9qibyebbesu5rXZGhyF6z
Co-Authored-By: Claude <noreply@anthropic.com>
@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 13, 2026
@github-actions

github-actions Bot commented Nov 13, 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, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • 6 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 — 171 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 5430b4a40cf298d0784ea3a9f8aabdf36068d761 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 5430b4a40cf298d0784ea3a9f8aabdf36068d761

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#2 · os-tesla · session_01L9qibvfX5bawZKtfa6u7j9

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 0d2b827809368c9c070bd465bc1307dbd7bc1e6e
Local-runs: probe — the seat asked for the consumer-package suites of these schemas (dispatch-gates misses them); run on a git archive export of the head tree, repo checkout untouched, after a filtered pnpm install --frozen-lockfile and pnpm turbo run build --concurrency=2 --filter='@objectstack/cli...' (64/64 tasks). Runs:

  • spec · vitest run --project local --maxWorkers=2 src/stack src/compose src/migrations src/api/error-code-ledger: 57 files, 1679 tests passed.
  • runtime · src/artifact-collections.public-reader.test.ts, src/artifact-collections.test.ts: 2 files, 25 passed.
  • metadata · src/owner-stamp-residual-build-boot.test.ts, src/plugin-artifact-packages-attribution.test.ts, src/plugin-artifact-forward-conversion-retired-after.test.ts: 3 files, 43 passed.
  • metadata-protocol · src/protocol.install-manifest-id.test.ts: 19 passed. core · src/capability-composition.test.ts: 13 passed.
  • cli · src/utils/artifact-packages.test.ts, test/migrate-meta-composed.test.ts, test/serve-config-boot-residual.integration.test.ts: 3 files, 26 passed. The two e2e files (test/build-multi-package-artifact.e2e.test.ts, test/compile-artifact-packages.e2e.test.ts) are outside the default projects and did not run.
  • Throwaway probe, 27 verdicts, run against head source and against the merge-base stack.zod.ts (12b14462); the judgments in ① cite it.
  • New pins run against merge-base source: additive, hand-built and runtime round-trip pins red, control green, the one/two-residual pin red on its wording assertion only (N3).
    Scope: packages/spec/src/stack.zod.ts, packages/spec/src/migrations/entries/semantic/18.define-stack-packages-residual-second-app-refused.ts (hits); packages/spec/src/stack.test.ts, packages/runtime/src/artifact-collections.public-reader.test.ts; the changeset and PR body (prose, sentence by sentence) + read at head: packages/metadata/src/plugin.ts (unclaimedTopLevel, artifactItemSlot, ARTIFACT_FIELD_TO_TYPE), packages/core/src/artifact-packages.ts, packages/spec/src/kernel/collection-item-owner-stamp.ts, packages/runtime/src/artifact-collections.ts, .changeset/32586-…, .changeset/32810-…, docs/adr/0019-app-as-consumer-unit.md, HotCRM 0009f58 (objectstack.config.ts, test/helpers/composed-stack.ts)

Check-runs at review time (2026-11-13T08:39Z): 47 success, 11 skipped, 6 in progress (Test Core 7/8 and 8/8, Test UI 1/16 and 16/16, Type Check UI, Type Check · workspace), no failure; Check Changeset success. Tests and type check are not yet a full gate verdict. main moved 12b14462 → 4079b06b with no change to any path of this diff.

① Derived judgments

  • Narrowing arm, reproduced and fixed: a preserve suite plus one top-level app no body declares, the manifest-id body holding one app, is accepted at merge-base and refused at head with STACK_SINGLE_APP_VIOLATION 422, under a module and an app manifest. Right.
  • Widening arm, reproduced and fixed: an additive artifact whose top level repeats two bodies' apps is refused 422 at merge-base and accepted at head; the reader round trip likewise. Right.
  • Whole delta (T top-level apps, R of them residual, B apps in the manifest-id body): the old rule refuses T ≥ 2, the new one refuses R ≥ 1 and B + R ≥ 2. Newly refused ⇔ T = R = 1 and B ≥ 1, exactly the declared shape. Nothing else previously accepted is refused. Right.
  • Newly accepted beyond the named example: copies of other bodies' apps beside one residual app, where the manifest-id body has none or no body has that id. The load path puts one app under the manifest id there. Right, inside "judged by the residual rule".
  • The two doors agree: a composeStacks result that carries packages[] and passes is accepted by strict defineStack (a flat composition of a nested artifact was refused at merge-base); hand-built equivalents of two compositions composeStacks refuses are refused by defineStack with the same package and count. Right.
  • One judge: residualSingleAppFinding holds the predicate (isResidualTopLevelItem), the owner id, the in-body apps, the threshold and the sentence; a door supplies the subject, the residual labels and the remedy. The composeStacks finding is the same template string for string. Right. No second copy.
  • Mirror of the load path: unclaimedTopLevel walks apps, claims by name and owns under manifest.id ?? id; the judge reads the same three. packages/metadata is untouched. Right.
  • Unchanged: a stack without packages[] (finding byte-identical at merge-base and head), strict: false, manifest types other than app/module, a stack with no manifest, packages: [] (same verdict, wording moves, N2). Right.
  • No export moves, no new error code, no schema shape change; registry.ts is git-ignored, so no generated artefact is owed in the diff.
  • Exposure: no non-test code in packages/**, examples/**, apps/** or HotCRM hands a packages[] stack to strict defineStack. metadata, metadata-protocol, core and cli have no non-test defineStack(/composeStacks( call; their tests call the producers on per-package inputs, strict: false inputs or config literals, none passing a packages[] value to strict defineStack. None names validateSingleApp.

② Semver level

Clause-②: yes (narrowing) + Metadata-protocol: narrowed is correct: yes for the widened accept set, and the one permitted arm is (narrowing) because that arm is the breaking one; narrowed outranks added. @objectstack/spec minor matches the kind and the sibling entries (#32586, #32810). No runtime changeset is owed (test-only). The semantic entry has the five SemanticMigration fields, the adr-0087: registered id equals the entry id, and the BREAKING banner carries Before / Now / Unchanged / Fix. Skills-docs: none holds: no skill, docs page or example hands a packages[] stack to defineStack.

Prose faces against the code at head:

  • Changeset Before, Now, Unchanged, Fix: each bullet holds, with N1, N2 and N4.
  • Entry replacement, reason, acceptanceCriteria: hold. surface: N1.
  • Docblocks of validateSingleApp, StackSingleAppViolationError, collectComposedSingleAppErrors, residualSingleAppFinding: hold, with N5.
  • The five new describe/it strings: hold (N3). The PR body's example finding matches the emitted text.

③ Boundary flags

④ Design judgment

Holds. Strict defineStack now reads a packages[] stack as the load path registers it, through the judge #32898 already gave composeStacks, and leaves the authored (no packages[]) route on its old line. The order's five steps are met: shared implementation, docblock corrected, four pins plus the round trip on the reader's side, changeset at the named path. Judging on the stack manifest's type is the reading composeStacks uses, so the doors cannot split on it.

No must-fix, no should-fix. Nits:

  • N1 · the declaration line's "(or two such apps) … where it was accepted" and the entry surface's "or two or more such apps" name no newly refused shape: two undeclared top-level apps were already refused at merge-base with the same code and status. Over-inclusive, safe direction.
  • N2 · a packages[] stack that was already refused (two undeclared top-level apps, or packages: [] with two apps) now gets the residual sentence in place of "package 'X' defines N …", and an app manifest loses the "fold them into one app" remedy on that path. Code, status and header unchanged; the changeset does not mention the rewording.
  • N3 · pin 3's "refuses two" half does not discriminate by verdict (merge-base refuses it too; only the wording assertion turns red). No pin covers the copy-plus-one-residual widening, or a manifest-id body of an unjudged type.
  • N4 · the changeset's Widened line names resolveArtifactCollections output as accepted without the spec: strict defineStack refuses an additive packages[] artifact of differently-namespaced packages with STACK_NAMESPACE_PREFIX_INVALID, judging body objects against the stack manifest's namespace #33069 limit (differently-namespaced packages are still refused earlier). The PR body states the limit.
  • N5 · residualSingleAppFinding's docblock says door "only names" the residual apps, but door.residual also enumerates them, so the count comes from the door. The two doors agree today; a third could differ.

Implemented-by: claude/project-thread-77f6jr
Reviewed-by: subagent of session_01L9qibvfX5bawZKtfa6u7j9

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#2 · os-tesla · session_01L9qibvfX5bawZKtfa6u7j9

维护者速读

  • 改了什么:严格模式 defineStack 遇到带 packages[] 的 stack 时,改用 composeStacks 已有的同一套「单应用」判定(按加载路径实际登记的方式读):多包 additive 产物顶层重复各包的 app 不再被误拒;顶层多出一个没有任何包声明的 app、而 manifest 那个包里已有 app 时,现在被拒(422 STACK_SINGLE_APP_VIOLATION)。
  • 为什么改:两道门原来判法不同,composeStacks 产出的合法 stack 交给 defineStack 会被拒,反过来有一种双应用形状能混过严格模式。
  • 风险与回滚:Clause-②: yes (narrowing),Metadata-protocol: narrowed,spec minor,附 18 版语义迁移条目;仓内代码、examples 与 HotCRM 都没有把 packages[] stack 交给严格 defineStack。回滚即 revert。
  • 先看:packages/spec/src/stack.zod.ts 里的 residualSingleAppFinding 与 validateSingleApp 调用处。
  • 两分钟验证:pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/stack.test.ts,预期全绿。
  • 需要你做的:18.4.0 冻结期间不入队;是等解冻还是向 triage 申请例外,请在线程决策卡上选。

席位意见:可以落地;按冻结裁定 6848983225 暂不入队,解冻后由席位落地。

席位核对

ACCEPT · seat domain:spec#2 · head 0d2b8278 · 2026-11-13T09:43Z

  1. Shape: Fixes #32978, draft, base main, 5 files, +270/−40; changeset .changeset/32978-define-stack-packages-single-app.md (@objectstack/spec minor); new semantic entry 18.define-stack-packages-residual-second-app-refused. Clause-②: yes (narrowing), Metadata-protocol: narrowed; claim 6846776794 said yes / semantic, corrected by amendment 6846967975 (which also added the runtime test to the surface).
  2. Premise: feat(spec)!: composeStacks refuses a flat composition that puts two or more apps under one app or module package id, and every packages[] body is held to one app #32898 merged (composeStacks residual judge); both arms reproduced against merge-base 12b14462 (record 6848214183 ①: narrowing arm accepted then, widening arm refused then).
  3. Contract review: owed at CONTRACT_REVIEW_TIER (packages/spec/src/** non-test; Clause-② yes). Record 6848214183 on this head 0d2b8278: PASS, no must-fix, no should-fix, nits N1–N5. Isolated subagent. It ran the consumer-package suites by hand (metadata, metadata-protocol, core, cli, runtime). The seat read the whole-delta judgment (newly refused ⇔ T = R = 1 and B ≥ 1) against the declared shape.
  4. Gates / check-runs: dev battery at 0d2b8278 (os-dev report 6849465771): spec 26827, runtime 10562, metadata 2178, metadata-protocol 22799, core 3368, lint 8610 and cli unit 5933 tests all passed; typechecks exit 0; check:generated 14/14; 91/91 derived gates exit 0 (--ran 0 NOT-MEASURED); full dogfood 3844 tests, 0 failures. CI on 0d2b8278: 67 runs, all success or skipped. K = 12 since the merge-base: under 15, no new locale pack.
  5. Accepted deviations and out-of-scope findings:
  6. Landing: not governed (check-governed-merges --pr 33074: 0 of 5 paths), 310 changed lines. ⛔ Not enqueued: the 18.4.0 merge freeze (ruling 6848983225 on [sweep] v18.4.0 release test sweep #32908, until chore: version packages #29963 merges) holds every changeset PR that is not a blocker or Round 2 fix. The PR stays draft and out of the queue. The seat lands it at the thaw (re-reading K and CI then) unless the maintainer rules an exception. On MERGED: spec: strict defineStack counts every top-level app of a packages[]-carrying stack against the stack's own manifest, while composeStacks and the load path count only the apps no body declares #32978 closes via Fixes; pm:dispatched comes off.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#2 · os-tesla · session_01L9qibvfX5bawZKtfa6u7j9

维护者速读

  • 改了什么:同 ACCEPT 6849491835;本次只是解冻后合入 main,PR 自身改动未变。
  • 为什么改:两扇门对 packages[] stack 的单应用判定不一致,见原 ACCEPT。
  • 风险与回滚:与原 ACCEPT 相同(spec minor,收紧一种形状,附迁移条目);回滚即 revert。
  • 先看:packages/spec/src/stack.zod.ts 的 residualSingleAppFinding。
  • 两分钟验证:pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/stack.test.ts。
  • 需要你做的:无。维护者已同意等解冻后落地(不申请例外),随下一版本发布。

席位意见:可以落地。

席位核对

ACCEPT · seat domain:spec#2 · head 35660b55 · 2026-11-13T13:18Z

  1. Shape: unchanged from ACCEPT 6849491835: Fixes #32978, 5 files, @objectstack/spec minor, Clause-②: yes (narrowing), Metadata-protocol: narrowed. 35660b55 is the relay pr_update_branch merge of main into 0d2b8278; git diff 0d2b8278 35660b55 over the PR's five paths is empty.
  2. Premise: unchanged; feat(spec)!: composeStacks refuses a flat composition that puts two or more apps under one app or module package id, and every packages[] body is held to one app #32898 merged. 18.4.0 is published (triage 6853211089), so this ships in the next release, per the maintainer's choice to hold until the thaw.
  3. Contract review: record 6848214183 PASS on 0d2b8278. The landing head differs from it only by a merge of main that touches none of the reviewed paths, so the judged text is byte-identical.
  4. Gates / check-runs: CI on 35660b55: 67 runs, 56 success, 11 skipped, 0 failed, 0 running. Dev battery at 0d2b8278 (os-dev report 6849465771) green. K = 2 since the new merge-base: under 15.
  5. Accepted deviations and out-of-scope findings: as in 6849491835 (N1–N5 in Acceptance notes; spec: strict defineStack refuses an additive packages[] artifact of differently-namespaced packages with STACK_NAMESPACE_PREFIX_INVALID, judging body objects against the stack manifest's namespace #33069 separate; ADR-0019 log follow-up after landing).
  6. Landing: not governed (check-governed-merges --pr 33074), 310 changed lines. The freeze is lifted (triage 6853236911). The seat readies the PR and arms auto-merge under the maintainer's standing words 「车道经理应该使用 pm-dispatch 技能审核和落地pr」. On MERGED: spec: strict defineStack counts every top-level app of a packages[]-carrying stack against the stack's own manifest, while composeStacks and the load path count only the apps no body declares #32978 closes via Fixes; pm:dispatched comes off.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 13, 2026 13:18
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit 2c98485 Nov 13, 2026
68 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-77f6jr branch November 13, 2026 13:46
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…] body are judged since 2026-11-13 (objectstack-ai#33502)

<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X4e82tcKptpRRoyvCJDwBeL)_

Fixes objectstack-ai#33135

domain:skills#1 · os-project-manager · session_01FEkQ5obDWQ7NdtH2f9iZXC

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 改了什么:ADR-0019 在 2026-11-12 的执行记录里写着「两种形状不受检查:扁平的 `composeStacks`,和手工拼的
`packages[]` 包体」。这句改成当日的读数(过去时),并在其后新增一段「自 2026-11-13 起,组合与 `packages[]`
包体都受检查」,逐条写明 objectstack-ai#32898、objectstack-ai#33074、objectstack-ai#33122 三次合并各自检查了什么;状态行的「已落地」也补上这三次合并及其提交号。
- 为什么改:这句话两半在 `main` 上都已不成立:扁平组合把两个以上应用放到同一个 app/module
包名下会被拒(`STACK_SINGLE_APP_VIOLATION`,422),手工拼的包体也按包分别检查单应用和命名空间前缀。照着旧文字读的作者或
AI 会以为这些形状不受检查。
- 风险与回滚:只改决策记录文字,不动代码、协议和技能包;回滚即还原本 PR。
- 先看:`docs/adr/0019-app-as-consumer-unit.md` D3 修订说明下的「Enforced for
compositions and `packages[]` bodies since 2026-11-13」一段;再看第 3
行状态行新增的那半句。
- 两分钟验证:`pnpm check:adr-symbol-anchors`,预期 exit 0、「anchors across 156
records resolve」。
- 需要你做的:受管面 Tier H(`docs/adr/**`):请批准或合并。

## What changes

- **`docs/adr/0019-app-as-consumer-unit.md`, D3, the 2026-11-12 note
"Enforced for modules since 2026-11-12".** Its sentence "The check reads
one `defineStack` call. Two shapes are not judged (objectstack-ai#32810): a flat
`composeStacks` … and a hand-built `packages[]` body." is rewritten as
the reading at that merge, in the past tense, and points to the next
paragraph: "At this merge the check read one `defineStack` call, and two
shapes were not judged (objectstack-ai#32810): … Both are judged since 2026-11-13; see
the next paragraph." The rest of that paragraph is unchanged.
- **New dated paragraph "Enforced for compositions and `packages[]`
bodies since 2026-11-13."**, following the file's own convention (the
2026-11-12 note keeps the paragraph before it "as written" and adds a
dated note). One bullet per merge:
- objectstack-ai#32898 (`0b23b2a0c4`): `composeStacks` refuses a flat composition
(`'last'`, `'first'` or an index) whose kept manifest is an `app` or
`module` package and that brings two or more apps,
`STACK_SINGLE_APP_VIOLATION` (422), naming each app and its input; the
remedy is `manifest: 'preserve'`; every `packages[]` body of a
composition is held to one app; a one-input composition is handed back
unjudged.
- objectstack-ai#33074 (`2c98485db5`): changes only how strict `defineStack` counts
the top level of a `packages[]` stack. Before, every top-level app
counted against `manifest.id`; since, the residual rule objectstack-ai#32898 gave
`composeStacks` (top-level apps no body declares count against
`manifest.id` beside that id's own body). Bodies are judged as before,
per body since objectstack-ai#32898.
- objectstack-ai#33122 (`5b2ec820c8`): strict `defineStack` judges namespace prefixes
per body against the body's own namespace, residual top-level objects
against `manifest.namespace`, `STACK_NAMESPACE_PREFIX_INVALID`; a body
with no namespace is not judged.
- What stays unjudged at `defineStack` (other package types, no
manifest, `strict: false`, the last now judged at `composeStacks`), and
the placement sentence, which stands (measured, below).
- **Status line, "Landed in spec".** After the objectstack-ai#32586 clause: "and the
same rule on a flat `composeStacks` and on every `packages[]` body
(objectstack-ai#32898, merged 2026-11-13 as `0b23b2a0c4`; objectstack-ai#33074, merged 2026-11-13 as
`2c98485db5`), and the namespace-prefix rule judged per `packages[]`
body (objectstack-ai#33122, merged 2026-11-13 as `5b2ec820c8`)."
- Not touched: the D3 reasons, the 2026-11-12 "Enforced today, and not
yet." paragraph, ADR-0130 (the order's surface is this file only), and
`skills/**` (PR objectstack-ai#33475 teaches the flat-compose fact there).

## Why

Read on `origin/main` `b392ff7b`, not from the card:

- `packages/spec/src/stack.zod.ts`: `collectComposedSingleAppErrors` and
`flatSingleAppFinding` (flat result: every app counts against the one
kept manifest), `SINGLE_APP_PACKAGE_TYPES` = `app`, `module`,
`SINGLE_APP_COMPOSE_REMEDY` (names `manifest: 'preserve'`),
`collectPackageBodySingleAppErrors` (each body by its own `type`, `id`,
`apps`), `validateSingleApp` and `residualSingleAppFinding` (one judge
for both doors), `namespacePrefixErrors` (per body, residual top level),
`composeStacks`' `stacks.length === 1` early return.
- `examples/app-multi-package/objectstack.config.ts` composes with
`manifest: 'preserve'`.
- Attribution per PR, read from each merge commit's tree:
`residualSingleAppFinding`, `flatSingleAppFinding` and
`collectPackageBodySingleAppErrors` exist at `0b23b2a0c4` (objectstack-ai#32898),
where `validateSingleApp` does not call the residual judge; it does at
`2c98485db5` (objectstack-ai#33074); `namespacePrefixErrors` first exists at
`5b2ec820c8` (objectstack-ai#33122).
- Each merge commit is an ancestor of `origin/main` (`git merge-base
--is-ancestor`, exit 0 for all three, after deepening the shallow
clone).
- One probe against `packages/spec/dist` built from `b392ff7b`, not kept
as a test:

  | Shape | Answer |
  |:--|:--|
| flat `composeStacks` (default `'last'`) of two module stacks with one
app each | refused, `STACK_SINGLE_APP_VIOLATION` 422 |
  | the same under `manifest: 'preserve'` | accepted |
| hand-built `packages[]` body (module) with two apps, `defineStack` |
refused, `STACK_SINGLE_APP_VIOLATION` 422 |
| hand-built body, namespace `svc`, object `crm_case` | refused,
`STACK_NAMESPACE_PREFIX_INVALID` 422 |
  | control: same body with `svc_case` | accepted |
  | placement: module with no objects, app names `crm_case` | accepted |
| placement: object-less body's app names a sibling body's object,
`defineStack` and `'preserve'` compose | accepted |

The placement sentence therefore stands, as the order asked to measure.

Ruling: Leehom 2026-11-14T21:21:06Z 「开放 p3卡认领」 (p3 cards open for
claiming); scope widened to both halves by the skills seat's note
6884985712 on the card.

## Acceptance notes

- **The 2026-11-12 paragraph is edited, not kept verbatim.** The order
asks for both "rewrite the whole sentence" and "keep the dated paragraph
as the reading at that date". Rewriting the one sentence into the past
tense, with a pointer to the new note, does both: the paragraph still
reads as at objectstack-ai#32586's merge, and no present-tense sentence on the page is
false.
- No out-of-scope findings.

## Verification

Head `691fe886` (round 1, after contract review 6885553305; round 0 was
`c72ef404`), base `origin/main` `b392ff7b`.

<details><summary>Derived gates: 21 derived, 21 run, all exit
0</summary>

`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 21 families for the one path. Each
ran on head `c72ef404` (round 0) and again on `691fe886`, 21 of 21 exit
0 (`33135-gates-ran-r1.txt`) with its exit code captured before any
pipe, after building `@objectstack/lint...` under the verify lock
(VERDICT command-exit 0, 86s):

- exit 0: `check-adr-links` (scan and `--self-test`),
`check-closing-keyword-parity` (scan and `--self-test`),
`check-comment-mask-corpus`, `plan-test-core-shards --self-test`,
`@objectstack/lint check:doc-formula-expressions`, `check:adr-anchors`,
`check:adr-index`, `check:adr-symbol-anchors` ("3594 anchors across 156
records resolve"), `check:ci-filter-parity`,
`check:closed-ceremony-text`, `check:cross-package-test-inputs`,
`check:doc-authoring`, `check:driver-memory-census`,
`check:gitlink-declared`, `check:nul-bytes`, `check:pm-governed-merges`,
`check:pm-prior-rulings`, `check:refd-timer-probe`,
`check:watch-hint-literal`.
- `--ran` reconciliation: "21 derived famil(ies) accounted for — 21 run,
0 NOT-MEASURED".
- The path-less symbol continuations (`#flatSingleAppFinding`,
`#SINGLE_APP_COMPOSE_REMEDY`, `#collectPackageBodySingleAppErrors`,
`#validateSingleApp`, `#residualSingleAppFinding`,
`#namespacePrefixErrors`) are not judged by `check:adr-symbol-anchors`
(that spelling is off in this corpus); each was found by `grep` as a
declaration in `packages/spec/src/stack.zod.ts` on `b392ff7b`.
- CI families are read from this PR's check-runs, not re-run here.

</details>

<details><summary>Tier and governed readings</summary>

- `dispatch-gates --tier`: MANDATORY contract-review tier for
`docs/adr/**`; no one-line exit for this surface. This thread ran at the
claim's default model; the seat's in-seat contract review is the owed
record.
- `node scripts/pm/check-governed-merges.mjs --branch
claude/project-thread-bd7546`: GOVERNED, landing tier H (人合),
`docs/adr/**` x1. Size +50 / -4, under the 3000 threshold.
- `node scripts/pm/check-skill-line-ratchet.mjs`: exit 0 (no skill file
touched). No changeset: `docs/adr/**` ships in no package
(`skip-changeset`).

</details>

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

https://claude.ai/code/session_01FEkQ5obDWQ7NdtH2f9iZXC

<!-- signed: domain:skills#1 · os-project-manager ·
session_01FEkQ5pjSPT7ui2EUcunaVb -->

---------

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