Uh oh!
There was an error while loading. Please reload this page.
fix(metadata-protocol): package-less draft saves inherit the overlaid active row's package binding (#11087) - #11139
Conversation
…id active row's package binding (#11087) A state='draft' save is a pending change OVER the published row, and every package-scoped consumer — listDrafts({packageId}), the console's pending-changes surfaces, publishPackageDrafts — keys drafts by package_id. A caller that names no base (the console's plain PUT …?mode=draft) stamped NULL even when the overlaid active row is package-bound, producing an orphan draft no package view counts and no per-package publish can promote. Measured live on a cloud tenant (cloud#1593): GET /meta/_drafts listed the draft, ?packageId= listed nothing, and the AI build surface's pending-changes bar stayed dark over a publishable change. put() now resolves the draft's package binding in this order: the caller's explicit opts.packageId (ADR-0048 — callers state their scope, never overridden), else the overlaid ACTIVE row's package_id, else NULL (a brand-new item drafted first keeps package-less semantics). Plus orphan adoption: when the binding was inherited and the scoped existing-row lookup misses, a pre-fix NULL-package draft for the same (org,type,name) is updated in place and adopted into the package — never forked into a second draft row. Four pins in sys-metadata-repository.draft-package-inherit.test.ts; full metadata-protocol suite 1857 passed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 11 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 7 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 838e580dad3e4417774731128784c5e68adc4b30 && git checkout 838e580dad3e4417774731128784c5e68adc4b30
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin acb4dbc09703d5c6145efb376c50ea12dfe9f41c e06d0365addb3e3fcd63ef194e6a67077e2c3ad7 && git checkout -B drift-repro acb4dbc09703d5c6145efb376c50ea12dfe9f41c && git merge --no-ff e06d0365addb3e3fcd63ef194e6a67077e2c3ad7
node scripts/docs-audit/affected-docs.mjs --json acb4dbc09703d5c6145efb376c50ea12dfe9f41c
|
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…edger Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
os-zhuang
commented
Aug 22, 2026
|
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 32599882981 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
What
SysMetadataRepository.put()resolves astate='draft'save's package binding as: explicitopts.packageId(never overridden, ADR-0048) → the overlaid active row'spackage_id→ NULL (brand-new item drafted first, unchanged semantics). Plus orphan adoption: an inherited-binding save whose scoped existing-row lookup misses re-reads the package-less draft row for the same(org, type, name)and updates it in place — adopting the pre-fix orphan instead of forking a second draft row.Why
Live tenant measurement (cloud#1593): a console
PUT /meta/:type/:name?mode=draftover a row owned byapp.k9qklandedpackage_id NULL—GET /meta/_draftslisted 1 draft,GET /meta/_drafts?packageId=app.k9qklisted 0. Every package-scoped consumer (the AI build surface's standing pending-changes bar objectui#5696, inline publish counts,publishPackageDrafts) is blind to such drafts, and per-package publish can never promote them.Note: the issue's original first half (org-scope list blindness) was retracted after live re-verification — see the correction comment on #11087; this PR is the confirmed second half.
Tests
4 pins in
sys-metadata-repository.draft-package-inherit.test.ts(inheritance + scoped listDrafts counts it; explicit package untouched; new-item NULL; orphan adopted not forked). Fullmetadata-protocolsuite: 1857 passed.Closes#11087. Cloud consumer: cloud#1593 (pin bump to follow).
🤖 Generated with Claude Code