Repository navigation
feat(scenarios): run-scenarios --packages published|workspace; the gallery exporter refuses workspace records - #31188
Conversation
…porter refuses workspace records `--packages workspace` builds and packs every package the release publishes, scaffolds with the packed create-objectstack (its install pointed at the tarballs by a global pnpmfile), persists the tarballs as pnpm overrides, and refuses the scaffold unless every @objectstack/* package is a tarball and .claude/skills/ equals the workspace catalog. Every record and scorecard states its package source; the gallery exporter exports only published runs. Claude-Session: https://claude.ai/code/session_01FEkQ5motx584vybgif8qQe Co-Authored-By: Claude <noreply@anthropic.com>
…ished-only rule Claude-Session: https://claude.ai/code/session_01FEkQ5motx584vybgif8qQe Co-Authored-By: Claude <noreply@anthropic.com>
…tional file: spec, and compare skills skill by skill npx hands --package= to its children as npm_config_package, so the scaffolder's own npx skills@... ran as a bin of the scaffolder tarball and installed no skill. The sync copies each skill directory whole and leaves the catalog's top-level README. Claude-Session: https://claude.ai/code/session_01FEkQ5motx584vybgif8qQe Co-Authored-By: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 24 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 5 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 0 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 f102a12efdab3499ff61e3cb6792b1b728574e92 && git checkout f102a12efdab3499ff61e3cb6792b1b728574e92
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 66b17a3ed34b48a8270e5d61cbf7bfcb2fea898c 38562001b6482c348bf79c73f0e8952751b69fa6 && git checkout -B drift-repro 66b17a3ed34b48a8270e5d61cbf7bfcb2fea898c && git merge --no-ff 38562001b6482c348bf79c73f0e8952751b69fa6
node scripts/docs-audit/affected-docs.mjs --json 66b17a3ed34b48a8270e5d61cbf7bfcb2fea898c
|
The scaffolded project sits outside the checkout and pins no packageManager, so under Corepack its pnpm resolved the registry's latest (pnpm 12), which reads no npm_config_* variables: the global pnpmfile went unread and the install asked npm for the unreleased version. Every pnpm the scaffold and the settle step run now goes through a shim that runs the pnpm on PATH from inside the checkout, where the root's pin applies, with --dir pointing at the caller. The test workspace declares the repository's pin, asserts the project was installed by it, and reports the scaffold's full output when it fails. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5motx584vybgif8qQe
|
domain:devx#3 · os-project-manager · session_01FEkQ5njkh3xbcDN6EtSfw7 席位核对Verdict: ACCEPT · head
Generated by Claude Code |
Requested by Leehom · project thread
Fixes #31147
Clause-②: no
Metadata-protocol: none
维护者速读
run-scenarios新增--packages published|workspace,默认published(行为不变)。workspace先按发布的方式构建、pnpm pack本仓所有会发布的包,再用打包出的create-objectstack原样脚手架项目,依赖与技能都装自这些 tarball;每份运行记录和计分卡首行写明包来源(packages: published 18.3.0或packages: workspace @ SHA (unreleased))。画廊导出器只导出published的运行,workspace记录(以及未写明来源的记录)一律拒绝。38562001):CI 的 pnpm 是 Corepack 垫片,在仓外无packageManager的项目目录里会解析到 registry 最新版 pnpm 12,它不读npm_config_*,于是装依赖时直奔 npm 而失败。现在 workspace 模式里脚手架和收尾安装用的每个pnpm都固定为本仓自己的版本(见下文 pnpm is pinned to the workspace's)。@objectstack/scenarios,不发布任何东西,create-objectstack未改;published路径的脚手架命令不变,只多读一次已装的 spec 版本写进记录。回滚即还原本 PR。packages/qa/scenarios/src/runner/packages.ts(打包、pnpmfile、overrides、安装后核验)、src/export/record.ts的unpublishedRunRefusal与exporter.ts的调用点、src/runner/cli.ts的--packages接线。pnpm --filter @objectstack/scenarios exec vitest run --maxWorkers=2 test/runner/packages.test.ts test/export/exporter.test.ts,预期 49/49 通过(含工作区独有技能标记落进.claude/skills/、workspace记录被导出器拒绝)。What changes
run-scenarios --packages published|workspace(runner/cli.ts), defaultpublished, which keeps today's scaffold command (npx -y create-objectstack@VERSION) byte for byte.--packages workspacebeside--create-versionis refused: the version names a published scaffolder.workspacemode (runner/packages.ts, new), built once per run before the first card:@objectstack/*orcreate-objectstack(75 today),turbo run build build:distfiltered to them (build:distis the Console copy the release'sconsole:buildmakes).pnpm packs each one: the tarball npm would serve,files[]only, everyworkspace:range rewritten to the version.create-objectstack, untouched:npx -y file:TARBALL NAME, its own install, its own skills sync, its own summary. Everypnpmit runs, and the install in step 4, is the workspace's own pinned pnpm (pinnedPnpm, see Acceptance notes). Itspnpm installis pointed at the tarballs by a global pnpmfile (npm_config_global_pnpmfile) whosereadPackagehook rewrites every packed name in every dependency field of every manifest. The project'spackage.jsonis not rewritten: it pins the version, as a published scaffold does.overridesin the project'spnpm-workspace.yamland installs again, so a laterpnpm addby the agent stays on the tarballs.@objectstack/*/create-objectstackentry innode_modules/.pnpmis a tarball (@file+…) and.claude/skills/holds the workspace build's catalog (packages/skills/dist/skills), skill for skill and file for file.runner/scorecard.ts):RunRecordMeta.packagesis required, so every record states it asenv.packages({ source: 'published', versions }or{ source: 'workspace', commit, uncommitted }) andenv.packagesLine; the scorecard table's first line ispackages: published 18.3.0orpackages: workspace @ SHA (unreleased)(+ uncommitted changeswhen the tree had any). The published version is the@objectstack/speceach scaffolded project installed.export/record.tsunpublishedRunRefusal, checked inexporter.tsbefore the pass judgement): aworkspacerecord, a record that states no package source (written before this flag), and apublishedrecord with no version are refused per card, with the reason; as for any refusal, an app the previous index listed is removed when its newest record is refused. The export CLI offers no flag around it.runCommand/scaffold(runner/project.ts) take an environment addition (the pnpmfile variable, and thePATHthat leads with the pinned pnpm), merged over the existing environment. README: the--packagescommand line and a Package source paragraph.Why
The maintainer's ruling on the card, verbatim: 「两种都要」 — run on the published packages after each release, and a runner option to run on the workspace's unreleased packages beforehand, so a skill change can be measured before it ships. A workspace run's
@objectstack/specpin still reads18.3.0(the workspace has not been versioned), which is why the exporter cannot trust the version and refuses on the stated source instead.Tests
test/runner/packages.test.ts, new, 9 cases, ~3 s of tests): a temp pnpm workspace holding a skills catalog with a marker skill and a stand-increate-objectstackthat does what the real one does in its order (write the manifest andpnpm-workspace.yaml,pnpm install, copy each skill). The pack, thenpx -y file:scaffold, the pnpmfile and both installs are the real tools, at a version npm never published, so an install that reached for the registry fails instead of quietly finding something. Pins: only the released packages are built and packed (aprivateone is not) and the commit is stated; the marker present only in the workspace build is in.claude/skills/and the verification is empty; the installed package is the tarball (@file+), not a link, and a file outsidefilesis absent;package.jsonkeeps the version pin,pnpm-workspace.yamlgains the overrides, the lockfile carries no pnpmfile checksum; the hook rewrites only packed names, in every field; every install ran the workspace's pinned pnpm (the project'snode_modules/.modules.yamlnames the checkout'spnpm --version; the temp workspace declares that pin as the real root does). A failed scaffold reports its whole output. Negative pins: a published catalog in.claude/skills/(no marker, an extra skill) is refused file by file; a registry store entry is refused; a project with no pnpm store is refused.test/export/exporter.test.ts, new top-level describe, 4 cases): aworkspacerecord that passed every half (judgeRecordpasses it) is refused and nothing of it is written; a newerworkspacerecord removes the published export it follows; a record with no package source, and a published one with no version, are refused; a published run exports and itsscorecard.mdstatespackages: published 18.3.0.test/runner/units.test.ts, new describe, 3 cases): defaultpublished,workspacetaken, an unknown value andworkspace+--create-versionrefused; both line forms; the published version read from the installed spec. Existing record fixtures (orchestrate.test.ts,export/fixture.ts) now statepublished 18.3.0.Ablations (each restored: blob == HEAD, git diff HEAD empty)
Ablations 1–3 run through
scripts/ablation-replace.mjs(anchor x1 → x0, replacement x0 → x1); the suites importsrc/directly, so no dist leg.if (unpublished)guard inexporter.tsANDed with an always-falseString("ABL1").lengthcomparison):exporter.test.ts -t 'only a run on published packages'→3 failed | 1 passed(the workspace, newer-workspace and unstated/versionless cases red; the published case green).if (differ.length)guard inpackages.tsANDed with an always-falseString("ABL2").lengthcomparison):packages.test.ts→1 failed | 7 passed(the published-catalog refusal).ABL3_npm_config_global_pnpmfile):packages.test.ts→ thebeforeAllscaffold answers exit 1 (the install reaches for a version npm never published), the suite reds, 5 cases do not run.packages.tsthat38562001carries, by a saved copy ofpackages.tsrestored withcmpclean), the shim dropped from the scaffold'sPATH(env.PATHset to the inheritedPATH), run under a CI-shaped Corepack (COREPACK_HOMEset,corepack enableinto a temp bin first onPATH,CI=true):packages.test.ts→ thebeforeAllscaffold answers exit 1 with CI's exact error,No matching version found for @objectstack/skills@0.0.0-scenario-workspace-test while fetching it from https://registry.npmjs.org/; restored,9 passed.Live workspace scaffold, no model (the order's no-live-run rule held)
Measured in this container on the branch after a release-shape build of the scaffold closure plus the Console (
turbo run build build:dist, 98 tasks, 15 min 14 s, exit 0):create-objectstackexit 0 in 14 s; settle (overrides + install,Already up to date) exit 0 in 7 s.node_modules/.pnpm: 61@objectstack/*entries, 0 not from a tarball;@objectstack/specresolves to.pnpm/@objectstack+spec@file+..+..+workspace-packages+objectstack-spec-18.3.0.tgz..claude/skills/: 11 skills, byte-identical topackages/skills/dist/skills(the catalog's top-levelREADME.mdis not a skill and is not synced, measured withdiff -rq);skills-lock.jsonentriessource: @objectstack/skills,sourceType: node_modules.objectstack validatein the project: exit 0.objectstack dev --fresh(bootDev):/api/v1/health200 after 13 s, stopped.create-objectstack@18.3.0scaffold of the same name, run through the same verification, is refused on every@objectstack/*store entry (registry) and on 47 skill files that differ from the workspace catalog — the check tells the two apart on today'smain.npx -y --package=TARBALL create-objectstack: the scaffold exited 0 with no skills, because npx hands--packageto its child asnpm_config_packageand the scaffolder's ownnpx -y skills@1.7.2 …then ranskills@1.7.2as a bin of the scaffolder's tarball (sh: 1: skills@1.7.2: not found). The verification refused it; the scaffold now names the tarball positionally (npx -y file:TARBALL), as the published one is named.--driver recorded:F) is NOT MEASURED (listed below).NOT MEASURED
--driver recorded:F). No recording of a card exists in this container, and making one needs a live model run, which is paused.pnpm addin a workspace-mode project. It runs whatever pnpm that project directory resolves, because the pin covers only the runner's scaffold and settle steps. It stays on the tarballs through theoverridespersisted inpnpm-workspace.yaml, but that mechanism is measured on pnpm 10.31 only. Under a Corepack whose unpinned default is a later major, it is not measured.Acceptance notes
pnpm is pinned to the workspace's (round 2). Round 1 went red on Test Core (5/8) for
packages.test.ts, while it was green locally. CI'spnpmis a Corepack shim, and the scaffolded project lives in a temp directory outside the checkout with nopackageManagerfield, so Corepack resolved the registry'slatestthere: pnpm 12.18.0 on 2026-11-07. pnpm 12 reads none ofnpm_config_*, so the global pnpmfile went unread and the install asked npm for a version it never published. The container measured green only because itspnpmis a standalone 10.31.0. A real run on a machine whose pnpm is Corepack's would have failed the same way, so the fix is in the runner and not only in the test.prepareWorkspacePackagesnow writes apnpmshim (pinnedPnpm,runner/packages.ts). It runs thepnpmonPATHfrom inside the checkout, where Corepack (or pnpm's own version management) resolves the root'spackageManagerpin, and points it at the caller's directory with--dir. The shim is refused unless it answers the same--versionthe checkout does. The scaffold and the settle install both run under aPATHled by it. The settle install still runs without the pnpmfile, so the lockfile records no pnpmfile checksum. Measured under a CI-shaped Corepack: the Corepack store afterwards holds only the pinned 10.31.0 and nolastKnownGood.json, so thesetup-pnpmstore guard's incident shape is not armed. The shim is a POSIXshscript, so workspace mode runs on Linux and macOS, not on Windows.Why a pnpmfile and then overrides, not one of them. The scaffolder writes
pnpm-workspace.yamland installs in the same process, so overrides cannot be in place before its install; a global pnpmfile is the one pnpm 10.31 reads from the environment (npm_config_global_pnpmfile;pnpm_config_global_pnpmfileis not read, measured: the install reached for the registry). A lockfile written under a pnpmfile records its checksum, and a later install without it would re-resolve from npm; the persisted overrides plus the second install remove that path. Running the scaffolder with--skip-installand installing in the runner was rejected: it would copy the scaffolder's skills command into the runner, where a later bump of its pinnedskillsCLI would not follow.Pack, not link, as the card expected: a tarball holds
files[]only (pinned: a file outsidefilesis absent from the installed package).Scope of the overrides: every package the release publishes, not only the scaffold's closure, so a package the agent adds later is the workspace's too.
Workspace mode needs pnpm for the scaffolder's install; with npm the verification finds no
.pnpmstore and refuses the scaffold, never a silent npm install. The runner already runs inside this pnpm workspace.A record written before this PR states no package source and is refused by the exporter; run the card again. Records are local, git-ignored output, and the gallery is not live yet.
The build step is the release's own and runs through turbo; a second run of an unchanged tree is a cache hit. A cold build of the scaffold closure plus the Console took 15 min here.
No change to
create-objectstack: the scaffolder needed no hook, so nothing published moves and no changeset is owed (skip-changeset).Verification
Round 2, head
38562001(one commit on4551309a, touchingrunner/packages.tsandtest/runner/packages.test.tsonly):packages.test.tsreports9 passedboth under that Corepack and under the standalone pnpm. The whole package under Corepack reportsTest Files 24 passed (24),Tests 471 passed (471).tsc --noEmitexits 0.exit 0;--ranreconciliation:51 run, 0 NOT-MEASURED. A first pass on the round-2 commit hadcheck:cross-package-test-inputsexit 1, because the test read the repo-rootpackage.jsonfor the pin. The test now askspnpm --versionin its own directory instead, and the gate exits 0.Round 1: all on head
4551309a, in worktreeobjectstack-issue-31147, base8ef4d309;origin/mainhas moved 8 commits since, none underpackages/qa/scenarios,packages/create-objectstackorpackages/skills, andgit merge-treeis clean.pnpm --filter "@objectstack/scenarios..." build:pnpm --filter @objectstack/scenarios test→Test Files 24 passed (24),Tests 470 passed (470);pnpm --filter @objectstack/scenarios typecheck(tsc --noEmit, tests included) exit 0;VERDICT command-exit 0.pnpm exec eslint packages/qa/scenarios --no-inline-configexit 0.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack→ 51 commands; all 51 run, eachexit 0;--ranreconciliation:51 derived, 51 run, 0 NOT-MEASURED, 0 UNRUN. (A first round on an earlier head readcheck-plugin-teardown-shape --self-testandcheck:dual-build-cjs-loadsexit 3, prerequisite not met; aftergit fetch --depth=1of the self-test's pinned commit and the package build, both exit 0 on this head.)@objectstack/scenarios("private": true):skip-changeset.!in the title, no(narrowing)arm).The 51 derived gates, as run
Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.skip-changeset.)packages/spectouched: its generated artifacts are regenerated and committed. (Not touched.)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code