Skip to content

feat(console): the docs reader lists the candidate packages when a doc name two packages ship is refused - #34109

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-mr9g83
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-mr9g83

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #34070
Waits-on: #34036 — satisfied: merged to main as 5af956f3; this branch merged origin/main at 37ea190a.
Clause-②: yes (widening) — widened: where a doc read that names no package answers 409 RESOURCE_CONFLICT naming its holders (details.candidates), the Console docs reader lists those packages, each linking to that package's address /apps/PACKAGE/docs/NAME, where it showed "Failed to load documentation"; a flat permalink under a package container of a name that package ships opens the doc in that package's own book; three @object-ui/i18n keys (help.docConflictTitle, help.docConflictDescription, help.docConflictCandidates) in all 11 shipped locales, none renamed or removed. A doc one package ships, and every other failure, render as before.
Metadata-protocol: none

维护者速读

  • 改了什么:两个启用的包发布同名文档时,Console 文档页不再显示笼统的「Failed to load documentation」,而是列出提供该文档的各个包(先显示包在文档门户里的名字,旁边是包 id),点哪个就在那个包的地址 /apps/包id/docs/文档名 下打开那一份,并且侧边栏是那个包自己的书。
  • 为什么改:落实裁决 6893582352(metadata-protocol: a bare by-name read of a doc name two namespaces ship serves the first-registered holder #33264):服务端在 PR fix(objectql)!: a bare doc read refuses a name two enabled packages hold, naming both #34036 合并后,不指明包读取同名文档会回 409 并列出候选包,Console 要把候选包显示出来让用户选,而不是报错。
  • 风险与回滚:只在读取返回 409 RESOURCE_CONFLICT 且带候选包时生效;单持有者的文档、401/403、404 和其他错误都照旧。另含一处小修:在包容器下打开同名文档时,首页书按该包自己的那份来定(否则会落进另一个包的书)。回滚即还原本 PR。
  • 先看:ui/apps/console/src/pages/DocPage.tsx 的 conflictCandidates 与 state === 'conflict' 分支;ui/apps/console/src/pages/DocsSlug.tsx 的 ownCopy 一行;docs-portal.test.tsx 末尾新增的 describe。
  • 两分钟验证:pnpm --dir ui exec vitest run apps/console/src/pages/docs-portal.test.tsx -t objectstack#34070,预期 4 个用例通过。
  • 需要你做的:无,席位落地(fix(objectql)!: a bare doc read refuses a name two enabled packages hold, naming both #34036 已合并,本分支已并入 main)。

What changes

PR #34036 (merged as 5af956f3; read first at its head e4b68eb2b) makes a doc read that names no package, of a name two or more enabled packages ship, answer 409 RESOURCE_CONFLICT with every holder named. The envelope this PR reads, and where it was read:

  • The thrown refusal: PackageScopedNameRefusedError (code = 'RESOURCE_CONFLICT', status = 409, refusal.candidates) in packages/core/src/package-scoped-resolution.ts; fix(objectql)!: a bare doc read refuses a name two enabled packages hold, naming both #34036 throws it from readMetaItem through refuseAmbiguousBareDocRead (packages/metadata-protocol/src/protocol-meta-item-reads.ts on its head; on main the judge call in readMetaItem is unchanged — the file differs from that head only by an unrelated action-artifact hunk).
  • The wire: the GET /meta/:type/:name handler answers it with handleRouteError(res, error, undefined, { packageScopedCandidates: true }) (packages/rest/src/meta-item-read-routes.ts), which puts the holders at details.candidates (packageScopedCandidatesMember, packages/rest/src/error-response.ts).
  • The client: unwrapResponse in packages/client/src/index.ts sets err.code, err.httpStatus and err.details = errorBody.details on the rejection.
  • The docs: content/docs/api/client-sdk.mdx, the /meta 409 section ("The server picks no holder for you"): err.httpStatus === 409 && err.code === 'RESOURCE_CONFLICT', then err.details?.candidates = [{ kind: 'package', packageId }, …]. The head and the docs agree.

Where the 409 lands in the Console: a flat /docs/NAME permalink of a name in the member's doc list redirects (DocsSlug) to /docs/BOOK/NAME, and DocPage's read there names no package, so the refusal reaches DocPage, which rendered "Failed to load documentation". The change sits there:

  • DocPage.tsx: conflictCandidates(err) reads a 409 RESOURCE_CONFLICT rejection's details.candidates and keeps the package holders. Non-empty ⇒ a conflict state: a "Choose a package" list, each entry labelled as the portal names the package (its home book for this doc, homeBook(name, books, docs, packageId)), the package id beside it, linking to /apps/PACKAGE/docs/NAME (the package container's flat permalink, the address the app header's docs link already uses). Every other failure keeps today's branch.
  • DocsSlug.tsx + book-nav.ts: homeBook takes an optional packageId. Under /apps/PACKAGE/docs/NAME, when that package ships NAME, its own copy decides the home book. Without this, the redirect took the first listed doc of the name, so a candidate link landed in the OTHER package's book (content right, since DocPage reads with ?package=, sidebar wrong). No other URL changes its answer: the package is passed only when the container ships the name.
  • @object-ui/i18n: help.docConflictTitle, help.docConflictDescription ({{name}}), help.docConflictCandidates, in all 11 locale packs; zh-Hant.ts regenerated with gen-zh-hant.mjs from zh-Hans.ts.

Candidates of another kind (environment, platform, residual) are not listed: for a doc the environment's own item answers first (#34036), so a doc refusal names packages only; a refusal naming no package keeps today's error state.

Tests

New top-level describe in the shared harness ui/apps/console/src/pages/docs-portal.test.tsx (real DocsLayout / DocsSlug / DocPage under the real route table, /docs and /apps/:appName/docs), with a third adapter world: shared_guide shipped by com.example.beta (listed first) and com.example.alpha; a read of it with no package rejects the way @objectstack/client does on the 409 (httpStatus, code, details.candidates); with a package it answers that package's copy.

  • a 409 with two candidates lists both, each linking to /apps/PACKAGE/docs/shared_guide, labelled Alpha / Beta with the id beside it; no doc body, no load error.
  • each candidate opens that package's doc in that package's book: alpha lands on /apps/com.example.alpha/docs/com.example.alpha/shared_guide with alpha's body, beta likewise.
  • CONTROL: a doc one package ships renders as today, no list.
  • CONTROL: a non-409 failure (500) keeps today's "Failed to load documentation" with the server's message, no list.

No existing test was edited (the hoisted adapter gained the third world, switched on only inside the new describe).

Ablation (two legs, each red, each restored)

Both through scripts/ablation-replace.mjs, pins run with -t objectstack#34070 (ui vitest resolves @object-ui/* and the Console to src/, so no build sits between mutation and run):

  • A, the conflict branch never taken (if (holders) { to if (holders && (false as boolean)) { in DocPage): anchor 1 to 0, blob 217c8533 to 19bdbb86; 2 failed, 2 passed (both candidate pins: Unable to find role="list"). Restored: blob equal to HEAD, git diff HEAD empty.
  • B, the container no longer decides the home book (homeBook(slug, books, docs, ownCopy ? appName : undefined) to homeBook(slug, books, docs, undefined) in DocsSlug): anchor 1 to 0, blob 6164bc8b to 37d661e1; 1 failed, 3 passed (expected '/apps/com.example.alpha/docs/com.example.beta/shared_guide' where alpha's book was pinned). Restored: blob equal to HEAD, git diff HEAD empty.

Acceptance notes

Verification

Round 2, after #34036 merged — head 37ea190a (merge of origin/main 385ea1cc into be6b38f6, no conflict): the envelope files are byte-identical to the #34036 head read in round 1 (git diff --quiet exit 0 for packages/core/src/package-scoped-resolution.ts, packages/rest/src/meta-item-read-routes.ts, packages/rest/src/error-response.ts, packages/client/src/index.ts, content/docs/api/client-sdk.mdx); packages/metadata-protocol/src/protocol-meta-item-reads.ts and packages/objectql/src/registry.ts equal the merge commit 5af956f3's, with refuseAmbiguousBareDocRead called at the same spot. The branch delta against origin/main is still these 16 files (+264 / -14). After pnpm install --frozen-lockfile and rebuilding @objectstack/client..., @objectstack/formula..., @objectstack/sdui-parser... (VERDICT command-exit 0): pins -t objectstack#34070 4 passed; apps/console/src/pages/ 159 files, 1333 tests passed; packages/i18n/ 102 files, 1894 passed, 13 skipped.

Round 1: All readings at head be6b38f6 (this branch), objectstack-ai/objectstack, base 63db7240. The ablation legs ran at 9854afce, whose ui/apps/console tree is byte-identical at this head (git diff --quiet exit 0; the later commits add the changeset and regenerate zh-Hant.ts); the pins were re-run at this head.

Suites, lint, gates
  • pnpm --dir ui exec vitest run apps/console/src/pages/docs-portal.test.tsx: 28 passed (24 existing + 4 new).
  • pnpm --dir ui exec vitest run packages/i18n/: 102 files, 1894 passed, 13 skipped (zh-hant-generated, all-locales-key-parity included).
  • node ui/scripts/check-i18n-call-site-keys.mjs, check-i18n-dead-keys.mjs, check-i18n-en-drift.mjs: each exit 0.
  • pnpm check:new-line-citations (ui): 0 new, exit 0. eslint on the four console files: 0 errors (2 existing any warnings on untouched lines).
  • dispatch-gates.mjs --commands (no paths, at be6b38f6): 39 derived, 39 run, each exit 0 (under the verify lock, VERDICT command-exit 0); --ran reconciliation: 39 accounted, 0 NOT-MEASURED.
  • pnpm --dir ui exec vitest run apps/console/src/pages/ at be6b38f6: 159 files, 1333 tests passed.
  • Console pnpm run type-check (tsc --noEmit and tsc -b tsconfig.node.json) after building @object-ui/console^...: VERDICT command-exit 0; --listFiles holds all four edited console files.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ADHkmP4uQusF8yrKtRnvqJ

… as ambiguous

A doc name two enabled packages ship is refused by a read that names no
package (409 RESOURCE_CONFLICT, holders in details.candidates). The docs
reader now lists those packages, each linking to its package address, and
a flat permalink under a package container opens that package's own copy
in that package's book.

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

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 37ea190a8e760d77e11608724c69c87f951d47f4
Local-runs: none

Face: declaration (Clause-②: yes (widening) on the changeset and the PR body; no published schema, no governed path: check-governed-merges --pr 34109 0 of 16 paths). Inputs read: card #34070 and ruling 6893582352 on #33264, the Claim, os-dev-report 6899881851 and the round-2 note, PR #34109 body, the net diff against main at the merge base (16 files), and the check-runs on this head (2026-11-15T20:25Z: 47 success, 15 skipped, 0 failed).

① Derived judgments

  • Accept set read from the server: the page acts only on httpStatus 409 + code RESOURCE_CONFLICT with an array details.candidates holding at least one { kind: 'package', packageId } with a non-empty id (DocPage.tsx conflictCandidates); any other failure, and a 409 naming no package, keeps today's path. This is the envelope fix(objectql)!: a bare doc read refuses a name two enabled packages hold, naming both #34036 (merged as 5af956f3) serves and content/docs/api/client-sdk.mdx documents; the dev re-read both at this head and they are byte-identical to the head built against. Right.
  • Public surface: @object-ui/i18n gains three keys under help (docConflictTitle, docConflictDescription, docConflictCandidates) in all 11 shipped locales; nothing renamed or removed. This is the widening the line declares. @object-ui/console (app) and the internal book-nav.ts homeBook(…, packageId?) gain an optional trailing parameter; every existing caller passes three arguments and keeps its answer. Right.
  • Navigation: each candidate links to /apps/PACKAGE/docs/NAME, the package address where the read names the package; DocsSlug.tsx then sends a flat permalink under a container that ships the name to that package's own book (ownCopy), so the chooser's link lands on the copy it names. Pinned by the docs-portal harness (two candidates both rendered and linked; CONTROL single holder; CONTROL non-409; ablation red per the report).
  • Served metadata and API: unchanged. Metadata-protocol: none is right.

② Semver level

patch on @object-ui/console and @object-ui/i18n: additive keys and an additive branch; Check Changeset concluded success on this head. Correct.

③ Boundary flags

  • open_questions: candidate label source. Answered A by the seat: the package's home book label first, its id as secondary text when they differ (as built).
  • Bounded rider accepted: homeBook(…, packageId) so /apps/PACKAGE/docs/NAME opens in that package's book; without it the chooser's link could open the other holder's book. Pinned, ablation red.
  • Location deviation accepted: the 409 lands in DocPage.tsx (the in-book reader's bare read), not DocsSlug.tsx, measured by the dev; the chooser sits where the refusal arrives.
  • Sequencing: Waits-on: #34036 satisfied (merged); the branch merged origin/main at this head without conflict.
  • security_findings: none. The chooser renders only package ids the server already returned to this reader.

Implemented-by: claude/project-thread-mr9g83
Reviewed-by: session_01ADHkmT2NE3iyG1o6TDg3sf

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf

席位核对

Verdict: ACCEPT · head 37ea190a · 2026-11-15T20:26Z

  1. Shape. Draft → main, first content line Fixes #34070, line 2 Waits-on: #34036 now satisfied (merged as 5af956f3). 16 files on the claimed surface: DocPage.tsx, DocsSlug.tsx, book-nav.ts, docs-portal.test.tsx, 11 @object-ui/i18n locale packs, one changeset (@object-ui/console, @object-ui/i18n patch).
  2. Contract. Clause-②: yes (widening) (three help.* i18n keys); same-head TIER_DEFAULT record PASS: comment 6900815044. Metadata-protocol: none.
  3. Open question (candidate label): A, book label first with the id beside it.
  4. Gates on 37ea190a. 62 check runs: 47 success, 15 skipped, none failed. Round 2 after merging main: pins 4/4, console pages 1333 passed, packages/i18n 1894 passed.
  5. K. K = 0; no sync owed.
  6. Governed. check-governed-merges --pr 34109: NOT governed (0 of 16 paths).
  7. Landing. This stroke: pr_ready + automerge_enable, under the maintainer's landing approval in the seat thread (2026-11-15T16:10Z, 「批准席位 本班复核通过的 PR 执行 --land」). On MERGED Fixes #34070 closes the card; the seat then removes pm:dispatched and the assignee.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 20:26
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 43759582494 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Dogfood Regression Gate (3/3) — 失败步骤: Boot example apps and exercise real user flows

    @objectstack/dogfood:test:  FAIL   isolated  test/two-factor-lockout.dogfood.test.ts > #3624 follow-up: better-auth 2FA lockout counts wrong codes > counts each wrong code against the account budget
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: a wrong code must be rejected, not accepted: expected 200 to be greater than or equal to 400
    @objectstack/dogfood:test:  FAIL   isolated  test/two-factor-lockout.dogfood.test.ts > #3624 follow-up: better-auth 2FA lockout counts wrong codes > resets the count when a correct code lands
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: precondition: a non-zero failure count to clear: expected 0 to be greater than 0
    @objectstack/dogfood:test:  FAIL   isolated  test/two-factor-lockout.dogfood.test.ts > #3624 follow-up: better-auth 2FA lockout counts wrong codes > locks the account once the operator-configured budg
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: the counter must advance on every failure (after #1): expected +0 to be 1 // Object.is equality
    @objectstack/dogfood:test:  FAIL   isolated  test/two-factor-lockout.dogfood.test.ts > #3624 follow-up: better-auth 2FA lockout counts wrong codes > lazily clears an expired lock on the next attempt
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: precondition: carries the lock from the previous test: expected null not to be null
    @objectstack/dogfood:test:  FAIL   isolated  test/two-factor-lockout.dogfood.test.ts > #3624 follow-up: better-auth 2FA lockout counts wrong codes > the admin unlock action releases a second-factor lo
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: precondition: the account is locked again: expected null not to be null
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • test/two-factor-lockout.dogfood.test.ts — 24h 窗口内只有本 PR 撞到过,暂不汇总(再有一个不同 PR 撞到就会自动开汇总 issue)。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 30 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 43767190319 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test UI (13/16) — 失败步骤: Run the ui tests (shard 13/16)

    × a page behind the gate mounts once, so its child reads once per load 26ms
    FAIL   dom  packages/app-shell/src/hooks/__tests__/useLauncherApps-26838.test.tsx > the first /me/apps read is pending from the first render (objectstack#28085) > a page behind the gate mounts once, s
      ↳ 失败原因: AssertionError: expected "vi.fn()" to be called 1 times, but got 0 times
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • ⚠️ 本 PR 过去 24h 已在队列失败 1 次(不含本次)。 内容未变而反复失败 ⇒ 高度怀疑 flaky 测试或与同组 PR 的语义冲突,重排不解决。
  • 过去 24h 队列共有 13 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

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 tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants