Repository navigation
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
Conversation
…ckage id to at most one app A flat composition (manifest 'last', 'first' or an index) keeps one manifest and concatenates every input's apps under it, so an app package and a module package with one app each became one package id with two apps. composeStacks now refuses that with STACK_SINGLE_APP_VIOLATION, naming the package, each app with its input and the manifest: 'preserve' remedy; defineStack and composeStacks judge every packages[] body by the same rule. The defineStack finding names the preserve remedy and derives its package-type label from the type. Claude-Session: https://claude.ai/code/session_01L6bhgWcBCVseHddrok9Ndf Co-authored-by: Claude <noreply@anthropic.com>
…package id; docs example composes under preserve The concat-mechanics pins compose with a selected plugin manifest, the preserve reference fixtures give the second package no app, and the composeStacks plus defineStack integration pin now asserts that two app packages with an app each are refused flat. The getting-started composition example composes CRM and Todo with manifest: 'preserve'. Claude-Session: https://claude.ai/code/session_01L6bhgWcBCVseHddrok9Ndf Co-authored-by: Claude <noreply@anthropic.com>
…-2eliu6 Claude-Session: https://claude.ai/code/session_01L6bhgWcBCVseHddrok9Ndf Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 171 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 6e32ebc5007c307ee792087fdb85fa2c8678801e && git checkout 6e32ebc5007c307ee792087fdb85fa2c8678801e
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c54a23d2237dd1fce2b01f66de31d3ea33735d7c 16e4c087248237dfd5e77d81044b204426f51191 && git checkout -B drift-repro c54a23d2237dd1fce2b01f66de31d3ea33735d7c && git merge --no-ff 16e4c087248237dfd5e77d81044b204426f51191
node scripts/docs-audit/affected-docs.mjs --json c54a23d2237dd1fce2b01f66de31d3ea33735d7c
|
…er the artifact's manifest id, as the load path registers them A result that carries packages[] registers each body under its own id, and the boot's residual rule registers every top-level app no body declares under the artifact's manifest id. The composed judgment now follows that: under every manifest option, those residual apps are counted together with the apps of the body that has the manifest id. A preserve composition whose input has no manifest but brings an app is refused, and a flat composition of a nested artifact whose flattened copy repeats its bodies' apps is no longer counted against the kept manifest. Also from the contract review's nits: findings print a package with no id by its name, the docblocks say which door judges what (strict: false inputs included), the composeStacks example names this refusal, and the semantic entry says that under preserve the artifact identity is the last input's. Claude-Session: https://claude.ai/code/session_01L6bhgWcBCVseHddrok9Ndf Co-authored-by: Claude <noreply@anthropic.com>
|
domain:spec#2 · os-sales · session_01L6bhgWcBCVseHddrok9Ndf Contract review brief — PR #32898 @
|
|
domain:spec#2 · os-sales · session_01L6bhgWcBCVseHddrok9Ndf Contract reviewServed-tier: Read for this record: card #32810 (body and its six comments), PR #32898 (body, its 11 files, the net diff from merge base ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
What holds:
S1 · should-fix · the top level is judged by the
So The mirror case over-refuses. Under a flat option, an input that carries Owed, one of two. Either judge what registration puts under the artifact's manifest id under every option; the inputs that are assembled into no body are the two cases Nits, none of which changes what is accepted or refused:
Grades: S1 should-fix; N1 to N5 nit. No must-fix. The nits sit under Implemented-by: VERDICT: PASS |
|
domain:spec#2 · os-sales · session_01L6bhgWcBCVseHddrok9Ndf Contract reviewServed-tier: This is a delta round. It follows record 6839703155, rendered on Read for this round: the diff from ① Derived judgments
② Semver levelUnchanged and still right: ③ Boundary flags
④ Design judgment
S1 is answered, and the answer holds. The commit took the first of the two routes the first record offered: it judges what registration puts under the artifact's manifest id, under every option. Read against the load path, piece by piece:
Tried against it, each with the outcome registration gives:
The nits of the first record:
New in this round, none of which changes what is accepted or refused:
Grades: S1 answered, no should-fix open; N1 to N5 addressed; N6 to N9 nit. No must-fix. The new nits sit under Implemented-by: VERDICT: PASS |
|
domain:spec#2 · os-tesla · session_01L9qibvfX5bawZKtfa6u7j9 Contract reviewServed-tier: Landing-head round. The head merges ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentThe narrowing makes the spec's own refusal real and takes no declared capability away. ADR-0019 D3 as amended, on Tried against the tree at this head: a new product caller composing flat with two apps (none); a No must-fix and no should-fix. N6 to N9 of record 6840656371 stand as accepted deviations. New nits:
Implemented-by: VERDICT: PASS |
|
domain:spec#2 · os-tesla · session_01L9qibvfX5bawZKtfa6u7j9 维护者速读
席位意见:可以落地。 席位核对ACCEPT · seat
|
…ition of two apps under one package is refused (objectstack-ai#33475) <!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XXDXbLfrrkD6FUmGTNP2aVq)_ Fixes objectstack-ai#32977 domain:skills#1 · os-project-manager · session_01FEkQ5mo8ZsDz2BHVZiwWLs Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:`bootstrap.md`「多应用组合」一节改为:套件(一个 app 包加若干 module 包,各带一个应用)用 `composeStacks(stacks, { manifest: 'preserve' })` 组合,保留每个包自己的 id(`examples/app-multi-package` 就这么用);扁平组合(`'last'` 默认、`'first'`、索引)只留一个 manifest,一个 app/module 包 id 下落两个以上应用即被拒(`STACK_SINGLE_APP_VIOLATION`,422)。删掉「本仓没有应用用它」这句错话。`objectstack-ui/SKILL.md`「App Navigation」补同一条补救:套件用 `preserve` 组合,扁平组合会被拒。 - 为什么改:objectstack-ai#32810(PR objectstack-ai#32898)已让 `composeStacks` 拒绝扁平组合出「一个包 id 下多个应用」,技能文字没教 `preserve`,AI 照写扁平组合会白跑一轮被拒。 - 风险与回滚:纯技能文字,两个文件 +32/-24 行,外加 `@objectstack/skills` patch changeset;新增文字由同文件删除重复内容付账,两个文件都仍在 token 上限内,未抬任何上限;回滚即还原本 PR。 - 先看:`skills/objectstack-platform/references/bootstrap.md` 的 Multi-App Composition 一节;`skills/objectstack-ui/SKILL.md` 第 139–147 行(App Navigation 第二段)。 - 两分钟验证:`node scripts/check-skills-token-ratchet.mjs | grep -E "bootstrap|objectstack-ui/SKILL"`,预期 bootstrap.md 1340/1343、objectstack-ui SKILL.md 3809/3814,均不超限。 - 需要你做的:受管面 Tier H(`skills/**`):请批准或合并。 ## What changes - **`skills/objectstack-platform/references/bootstrap.md`, § Multi-App Composition.** The `composeStacks()` paragraph said "No app in this repo uses it — read the schema before reaching for it" and named no strategy for a suite. It now says: a suite (an app package plus module packages, one app each) composes with `composeStacks(stacks, { manifest: 'preserve' })`, which keeps each package's own id (`examples/app-multi-package`); a flat `manifest` (`'last'`, the default, `'first'` or an index) keeps one, so two or more apps under one `app` or `module` package id are refused (`STACK_SINGLE_APP_VIOLATION`, 422). Card Work items 1 and 2. - **`skills/objectstack-ui/SKILL.md`, § App Navigation** (fold 6846119916 row 1). The suite sentence now ends with the remedy: the suite composes with `composeStacks(stacks, { manifest: 'preserve' })`, which serves each app under its own package id; a flat composition puts them under one and is refused. - **`.changeset/32977-skills-suite-composes-under-preserve.md`**: `'@objectstack/skills': patch`, carrying both declaration lines. - **`docs/adr/0019-app-as-consumer-unit.md` is not touched** (fold 6846119916 row 2). The folded row and objectstack-ai#33135 name the same sentence of the 2026-11-12 "Enforced for modules" note ("Two shapes are not judged ... a flat `composeStacks` ... and a hand-built `packages[]` body"), so the ADR stays with objectstack-ai#33135 as the order rules. objectstack-ai#33135's Expected names only the hand-built body; the flat-composition half of that sentence is false too since PR objectstack-ai#32898, so objectstack-ai#33135's PR should rewrite the whole sentence (noted in the report for the seat). ### Paid in the same file (no ceiling moved) - `bootstrap.md`: the title's "(moved verbatim from SKILL.md)" (no longer true once this section changes); "this is how real multi-app composition happens" and "equal the physical table name" (the second restates `objectstack-platform/SKILL.md` § Object naming); "Use barrel exports to keep config clean:" and "A minimal but complete project from scratch:" (each restates its heading); "(traditional)" and "(key becomes name) ... for readability" in the Map Format comments (the sentence above the block says the key becomes the `name`); the `stack.zod.ts` file pointer (`references/_index.md` carries the schema pointers). - `objectstack-ui/SKILL.md`: the `subforms` example's "relationshipField + columns are derived from the child object" comment (the paragraph under the list says the FK and columns are derived in every case); the `requiresObject` / `requiresService` note shortened to what it says ("hide an item whose optional system object or kernel service is missing"). The pinned lines named in the file's CEILINGS entry are untouched. ## Why Read on `origin/main` 34c0522, `packages/spec/src/stack.zod.ts`: - `SINGLE_APP_PACKAGE_TYPES` = `app`, `module`. `SINGLE_APP_COMPOSE_REMEDY` is the text every single-app finding names: "compose the packages into one artifact with composeStacks(stacks, { manifest: 'preserve' }), which keeps each package's own id (a flat composition puts every app back under one)". - `composeStacks` calls `collectComposedSingleAppErrors(stacks, composed, opts.manifest)` and throws `StackSingleAppViolationError` (`code = 'STACK_SINGLE_APP_VIOLATION'`, `status = 422` from `StackRefusalError`) with the header `composeStacks single-app validation failed (N issues):`. With no `packages[]` in the result, `flatSingleAppFinding` refuses when the composed manifest's type is in the set and the composed `apps` has more than one entry, naming each app with the input it came from. - `examples/app-multi-package/objectstack.config.ts` line 68: `export default composeStacks([ordersStack, coreStack], { manifest: 'preserve' });`, so the old "No app in this repo uses it" was false. ## Acceptance notes - `resolveArtifactCollections` (`@objectstack/runtime`, named in 6846119916 as the platform reader the remedy could name) is not taught: the ask is the `preserve` remedy, the file has no headroom, and an author composes with `composeStacks`, not with the runtime reader. - No eval is added: the card asks for teaching text only. - `origin/main` moved to b5f2f51 (objectstack-ai#33292) after the branch was cut; it touches none of these files, so no merge. ## Verification Head `f4fc5ea9`, base `origin/main` 34c0522. <details><summary>Line and token budget (skills/**)</summary> - `skills/objectstack-platform/references/bootstrap.md`: 190 to 188 lines, 5398 to 5390 bytes; token ratchet 1342 to 1340 (ceiling 1343, headroom 3). - `skills/objectstack-ui/SKILL.md`: 301 to 301 lines, 15276 to 15253 bytes; token ratchet 3814 to 3809 (ceiling 3814, headroom 5). - Whole package, all `skills/*/SKILL.md`: 4602 to 4602 lines. Bundle total (whole shipped tree): 244649 to 244642 tokens. - `node scripts/pm/check-skill-line-ratchet.mjs`: exit 0. `node scripts/check-skills-token-ratchet.mjs`: exit 0. No ceiling raised. </details> <details><summary>Derived gates: 48 derived, 46 run green, 2 NOT MEASURED</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 48 families for the three paths. `turbo run build --filter=@objectstack/formula --filter=@objectstack/lint --filter=@objectstack/spec` ran first under the verify lock (VERDICT command-exit 0, 87s). Each family was then run with its exit code captured before any pipe. - 46 exit 0, among them `check-adr-0087-registration`, `check-empty-changeset`, `check-skills-token-ratchet` (scan and `--self-test` each), `@objectstack/lint check:doc-formula-expressions`, `@objectstack/spec check:skill-docs` and `check:skill-refs`, `check:doc-authoring`, `check:nul-bytes`, `check:pm-governed-merges`, `check:published-files`, `check:scaffold-emission-policy`, `check:skill-compatibility`, `check:skill-frame-sync`, `check:skill-identifier-liveness`, `check:skill-links`; `check:dts-closure` and `check:sourcemap-no-sources-content` over the 5 built packages only. - NOT MEASURED, exit 3 PREREQUISITE NOT MET (every package's `dist/`): `check:dual-build-cjs-loads`, `check:lean-entry-closure`. No package source is touched, so no full build was paid; CI builds and runs them. - `--ran`: "48 derived famil(ies) accounted for — 46 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)". - 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, `skills/**` under clause ① (the published catalog); no one-line exit for this surface. - `node scripts/pm/check-governed-merges.mjs --branch claude/project-thread-rqofat`: exit 3, GOVERNED, landing tier H. 2 of 3 paths on the register (`skills/**`); the changeset is not. Size +32 / -24, under the 3000 threshold. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01FEkQ5mo8ZsDz2BHVZiwWLs <!-- signed: domain:skills#1 · os-project-manager · session_01FEkQ5pjSPT7ui2EUcunaVb --> Co-authored-by: Claude <noreply@anthropic.com>
…] 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>
Requested by Sales · project thread
Fixes #32810
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #32977 (skills/objectstack-platform/references/bootstrap.md; skills/objectstack-ui/SKILL.md and the ADR-0019 note folded in by comment 6846119916)
维护者速读
composeStacks扁平组合(默认manifest: 'last'、'first'或下标)若把两个以上应用放到同一个 app/module 包 id 下,现在会被拒(STACK_SINGLE_APP_VIOLATION,422),报错写出包 id、每个应用来自哪个输入、以及改用manifest: 'preserve';defineStack与composeStacks也按同一规则判每个packages[]包体;结果带packages[]时,没有任何包体声明的顶层应用(例如 preserve 下没有 manifest 的输入带来的应用)会被加载路径登记到制品 manifest 的 id 下,现在和该 id 包体自己的应用一起判。defineStack的报错文案补上 preserve 改法,包类型标签从类型推导。defineStack判单个包,扁平组合会把各包的应用合到一个包 id 下,没有任何一道门拦。examples/app-multi-package已用 preserve),7 个 spec 测试夹具与一页入门文档按席位同意的方式改了;hotcrm 的测试视图test/helpers/composed-stack.ts是扁平组合,升级到含本改动的版本前要先迁(平台读法卡 runtime: no public reader returns a composed artifact's collections across itspackages[]bodies, so a consumer that needs "every collection of the suite" can only compose flat — which #32810 refuses for a suite #32827)。回滚即 revert 本 PR。packages/spec/src/stack.zod.ts的collectComposedSingleAppErrors(及flatSingleAppFinding/residualSingleAppFinding)与composeBuiltStacks第 3c 步;同文件singleAppFinding/validateSingleApp;packages/spec/src/stack.test.ts新 describe。pnpm --filter @objectstack/spec exec vitest run src/stack.test.ts -t "composeStacks — at most one App",预期 11 条全绿,其中一条是「扁平组合 app 包与 module 包各一应用被拒,点名包、各应用来源与 preserve 改法」。席位意见:可以落地。落地头契约复审 PASS 6845646714,CI 全绿,非受管面,随 18.4.0 发版。
What changes
composeStacksjudges what it puts under each package id (packages/spec/src/stack.zod.ts, newcollectComposedSingleAppErrors, called as step 3c ofcomposeBuiltStacks, after the artifact cross-reference pass — the orderdefineStackruns its cross-reference and single-app refusals in):manifest: 'last', the default,'first'or an index) of inputs that carry nopackages[]keeps one manifest and concatenates every input'sappsunder it: its result is one package. When that manifest is anappormodulepackage and the result holds two or more apps, it is refused withSTACK_SINGLE_APP_VIOLATION(422), headercomposeStacks single-app validation failed (N issues):. The finding names the package, each app with the input it came from and the remedy, e.g. "A 'module' package must define at most one app, but composeStacks with manifest: 'last' gives package 'com.example.crm.service' 2 ('crm_sales' from 'com.example.crm' (stack #0), 'crm_service' from 'com.example.crm.service' (stack Add metamodel interfaces for ObjectQL/ObjectUI contract #1)): a composition that keeps one manifest puts every input's apps under that one package id. Keep one app per package and compose the packages into one artifact with composeStacks(stacks, { manifest: 'preserve' }), which keeps each package's own id (a flat composition puts every app back under one) — ADR-0019 (app-as-consumer-unit) D3 as amended (a suite may surface several apps, one per package)."packages[]body the result carries is judged by its owntype,idandapps, under every manifest option.91fca555, answering contract-review should-fix S1 in record 6839703155). A result that carriespackages[]registers each body under its own id, and the boot's residual rule (unclaimedTopLevelin@objectstack/metadata, mirrored in this file byisResidualTopLevelItem) registers every top-level app that no body declares under the artifact's manifest id. Under every manifest option those apps are now counted together with the apps of the body that carries that id, and two or more, at least one of them residual, are refused (residualSingleAppFinding). That closes a'preserve'composition whose input has no manifest but brings an app, which the first head accepted, and it stops counting a nested artifact's flattened copies of its bodies' apps against the kept manifest of a flat composition, which the first head over-refused. A one-app-per-package'preserve'composition, where every input that defines an app carries a manifest, leaves no residual app and builds as before.defineStack, and not at all when that input was built withstrict: false.defineStackjudges everypackages[]body too (validateSingleAppnow addscollectPackageBodySingleAppErrors), so a hand-assembled artifact whose body defines two apps is refused at the door it enters. The stack's own package is judged as before; the readconst type = config.manifest?.typethat themanifest.typeliveness evidence quotes is unchanged.singleAppFinding, for the authored stack and everypackages[]body; a composition's result is judged byflatSingleAppFindingandresidualSingleAppFindingwith the same predicate and constants): review nit N3 — the remedy now namescomposeStacks(stacks, { manifest: 'preserve' }); review nit N2 — the package-type label is derived from the type (An 'app' package,A 'module' package), not two hard-coded strings. The words "must define at most one app" stay, whichpackages/cli/test/generate-scaffolds-reach-stack.e2e.test.tsandstack-refusal-envelopes.test.tsmatch. Nit N1 (the module finding offers no fold remedy) is unchanged. A package with noid(reachable only throughstrict: false) is printed by itsname, asstackLabeldoes, not as'undefined'(contract-review nit N4).StackSingleAppViolationErrordocblock names its two raise sites; theSTACK_SINGLE_APP_VIOLATIONledger comment inerror-code-ledger.zod.tssays the same (enum member, family and status untouched); thecomposeStacksTSDoc and themanifestoption's doc state the rule.packages/spec/src/migrations/entries/semantic/18.compose-stacks-flat-second-app-refused.ts(adr-0087: registered compose-stacks-flat-second-app-refused), no D2 conversion — whether the inputs are one package or several, and which app stays where, is the author's call..changeset/32810-compose-stacks-single-app.md:@objectstack/specminor, BREAKING banner, Before / Now / Unchanged / Fix; the Fix names the flat-composition-as-a-test-view usage and its move.content/docs/getting-started/examples.mdx§ Composition Pattern taughtcomposeStacks([CrmApp, TodoApp]), two app packages with an app each composed flat, which this change refuses. It now composes with{ manifest: 'preserve' }and says why (added to the claim's file surface by the seat).Why
ADR-0019 (app-as-consumer-unit) D3 as amended: a suite may surface several apps, each defined by a different package, and no package defines more than one — the Console addresses an app by its package id, read by its id a multi-app package answers as absent, and disabling a module removes the app that module owns. #32586 (merged
9ae829108c) enforced it per authored package indefineStack. Onorigin/main2ca09de55,validateSingleApphad one caller (defineStack), andcomposeStacksconcatenatedappsunder its one selected manifest without judging the result, so the default composition of a suite produced exactly the removed shape, and the #32586 finding's remedy did not say to compose underpreserve. Declared means enforced.Measured: who composes suite packages, and with which
manifestoptionRead-only. objectstack at
2ca09de55(the branch point); hotcrm at8277e61(shallow clone ofmain, read-only); the shipped templates are this repo'spackages/create-objectstack.manifest2ca09de55examples/app-multi-package/objectstack.config.ts:68(orders module + core app)'preserve'packages/**/src,ui/**ui/packages/core's deprecated re-exportpackages/create-objectstack(one bundled template,blank)composeStackspackages/spec: 52 files in cli, runtime, metadata, objectql, core, plugin-dev, plugin-security, service-automation, verify'preserve'dist(see Verification)packages/spectestscontent/docs/getting-started/examples.mdx:324'preserve'8277e61objectstack.config.ts:56, the artifact (5 packages; sales, service, marketing one app each; revenue, o2c none)'preserve'test/helpers/composed-stack.ts:43, a test view of every collection'last')app.objectstack.hotcrm(type: 'app') with three apps; refused at module load. 165 of 266 test files load it (158 directly, 7 throughtest/helpers/flow-regions.ts/stack-picklists.ts; staticgit grep, not a run). hotcrm pins@objectstack/*18.3.0, so nothing breaks before it bumps. Its move needs a public reader of a composed artifact's collections (resolveArtifactCollectionsis internal to@objectstack/runtime): filed by the seat as #32827, to land before or with the release that carries thisSeat disposition of the measurement: ruled A by the lane seat in the card thread, not yet recorded on the card itself (contract review ③). Narrow as the card orders; the hotcrm move rides #32827 and the hotcrm lane.
Tests
packages/spec/src/stack.test.ts, new describe "composeStacks — at most one App per package, judged on what the composition puts under each package id": a flat composition (default'last') of an app package and a module package with one app each is refused (envelopecode,status, one issue, header), naming the package, both apps with their inputs and the preserve remedy; the same under'first'and index0, selecting the app package; the same packages under'preserve'build unchanged, each body carrying its one app;defineStackrefuses a hand-assembledpackages[]body with two apps, naming the body (packages[0]) and both apps;composeStacksrefuses such a body that reached it throughstrict: false, under'last'and'preserve'; controls: a single-input composition is returned by identity, a flat composition whose inputs bring one app is accepted, and a flat composition whose selected manifest is apluginpackage is not judged. The existing HotCRM planned-shape pin (preserve of an app package and three modules) is unchanged and green. Added in91fca555: a'preserve'composition whose input with no manifest brings an app is refused, naming the package, the body's app, the residual app and the remedy; a flat composition of a nested artifact whose flattened copy repeats its body's app, plus a module with one app, is accepted; a flat composition with a nested artifact and two further modules with an app each is refused, counting only the two residual apps; and a package with noidis named by itsname.compose-stacks.test.ts"should compose outputs of defineStack" pinned two app packages' apps under one id (appslength 2), the removed shape: the todo stack now carries no app (objects 2, last-wins manifest kept), and the two-app pair is asserted refused (STACK_SINGLE_APP_VIOLATION, 422).compose-stacks-key-loss.test.ts"concatenates in stack order",compose-key-dispositions-export.pin.test.tspin 4 (everyconcatkey) andcompose-stacks-concat-shape-refusal.test.ts'sappscontrol: the subject is the concat pass, so the selected (last) manifest is apluginpackage, which this rule does not judge; a comment beside each says so and says to retype it if a ruling ever holdspluginto one app.compose-stacks-manifest-preserve.test.ts: the flat composition used as the reference (bodiesReproduceFlattened) and as theobjectConflictCONTROL now composes a second package with no app (withObjects(…, false)); theappscomparison still reads one app.dd30cfb0; the spec tests importsrc/, so nodistleg), each throughscripts/ablation-replace.mjsin WRAP mode, runningstack.test.ts,compose-stacks.test.tsandcompose-stacks-manifest-preserve.test.ts; every leg restored withgit diff HEADempty and the blob equal to HEAD (b18fea40):collectComposedSingleAppErrors(...)→[]): 4 red — the flat refusal,'first'/index, thestrict: falsebody, and the movedcompose-stacks.test.tspin.defineStackbody judgment: 1 red — the hand-assembledpackages[]body.manifest: 'preserve'): 2 red — the flat finding and the body finding.'preserve'too: 2 red — the preserve control and the existing HotCRM planned-shape pin.91fca555, the same way and the same three files, each leg restored to the HEAD blob (93e8d785):packages[]returns no finding): 2 red — the preserve residual refusal and the nested-artifact flat refusal.idalone: 1 red — the package named by itsname.Acceptance notes
claude/project-thread-2eliu6to this card thread, notclaude/issue-32810-*; the restated claim (6836152532) names it.packages[]bodies. The card's Work line 2 says "judge eachpackages[]body by the same rule"; feat(spec)!: defineStack holds a module package to at most one app, as it does an app package #32792's contract review (6833950860, ③ third flag) assigned "a module body with two apps inside a hand-builtpackages[]passesdefineStack" to this card. So the body judgment sits indefineStack(strict) and incomposeStacks; the seat agreed.defineStack(…, { strict: false })still skips it atdefineStack, andcomposeStacksjudges such a body when it is composed.appormodule(pluginand the rest — whetherpluginis held to one app has no ruling, and the measurement found no plugin caller that makes it matter, so noopen_question); a composition that keeps no manifest.plugincan still take an app package's app, or a residual app, under the plugin's id. Out of scope with the plugin question above; reported, not built.composeStacks's object / action conflict arms are untouched (ADR-0150 D4 work; spec: compose object-conflict refusal: pin the one unpinned preserve cell, add two admit CONTROLs, correct the changeset's before/error-text wording (follow-up of #32516) #32672 pins those cells).skills/objectstack-platform/references/bootstrap.md§ Multi-App Composition presentscomposeStacks()with itsmanifeststrategies and does not say a suite composes under'preserve'(it also says no app in this repo uses it, whileexamples/app-multi-packagedoes);skills/objectstack-ui/SKILL.md§ App Navigation says the refusal isdefineStack's for atype: 'app'package (already carried by skills, docs(adr): objectstack-ui § App Navigation, the ADR-0019 status line and the ADR-0130 fact row still say defineStack judges only a type: 'app' package, now that #32586 holds a module package to one app #32809). Product PRs do not editskills/**; the seat files the card.cf5a8840(brief 6839695698, record 6839703155): PASS, with should-fix S1 (the top level was judged by themanifestoption, while the load path decides by whether the result carriespackages[]) and nits N1 to N5, all answered in91fca555. Delta round on91fca555(record 6840656371): PASS, no must-fix, no open should-fix; nits N6 to N9 left as accepted deviations. Its ③ raises one item for the seat, outside this card:defineStackstill counts every top-level app of apackages[]-carrying stack against the stack's own manifest (onmainsince spec: defineStack refuses a module package that defines more than one app, the enforcement of the amended ADR-0019 D3 (a suite surfaces several apps, one per package) #32586, not moved here), which over-refuses an additive artifact and misses a hand-assembled stack with one undeclared app beside the same-id body's app.packages[]bodies, so a consumer that needs "every collection of the suite" can only compose flat — which #32810 refuses for a suite #32827 has a pull request open, feat(runtime): export resolveArtifactCollections, the reader of every collection of a composed suite #32928; it lands no later than the release that carries this change.content/docs/releases/,CHANGELOG.mdor generated reference edits.Verification
Final head
91fca555: the fix (79650a1a), the fixture moves (dd30cfb0), one merge oforigin/mainc04aa295db(cf5a8840; it brought 32 files, all underui/packages/{app-shell,auth,i18n}and.changeset/), and the contract-review fix (91fca555). No further merge ofmain: the lane seat parked this PR until the 18.4.0 version commit lands.Each command's exit code was written to disk before any pipe. Heavy runs held
scripts/pm/os-verify-lock.sh. All of the following ran on91fca555:pnpm --filter @objectstack/spec build: exit 0.pnpm --filter @objectstack/spec test: exit 0. 836 of 836 files passed; 26745 tests passed, 1 todo.pnpm --filter @objectstack/spec typecheck: exit 0, includingcheck:test-typecheck.pnpm --filter @objectstack/spec check:generated: exit 0. All 14 generated artifacts are up to date.pnpm exec eslinton the changed.tsfiles: exit 0, no findings.Gate families from
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 119 derived, 119 run, every one exit 0.--ranreconciliation: 0 NOT-MEASURED, 0 UNRUN. This coverscheck-changeset-no-majorandcheck-adr-0087-registration.Consumers: the 52 test files outside
packages/specthat callcomposeStacksor build apackages[]artifact, run against the@objectstack/specdistbuilt from this head:Plus
packages/cli's two nightly-tier e2e files,test/build-multi-package-artifact.e2e.test.tsandtest/build-package-docs-attachment.e2e.test.ts. These were run withOS_TEST_TIERS=nightly: 2 files, 11 tests, exit 0.Dogfood:
pnpm --filter @objectstack/dogfood test, the full battery with no shard or path, afterturbo run build --filter='@objectstack/dogfood^...': exit 0. 456 files passed and 3 skipped (459); 3831 tests passed and 42 skipped (3873).Ablation: legs A to E ran on
dd30cfb0and legs F to H on91fca555, both listed under Tests. Each leg went red on the tests named there and was restored to its HEAD blob.CI on
91fca555: 68 check-runs completed with none failed. Oncf5a8840,Type Check · workspacehad timed out in its checkout step without measuring anything. On this head it ran its type-check step to success.Contract review: round 1 on
cf5a8840(brief 6839695698, record 6839703155) passed with one should-fix (S1) and five nits. All six were answered in91fca555. The delta round on91fca555(record 6840656371) passed. It found no must-fix and no open should-fix. Its four new nits, N6 to N9, are wording and dead-fallback points underpackages/spec/src, left as accepted deviations.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgWcBCVseHddrok9Ndf