Uh oh!
There was an error while loading. Please reload this page.
feat(spec,metadata-protocol): a page hit kind on GET /api/v1/search — command palette indexes published pages - #14249
Conversation
…weep Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mciyv38maJ6HYVMiaM26T1
…regen spec artifacts; changeset Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mciyv38maJ6HYVMiaM26T1
…sertion Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mciyv38maJ6HYVMiaM26T1
…); regen docs Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mciyv38maJ6HYVMiaM26T1
…arch-published-pages
…rated on the merge result Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mciyv38maJ6HYVMiaM26T1
📓 Docs Drift CheckThis PR changes 4 package(s): 9 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 133 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 9423bce2bd2f120671f2f7a1db447f8d853c1acb && git checkout 9423bce2bd2f120671f2f7a1db447f8d853c1acb
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 74a32a2edd55f06158effef71b9151f2f2eec36a 88eee836dd3f4be415e45401cd1116345e0e0e66 && git checkout -B drift-repro 74a32a2edd55f06158effef71b9151f2f2eec36a && git merge --no-ff 88eee836dd3f4be415e45401cd1116345e0e0e66
node scripts/docs-audit/affected-docs.mjs --json 74a32a2edd55f06158effef71b9151f2f2eec36a
|
Uh oh!
There was an error while loading. Please reload this page.
The merge driver treats content/docs/permissions/system-context.mdx as generated and does not text-merge it, so the merge left this branch's pre-merge copy in place — which would have dropped the rows PR #14249 added on main. Took main's copy wholesale and re-derived the anchors from the MERGED tree with the repo's own tooling (pnpm gen:system-context-census). Result verified against main's copy: 12 rows differ and every difference is an engine.ts line number inside backticks; all prose is byte-identical, so #14249's rows survive intact. The 15 rewritten anchors are the same 15 this branch's engine.ts insertion shifts, and the census totals are unchanged (109 read sites / 145 anchors / 27 declared non-read), so this is line rot and not a population change. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q5WBDtaUnoz5XuJ6jk8pQ5
Part of #13216
Direction 3 only — command-palette indexing of published pages, per the 2026-08-29 maintainer ruling (directions 1 + 3 adopted; verbatim 「同意」) and the 22:36Z retriage settlement anchoring this remaining direction to the
domain:speclane. Direction 1 landed separately in PR #13372 (d23dc08a0f, content-verified onorigin/main); the two were deliberately split so each published-contract change gets its own contract review. Direction 2 (nav registration at publish time) stays deferred to design card #13620 — #13620 remains open,app.allowOrgOverrideis untouched here, and no new authorization surface is added.Clause-②: yes— both limbs:packages/spec/src/**(api/protocol.zod.ts, plus the pin-test ledger and regenerated artifacts).GET /api/v1/searchresponse shape — a new hit kind on an already-published body.⛔ This PR parks in draft with
needs:contract-reviewhung at creation (director note of 2026-08-31 00:42Z: the label re-attaches the moment a reviewable increment exists). Not to be flipped ready, queued, or armed by any seat — landing belongs to the contract-review chain.What changed
A custom React page created and published at runtime renders perfectly and was absent from the ⌘K palette door alone (#13100's measurement; the card's direction 3):
searchAllswept object records and nothing else. This PR adds a page hit kind to the published/api/v1/searchresponse and wires published pages into the same producer:packages/spec/src/api/protocol.zod.ts— newSearchAllPageHitSchema({ kind: 'page', name, title, snippet?, pageType? });SearchAllResponseSchemagains a requiredpagesarray; blank-query short-circuit documented as carryingpages: [].packages/metadata-protocol/src/protocol.ts—searchAllsweeps published pages throughgetMetaItems({ type: 'page' })on unscoped sweeps, after the record loop; shared excerpt helper (cutExcerpt) now produces both record and page snippets; org scope threaded throughorganizationIdForMetaRead('page', context.tenantId).packages/rest/src/rest-route-ledger.ts— the search row'snoterecords the widened body. No REST handler change: the route relays the producer's return bare, exactly as before (pinned by the relay conformance test), and no request parameter is added (GLOBAL_SEARCH_PARAMSuntouched).packages/client/src/index.ts— docblock only: the relayed shape now namespages. The SDK's return type flows fromSearchAllResponseand needed no code change.api-surface/,export-origins/,declaration-map/,json-schema.manifest/api.json,authorable-surface/api.json,content/docs/references/**, strictness-ledger counts — all produced bycheck:generated --fixafter a full spec build, only the proved-stale set..changeset/search-published-pages-hit-kind.md— spec minor, metadata-protocol minor (reasoning below).Derived judgments (each declared, none assumed)
pagesarray, not new members ofhits. Everyhitselement is a record with anobject/idaddress; an existing consumer iteratinghitsmust not receive an element whose address vocabulary it predates (a palette client today builds/{object}/{id}links from it). Page hits live in their own array, and each carrieskind: 'page'as a self-describing discriminant for clients that flatten both arrays into one palette list. Record hits are byte-identical to before — nokindwas added to them, deliberately, to keep the existing produced bytes untouched.pagesis REQUIRED, not optional. The schema is "declared AS PRODUCED" (maintainer ruling 2026-08-25 on the Four client SDK routes answer a shape no published contract declares —automation.create/automation.update/search/data.clone#11924 declaration), and the producer now always emits the member ([]included, blank-query short-circuit included). The producer-side and relay-side conformance tests both parse the real bodies. Version-skew note: the SDK does not runtime-parse responses (unwrapResponseis a cast), so a new client against an older server degrades toundefinedexactly as any additive field does.getMetaItems({ type: 'page' })— the same verb the RESTGET /meta/pagelist door serves, behind the sameenforceAuthgate the search route already had. Published (state: 'active') items only — drafts surface exclusively underpreviewDrafts, never passed; disabled-package withholding and stored-row conversions ride along. Org scope goes throughorganizationIdForMetaRead— the registry-gated predicate every REST meta read door uses (Org-overridable metadata (view,dashboard) is accepted with a 200state:'active'receipt but served by no read door #9454), so sweep and read door move together ifpageever declares org override. A page hit therefore surfaces to a caller exactly what that caller's own meta read door already answers (name, label, description) — never more.page.assignedProfileswas measured to have zero backend read-door consumers on this tree (its enforcement lives at page render, client-side); following direction 1's delegation precedent, opening a hit goes through the existing page routes/renderer where that audience gate applies unchanged — adding a server-side profile filter here would have been a NEW enforcement surface, the very thing the ruling's basis excludes. Search is not a second read door and bypasses nothing.?objects=leadasks for records of those objects; answering pages there would widen a request the caller deliberately narrowed. Pinned, including "the page read never ran".perObject(the page store is one more scanned container, not a competitor forlimit); order is the served listing's order. No new totals member —totalObjects/totalHits/truncatedkeep their record-only meaning (their describes were already literal about that and stay true).$searchexpansion to delegate to. Matching uses the full term list (allTerms), not the 8-term snippet cap, so a 9th term cannot silently widen page recall relative to record recall. i18n label maps match on every locale value (a zh-CN query hits a zh-CN label); titles resolve through the sharedresolveI18nLabelchain (spec: 后端第一个I18nLabel → string共享解析器 —— #6761 裁决 B 的契约半边(须与 objectuipickLocalized同规则,否则同一个 map 两端渲染不同) #6765) — no fourth hand-rolled label resolution.getMetaItemsalready discriminates the benign store-unprovisioned case and raises real outages as 503, so the sweep adds nocatch— pinned (rejects.toMatchObject({ status: 503 })), a partial scan must not wear a whole one's answer.searchAll). rest and client carry no changeset: rest has zero behavior change in-package (ledger note is prose), client is docblock-only.packages/objectql/src/search-companion.ts— named in the retriage's predicted surface — is deliberately untouched, and the re-derivation is recorded here as the flag the dispatch asked for: that module is the pinyin companion column for record columns; the page sweep matches metadata documents and never composes a$searchfilter, so no seam there is on this change's path. Pinyin recall for page labels would require materializing normalized forms for metadata — out of this card's scope and not part of the ruling.skills/**untouched (no generator fired —ListViewSchemaunchanged,check:react-blocksgreen);docs/adr/**,.claude/**,AGENTS.md,CLAUDE.md,content/docs/releases/**untouched.registry.listItems, an honest emptysys_metadataanswer) — each annotated in place. Two whole-bodytoEqualpins were inverted in place with the reason (pages: []joined the body); nothing was skipped, disabled, or quarantined.Verification
packages/metadata-protocol/src/protocol.search-published-pages.test.ts(12 tests): published-page surfacing with the declared shape · draft rows do NOT surface (with discriminating control) · disabled-package pages do NOT surface (with control) · record hits untouched beside page hits · scoped sweep skips the page read entirely · blank-q short-circuit · AND-of-terms across fields · i18n label matching + shared title resolution · conditional snippet with record-identical excerpt geometry ·perObjectcap (andlimitnon-interference) · 503 propagation · swept-set ⊆ served-set parity.search-clone-schema-conformance.test.ts) extended:pagesparsed as produced, page-hit key-subset check, both snippet branches, widened short-circuit. Relay conformance (packages/rest) extended: the widened body relays bare through the real mount..d.ts(probe files inpackages/client, removed after): accept probe (body with a page hit) compiles; reject probes red with tsc's own lines —TS2741: Property 'pages' is missing … but requiredandTS2322: Type '"pagey"' is not assignable to type '"page"'— so the shape widened and did not degrade.pageview type on objects, or nav registration at publish time #13216.Generated by Claude Code
Generated by Claude Code