Uh oh!
There was an error while loading. Please reload this page.
fix(rest): GET /meta/_drafts reads in the caller's org scope — closes the write-org/read-null split (#11087 layer 2) - #11160
Conversation
A draft saved by a session carrying an active org lands in that org's overlay scope (saveMetaItem's organizationId: ctx?.tenantId). The drafts route read with NO org — getOverlayRepo(null) sees only env-wide (organization_id IS NULL) rows — so every org-scoped draft was invisible to the pending-changes surfaces while single reads (which thread the ctx) and the publisher (which resolves each draft's own scope) saw it fine: the write-org/read-null split behind cloud#1593, measured live on a staging tenant (view draft saved 'org=org_mt42…' → _drafts answered only the older env-wide row). With the org threaded, SysMetadataRepository.listDrafts' own $or contract surfaces BOTH the caller's org overlay and env-wide drafts. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 1 changed package(s)), so this run has no opinion about the docs. What this run could not see
Coarse fallback — 13 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
Uh oh!
There was an error while loading. Please reload this page.
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 32604960585 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
What
The
_draftsroute threadsctx?.tenantIdintoprotocol.listDrafts— symmetric with the save route'sorganizationId: ctx?.tenantId.SysMetadataRepository.listDrafts's existing$orcontract then surfaces BOTH the caller's org overlay and env-wide drafts.Why (live staging measurement, cloud#1593)
A view draft saved through the console landed
org=org_mt42…(the session carries an active org), whileGET /meta/_draftsread with NO org —getOverlayRepo(null)matches onlyorganization_id IS NULL— so the draft was invisible to every pending-changes surface while the single read and the publisher (each threading its own scope) saw it fine. This is the second, orthogonal layer of #11087: layer 1 (merged, #11139) fixed thepackage_id NULLorphan; this fixes org-scope invisibility. Both are required before the pending-changes bar can count what a console session actually drafts.Tests
New pin in
rest-server-meta-org-scope-url-spelling.test.ts(drafts read carries the caller org); suite file 12/12. Fullrestpackage: 1681/1681 executed tests pass locally (39 file-level load failures are unbuilt-sibling-dist noise on the local rig — service-analytics/service-package dists absent — CI builds the graph).Part of #11087 / cloud#1593.
🤖 Generated with Claude Code