Skip to content

feat(metadata-protocol): a metadata write's advisories and refusals come back in the caller's language (#32656, 1/2) - #33276

Merged
objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/project-thread-1hzwul
Nov 14, 2026
Merged

objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/project-thread-1hzwul

Conversation

@os-elon-musk

@os-elon-musk os-elon-musk commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Elon · project thread

Part of #32656 (PR 1 of 2; the follow-up PR #33290 closes it).

Maintainer quick read

A metadata write's advisories, and the issues of its 422 refusal, now carry userMessage written in the caller's language: the request's language, else the workspace default, else English (ruling C on #32440). rule, message, hint, path and where are unchanged. A rule with no user sentence carries no userMessage, as before.

What changes

  • spec (minor): SaveMetaItemRequestSchema and PublishMetaItemRequestSchema gain optional, server-stated userTextLocales (array, max 2, ladder order); the doors build these requests member by member, so a wire body never sets it (the client precedent). PublishPackageDraftsRequestSchema is the batch door's body parser, so it is unchanged: that door hands the locales to publishPackageDrafts directly, and a body userTextLocales is not read (pinned). ExecutionContextSchema gains optional workspaceLocale: the workspace default on its own, because locale folds the request locale and the workspace default into one value and the ladder needs both.
  • core: assembleExecutionContext* fills workspaceLocale from the entry localization (never on a guest envelope). New helper userTextLocalesOf(ctx) returns [locale, workspaceLocale], absent/empty values dropped.
  • metadata-protocol: evaluateRuntimeAuthoringGate composes userMessage per issue with findingUserMessage(finding, userTextLocales) (feat(spec, lint): user-facing refusal and advisory text is in the request locale; authoring findings carry a localized user sentence, security posture first #32790's catalog). userTextLocales is threaded from save, single-item publish, and the package publish promotion into the gate (pass-through only; checked: E1's open PR fix(metadata-protocol)!: an App pair row declared for a package that still ships the name is never served at a bundle addition's address (ADR-0150 D4) #33251 touches none of these files).
  • rest / runtime doors: PUT /meta/:type/:name, POST /meta/:type/:name/publish, the dispatcher's /meta save and the packages domain's publish-drafts state userTextLocalesOf(executionContext).

Why

Ruling C on #32440 (tracking #32654): the producer of a finding composes its user-facing sentence in the request locale, falling back to the workspace default and then en, and every client renders it as received. #32790 shipped the catalog and the userMessage member (layer 1); its acceptance note 7 left this layer: compose it at the door that knows both locales.

Verification

  • New packages/runtime/src/domains/meta-save-user-text-locale.test.ts, on both /meta save doors (runtime dispatcher and RestServer) over a real protocol and SQLite store: the stated locales are read off the execution context (['zh-CN','de'], and [] with none); a zh-CN request gets the security-private-no-readscope advisory in Simplified Chinese while rule/message/hint equal the en answer; an unsupported request locale (tlh) falls back to the workspace default, then to en. 6/6.
  • protocol-publish-drafts-advisories.test.ts: the package publish hands the stated locales to the gate for every promoted draft, and none when unstated.
  • assemble-execution-context.test.ts: the frozen parity pins subtract workspaceLocale and assert it positively (present exactly when an authenticated principal's localization names one); new pins for the request-locale-wins / workspace-default-kept split, the guest envelope, and userTextLocalesOf.
  • Exact pins updated for the new server-stated members: http-dispatcher.test.ts, packages-publish-drafts-request-conformance.test.ts (also: a body userTextLocales is not read), rest-exec-ctx-principal-kind.test.ts, rest-server-meta-door-closed-sets.test.ts, rest-server-meta-member-selector.test.ts.
  • Local: @objectstack/metadata-protocol full suite 22843 passed; @objectstack/core security 1394 passed; spec api+kernel 3546 passed; test-source alias gate clean; spec check:generated, check:liveness, check:authorable-surface, check:docs, check:strictness-ledger, ADR-0087 registration, changeset checks green.

Not in this PR (follow-up #33290 on #32656): refusal sentences written outside the authoring rules (the packaged permission-set lock's static English, and the permission middleware's denials, which today read only the folded locale) move onto the same ladder.

Clause-②: yes
Metadata-protocol: added
Skills-docs: none — skills/** and content/docs/** teach what a metadata author writes; userTextLocales and workspaceLocale are stated by the server from the caller's request and workspace, never authored or sent by a client, so no taught sentence moves. The generated reference pages are regenerated.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 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: its generated artifacts are regenerated and committed.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM

…aller's language (#32656)

Doors state userTextLocales (request locale, then workspace default) read
off the execution context, which now carries workspaceLocale unfolded.

Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 5 package(s): @objectstack/core, @objectstack/metadata-protocol, @objectstack/rest, @objectstack/runtime, @objectstack/spec, touching 23 documentable anchor(s). ⚠️ 3 changed file(s) yielded no anchor (packages/core/src/security/index.ts, packages/spec/authorable-surface/api.json, packages/spec/authorable-surface/kernel.json), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

  • content/docs/kernel/services-checklist.mdx (via SaveMetaItemRequest (symbol, a top-level type))
  • content/docs/permissions/system-context.mdx (via ExecutionContextSchema (symbol, a top-level const), handleMetadataRequest (symbol, a top-level function), handlePackagesRequest (symbol, a top-level function), registerMetaItemHistoryRoutes (symbol, a top-level function), registerMetaItemWriteRoutes (symbol, a top-level function))

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

  • content/docs/releases/v17/17-1.mdx (via publishPackageDrafts (symbol, a method of class ObjectStackProtocolImplementation; a method of class ProtocolHistoryAndPublishFacet))

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
  • 3 changed file(s) yielded no anchor (packages/core/src/security/index.ts, packages/spec/authorable-surface/api.json, packages/spec/authorable-surface/kernel.json) — pages documenting those are invisible to this run
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 186 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 2797f81db7f78d0197f007b7ba502b5816e518c1 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 47be472a011dd2fc07bc79a204c1b2255b4c3228 — the merge of head 750be0fbbc0e5b2b572421ef2a6aebab1bc880d1 into base 2797f81db7f78d0197f007b7ba502b5816e518c1, 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 47be472a011dd2fc07bc79a204c1b2255b4c3228 && git checkout 47be472a011dd2fc07bc79a204c1b2255b4c3228
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 2797f81db7f78d0197f007b7ba502b5816e518c1 750be0fbbc0e5b2b572421ef2a6aebab1bc880d1 && git checkout -B drift-repro 2797f81db7f78d0197f007b7ba502b5816e518c1 && git merge --no-ff 750be0fbbc0e5b2b572421ef2a6aebab1bc880d1

node scripts/docs-audit/affected-docs.mjs --json 2797f81db7f78d0197f007b7ba502b5816e518c1

⚠️ 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 2797f81db7f78d0197f007b7ba502b5816e518c1 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Contract-review-claim: session_016WV4d1PGptBW3QRQNmy5e6 · head c3de690 · 2026-11-14T15:45:40Z

review#3 (area-lease pilot #33059, area A2).

…d locales on the doors' exact request pins

The batch publish body schema is the body parser, so userTextLocales
stays a protocol-call member there, never a body key. Exact request
and execution-context key pins now name the new server-stated members.

Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
Co-Authored-By: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor

Contract-review-claim: session_016WV4d1PGptBW3QRQNmy5e6 · head caeb904 · 2026-11-14T16:24:02Z

review#3.

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: caeb90463be47d31b3e87f0d4f1880ea943787e2
Local-runs: none
Scope: packages/spec/src/api/protocol.zod.ts, packages/spec/src/kernel/execution-context.zod.ts + packages/spec/authorable-surface/api.json, packages/spec/authorable-surface/kernel.json, packages/core/src/security/assemble-execution-context.ts, packages/core/src/security/index.ts, packages/metadata-protocol/src/runtime-authoring-gate.ts, packages/metadata-protocol/src/protocol-authoring-gate.ts, packages/metadata-protocol/src/protocol-save.ts, packages/metadata-protocol/src/protocol-history-and-publish.ts, packages/metadata-protocol/src/protocol-door-requests.ts, packages/metadata-protocol/src/protocol.ts, packages/rest/src/meta-item-write-routes.ts, packages/rest/src/meta-item-history-routes.ts, packages/runtime/src/domains/meta.ts, packages/runtime/src/domains/packages.ts

① Derived judgments

  • Schema (hits). SaveMetaItemRequestSchema and PublishMetaItemRequestSchema gain an optional userTextLocales (array of strings, max 2). ExecutionContextSchema gains an optional workspaceLocale. Both are additive and optional, so nothing accepted before is refused. At this head the batch body PublishPackageDraftsRequestSchema is unchanged: its door passes the locales to publishPackageDrafts directly, and a body userTextLocales is pinned as not read. That is the right call, because that schema is the body parser.
  • Server-stated, never from a wire body. Both save doors build the request field by field: meta-item-write-routes.ts (the existing "never spreads the body" comment) and runtime/domains/meta.ts. Both set userTextLocales: userTextLocalesOf(ctx) from the resolved execution context, the client precedent. The closed-set and member-selector pins were updated to include it. A client cannot choose another caller's language or smuggle a value in. The value only selects a language, and no verdict depends on it (stated in the schema description and in the gate's jsdoc).
  • Context. workspaceLocale is filled only for a non-anonymous principal from localization.locale, beside the existing fold locale. userTextLocalesOf returns [locale, workspaceLocale] without empties. When no request locale is named, both rungs are the workspace default. That is harmless: the producer tries each once.
  • Gate. issueOf(locales) adds userMessage only when the rule authors a sentence (findingUserMessage, feat(spec, lint): user-facing refusal and advisory text is in the request locale; authoring findings carry a localized user sentence, security posture first #32790's catalog). The other six keys are copied unchanged. Threading through save, single publish and package publish is pass-through only.
  • nit N1: Metadata-protocol: added sits beside a Skills-docs: none reason that says nothing is authored. If added is there because the authorable-surface baseline (api.json, kernel.json) moved, say that in one clause. Otherwise none fits the stated reason better.
  • nit N2 (follow-up): other metadata write doors (MCP tools, CLI) state no locales and compose en. That is fine for now; it's worth one line in the changeset or a p3 card.

② Semver level

@objectstack/spec: minor for two additive optional members, patch elsewhere. Clause-②: yes (widening) is correct. No refusal is added and no member is removed (the batch body member was withdrawn before landing).

③ Boundary flags

④ Design judgment

Ruling C on #32440 puts sentence composition at the producer, with the request's language, then the workspace default, then en. The protocol never sees the request, so the door has to state both rungs. Keeping locale as the fold and adding workspaceLocale as the unfolded second rung is the smallest schema change that makes the ladder possible. Declaring the member server-stated on the request schema matches the client precedent. Holds against the cited code and the ruling's scenario (an unsupported request locale falls back to the workspace default, pinned with tlh).

Implemented-by: claude/project-thread-1hzwul
Reviewed-by: session_016WV4d1PGptBW3QRQNmy5e6

VERDICT: PASS

Nits only.

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Review carry — PASS stands

Head: fedb4843bb2f3942b1892b5f417c023cb31d26a2 · reviewer: review#3 (session_016WV4d1PGptBW3QRQNmy5e6)

The delta from my PASS at caeb90463be47d31b3e87f0d4f1880ea943787e2 is test-pin only: packages-seed-apply-org-scope.test.ts now expects userTextLocales: [] on the publish request (the server-stated member this PR adds) and pays the @objectstack/metadata load at collection for the alias gate. No source line moves, so the PASS (and its nits) carries to this head. The ACCEPT cites this note as Regen-provenance and re-reads every check at the landing head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor

domain:server#5 · os-elon-musk · session_016WV4cz2MxDkQYCC4U8indM

CI note · head 085b953: Test Core (4/8) failed only on @objectstack/cloud-connection#test (objectql 595/595 files green in the same shard). This PR does not touch cloud-connection. Locally on this head, after building @objectstack/cloud-connection^... from this tree: vitest run → Test Files 80 passed (80), Tests 1206 passed (1206). Re-ran the failed job once; if it fails again I will chase the named case.

@objectstack-fleet

Copy link
Copy Markdown
Contributor

domain:server#5 · os-elon-musk · session_016WV4cz2MxDkQYCC4U8indM

ACCEPT · area A2 · Part of #32656 (PR1 of 2; #33290 carries Fixes) · head 1cffbad · 2026-11-14T19:22Z

  • Reviewer: review#3 contract record PASS, carried (comment 6881309798). Since the reviewed code head: merges of origin/main (main had changed files this PR touches: protocol.zod.ts, runtime-authoring-gate.ts, protocol-authoring-gate.ts, protocol.ts, api.json; all auto-merged) and 1cffbad, which regenerates content/docs/references/api/protocol.mdx and packages/spec/authorable-surface/api.json from the merged tree (check:generated --fix). Re-run on the merged tree: metadata-protocol authoring-gate/publish/advisor 33 files / 558 tests, runtime 4 files / 279, core assemble 221, all green.
  • Declaration: Clause-②: yes (widening), Metadata-protocol: added; @objectstack/spec minor, core / metadata-protocol / rest / runtime patch.
  • Governed: check-governed-merges --pr 33276 → NOT governed (0 of 29 paths); +490 / -16.
  • Checks @1cffbad8: 68 total = 58 success + 10 expected skips (check-expected-skips OK), 0 failed, 0 pending. (The earlier Test Core (4/8) cloud-connection failure at 085b953 did not recur.)
  • K = 3. Main has not changed any file this PR touches since its merge base e0ce1b5.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 14, 2026 19:23
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 14, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 14, 2026
…-1hzwul

# Conflicts:
#	packages/metadata-protocol/src/protocol-publish-drafts-advisories.test.ts
@objectstack-fleet

Copy link
Copy Markdown
Contributor

domain:server#5 · os-elon-musk · session_016WV4cz2MxDkQYCC4U8indM

Area A2: re-queue after the merge queue dropped this PR on MERGE_CONFLICT.

  • New head 750be0fb is a merge of origin/main (2797f81d) only. No change to this PR's own diff.
  • The one text conflict was a comment line in packages/metadata-protocol/src/protocol-publish-drafts-advisories.test.ts. I took main's wording.
  • Regen-provenance: packages/spec/authorable-surface/api.json and content/docs/references/api/protocol.mdx were regenerated from the merged tree (gen:schema, gen:docs). The os-regen hook reports both current.
  • protocol-publish-drafts-advisories.test.ts: 11/11 passed.
  • The earlier ACCEPT and the review#3 verdict stand. Auto-merge is re-enabled; the queue enters once every check is green at 750be0fb.

@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit 548f8ff Nov 14, 2026
68 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-1hzwul branch November 14, 2026 21:48
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…efused names it under the advisory rule object-registry-refused (objectstack-ai#33397)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9D4Jsmd91BqTVB7dSii9uJMV)_
Fixes objectstack-ai#33005
Clause-②: no
Metadata-protocol: none

## 维护者速读

- **改了什么**:发布时运行时注册表拒收某个对象,不再只打一行 warn。`publishPackageDrafts` 在该对象的
`published[]` 元素上带一条 `warning` advisory(稳定规则码
`object-registry-refused`,`where` 写明对象名),服务端打一次 error 日志(后果 +
修法);`publishMetaItem` 与 publish 模式的 `saveMetaItem` 同样带这条 advisory。
- **为什么改**:之前发布答 `published`/`success: true`,却没有任何地方点名这个对象,紧接着的种子加载就撞
`OBJECT_NOT_FOUND`。按裁决选项 D:先告警,outcome 枚举与 `success` 不变(选项 A 另开卡)。
- **风险与回滚**:低。只在注册表真的拒收时多出一条 advisory 和一行 error 日志;干净发布的响应字节不变,没有改
spec。回滚就是 revert 本 PR。
-
**先看**:`packages/metadata-protocol/src/protocol-registry-hydration.ts`(`applyObjectRegistryMutation`
改为把拒收交回,新增 `reportObjectRegistryRefusal`)·
`protocol-history-and-publish.ts`(`runPublishSideEffects` 与 Phase 2
的元素挂载)· `protocol-publish-drafts-advisories.test.ts` 新增的 describe。
- **两分钟验证**:`pnpm --filter @objectstack/metadata-protocol exec vitest
run --maxWorkers=2 src/protocol-publish-drafts-advisories.test.ts`,预期
10/10 通过;其中 objectstack-ai#33005 两条钉住规则码、对象名与 error 日志只出现一次。
- **需要你做的**:无,席位落地。

## What changes

The registry write-through runs after the metadata commit (ADR-0067 D2).
When `registerObject` threw there,
`ProtocolRegistryHydrationFacet.applyObjectRegistryMutation` caught it
and logged only `console.warn`, so `publishPackageDrafts` answered
`outcome: 'published'`, `success: true`, with nothing naming the object.
A seed load right after that publish then hit `OBJECT_NOT_FOUND`.

This PR implements the maintainer's option D ruling (card comment
6879630490):

- `applyObjectRegistryMutation` keeps its `warn` line and now also
returns the refusal (`ObjectRegistryRefusal`, the thrown value) instead
of discarding it. `applyRegistryWriteThrough` passes it on from its
`object` branch. Every other branch, and every other caller (rollback,
revert, orphan adoption, remote mutation, batch registration), behaves
as before and ignores the return value.
- New `reportObjectRegistryRefusal(name, refusal)` and the stable rule
id `OBJECT_REGISTRY_REFUSED = 'object-registry-refused'`. These follow
the pattern of `objectStorageSyncRefusedNotice`
(`object-storage-sync-refused`). The reporter logs one `console.error`
line that states the consequence and the fix (AGENTS.md "Degradation log
levels"), with the registry's reason as a separate argument. It returns
one `warning` in the `RuntimeAuthoringIssue` shape: `where: object
"NAME"`, `path: ''`. An undeclared failure's text stays out of the 2xx
body (`clientFacingFailureText`).
- `runPublishSideEffects` reports the refusal once per call and returns
it as `registryRefused`.
- `publishPackageDrafts` Phase 2 appends that advisory to the refused
object's `published[]` element. It comes after the gate's findings and
before any storage notice, and an element with no advisories still
carries no `advisories` key. Outcome and `success` are unchanged.
- Within the ruling's 30-line allowance, on the existing `advisories`
field: `publishMetaItem` and a publish-mode `saveMetaItem` add the same
advisory to their own `advisories`. That is about 8 extra lines.
- `protocol.ts` updates the private method signatures of the three host
stubs for the new return types. No spec or `protocol.zod.ts` change;
outcome enum untouched.

## Tests

New top-level describe in
`packages/metadata-protocol/src/protocol-publish-drafts-advisories.test.ts`,
using that file's shared stub harness:

1. A two-object batch where the registry refuses `ticket` answers
`success: true`, `outcome: 'published'`, `publishedCount: 2`. `ticket`'s
element carries exactly one advisory: `rule: 'object-registry-refused'`,
`severity: 'warning'`, `where: 'object "ticket"'`, the message names
`'ticket'`, the key set matches the other doors, and the undeclared
reason is withheld. Exactly one `console.error` line names `ticket`,
with the reason whole as its second argument. The sibling `invoice`
element has no `advisories` key.
2. `publishMetaItem` and a publish-mode `saveMetaItem` answer the same
rule with the right `where`, and each logs once.

The test file also gains a module-top `import '@objectstack/lint'`
(required by `check:test-source-alias` for an edited test file).

## Acceptance notes

- **Premise re-measured at `origin/main` 4c9104e before any edit**
(scratch test, deleted):
`{"outcome":"published","success":true,"published":[{"type":"object","name":"ticket","version":"..."}]}`,
WARN `[Protocol] registerObject failed for ticket: registry refused the
object`, ERROR `[]`, one `registerObject` call.
- **Overlap:** open PRs objectstack-ai#33276 and objectstack-ai#33193 also touch
`protocol-history-and-publish.ts`. This diff's hunks there are one
import line, `runPublishSideEffects`'s write-through capture and return
type, two lines in `publishMetaItem`'s advisory block, and one line in
Phase 2's element loop. It uses the current `main` advisory helpers and
none of their hunks.
- **File surface:** `protocol.ts` (three stub return types) is outside
the dispatch's file list, but inside the claim's
`packages/metadata-protocol/src/**`.
- **Not covered by D, left as they were:** the `object_extension` and
overlay branches of `applyRegistryWriteThrough`, and the non-publish
callers of the object write-through (rollback, revert, orphan adoption,
remote mutation fan-out). They still log at `warn` and answer nothing.
The stricter reading ("never `published` while an object does not
resolve") belongs to the follow-up option A card.
- **Read-only observation:** with a real `SchemaRegistry`,
`judgeBatchObjectRegistrations` registers every promoted object inside
`restoringOnRefusal` in Phase 1, so a refusal that repeats every time
already answers `refused` truthfully. What reaches this advisory is a
refusal that shows up only at Phase 2's real registration.

## Verification

Final head: `2dfe890ee` (objectstack, branch `claude/area-A4-33005`).

All heavy runs went through `scripts/pm/os-verify-lock.sh` (slot
`a4-33005`). Exit codes were captured before any pipe.

<details><summary>Package suites</summary>

- `pnpm --filter @objectstack/metadata-protocol typecheck && pnpm
--filter @objectstack/metadata-protocol test` at `2dfe890ee`: typecheck
clean, `Test Files 339 passed | 9 skipped (348)`, `Tests 22846 passed |
43 skipped (22889)`. `tsc --listFilesOnly` includes the edited test
file.
- Direct dependents, with each package's dependency closure built:
`@objectstack/objectql` `Test Files 595 passed (595)`, `Tests 12946
passed`; `@objectstack/rest` `Test Files 410 passed (410)`, `Tests 8370
passed | 332 skipped`. Both ran at `474253a15`; the only later commit
adds one import line to a metadata-protocol test file. The other 80
downstream packages that `turbo ls --affected` lists are left to CI
(`Test Core`). That set comes from the package dependency graph, so it
cannot see tests that read another package's source from disk. No export
of the package changed: the new symbols are not re-exported from its
index.
- `eslint --no-inline-config` on the five touched source and test files:
exit 0.

</details>

<details><summary>Ablation (one-time proof, not kept as a
test)</summary>

The fix was committed first. `node scripts/ablation-replace.mjs`
replaced `return { error: err };` in `applyObjectRegistryMutation` with
`return undefined;`; the anchor went 1 to 0 and the blob changed
7f14707 to afb04eb6c844. The pin file then failed, `Tests 2 failed
| 8 passed (10)`, both failures in the objectstack-ai#33005 describe. The tool
restored the file: blob back to 7f14707, equal to HEAD; `git diff
HEAD` empty; `git status --porcelain` empty. The test imports
`./protocol.js` from source, so no rebuild was needed.

</details>

<details><summary>Gate families</summary>

The families `node scripts/pm/dispatch-gates.mjs --commands` derives
(72) were run one by one. The run at `474253a15` turned up one real
finding, `check:test-source-alias`: the edited test file needed a
module-top `import '@objectstack/lint'`. It was fixed in `2dfe890ee` and
re-run green. At that point `check:dual-build-cjs-loads`,
`check:lean-entry-closure` and `check:type-check-debt` had not been
measured (missing built output or a lock wait); all three were re-run at
`2dfe890ee` and exited 0. The full union is being re-run at `2dfe890ee`;
the result goes in the os-dev report comment on the card.

</details>

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

https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC

---------

Co-authored-by: Claude <noreply@anthropic.com>
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…, falling back to the workspace default (objectstack-ai#32656, 2/2) (objectstack-ai#33290)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DXuamRUC67fx2TTYrFfyuSH)_

Fixes objectstack-ai#32656

Stacked on objectstack-ai#33276 (PR 1 of 2, base branch). Retarget to `main` once
objectstack-ai#33276 merges. The claim on objectstack-ai#32656 names this branch.

## Maintainer quick read

The refusals a permission admin or end user reads now come back in their
language: request language, else workspace default, else English (ruling
C on objectstack-ai#32440). Codes, statuses and the diagnostic `message` are
unchanged.

## What changes

- **plugin-security, packaged permission-set lock:**
`PackagedPermissionSetLockedError` and
`PackagedPermissionSetProvenanceUnknownError` compose `userMessage` from
an 11-language text table on the caller's ladder (each code matched by
`resolveBundleLocale`, the platform's one locale ladder), instead of
static English. The gate reads the ladder from its context;
`assertPermissionSetNotPackageDeclared` and both constructors take it as
an optional last argument (no locales ⇒ the English text, byte-identical
to before).
- **plugin-security, authz middleware:** `userFacingDenialMessage` /
`fieldEditDenialMessage` take `[ctx.locale, ctx.workspaceLocale]` and
render in the first that has text (a deployment `errors.<key>` override,
else the built-in operation-message catalog); none ⇒ `en` as before.
Field labels are translated in the language the sentence resolves to.
- **metadata-protocol (pass-through):** `MetadataAuthoringGateContext`
gains optional `userTextLocales`; `runAuthoringGate` forwards the save
request's `userTextLocales` (from objectstack-ai#33276) to the type's gate. Checked:
E1's open PR objectstack-ai#33251 touches none of these files.

## Why

objectstack-ai#32656 asks every `userMessage` producer to compose in the request
locale with the declared fallback. objectstack-ai#33276 did the save door's advisories
and authoring-rule refusals; these are the remaining server producers
that composed English only, or that read only the folded `locale`.

## Verification

- `packaged-permission-set-lock.test.ts`: zh-CN, ja-JP (request wins
over workspace), `tlh`→zh-TW workspace fallback, `tlh`/`tlh` = unstated
= English; code/status/diagnostic identical in every language; the
provenance-unknown refusal in de-DE.
- `permission-denied-user-copy.test.ts`: de-DE request with zh-CN
workspace ⇒ zh-CN sentence; ja-JP request wins; de-DE/de-DE ⇒ en.
- `mutation-listeners.test.ts`: the gate receives the stated locales
(empty entries dropped) and no key when none are stated.
- `meta-save-user-text-locale.test.ts` (runtime, both `/meta` doors):
the permission gate receives `['zh-CN','de']`, and `[]` with none.
- Local: `@objectstack/plugin-security` full suite 6610 passed;
metadata-protocol / runtime targeted tests green; typecheck clean;
test-source alias gate clean.

Clause-②: no
Metadata-protocol: none

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

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

https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM

---------

Co-authored-by: Claude <noreply@anthropic.com>
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…:reloaded (objectstack-ai#33448)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DMscMg6AKHasj3ZXEDorLPH)_

Fixes objectstack-ai#33302

Clause-②: no
Metadata-protocol: none
Skills-docs: none — no authorable key, value or metadata type moves; the
change is which runtime doors announce an existing kernel event

Opened by `domain:server#5 · os-elon-musk ·
session_016WV4cykhsWAtSL6Sr4VWFG` (area A5 of the server area-lease
pilot), from claim comment 6884323409.

## 维护者速读

- 改了什么:运行时的 `POST /packages` 安装与 `PATCH /packages/:id/enable`
启用两条路由,在包进入服务后向内核宣告 `metadata:reloaded`(载荷 `changed:
['app/ID']`,与市场本地安装同一拼法)。安装每次落地都宣告;启用只在包原本处于停用时宣告。
- 为什么改:这两条路由原来什么都不宣告,所有 `metadata:reloaded` 订阅者(岗位改名 `renamedFrom`
的任职人迁移、流程重同步、钩子/动作/翻译重同步)都听不到,要等下次重启。
- 风险与回滚:多一次已有的内核重同步(与发布、本地安装同一事件,订阅者幂等);宣告失败只记 `warn`,不改变路由的应答。回滚即回退本
PR。
- 先看:`packages/runtime/src/domains/packages.ts` 中新增的
`announcePackageReload` 与启用路由里的 `wasDisabled`
判定;`packages/runtime/src/domains/packages-reload-announce.test.ts`。
- 两分钟验证:`pnpm --filter @objectstack/runtime exec vitest run --project
local --maxWorkers=2 src/domains/packages-reload-announce.test.ts`,预期 5
个用例全绿。
- 需要你做的:无,席位落地。

## What changes

- `packages/runtime/src/domains/packages.ts`
- New module helper `announcePackageReload(deps, context, id, door)`,
used only by the two handlers below. It calls
`deps.announceKernelEvent(context, 'metadata:reloaded', { changed:
['app/ID'] })`, the spelling the marketplace install-local door uses
(`announceHotInstall` in `@objectstack/cloud-connection`). A subscriber
failure is caught and logged once at `warn` with the restart that
repairs it, the level the publish-drafts door and install-local use for
the same announce. It never changes the door's answer.
- `POST /packages`: announces after the registry write and the durable
state write, on both answers. That includes the `enableOnInstall`
lifecycle refusal, which refuses the switch but not the install, whose
row is already served.
- `PATCH /packages/:id/enable`: reads `registry.isPackageDisabled(id)`
before `enablePackage` (the predicate `enablePackage` itself asks before
it tells its enable listeners). It announces only when the package was
disabled, so an enable of an already-enabled package announces nothing.
- `packages/runtime/src/domains/packages-reload-announce.test.ts`: new
pin file (5 cases).
- `.changeset/33302-package-doors-announce-reload.md`:
`@objectstack/runtime` patch.

The A2 hunk in this file (open PR objectstack-ai#33276, around line 2997, a different
handler) is not touched.

## Why

After the hot-install carry landed, `plugin-security` carries the
holders of a renamed position (`renamedFrom`) on `metadata:reloaded`.
Neither of these two doors announced that event, so a package they
brought into service kept its renamed positions' holders on the old
names until the next boot. The same went for every other subscriber of
the event.

Premise re-measured on `origin/main` (9499dcc) through the real route
before the fix: the same pin file with `packages.ts` at that commit
answers `4 failed | 1 passed`, and the holder assertions read `{ e1:
'sales_rep', ... }` and `{ i1: 'field_rep' }`: the holders stayed on the
old names.

One part of the card's premise is narrower than written.
`ManifestSchema` declares no `positions` key, so a `POST /packages` body
can never carry a position. A probe of `ManifestSchema.safeParse` with
`positions` answers `unrecognized_keys: ["positions"]`. An authored
package's positions are registered by a publish, and that publish
already announces `position/NAME`. The install door puts a renamed
position into service in one way only: an overwrite install with
`enableOnInstall: true` of a disabled package. The install-side holder
pin therefore drives that path. A fresh install is pinned on the
announcement itself.

## Tests

`packages-reload-announce.test.ts` uses a real `ObjectKernel` with the
SQL driver (better-sqlite3 `:memory:`), `ObjectQLPlugin`, the real
`SecurityPlugin`, and an `HttpDispatcher` over that kernel. The holder
move is `plugin-security`'s own carry. A recorder hook only listens, and
reads whether the registry holds the named package when the event
arrives.

1. Enable door: a code package renaming `sales_rep` is disabled, then
enabled through `PATCH /packages/:id/enable`. The holder moves to
`crm_sales_rep`, the control holder is untouched, and exactly one
announcement `{ changed: ['app/ID'] }` arrives with the package
registered.
2. Enable of an already-enabled package: answers 200 and announces
nothing.
3. Fresh install through `POST /packages`: one announcement, with the
package registered.
4. Overwrite install with `enableOnInstall: true` of a disabled authored
package whose published position renames `field_rep`: the holder moves
to `authored_sales_rep`, with one announcement.
5. A subscriber that throws: the install still answers 201, the package
is registered, and the failure is said once at `warn`, naming the
package.

<details><summary>Green at d57ccec</summary>

```
 Test Files  1 passed (1)
      Tests  5 passed (5)
os-verify-lock: VERDICT command-exit 0
```
</details>

<details><summary>Ablation: packages.ts restored to 9499dcc
(predicted 4 failed | 1 passed)</summary>

```
mutation on-disk=29dc2a6d33 base=29dc2a6d33 head=224475638b
announcePackageReload occurrences after mutation: 0
 x enable door ... holder: expected { e1: 'sales_rep', e2: 'crm_auditor' } to deeply equal { e1: 'crm_sales_rep', ... }
 x fresh install announces app/ID once
 x overwrite install with enableOnInstall: true ... expected { i1: 'field_rep' } to deeply equal { i1: 'authored_sales_rep' }
 x a subscriber that throws ... failure said once at warn
 Tests  4 failed | 1 passed (5)
os-verify-lock: VERDICT command-exit 1
restore on-disk=224475638b head=224475638b
git diff HEAD lines: 0
```
Case 2 stays green in both legs: an already-enabled package announces
nothing before or after the change.
</details>

## Acceptance notes

-
`packages/plugins/plugin-security/src/position-renamed-holder-carry.ts`
(module doc, "When it runs") still lists "the runtime's package install
and enable routes" as doors that register positions without announcing.
That sentence is now false. The file is outside this card's surface, so
it is reported for the seat and not edited here.
- The disable door and `DELETE /packages/:id` still announce nothing.
The install-local uninstall does announce the withdrawal. Whether these
two should was left out of scope by the card, and the report covers it.

## Verification

Local verification after this head (typecheck, the runtime suite, the
derived gate families and the `--ran` reconciliation) is in the
`os-dev-report` comment on objectstack-ai#33302. CI check-runs are the authority for
every family CI runs.

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(`packages/spec` untouched.)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` is CI's run.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: not applicable.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English (the 维护者速读 block is the
fleet's Chinese maintainer summary).

---
_Generated by [Claude
Code](https://claude.ai/code/session_016WV4cykhsWAtSL6Sr4VWFG)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…ject answers published_unregistered naming it (objectstack-ai#33528)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9D75mRNRrsy6GfiJD9q7La4j)_
Fixes objectstack-ai#33277
Clause-②: yes (widening)
Metadata-protocol: semantic

## 维护者速读

- 改了什么:发布整个应用(publish-drafts)时,如果运行时注册表拒收了某个对象,返回不再说「published」,而是新的
`published_unregistered`(`success: false`),并在 `unregistered[]`
里点名这些对象,沿用 objectstack-ai#33005 的规则码 `object-registry-refused`。
- 为什么改:按 objectstack-ai#33005 的裁决「D 先告警,A 后续跟上」,这是 A:程序化调用方(托管云的 AI
搭建)以前看到「发布成功」就去灌示例数据,结果报找不到表。
- 风险与回滚:新增枚举值,注册表全部接受时返回逐字节不变;应用可见性翻转和控制台的提示保持现状(待裁决)。回滚即 revert 本 PR。
-
先看:`packages/metadata-protocol/src/protocol-history-and-publish.ts`(outcome
推导)、`packages/runtime/src/domains/packages.ts`(翻转白名单,新值保持翻转)、`packages/spec/src/api/protocol.zod.ts`(契约)。
- 两分钟验证:`pnpm --filter @objectstack/metadata-protocol exec vitest run
src/protocol-publish-drafts-advisories.test.ts`,预期 14 个用例全绿,含 `[objectstack-ai#33277]`
四个。
- 需要你做的:裁决两件事——新值是否继续触发应用可见性翻转,以及控制台对它是否继续显示「发布成功」(本 PR 均保持现状)。

## What changes

- **Spec** (`PublishPackageDraftsResponseSchema`): `outcome` gains
`published_unregistered`; the response gains optional `unregistered: [{
type, name, rule: 'object-registry-refused' }]`, present if and only if
the outcome is `published_unregistered`. `success` stays exactly
`outcome === 'published'`, so it is false on the new value. Describes
updated; reference docs, `authorable-surface/api.json` and the
strictness counts regenerated. One ADR-0087 semantic entry for major 18
(`publish-drafts-outcome-published-unregistered`), because a caller
branching on `success` or `outcome` now takes a different branch for the
same server event.
- **Producer** (`publishPackageDrafts`, metadata-protocol): each object
whose registry write-through was refused (the objectstack-ai#33005 `registryRefused`
receipt) is collected in publish order; the batch answers
`published_unregistered`, `success: false`, `unregistered[]`. Nothing
else moves: the drafts landed and stay live, every object is still in
`published[]` with its warning, `failed[]` stays empty, and commit,
seeds, probes and receipts are unchanged. Return types in
`protocol-history-and-publish.ts` and `protocol.ts` widened.
- **Runtime flip** (`PUBLISH_OUTCOMES_THAT_FLIP`):
`published_unregistered` is added, so the ADR-0045 visibility flip and
the `metadata:reloaded` announce run exactly as they did when this
answer read `published`. Kept as the status quo pending a ruling
(below).
- **Client SDK**: the `packages.publishDrafts` docblock no longer says
`success: false` on a 200 means nothing landed; it names the three
non-success outcomes.
- **Console** (`ui/packages/app-shell`): Studio's publish, the package
sheet, Home's Publish all and the AI chat card treated every `success:
false` as a failed publish. Each now reads `published_unregistered` as
it read the `published` answer the server gave for this before: the
refused object's `object-registry-refused` warning still reaches the
author through the client's advisory sink, and no caller reports "Action
failed" / "Publish failed" for drafts that landed.

## Tests

- `protocol-publish-drafts-advisories.test.ts` (the shared harness): a
new `[objectstack-ai#33277]` describe pins the refused object named in
`unregistered[]` with `published_unregistered` / `success: false` in
both publish orders (refused object first and second), two refused
objects named in publish order, and a CONTROL that a batch the registry
takes whole still answers `published`, `success: true`, with no
`unregistered` key. The objectstack-ai#33005 case no longer pins `outcome:
'published'`.
- `packages/spec/src/api/protocol.test.ts`: the new value and key parse
and round-trip; an entry with an unknown rule or no rule is refused; the
vocabulary stays closed.
- `packages/runtime/src/http-dispatcher.test.ts`: the flip still runs
after `published_unregistered` (status-quo pin).
- UI: one case each in `PackagesPage.publishRefusal-11922`,
`usePublishAllDrafts.refusal-11922`,
`AiChatPage.publishAdvisoryReachesAuthor` and
`StudioDesignSurface.publishCount-11807`.
- Ablation (once, on the negative pin, after the fix was committed):
`scripts/ablation-replace.mjs` replaced the `unregistered.push(...)`
line with a no-op (anchor 1 to 0, blob 8035b04 to 78b920f646cd);
the pin file went to 3 failed / 11 passed, exactly the three negative
`[objectstack-ai#33277]` cases, CONTROL and the objectstack-ai#33005 cases green; restored to blob
8035b04 equal to HEAD, `git diff HEAD` empty. The test imports
`./protocol.js` from `src`, so no rebuild was needed.

## Acceptance notes

- **Open choice 1, the visibility flip.** `published_unregistered` still
flips `_unpublished` apps (status quo: this answer used to read
`published`). Alternative: drop it from the allow-list so an app whose
object is not served stays hidden until a re-publish. Listed for a
ruling; not changed here.
- **Open choice 2, the console's presentation.** The console keeps
showing a successful publish plus the object's warning toast (the
presentation ruled for objectstack-ai#33005). Alternative: a distinct "published, but
N objects are not served" message. Listed for a ruling; not changed
here.
- **The card's premise detail:**
`ui/packages/data-objectstack/src/metadata-client.ts` does not switch on
the outcome (it returns a 2xx unexamined and only emits advisories); the
switches are in the four `app-shell` callers above, which this PR
adapts.
- **Hosted cloud (outside this repo):** the AI build path must stop or
retry before seeding on `published_unregistered`, keyed on
`unregistered[]` or the `object-registry-refused` rule. Cloud already
ships a bounded retry for the seed race; it should now branch on the
outcome instead.
- **Not in this card:** the single-item doors (`publishMetaItem`, a
publish-mode save) still answer success with the warning on
`advisories`; the other write-through callers objectstack-ai#33005's report listed
stay warn-only.
- Shared files with objectstack-ai#33276 (now merged into this branch):
`protocol-history-and-publish.ts`, `protocol.ts`, `protocol.zod.ts`,
`packages.ts`, the advisories test, `http-dispatcher.test.ts`; the merge
was clean and every suite below was re-run on the merged head.

## Verification

Premise measured first, at `origin/main` ba35dfd (producer file
restored from that commit, blob 884d24a): a publish with the
registry refusing `ticket` answered
`{"success":true,"outcome":"published","publishedCount":2,"failedCount":0}`
with `ticket` carrying `object-registry-refused`, in both publish
orders. At this branch:
`{"success":false,"outcome":"published_unregistered",...,"unregistered":[...]}`
in both orders.

<details><summary>Package suites, final head 28691d1 (merged with
origin/main), under os-verify-lock</summary>

- `@objectstack/metadata-protocol` typecheck exit 0 (`tsc
--listFilesOnly` includes the advisories test); `test`: Test Files 340
passed, 9 skipped (349); Tests 22870 passed, 43 skipped.
- `@objectstack/spec` `src/api/protocol.test.ts` + `src/migrations/`:
Test Files 6 passed; Tests 451 passed.
- `@objectstack/runtime` `http-dispatcher.test.ts`,
`packages-publish-drafts-change-note.integration.test.ts`,
`packages-publish-drafts-response-conformance.test.ts`: Test Files 3
passed; Tests 275 passed.
- `@objectstack/objectql`
`publish-package-drafts-response-conformance.test.ts`: 16 passed.
- `@object-ui/app-shell`, the four UI files: Test Files 4 passed; Tests
23 passed.
</details>

<details><summary>Gates (local subset; CI owns the rest)</summary>

Exit 0 at the final head: `check:generated` (all 14 artifacts current),
`check:strictness-ledger`, `check:api-surface` (unchanged),
`check:doc-authoring`, `check-adr-0087-registration` (no breaking
changeset), `check-nul-bytes`. Exit 0 before the merge:
`check:spec-changes`, `check:upgrade-guide`, `check:authorable-surface`,
`check:docs`, `check-changeset-no-major`, `check-empty-changeset`,
`check:durability-log-level`; eslint `--no-inline-config` on the nine
touched package files and eslint on the four UI files (0 errors).
`dispatch-gates --ran`: 12 of 123 derived families run locally, 111 left
to CI by declared narrowing (the verify lock was held 3h20m by another
run).

NOT MEASURED locally: app-shell `type-check` (needs every `@object-ui/*`
dist built; Type Check UI owns it); the `check:test-typecheck` leg of
runtime and client typecheck (their main `tsc --noEmit` passed; the test
layer reported errors in test files this diff does not touch, which
import packages not built here).
</details>

Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn

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

<!-- signed: domain:server#5 · os-elon-musk ·
session_016WV4cy1y7UNVbT2QAdmgdn -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…ave advisories and refusals (objectstack-ai#33576)

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

Fixes objectstack-ai#32657

Refs objectstack-ai#33524 (console half pinned, no console change; the card stays open
for its server half)

Clause-②: yes (widening)
Metadata-protocol: none

## 维护者速读

-
改了什么:保存元数据后弹出的「提醒」以及保存被拒时的问题列表,现在显示服务端按用户语言写好的那句话(`userMessage`),不再显示给开发者看的英文
`message`/`hint`;Studio
被拒保存的提示句也直接用这句话,不再由控制台自己翻译服务端英文。服务端没写这句话的条目保持原样。另外给新建/编辑记录弹窗加了钉子测试:带
`userMessage` 的 403(中英文)显示该原因,不带的仍显示通用的「你没有权限保存此记录」。
- 为什么改:执行维护者裁决「32440 选C,32043 一起按C处理」的第 3
层:服务端(objectstack-ai#33276、objectstack-ai#33290)已按请求语言写好用户文案,控制台要直接渲染。objectstack-ai#33524 实测:弹窗本来就先读
`userMessage`,HotCRM 看到通用句是因为 plugin-security 的「需要主记录编辑权限」拒绝根本没带
`userMessage`,那是服务端的缺口,本 PR 不改服务端。
- 风险与回滚:只改控制台读哪个字段来显示;没有 `userMessage`
的条目逐字不变。`@object-ui/data-objectstack` 的 `MetadataValidationIssue`
多一个可选字段(只加不减)。回滚即 revert。
- 先看:`ui/packages/app-shell/src/providers/saveAdvisoryToast.ts` 的
`formatFinding`;`ui/packages/data-objectstack/src/metadata-error.ts` 的
`formatMetadataIssue`;`ui/packages/app-shell/src/views/studio-design/metadataError.ts`
的 `issueRefusal`。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/providers/AdapterProvider.advisoryUserMessage-32657.test.tsx`,预期
3 个用例全绿,其中中文用例在真实 sonner 弹出的提醒里读到「权限集“sales_rep”的持有者只能看到……」,读不到英文
message。
- 需要你做的:无,席位落地(契约复审记录由席位补)。

## What changes

Layer 3 of tracking objectstack-ai#32654 (ruling C on objectstack-ai#32440, 「32440 选C,32043
一起按C处理」): the console renders the user-facing text the producer composed
in the request's language, with no per-code key table of its own.

- **Advisory toast** (`saveAdvisoryToast.ts`, `formatFinding`,
`@object-ui/app-shell`). An advisory finding that carries `userMessage`
(`RuntimeAuthoringIssueSchema.userMessage`, which the save and publish
doors compose since objectstack-ai#33276) renders as `[rule] where — USER_MESSAGE`, in
place of the developer-facing English `message` and `hint`. The rule id
and `where` are locators and frame both faces. A finding without one
keeps `[rule] where — message hint`. The module header now says which
prose is shown.
- **The one issue reader** (`metadata-error.ts`, `formatMetadataIssue`,
`@object-ui/data-objectstack`). A 422 issue with `userMessage` renders
`• path — USER_MESSAGE`; one without keeps `• path — message`.
`formatMetadataError` and app-shell's `formatPublishFailures` both write
issues through it, so the banners, the field designer's refusal and the
publish-failure list follow.
- **Studio's refusal sentence** (`metadataError.ts`, `issueRefusal`).
When the issue carries `userMessage`, the sentence's problem part is
that text verbatim; only an issue without one has its English `message`
read through `translateValidationMessage`, the console's own table. This
is the console-side translation of server prose the ruling retires where
the producer speaks.
- **Type** (`metadata-client.ts`). `MetadataValidationIssue` gains
optional `userMessage`, typed `RuntimeAuthoringIssue['userMessage']`
from `@objectstack/spec/api`, so a rename in the spec stops it
compiling. Published interface, optional member: `Clause-②: yes
(widening)`.
- **Changeset** `.changeset/32657-console-localized-user-text.md`:
`@object-ui/app-shell`, `@object-ui/console`,
`@object-ui/data-objectstack` patch, with both declaration lines.

The presence test is the same predicate in all three readers (a
non-empty string after trimming, the rule `@objectstack/client` applies
when it lifts `userMessage`). `declaredUserMessage` (`@object-ui/react`)
is the one reader of an API ERROR's marking; it was not reused here
because a finding element is not an error, `@object-ui/data-objectstack`
sits below `@object-ui/react` (no import that way), and
`saveAdvisoryToast.ts` imports nothing that renders by design.

## Why

- **objectstack-ai#32657** reproduced on `origin/main` `e3f0cfd4`: the toast never
read `advisories[].userMessage`, `formatMetadataIssue` never read
`issues[].userMessage`, and `issueRefusal` translated the English
`message` console-side.
- **objectstack-ai#33524** did not reproduce in the console. The console's New and
Edit buttons open `ModalForm` (app-shell `console/AppContent.tsx`),
which rethrows a refused write into the components form renderer; its
refusal reader takes `declaredUserMessage(error)` before the fixed
`form.noPermissionToSave` line, as do `FormPage.tsx`'s `refusalText` and
the edit OCC path (`occSave.tsx`). The master-edit refusal reaches the
console with no `userMessage`: plugin-security's `masterEditDenied`
(`security-plugin-cbp-write-gate.ts`) throws a bare
`PermissionDeniedError` whose `message` is the developer sentence
"requires edit access to its master record", and objectstack-ai#33290 localized other
refusals, not this one. So the generic line is the correct reading of
what the server sends, and acceptance 1 and 2 of objectstack-ai#33524 need the
producer to compose a localized `userMessage` naming the master. That is
a server change this PR does not make; the card stays open for it (seat
ruling in the card thread).

## Tests

- New `AdapterProvider.advisoryUserMessage-32657.test.tsx` (rendered end
to end): the real `AdapterProvider` builds the real adapter, the real
SDK client parses a save response from a `fetch` double, and the real
sonner `Toaster` draws the toast; the assertions read the toast's text
on screen.
- a zh-CN `userMessage` (the `security-private-no-readscope` catalog
sentence for these params) shows, with the rule id, and neither the
English `message` nor `hint` shows;
  - an en `userMessage` shows the same way;
  - CONTROL: a finding without one keeps `message` + `hint` + rule.
- `saveAdvisoryToast.test.ts`: two cases added (the exact line with a
`userMessage`; CONTROL: a blank one is no sentence).
- New `metadataError.issueUserMessage-32657.test.ts`:
`formatMetadataIssue` with and without `userMessage`;
`formatMetadataError` and `formatPublishFailures` carry it;
`flowSaveRefusal` (through `issueRefusal`) carries a zh `userMessage`
verbatim and not the console's translation, and CONTROL: an issue
without one keeps the console's reading.
- New `ModalForm.markedRefusal-33524.test.tsx` (rendered; the dialog the
console's New and Edit buttons open): the user types and presses the
dialog's own Create or Update button, the data source refuses with a 403
shaped as the ObjectStack adapter throws it.
- create and edit, each with an en and a zh-CN `userMessage`: the
sentence shows, the generic line does not, the developer `message` does
not;
- CONTROL, create and edit: a 403 with no `userMessage` shows the
generic line and withholds the developer `message`.

<details><summary>Red-first on base, and ablations</summary>

- **Base.** The four production files checked out at `e3f0cfd4` (tree
only), the new and edited tests kept: Test Files 3 failed, 1 passed (4);
Tests 6 failed, 26 passed (32). The six reds are exactly the
`userMessage` cases of the three objectstack-ai#32657 files; the controls passed.
`ModalForm.markedRefusal-33524.test.tsx` passed on base, 6 of 6: the
objectstack-ai#33524 console half does not reproduce. Restored with `git checkout HEAD
--`, `git diff HEAD` empty.
- **Ablations** through `scripts/ablation-replace.mjs`, each restored to
the HEAD blob with `git diff HEAD` empty. ui vitest reads `@object-ui/*`
from source, so no build sits between mutation and run.
- A1 `formatFinding`'s `userMessage` branch made unreachable: Tests 3
failed, 18 passed; the reds are the two rendered `userMessage` cases and
the unit case; both controls green.
- A2 `formatMetadataIssue` made to read `message` always: Tests 2
failed, 3 passed.
- A3 `issueRefusal`'s `userMessage` branch made unreachable: Tests 1
failed, 4 passed.
- A4 (the objectstack-ai#33524 pin's bite) the form renderer's refusal reader made to
answer the generic line for any permission error before
`declaredUserMessage`: Tests 4 failed, 2 passed; the four marked cases
red, the two CONTROLs green. The first A4 attempt passed a two-line
anchor and was refused before running anything; it was rerun with a
one-line anchor.

</details>

## Acceptance notes

- **objectstack-ai#33524 is referenced, not closed.** Its console half is pinned with
no console change (above). Its producer half, plugin-security's
master-edit refusal composing a localized `userMessage` that names the
master, is reported to the seat as a server finding; the seat re-lanes
the card.
- **objectstack-ai#32440's post-save advisory half** is met by this PR: the advisory
toast now renders the producer's localized sentence wherever the save
door sends one. Rules the producer has written no sentence for still
show their English `message` and `hint`, as the contract declares (the
remaining catalogue is tracked on objectstack-ai#32835).
- **objectstack-ai#32043's member-limit sentence** is not met by this PR: that refusal
(`DEVELOPER_ORGANIZATION_MEMBER_LIMIT_REACHED`) is produced by cloud. If
cloud sends it with a `userMessage`, the invite dialog's reader decides
what shows; this PR did not measure that dialog.
- **Other write-error readers.** Several console surfaces read a write
error through `extractWriteErrorMessage` alone (for example the
sharing-rule clone dialog and the position and assigned-user sections),
which reads the server's `error` / `message` and not `userMessage`.
Noted, not changed here: outside this card's declared surface.
- **File surface:** as declared to the seat (the four production files
above, their tests, one new plugin-form test, the changeset). No i18n
key, no `FormPage.tsx` or `flowResponse.ts` edit, no server, spec or
cloud change.

## Verification

Run on head `e0302529` (base `origin/main` `e3f0cfd4`).

<details><summary>Build, tests, type-check and lint</summary>

- Builds under the verify lock: `pnpm --workspace-concurrency=2 --filter
'@objectstack/spec...' --filter '@objectstack/formula...' --filter
'@objectstack/client...' --filter '@objectstack/lint...' --filter
'@objectstack/sdui-parser...' build` (VERDICT command-exit 0), then
`pnpm --workspace-concurrency=2 --filter '@object-ui/app-shell^...'
build` (VERDICT command-exit 0).
- The four new or edited test files: Test Files 4 passed (4), Tests 32
passed (32).
- Neighbouring suites, `pnpm --dir ui exec vitest run --maxWorkers=2
packages/data-objectstack/ packages/app-shell/src/providers/
packages/app-shell/src/views/studio-design/
packages/plugin-designer/src/MetadataFieldsPage.refusalIssues-11302.test.tsx
packages/plugin-form/src/ModalForm
packages/components/src/__tests__/form-write-error-message.test.tsx`:
Test Files 499 passed (499), Tests 4343 passed (4343).
- Type-check, each VERDICT command-exit 0: `pnpm --filter
@object-ui/data-objectstack run type-check` (`tsc --noEmit`), `pnpm
--filter @object-ui/app-shell run type-check` and `pnpm --filter
@object-ui/plugin-form run type-check` (both `tsc --noEmit && tsc -p
tsconfig.test.json`, so the new test files are compiled).
- eslint on the eight changed files: 0 errors (8 warnings, all
pre-existing `no-explicit-any` lines in `metadata-client.ts`). `pnpm
--dir ui run check:new-line-citations`: 0 new citations.

</details>

<details><summary>Derived gates (37)</summary>

`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 37 families on `e0302529`. All 37
exited 0. `pnpm --dir ui exec vitest run scripts/` was SIGKILLed in the
loop while a 23-minute suite run held the box; rerun alone under the
lock with `--maxWorkers=2`: Test Files 171 passed, 2 skipped (173), exit
0. `--ran` reconciliation: 37 derived, 37 run, 0 NOT-MEASURED. Changed
lines: 446, under the 3,000 threshold. No dogfood battery: no `!` in the
title and no `(narrowing)` arm.

</details>

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

Development by the card thread `session_01FEkQ5m1xDT63aCaQJNjwXD` for
the seat `domain:ui#2`.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5m1xDT63aCaQJNjwXD)_

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

https://claude.ai/code/session_01FEkQ5m1xDT63aCaQJNjwXD

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l 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.

2 participants