Skip to content

fix(runtime)!: the package draft doors refuse a query parameter they do not read - #26853

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-g4y5hj
Oct 27, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-g4y5hj

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Fixes #26713

Clause-②: yes (narrowing)
Metadata-protocol: none
Skills-docs: none — no skill or doc teaches a query parameter on either draft door: skills/** and content/docs name publish-drafts / discard-drafts only in plugin-hooks.md, metadata-api.mdx (a route list) and two reference tables, none with a query string, and no caller in ui/**, packages/client, the CLI or skills/** sends one.

维护者速读

  • 改了什么:包的两个草稿门 POST /packages/:id/publish-drafts 与 discard-drafts 现在拒收任何查询参数,答 400 VALIDATION_ERROR,文案用仓里唯一的那句「不认识的查询参数」。
  • 为什么改:publish-drafts?dryRun=true 以前忽略参数、真的发布草稿并答 200 published;想预览的工具与 AI 拿到的是不可逆的发布。
  • 风险与回滚:只拒带查询参数的请求;控制台、MetadataClient、SDK 都不带参数,行为不变。回滚即还原 packages.ts 一处 helper 与两行调用。
  • 先看:packages/runtime/src/domains/packages.ts 的 refuseDraftDoorQuery 与两处调用(在权限与 wall 闸之后、协议之前);其次新测试 packages-draft-doors-closed-query.test.ts。
  • 两分钟验证:cd packages/runtime && pnpm exec vitest run src/domains/packages-draft-doors-closed-query.test.ts,预期 10 passed;带 ?dryRun=true 的两例答 400 且协议未被调用。
  • 需要你做的:无,席位落地。

What changes

Why

The QA run (S3) measured POST /api/v1/packages/:id/publish-drafts?dryRun=true with {} answering 200 outcome: "published" with the draft live. A caller asking for a preview got the irreversible act, shaped like a success. Triage 6446824931 ruled: close the query set and refuse an unknown parameter with 400.

Tests

packages/runtime/src/domains/packages-draft-doors-closed-query.test.ts, 10 cases, driving dispatch() over a real SchemaRegistry and a recording protocol, for each door:

  • refusal: {dryRun: 'true'}, a repeated dryRun, and two unknown names each answer 400 VALIDATION_ERROR with exactly unknownQueryParamRefusalMessage(query, []), every name quoted, and the protocol's publishPackageDrafts / discardPackageDrafts never called;
  • preservation: no query, 200, the protocol called once;
  • order: a caller without manage_metadata sending ?dryRun=true gets 403, protocol not called.

There is no declared flag on either door, so the order's "repeated declared flag still refused the #23214 way" has nothing to pin here; a repeated unknown name is answered by recognition, which runs first (the query-allowlist.ts rule).

Red first on base c8583f8, green on head, ablation
  • Red, base c8583f80 (implementation absent): the new file 6 failed | 4 passed (expected 400, got {"status":200,..."outcome":"published"...} and the discard twin discardedCount: 1).
  • Real-door probe (one-off, not committed; real ObjectStackProtocolImplementation over SQLite, one pending view draft, handlePackages('/com.example.repairs/publish-drafts', 'POST', {}, {dryRun:'true'})):
    • base: {"status":200,"code":null,"outcome":"published","draftsBefore":["view/repairs_board"],"draftsAfter":[],"servedLabel":"Board v1"}: the draft went live.
    • head: {"status":400,"code":"VALIDATION_ERROR","message":"The \"dryRun\" query parameter is not supported by this endpoint. ... This endpoint takes no query parameters.","draftsBefore":["view/repairs_board"],"draftsAfter":["view/repairs_board"],"servedLabel":null}: nothing published, the draft still pending.
  • Ablation on head e542b231 through scripts/ablation-replace.mjs (anchor if (message === undefined) return null; → ... || true ..., anchor 1 → 0, blob 8dcfe74db65c → f592f4389363): 6 failed | 4 passed, exactly the six refusal cases; restored blob == HEAD, git diff HEAD empty. The test imports the dispatcher from src, so no build sits between the mutation and the run.

Acceptance notes

Sibling package write doors, measured on c8583f80 (none of them is changed here):

door closed query set?
POST /meta/:type/:name/publish (per-item publish, RestServer) yes, META_ITEM_PUBLISH_PARAMS (#22877)
POST /packages (install), reads overwrite no; repeats refused (#23214), unknown names ignored
DELETE /packages/:id (uninstall), reads keepData no; repeats refused (#23214), unknown names ignored
PATCH /packages/:id, PATCH /:id/enable, PATCH /:id/disable, POST /:id/publish, /:id/revert, /:id/rollback, /:id/commits/:c/revert, /:id/adopt-orphans, /:id/duplicate no; none reads the query
POST /packages/publish (RestServer package route) no; reads no query

Measured at the dispatcher door with the packages-write-flag-arity harness: DELETE /packages/:id?keepdata=true (and ?keep_data=true) answers 200 and calls deletePackage({ packageId }) with no keepData, so the protocol drops the object tables the caller asked to keep. That is reported to the seat as a proposed card, not widened into this PR.

Verification

All on head e542b231 (base c8583f80).

  • pnpm --filter @objectstack/runtime test: Test Files 460 passed (460), Tests 7458 passed | 19 skipped; lock VERDICT command-exit 0.
  • pnpm --filter @objectstack/runtime typecheck: exit 0.
  • Lint scoped to the touched package: eslint packages/runtime --no-inline-config exit 0 (the repo-wide pnpm lint is CI's).
  • Derived gates: node scripts/pm/dispatch-gates.mjs --commands on this diff named 60 families; all 60 ran and exited 0; --ran reconciliation: 60 derived famil(ies) accounted for — 60 run, 0 NOT-MEASURED. Two first-pass exit 3s were container prerequisites, re-run after fixing them: check-plugin-teardown-shape.mjs --self-test (positive-control commit fetched) and check:dual-build-cjs-loads (the seven packages without dist/ built: 112 entries across 69 packages load).
  • Hand gates: check-commit-card-trailers.mjs --range origin/main..HEAD exit 0, check-nul-bytes.mjs exit 0.
  • Full dogfood battery (the (narrowing) arm), pnpm --filter @objectstack/dogfood test under the lock after its ^... closure build: Test Files 314 passed | 3 skipped (317), Tests 2609 passed | 20 skipped (2629); VERDICT command-exit 0.
  • test:repo (vitest repo project): not run locally; the diff touches no repo-project test and the derived list does not name it; CI Test Core runs it.
  • Merge check against origin/main 8eef9a8d: git merge-tree clean; no open PR for metadata: the save door and the package publish door accept a package id that is not installed (object, dashboard, page …), storing and even publishing items into a phantom package; Studio renders a writable builder for it #26708 when this was opened.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (No spec change.)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes (scoped to packages/runtime, exit 0; the full sweep is CI's).
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: n/a.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English (the 维护者速读 block is the dispatch contract's Chinese summary).
  • The Before Submitting list in CONTRIBUTING.md is done.

Written by an os-dev card thread in session session_01FEkQ5nX7RrMithjQTtAtVb, dispatched by the PM loop (server seat 2).

🤖 Generated with Claude Code

https://claude.ai/code/session_01FEkQ5nX7RrMithjQTtAtVb


Generated by Claude Code

…do not read

`POST /packages/:id/publish-drafts?dryRun=true` ignored the parameter,
published the drafts for real and answered 200 outcome "published"; the
same parameter on `discard-drafts` dropped them. Both doors read no query
parameter, so their closed set is empty: any name is now refused 400
VALIDATION_ERROR with the shared recognition sentence
(`unknownQueryParamRefusalMessage`, @objectstack/rest), after the
capability and wall gates and before the protocol is asked.

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

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/runtime, touching 10 documentable anchor(s).

13 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/client-sdk.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery))
  • content/docs/api/error-catalog.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery))
  • content/docs/api/error-handling-client.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery))
  • content/docs/api/error-handling-server.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery))
  • content/docs/automation/hooks.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery))
  • content/docs/automation/jobs.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery))
  • content/docs/automation/webhooks.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery))
  • content/docs/data-modeling/drivers.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery))
  • content/docs/permissions/system-context.mdx (via handlePackagesRequest (symbol, a top-level function))
  • content/docs/protocol/kernel/error-handling.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery))
  • content/docs/protocol/objectql/types.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery))
  • content/docs/ui/forms.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery))
  • content/docs/ui/print-pages.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery))

⛔ 5 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-1.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery))
  • content/docs/releases/v17/17-5.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery))
  • content/docs/releases/v17/17-6.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery))
  • content/docs/releases/v17/17-7.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery))
  • content/docs/releases/v18/18-2.mdx (via VALIDATION_ERROR (literal, a string literal in refuseDraftDoorQuery), discardDrafts (sdk, the bare tail of client method packages.discardDrafts, bound to POST /packages/:id/discard-drafts), packages.publishDrafts (sdk, the route ledger binds it to POST /packages/:id/publish-drafts), publishDrafts (sdk, the bare tail of client method packages.publishDrafts, bound to POST /packages/:id/publish-drafts), /packages/:id/publish-drafts (route, a path literal in a comment on a changed line))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • the SDK route bridge reached 55 of 207 client-bound route-ledger rows — the other 152 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 152: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 97 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 — 27 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 8eef9a8db402b6d46b15cc2375f8acddbb0d7b7e → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 8eef9a8db402b6d46b15cc2375f8acddbb0d7b7e

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

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 8eef9a8db402b6d46b15cc2375f8acddbb0d7b7e → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对

ACCEPT · domain:server seat 2 · os-project-manager · session_0186vfjHHMsRXC9EUT9hTFMo · 2026-10-27T18:59Z · head e542b231 · #26713

The maintainer's standing authorisation for landing reviewed PRs, verbatim: 「按照 pm-dispatch 规则复核过的都授权」.

  1. Shape:
    • A draft against main, assignee os-project-manager.
    • These body lines are all line-initial:
      • Fixes #26713
      • Clause-②: yes (narrowing) (per triage 6446824931)
      • Metadata-protocol: none
      • Skills-docs: none, with its measured reason: no doc or skill teaches a query parameter on either door.
    • One @objectstack/runtime patch changeset (fix(runtime)!:), carrying both declaration lines.
    • check-governed-merges --pr 26853 reads NOT governed, 173 changed lines.
    • The card's newest claim (6448342519) names this PR's branch.
  2. Diff against the triage and the order (the seat read the whole non-test diff):
  3. Tests:
    • The new packages-draft-doors-closed-query.test.ts has 10 cases via dispatch() over a real SchemaRegistry. For each door:
      • dryRun, a repeated dryRun and two unknown names each answer 400 with exactly the shared sentence, and the protocol is never called;
      • no query answers 200, and the protocol is called once;
      • a caller without manage_metadata still gets 403 first.
    • Red on base c8583f80: 6 failed | 4 passed. The real-door probe gave 200 outcome: "published" with the draft live.
    • Ablation reds exactly the 6 refusal cases, then restored.
    • runtime: 460 files, 7,458 tests.
  4. Overlap: metadata: the save door and the package publish door accept a package id that is not installed (object, dashboard, page …), storing and even publishing items into a phantom package; Studio renders a writable builder for it #26708 (same handler, unknown package id) had no open PR at start or before pr_create. Whichever lands second merges main.
  5. Gates:
    • At this stamp every check-run on the head reads success or skipped; none reads failed or in progress.
    • Locally the dev reports:
      • 60 of 60 derived gates exit 0, with 0 NOT-MEASURED;
      • the full dogfood battery: 314 files, 2,609 tests.
  6. Out of scope: DELETE /packages/:id?keepdata=true answers 200 and drops the tables the caller asked to keep, and most package write doors have no closed query set. Filed as packages: DELETE /packages/:id?keepdata=true answers 200 and drops the tables the caller asked to keep; the package write doors have no closed query set #26857.

Generated by Claude Code

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

Development

Successfully merging this pull request may close these issues.

runtime: POST /api/v1/packages/:id/publish-drafts?dryRun=true ignores the unknown query parameter and performs a real publish

2 participants