Skip to content

Commit 00e6413

Browse files
huangyiireneclaude
andauthored
docs(spec): lead the deletion-gate anchor description with what it must NOT be used for (#16199)
`authorable-surface.base.json` already called itself an anchor. The warning answered the wrong question: it explains what the file is FOR (the #4650 deletion gate) and never what it must not be USED for, so a reader arriving with "is this key authorable today?" reads "a verbatim copy of the keys in authorable-surface/" and takes it as the live set. The description now leads with the negative, names the live ratchet, and names `scripts/docs-audit/affected-docs.mjs` as the reference consumer for the union read. No count is stated: the gate prints the current delta on every run, and a hard-coded number in a warning about staleness is the same defect one level up. The string lives in `build-schemas.ts` — the committed file is byte-compared against `serializeSurfaceBase()`, so both halves move together or the gate is fatal. `baseRev` and `keys` are untouched, and no consumer's input changes. Claude-Session: https://claude.ai/code/session_01T6HeZvT9wdSJD1ZxJb5Eno Co-authored-by: Claude <noreply@anthropic.com>
1 parent 5ca314a commit 00e6413

3 files changed

Lines changed: 50 additions & 12 deletions

File tree

docs/spec-generated-artifact-sharding.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,24 @@ arithmetic composes on a merge and the judgement does not).
5151
authenticity criterion is untouched in both halves: `baseRev` is an `origin/main`
5252
ancestor, and its keys **are** that commit's surface.
5353

54+
### Which artifact answers "is this key authorable today"
55+
56+
**`packages/spec/authorable-surface/*.json` — the live per-category ratchet, read as one
57+
set. ⛔ Never `authorable-surface.base.json`.** The anchor is pinned at a fixed `baseRev`,
58+
so it is missing every key authored since and answers that question with a stale *no* — a
59+
false negative that grows with the lag. `check:authorable-surface` prints the current
60+
delta on every run; ⛔ do not copy the number into prose, it rots (#14612 re-measured
61+
#13713's figure four days later and it had already moved).
62+
63+
Where no key may be dropped, read the **union** of ratchet and anchor — a union can only
64+
ever keep an anchor one source vouches for, never drop one more.
65+
`scripts/docs-audit/affected-docs.mjs` is the **reference consumer** for that union read
66+
(#13713 / PR #14607, which measured the false-negative class it closes), and its
67+
`--self-test` pins both halves against the live artifacts: that a key added after
68+
`baseRev` is still authorable, and that the `[RETIRED]` tombstone annotation the ratchet
69+
carries is **stripped** rather than matched — a tombstoned key still rejects with an
70+
upgrade prescription, so it is still surface a page documents.
71+
5472
## The invariant that makes sharding semantics-preserving
5573

5674
> **Every gate reads the whole DIRECTORY as one set — never "the shards this build would

packages/spec/authorable-surface.base.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"description": "In-tree anchor for the authorable-surface deletion gate (#4650, #5235): a verbatim copy of the keys in authorable-surface/ as they stood at `baseRev`, a commit on origin/main. A build that CAN reach origin/main anchors on the merge base instead, and re-verifies this file against `baseRev` — so a PR that edits it to hide a deletion goes red wherever the network exists. A build that CANNOT reach GitHub (image-build stages, air-gapped, fork, historical-tag reproduction) anchors here instead of failing. Written only by `gen:schema`, only from a git-resolved baseline — never from the build that is being checked. See #5235.",
2+
"description": "⛔ NOT the live surface — a pinned anchor for the deletion gate; the live surface is `authorable-surface/*.json`. ⛔ Never answer \"is this key authorable today?\" from this file: it is a snapshot at `baseRev`, so every key authored since is missing from it, and reading it alone yields false negatives that grow with the lag (`check:authorable-surface` prints the current delta on every run — ⛔ never hard-code that number). Ask the live ratchet instead, or read the UNION of ratchet and anchor where no key may be dropped: `scripts/docs-audit/affected-docs.mjs` is the reference consumer for that union read, and its `--self-test` pins both halves — that a key added after `baseRev` is still authorable, and that the `[RETIRED]` tombstone annotation the ratchet carries is stripped rather than matched. What this file IS, and the only question it answers: in-tree anchor for the authorable-surface deletion gate (#4650, #5235) — a verbatim copy of the keys in authorable-surface/ as they stood at `baseRev`, a commit on origin/main. A build that CAN reach origin/main anchors on the merge base instead, and re-verifies this file against `baseRev` — so a PR that edits it to hide a deletion goes red wherever the network exists. A build that CANNOT reach GitHub (image-build stages, air-gapped, fork, historical-tag reproduction) anchors here instead of failing. Written only by `gen:schema`, only from a git-resolved baseline — never from the build that is being checked. See #5235; #14612 for why the negative leads.",
33
"baseRev": "53ef05744f37789a3e2e2ee94325a616b706bea0",
44
"keys": [
55
"ai/AIModelConfig:maxTokens",

packages/spec/scripts/build-schemas.ts

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,23 +1088,43 @@ function computeSurfaceReachability(): SurfaceReachability {
10881088
* ⚠️ Every byte of this string is part of the anchor file's canonical form —
10891089
* `readCommittedSurfaceBase` compares the committed file against
10901090
* `serializeSurfaceBase()` and treats any difference as a hand-edit, fatally.
1091-
* So changing this text is not a comment edit: it invalidates the committed
1092-
* anchor in every checkout until someone re-anchors, which is itself the
1093-
* deliberate act #5358 made explicit. It is therefore left verbatim here, and
1094-
* "Written only by `gen:schema`" now UNDER-states the rule rather than
1091+
* So changing this text is not a comment edit: changed HERE ALONE it leaves the
1092+
* committed anchor non-canonical in every checkout, which is the deliberate act
1093+
* #5358 made explicit, read as an accident.
1094+
*
1095+
* It is nevertheless changeable WITHOUT re-anchoring, and #14612 measured that:
1096+
* the canonical form is `serializeSurfaceBase(committed.baseRev, committed.keys)`,
1097+
* so a diff that rewrites this constant AND `authorable-surface.base.json`'s
1098+
* `description` to the same bytes leaves `baseRev` and `keys` untouched and
1099+
* `check:authorable-surface` green. Both halves in one reviewed diff, or neither —
1100+
* a one-sided edit is the fatal case above, and `build-schemas-check-mode.test.ts`
1101+
* is what says so, because it seeds its fixtures with the description read off the
1102+
* committed file and runs THIS generator against them.
1103+
*
1104+
* "Written only by `gen:schema`" still UNDER-states the rule rather than
10951105
* contradicting it: the writer is still this generator (`scripts/build-schemas.ts`),
10961106
* but only in its `--update-base` mode (`gen:authorable-surface-base`), never on a
10971107
* plain build. Narrowing in the safe direction. Whoever next re-anchors should
10981108
* bring the sentence with them, in that same reviewed diff.
10991109
*/
11001110
const SURFACE_BASE_DESCRIPTION =
1101-
'In-tree anchor for the authorable-surface deletion gate (#4650, #5235): a verbatim copy of the ' +
1102-
'keys in authorable-surface/ as they stood at `baseRev`, a commit on origin/main. A build that ' +
1103-
'CAN reach origin/main anchors on the merge base instead, and re-verifies this file against ' +
1104-
'`baseRev` — so a PR that edits it to hide a deletion goes red wherever the network exists. A build ' +
1105-
'that CANNOT reach GitHub (image-build stages, air-gapped, fork, historical-tag reproduction) ' +
1106-
'anchors here instead of failing. Written only by `gen:schema`, only from a git-resolved baseline — ' +
1107-
'never from the build that is being checked. See #5235.';
1111+
'⛔ NOT the live surface — a pinned anchor for the deletion gate; the live surface is ' +
1112+
'`authorable-surface/*.json`. ⛔ Never answer "is this key authorable today?" from this file: ' +
1113+
'it is a snapshot at `baseRev`, so every key authored since is missing from it, and reading it ' +
1114+
'alone yields false negatives that grow with the lag (`check:authorable-surface` prints the ' +
1115+
'current delta on every run — ⛔ never hard-code that number). Ask the live ratchet instead, or ' +
1116+
'read the UNION of ratchet and anchor where no key may be dropped: ' +
1117+
'`scripts/docs-audit/affected-docs.mjs` is the reference consumer for that union read, and its ' +
1118+
'`--self-test` pins both halves — that a key added after `baseRev` is still authorable, and that ' +
1119+
'the `[RETIRED]` tombstone annotation the ratchet carries is stripped rather than matched. What ' +
1120+
'this file IS, and the only question it answers: in-tree anchor for the authorable-surface ' +
1121+
'deletion gate (#4650, #5235) — a verbatim copy of the keys in authorable-surface/ as they stood ' +
1122+
'at `baseRev`, a commit on origin/main. A build that CAN reach origin/main anchors on the merge ' +
1123+
'base instead, and re-verifies this file against `baseRev` — so a PR that edits it to hide a ' +
1124+
'deletion goes red wherever the network exists. A build that CANNOT reach GitHub (image-build ' +
1125+
'stages, air-gapped, fork, historical-tag reproduction) anchors here instead of failing. Written ' +
1126+
'only by `gen:schema`, only from a git-resolved baseline — never from the build that is being ' +
1127+
'checked. See #5235; #14612 for why the negative leads.';
11081128

11091129
/** Canonical bytes of the in-tree anchor — the one form the generator writes. */
11101130
function serializeSurfaceBase(baseRev: string, keys: string[]): string {

0 commit comments

Comments
 (0)