Repository navigation
feat(scenarios): gallery-publish publishes each gallery app to the marketplace as a template; the export carries the readmePath README - #39314
Conversation
…etplace template; the export carries the manifest's readmePath README (WIP) Claude-Session: https://claude.ai/code/session_01TsNV8Bsjqmw7aXCo2QuLU1 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TsNV8Bsjqmw7aXCo2QuLU1 Co-authored-by: Claude <noreply@anthropic.com>
…ay.at Claude-Session: https://claude.ai/code/session_01TsNV8Bsjqmw7aXCo2QuLU1 Co-authored-by: Claude <noreply@anthropic.com>
…geset Claude-Session: https://claude.ai/code/session_01TsNV8Bsjqmw7aXCo2QuLU1 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 47 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 14 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 2 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 f21159b17fd5b21315a4e557faadefca991c4da2 && git checkout f21159b17fd5b21315a4e557faadefca991c4da2
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6b2e596027c7d4f9b01efab0766e3cfd4f2ba7df c0a9ba2b74bf8b44237476fcf9038b206dbb8afe && git checkout -B drift-repro 6b2e596027c7d4f9b01efab0766e3cfd4f2ba7df && git merge --no-ff c0a9ba2b74bf8b44237476fcf9038b206dbb8afe
node scripts/docs-audit/affected-docs.mjs --json 6b2e596027c7d4f9b01efab0766e3cfd4f2ba7df
|
|
repo:cloud@zhuangjianguo · zhuangjianguo · session_01TsNV8Bsjqmw7aXCo2QuLU1 Contract reviewServed-tier: Judgments1. Widening declaration and changeset level: correct, but the declaration is incomplete (N1).
2. Credential safety: FAIL (B1, B2).
3. Idempotency: correct, with two precision gaps (N2, N3).
4. The exporter's README copy: correct (N5).
5. Tests and ablations: they correspond.
6. CI on the head, at 11:43:30Z.
Blocking
Non-blocking
VerdictFAIL at
What is correct:
CI has 0 failures so far. 6 runs are still in progress, and the CI-owned |
… gallery never wrote, and never fetches through npx - The publishing CLI is installed once per framework version with --ignore-scripts into a directory apart from the work copy, before any gallery code runs, fingerprinted, and checked before each keyed publish. It runs by path with an allowlisted environment: PATH, a fresh HOME, the key, OS_CLOUD_URL and OS_ORG_ID when set. - The gallery install keeps dev dependencies (--include=dev) and the build runs the project's installed CLI by path; an install that leaves none fails the app. Install and build get an allowlisted environment. - Each child leads its own process group, killed when it exits. - The 409 skip also matches the package id; skip and icon wording state what holds. - A readmePath through a symbolically linked directory is refused. - A dry run creates no directory; the publish module leaves the export subpath. Claude-Session: https://claude.ai/code/session_01TsNV8Bsjqmw7aXCo2QuLU1 Co-authored-by: Claude <noreply@anthropic.com>
…credential handling holds Claude-Session: https://claude.ai/code/session_01TsNV8Bsjqmw7aXCo2QuLU1 Co-authored-by: Claude <noreply@anthropic.com>
…ey make Claude-Session: https://claude.ai/code/session_01TsNV8Bsjqmw7aXCo2QuLU1 Co-authored-by: Claude <noreply@anthropic.com>
Part of #35134
Clause-②: yes (widening: a new
gallery-publishcommand on the published@objectstack/scenariosbin)Metadata-protocol: none
维护者速读
What changes
gallery-publish(packages/qa/scenarios/src/export/publish.ts, CLIpublish-cli.ts; the bin reaches it asnpx @objectstack/scenarios gallery-publish). For each app in a gallery checkout'sindex.json:framework.version. The package id isPREFIX.APP_ID, with_spelled-. It is checked against the spec'sPackageSchema.shape.manifestIdbefore anything runs.--id-prefixis required and has no default, because a package id is permanent and the publisher is the maintainer's decision.@objectstack/cli@VERSIONis installed once per version withnpm install --ignore-scripts --no-save --prefix DIRinto a temp directory of its own, apart from the work directory. Its tree is fingerprinted (treeDigest).apps/ID/sourceinto a work directory, so the gallery checkout is never written. It builds that copy with the project's own installed CLI, run by path:npm install --include=dev, thennode node_modules/@objectstack/cli/bin/run.js build. If the install leaves no@objectstack/cli, the app fails. Nothing is ever fetched and run throughnpx.node DIR/node_modules/@objectstack/cli/bin/run.js package publish --visibility marketplace --submit --readme-file … --license … --icon-url … --description … --homepage-url … --note …. Its tree must still match the fingerprint, or the app fails and nothing runs with the key.summary.en. The README is written fromindex.json, the screenshots (linked from the gallery), the 问数 transcript summary and the app's galleryREADME.md. The summary gives the counts, then how many askers of each question passed in the last half, with a link to the full transcript. The display name, the Chinese pair and the business functions come from the source'sobjectstack.manifest.json, which the export wrote.resolveFlowTriggerKind(scheduleandtime_relative), which is how the control plane counts them indeclaredScheduledFlowCount.--icon-urlis preferred. With--icon-file, an upload the control plane refuses fails the app with the cause named: no icon store on a 503. The message then points to--icon-url.GET /api/v1/marketplace/packages/:id, approved versions of a listed package). If the catalog already serves the version, the app is skipped and nothing is built or sent.packages/service-cloud/src/routes/package-publish.tslooks up(package_id, version)before any write and answers409withVersion 'V' already exists for package 'ID'. Bump the version and retry.os package publishprints that asPublish version failed (409): …in its!verRes.okbranch. The command treats that sentence as a skip only when V is this version and ID is this package. The lookup reads no review status, so the skip reason says the version is held "in review, approved but unlisted, or rejected".--install, which this command never passes. feat(cli): os deploy and os package publish --install stop on the hosted schema upgrade refusal and take --confirm-upgrade (#30887) #39286 left the printed line unchanged.OS_CLOUD_API_KEYonly. If it is missing, the command refuses before any network call or child process. A key flag on the command line is refused.npm installand its build get an allowlist of the caller's environment (TOOL_ENV): never the key,NODE_ENV,NODE_OPTIONSor any other secret.PATH, a fresh emptyHOME, the key,OS_CLOUD_URLand, when set,OS_ORG_ID. PinningOS_CLOUD_URLstops the CLI falling back to acloud.jsonURL.objectstack.config.tsrun as the same user, on the same file system. The fingerprint catches a rewrite of the publishing CLI. It does not stop code that escapes its process group or reads what the user can read. The README says to run the command where the key is the only secret, on a throwaway runner.--dry-runprints, per app,would publishorwould skipwith the reason, and the exact commands with the key shown as[redacted]. It builds, writes and publishes nothing, and creates no directory, not even--work DIR.@objectstack/scenarios/exportsubpath gains onlymainPublish(through theexport-checkre-exports) andmanifestReadmePath, both named in the changeset.source.ts). The exportedsource/now carries the README thatobjectstack.manifest.jsonnames asreadmePath, soos package publishrun there can read it. The app is refused, with its reason, when thereadmePath:..;node_modulesordist;Publishing the gallery to the marketplace — gallery-publish, covers the command, the env var, idempotency, and the rule that an app later removed from the gallery is not unpublished: its last good version stays installable. The refresh section now notes the README copy. Thegallery-publishpnpm script is added for use from a checkout.Why
Part of. Items 2 and 3 of the card live on objectstack-ai/gallery: the workflow on push tomainand the gallery README's install path. They wait for this CLI's release and for the maintainer's two preconditions: the publisher identity, its key and its id prefix, and the review policy and listing visibility.Read first (riskiest first):
publish.tsgalleryPublish, the CLI-install phase and the keyed spawn:cliInstallArgv,treeDigest,publishEnv. Check that the key reaches only the CLI this command installed.publish-cli.tsspawnChild: the process-group kill.publish.tsclassifyPublish: the skip rule, which must never turn a real failure into a skip.Two-minute check:
pnpm --filter @objectstack/scenarios exec vitest run --maxWorkers=2 test/export/publish.test.ts. Expect 22 green:npx;Acceptance notes
gallery-publishreaches the bin through theexport-checkbuild entry (check-cli.tsre-exportsmainPublish), becausetsup.config.tswas outside this claim's file surface.dist/bin.jsstill imports onlyfs,pathandurl, as measured after the build. A separateexport-publishentry is a one-line follow-up intsup.config.tsif the seat wants one.translations.zh.description, read from the manifest by the CLI) does not carry the note. The Chinese sentence is in the README only.os package publishruns a step-1 package upsert before the version POST that answers 409.readmePathcontainment. The review proposed a realpath check (N5). The code instead refuses a symbolic link on any directory of the path; the file itself was already refused bytake's lstat. That is stricter than realpath containment: it also refuses a link that stays inside the project, which the module's rule ("a symbolic link anywhere refuses the export") requires. With it in place, a realpath check could never fire, so none was added.OS_ORG_ID. It is in the publish allowlist beyond the four names the review listed, because the README promises it reaches--org.HOME. The publish child'sHOMEis a fresh directory rather than the caller's, so nothing the build wrote under the user's home (an oclif data directory,cloud.json) is read with the key.@objectstack/cli@18.5.0, installed with--ignore-scripts, is 703 MB and 23,939 files.--licensedefaultApache-2.0follows the publish command line in the card's 2026-11-18 readings. It matches the gallery's ownLICENSE(Apache License 2.0, read from a clone of objectstack-ai/gallery).Tests
Targeted tests and typecheck at the final head
Readings at head
c0a9ba2b74(objectstack-ai/objectstack).pnpm --filter @objectstack/scenarios exec vitest run --maxWorkers=2(the whole package): exit 0,Test Files 47 passed (47),Tests 1479 passed (1479).pnpm --filter @objectstack/scenarios typecheck: exit 0. Thetsc --listFilesrun includestest/export/publish.test.ts.eslint --no-inline-configon the changed source and test files: exit 0.dist/export.cjsexportsmainPublishandmanifestReadmePathas functions;galleryPublishisundefined, so it is not exported.pnpm --filter @objectstack/scenarios build: exit 0. The builtdist/bin.jsimports onlyfs,pathandurl, whichpacked-tarball.test.tspins.Red at base, then ablations (each restored to the HEAD blob)
Red at base (
git restore --source=f80864150e -- packages/qa/scenarios/src, then restored to HEAD):publish.test.tsfails to load (Cannot find module '../../src/export/publish-cli.js'). Inexporter.test.ts, 3 of the new README tests fail (Tests 3 failed | 74 passed (77)).Each mutation went through
scripts/ablation-replace.mjs: the anchor hit once, the blob changed, and the file was restored to blob == HEAD with an emptygit diff HEAD. The tests importsrc, so there is no build leg. Run:vitest run test/export/publish.test.ts test/export/exporter.test.ts, 92 tests.holds: false: 2 red (the catalog skip, and the dry-run skip line).listingDescription: 3 red (the metadata mapping, the scheduled-flow note, and the dry-run line).take(readme)is removed: 2 red (the README is exported, and the subdirectory case). The refusal case stays green, as expected, because its refusal comes before the copy.Fix round (L2 contract review, B1, B2, N1 to N5): red first, then ablations
Red first, at
6991287c7d's parent with only the new tests applied (red-fix-round.out, thenred3.outonce the dependency closure was built):publish.test.ts:Tests 13 failed | 9 passed (22). Every B1, B2, N2, N3, N4 and dry-run test was red. The process-group test timed out at 15 s, because the child'ssleep 30held the pipes open.exporter.test.ts:Tests 1 failed | 77 passed (78). The symlinkeddocs/README was exported.Each mutation went through
scripts/ablation-replace.mjsagainst the committed65ca516dc0. Each file was restored to blob == HEAD with an emptygit diff HEAD. Run:vitest run test/export/publish.test.ts test/export/exporter.test.ts, 100 tests.--ignore-scriptsdetached: false)npm installwithout--include=devnpxnpx objectstack buildnpxNODE_ENV,NODE_OPTIONSor runner secretdocs/--work DIRThe N3 and N4 wording is pinned by the existing skip-line and icon-line tests, which went red at base as listed above. The wording was not ablated separately.
Verification
Readings against the real gallery (a read-only clone of objectstack-ai/gallery, one app: asset_lifecycle @ 18.5.0)
6991287c7d's code (unchanged at the head), with nothing sent. The run usedOS_CLOUD_API_KEY=dummy-not-a-key NODE_ENV=productionand--server http://127.0.0.1:9 --work DIR, taking 73 s.@objectstack/cli@18.5.0was installed with--ignore-scriptsinto the separate CLI directory.npm install --include=devleftnode_modules/@objectstack/cli/bin/run.jsin place despiteNODE_ENV=production, and its build wrotedist/objectstack.json.Register package failed (0): fetch failed, giving0 published, 0 skipped, 1 failed, exit 1.would publish: asset_lifecycle as ai.objectos.gallery.asset-lifecycle@18.5.0.npm install --ignore-scripts … --prefix /tmp/gallery-publish-cli/18.5.0 @objectstack/cli@18.5.0line,npm install --include=dev …,node …/node_modules/@objectstack/cli/bin/run.js build, andenv -i PATH="$PATH" HOME=… OS_CLOUD_API_KEY=[redacted] OS_CLOUD_URL=… node /tmp/gallery-publish-cli/18.5.0/node_modules/@objectstack/cli/bin/run.js package publish ….--work DIRnor the CLI directory exists afterwards.cloud.objectos.aiand answered 404.source/. A scratch copy rannpm installandnpx objectstack buildwith CLI 18.5.0, both exit 0.scheduledFlowCounton itsdist/objectstack.jsonanswered1:post_monthly_depreciation, the monthly depreciation flow the 2026-11-18 reading saw not armed on a Free plan. So the listing for this app carries the Free-plan sentence.os package publish. It was given the exact flag set this command sends, against an unreachableOS_CLOUD_URL(127.0.0.1:9), so nothing was sent anywhere. It accepted every flag, loaded the artifact and the manifest, and stopped atRegister package failed (0): fetch failed, exit 1.env -u OS_CLOUD_API_KEY … gallery-publish …printedrefused — OS_CLOUD_API_KEY is not set …, exit 1.dist/bin.jsimports onlyfrom "fs",from "path"andfrom "url".require('dist/export.cjs').galleryPublishandrequire('dist/export-check.cjs').mainPublishboth load as functions.Gates: dispatch-gates --commands and --ran, at the final head c0a9ba2
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 83 families atc0a9ba2b74, the same list as at6991287c7d.check:query-options-erasureoutran 280 s twice (124). It exited 0 in 372 s on a 585 s bound, and the record carries that re-run code.check:dual-build-cjs-loadswas measured this time and exited 0:128 published require entry point(s) across 75 package(s) load. It was exit 3, NOT MEASURED, in the first round.node scripts/pm/dispatch-gates.mjs --ran ran3.list: exit 0,83 derived famil(ies) accounted for — 83 run, 0 NOT-MEASURED.6991287c7dand reconciled to82 run, 1 NOT-MEASURED, wheredual-build-cjs-loadsgave exit 3 before the closure was built.🤖 Generated with Claude Code
https://claude.ai/code/session_01TsNV8Bsjqmw7aXCo2QuLU1