Skip to content

Commit fed29ce

Browse files
committed
fix(pm): read the Served-tier value the way the board writes it
Measured against the live corpus rather than the fixture: every record the remediation rounds post spells the value as the stamp control first, then the tier — `Served-tier: 75/75 \`<tier>\`` — and the ruling's own specimen is written the same way. A reader that demanded the tier token immediately after the colon would have refused every verdict produced under the rule it enforces, on its first day. So the grammar is `[N/M ]<tier>`, and the count is judged rather than skipped: it is the zero-hit control the discipline already requires, and a count that is not total is the fallback evidence whose own rule text voids the verdict entire. Absent, it is vacuous — the tier alone decides, which is the ruling's minimum, so nothing the ruling permits is refused. Claude-Session: https://claude.ai/code/session_01DAcomhvR9kKizeYgg89Vo8 Co-authored-by: Claude <noreply@anthropic.com>
1 parent f5ac21c commit fed29ce

2 files changed

Lines changed: 100 additions & 19 deletions

File tree

‎.claude/skills/pm-dispatch/references/contract-review.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
- spec 席审低档实现者的契约增量,非自身产物;余席条款②复核 = 默认判断档自审加门禁。
2828
- 复核记录 = 一条评论落 PR 或卡,达档与默认档同形;散文、dev 自评、`os-dev-report` 恒不算。
2929
- 同形 = `## Contract review` 题头、所审 head sha 码段、①②③ 逐项、独立性对、PASS/FAIL 判词。
30-
- 同形含首行 `Served-tier:`,值取复核者转录的 harness `model` 盖章;无此行不成裁决。
30+
- 同形含首行 `Served-tier:`:值取转录 harness `model` 盖章,可前置 N/N;无此行不成裁决。
3131
- ① derived judgments 逐项:diff 引出的接受集与公开面变化逐条点名判对错。
3232
- ② semver 定级:变更级别与 changeset 声明一致。
3333
- ③ 边界旗处置:dev 挂旗与 `open_questions` 逐旗答复或升级。

‎scripts/pm/check-clause2-carriers.mjs‎

Lines changed: 99 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ const SELF_TEST_BATTERIES = Object.freeze({
661661
'the three read paths: ordered, offline-capable, and named in every refusal': 24,
662662
'C5: the direction claim checked against the diff (#16448)': 16,
663663
'C6: the review of record on this head, and the carrier the rule text names (#17302)': 40,
664-
'C7: the tier that SERVED the verdict the strip stands on (#17915)': 31,
664+
'C7: the tier that SERVED the verdict the strip stands on (#17915)': 42,
665665
'the exit register is distinct in every direction it must be': 6,
666666
'the argv contract and the board provenance (#16623)': 42,
667667
'#17366: the correction comment — the self-solvable exit, and the three things it is not': 65,
@@ -2466,8 +2466,7 @@ const REVIEWED_BY_LINE = AUTHORSHIP_KEY_LINES.get('Reviewed-by');
24662466
const SERVED_TIER_LINE = keyLineRegex('Served-tier');
24672467

24682468
/**
2469-
* The value token -- an opaque tier identifier, read immediately after the
2470-
* colon and its decoration, exactly like an identity token.
2469+
* The value token -- an opaque tier identifier.
24712470
*
24722471
* ⭐ Closed on an alphanumeric or a `]`, so a real id keeps its whole shape
24732472
* (a bracketed context suffix included) while a trailing `.` or `,` stays with
@@ -2481,12 +2480,53 @@ const SERVED_TIER_LINE = keyLineRegex('Served-tier');
24812480
*/
24822481
const TIER_TOKEN = /^([A-Za-z0-9](?:[A-Za-z0-9._:[\]-]*[A-Za-z0-9\]])?)/;
24832482

2483+
/**
2484+
* The STAMP CONTROL that may precede the tier -- `N/M`, measured on the live
2485+
* corpus and named by the ruling itself.
2486+
*
2487+
* ⭐ Corrected from a fixture against the board, which is the correction this
2488+
* family has had to make before (#17346: the corpus moved and the discriminator
2489+
* did not). Every record the remediation rounds write spells the value
2490+
* `75/75 \`<tier>\`` -- the at-tier stamp count over the total, THEN the tier --
2491+
* and the ruling's own specimen is written the same way. A reader that demanded
2492+
* the tier token immediately after the colon would have refused every verdict
2493+
* produced under the rule it enforces, on its first day.
2494+
*
2495+
* ⛔ And the count is not decoration to be skipped: it IS the zero-hit control
2496+
* the discipline requires -- a stamp reading is void unless the same probe
2497+
* returned a non-zero count on the same transcript -- and a count that is not
2498+
* FULL is the 「回退证据」 whose own rule text voids the verdict entire. So it
2499+
* is read, and it is judged: absent, the tier alone decides (the ruling's
2500+
* minimum, and nothing the ruling permits is refused); present, it must be
2501+
* non-zero and total.
2502+
*/
2503+
const STAMP_CONTROL = /^(\d+)[ \t]*\/[ \t]*(\d+)(?![\d/])/;
2504+
2505+
/**
2506+
* Does a declared stamp control STAND? Absent is vacuous; present must be
2507+
* total and non-zero. One predicate, so the row and the note cannot disagree.
2508+
*/
2509+
export function servedStampsHold(stamps) {
2510+
return stamps === null || (stamps.total > 0 && stamps.atTier === stamps.total);
2511+
}
2512+
2513+
/** The whole reading, as one verdict: at tier, on a control that stands. */
2514+
export function servedTierStands(served) {
2515+
return served?.state === 'read' && served.value === CONTRACT_REVIEW_TIER && servedStampsHold(served.stamps);
2516+
}
2517+
24842518
/**
24852519
* What one comment declares about the tier that served it.
24862520
*
2487-
* @returns {{ state: 'missing' }
2488-
* | { state: 'unreadable', line: string }
2489-
* | { state: 'read', value: string }}
2521+
* @returns {{ state: 'missing', stamps: null }
2522+
* | { state: 'unreadable', line: string, stamps: object|null }
2523+
* | { state: 'read', value: string, stamps: object|null }}
2524+
*
2525+
* Every shape carries `stamps`, so a caller never has to test for the key.
2526+
*
2527+
* `stamps` is the `N/M` control when the value carried one, `null` when it did
2528+
* not -- read here, judged by `servedStampsHold`, so the reading and the
2529+
* verdict stay two steps.
24902530
*
24912531
* Three-valued for the reason `readVerdictAuthorship` is four-valued: a carrier
24922532
* that was never started and one that was started and left unreadable are
@@ -2497,10 +2537,19 @@ export function readServedTier(text) {
24972537
for (const line of String(text ?? '').split(/\r?\n/)) {
24982538
const m = SERVED_TIER_LINE.exec(line);
24992539
if (!m) continue;
2500-
const token = TIER_TOKEN.exec(stripValueDecoration(m[1]));
2501-
return token ? { state: 'read', value: token[1] } : { state: 'unreadable', line: quoteLine(line) };
2540+
let rest = stripValueDecoration(m[1]);
2541+
let stamps = null;
2542+
const control = STAMP_CONTROL.exec(rest);
2543+
if (control) {
2544+
stamps = { atTier: Number(control[1]), total: Number(control[2]) };
2545+
rest = stripValueDecoration(rest.slice(control[0].length));
2546+
}
2547+
const token = TIER_TOKEN.exec(rest);
2548+
return token
2549+
? { state: 'read', value: token[1], stamps }
2550+
: { state: 'unreadable', line: quoteLine(line), stamps };
25022551
}
2503-
return { state: 'missing' };
2552+
return { state: 'missing', stamps: null };
25042553
}
25052554

25062555
/**
@@ -2642,9 +2691,11 @@ export function c6RecordNote(pair) {
26422691
`review of record on this head: ${v.where} thread, ${v.id ? `comment ${v.id}` : 'a comment carrying no readable id'} ` +
26432692
`(${v.at ?? 'undated'}) is a \`## Contract review\` comment naming \`${v.sha}\` and carrying a \`Reviewed-by:\` line -- ` +
26442693
'cite it in the provenance comment beside the clear (「凡清标同笔留 provenance 评论,引记录 id 与所判 head」). ' +
2645-
(v.served.state === 'read' && v.served.value === CONTRACT_REVIEW_TIER
2646-
? 'Its `Served-tier:` reads the declared tier, so the strip stands on C7 as well as on this row. '
2647-
: 'Its `Served-tier:` does NOT read the declared tier — C7 says what it reads, and this pair is adverse. ') +
2694+
(servedTierStands(v.served)
2695+
? 'Its `Served-tier:` reads the declared tier' +
2696+
(v.served.stamps ? ` on a stamp control of ${v.served.stamps.atTier}/${v.served.stamps.total}` : '') +
2697+
', so the strip stands on C7 as well as on this row. '
2698+
: 'Its `Served-tier:` does NOT stand — C7 says what it reads, and this pair is adverse. ') +
26482699
'⚠️ Existence, not the verdict: whether it reads PASS is precondition ① of the landing check and stays human.'
26492700
);
26502701
}
@@ -2717,21 +2768,35 @@ export function c6RecordNote(pair) {
27172768
export function c7ServedTierBelow(pair) {
27182769
const v = reviewOfRecord(pair);
27192770
if (v.state !== 'found') return null;
2720-
if (v.served.state === 'read' && v.served.value === CONTRACT_REVIEW_TIER) return null;
2771+
if (servedTierStands(v.served)) return null;
27212772

27222773
const where =
27232774
`PR #${pair?.pr}${pair?.draft ? ' (draft)' : ''} / card #${pair?.card}: the verdict the clear stands on -- ` +
27242775
`${v.where} thread, ${v.id ? `comment ${v.id}` : 'a comment carrying no readable id'} ` +
27252776
`(${v.at ?? 'undated'}), naming head \`${v.sha}\``;
2777+
const stamps = v.served.stamps ?? null;
2778+
const control =
2779+
stamps === null
2780+
? ''
2781+
: ` Its stamp control reads ${stamps.atTier}/${stamps.total}` +
2782+
(servedStampsHold(stamps)
2783+
? ', which stands.'
2784+
: stamps.total === 0
2785+
? ' -- a ZERO reading, which is void by the standing control: a zero counts only when the same probe ' +
2786+
'returns a non-zero stamp count on the same transcript.'
2787+
: ' -- NOT total, which is the 「回退证据」 the rule text voids a verdict entire for: some messages of ' +
2788+
'the round were served by something else.');
27262789
const reading =
27272790
v.served.state === 'read'
2728-
? `declares \`Served-tier: ${v.served.value}\``
2791+
? servedStampsHold(stamps)
2792+
? `declares \`Served-tier: ${v.served.value}\``
2793+
: `declares the tier \`${v.served.value}\` on a stamp control that does not stand`
27292794
: v.served.state === 'unreadable'
27302795
? `carries a \`Served-tier:\` line with no readable tier token (${v.served.line})`
27312796
: 'carries NO `Served-tier:` line at all, so it declares nothing about what served it';
27322797
const rule =
2733-
'The rule this row carries is `references/contract-review.md`\'s -- 「同形含首行 `Served-tier:`,值取复核者' +
2734-
'转录的 harness `model` 盖章;无此行不成裁决」 and 「清标前 `--pair`:裁决 `Served-tier:` ≠ ' +
2798+
'The rule this row carries is `references/contract-review.md`\'s -- 「同形含首行 `Served-tier:`:值取转录 ' +
2799+
'harness `model` 盖章,可前置 N/N;无此行不成裁决」 and 「清标前 `--pair`:裁决 `Served-tier:` ≠ ' +
27352800
'`CONTRACT_REVIEW_TIER` ⇒ exit 4,点名 PR、评论、读数」. The value is the HARNESS-STAMPED served-model field ' +
27362801
'of the reviewing round\'s own transcript, ⛔ never the dispatch `model` parameter, which is configuration ' +
27372802
'and not a reading. The comparison is EXACT, never a family or prefix floor -- widening a governance gate\'s ' +
@@ -2743,7 +2808,7 @@ export function c7ServedTierBelow(pair) {
27432808
const boundary =
27442809
'⛔ Verdict-agnostic: no PASS or FAIL token is read to reach this -- what produced the verdict is measurable, ' +
27452810
'what it concluded stays human -- and the constant is read from `dispatch-gates.mjs`, never restated here.';
2746-
return `${where} -- ${reading}, and the declared tier is \`CONTRACT_REVIEW_TIER\`. ${rule} ${remedy} ${boundary} ${NEVER_WRITES}`;
2811+
return `${where} -- ${reading}, and the declared tier is \`CONTRACT_REVIEW_TIER\`.${control} ${rule} ${remedy} ${boundary} ${NEVER_WRITES}`;
27472812
}
27482813

27492814
/**
@@ -3926,7 +3991,7 @@ export function selfTest() {
39263991
lines = [
39273992
'- **Implemented-by:** `claude/issue-13657-x`',
39283993
`- **Reviewed-by:** \`${RECORD_SESSION}\``,
3929-
`- **Served-tier:** \`${CONTRACT_REVIEW_TIER}\``,
3994+
`- **Served-tier:** 121/121 \`${CONTRACT_REVIEW_TIER}\``,
39303995
],
39313996
at = '2026-09-01T08:50:00Z',
39323997
id = 3301,
@@ -4538,6 +4603,22 @@ export function selfTest() {
45384603
t('…and states the reading is the harness stamp, ⛔ not the dispatch parameter', says(belowRow, 'HARNESS-STAMPED') && says(belowRow, 'dispatch `model` parameter'));
45394604
t('…and is verdict-agnostic, and never writes', says(belowRow, 'what it concluded stays human') && says(belowRow, '自查放行'));
45404605
t('an at-tier clear prints the reading in the C6-RECORD note, so a reader of exit 0 can see the strip stood on it', says(pairNotes(completed)[0]?.text, 'Served-tier'));
4606+
// ⭐ The LIVE spelling, corrected from a fixture against the board. Every
4607+
// record the remediation rounds write, and the ruling's own specimen, put the
4608+
// STAMP CONTROL first: `75/75 \`<tier>\``. A reader that demanded the tier
4609+
// token immediately after the colon would have refused every verdict written
4610+
// under the rule it enforces, on day one.
4611+
t('⭐ the LIVE value shape — stamp control, then the tier — reads at tier and stands', servedTierStands(readServedTier(`Served-tier: 75/75 \`${CONTRACT_REVIEW_TIER}\``)));
4612+
t('…and the count is READ, not skipped', JSON.stringify(readServedTier(`Served-tier: 138/138 \`${CONTRACT_REVIEW_TIER}\``).stamps) === JSON.stringify({ atTier: 138, total: 138 }));
4613+
t('…on a bulleted, bolded key too — the shape the seats actually post', servedTierStands(readServedTier(`- **Served-tier:** 102/102 \`${CONTRACT_REVIEW_TIER}\``)));
4614+
t('⛔ a ZERO control is void — a zero counts only against a non-zero stamp count on the same transcript', servedTierStands(readServedTier(`Served-tier: 0/0 \`${CONTRACT_REVIEW_TIER}\``)) === false);
4615+
t('⛔ a control that is not TOTAL is 回退证据, and the tier alone does not rescue it', servedTierStands(readServedTier(`Served-tier: 12/133 \`${CONTRACT_REVIEW_TIER}\``)) === false);
4616+
t('⛔ …and that is a C7 row, whose text names the count rather than only the tier', says(c7ServedTierBelow(bare({ prComments: [SERVED(`12/133 \`${CONTRACT_REVIEW_TIER}\``)] })), '12/133') && says(c7ServedTierBelow(bare({ prComments: [SERVED(`12/133 \`${CONTRACT_REVIEW_TIER}\``)] })), '回退证据'));
4617+
t('⛔ a count with NO tier after it declares no tier — unreadable, never a reading', readServedTier('Served-tier: 75/75').state === 'unreadable');
4618+
t('⭐ an ABSENT control is vacuous, never a refusal — the ruling\'s minimum is the tier alone', readServedTier(`Served-tier: \`${CONTRACT_REVIEW_TIER}\``).stamps === null && servedStampsHold(null));
4619+
t('the control is judged by ONE predicate the row and the note both read', servedStampsHold({ atTier: 5, total: 5 }) && !servedStampsHold({ atTier: 5, total: 6 }) && !servedStampsHold({ atTier: 0, total: 0 }));
4620+
t('⛔ a below-tier value with a PERFECT control is still refused — the control never substitutes for the tier', typeof c7ServedTierBelow(bare({ prComments: [SERVED('99/99 example-below-tier')] })) === 'string');
4621+
t('the reference fixture itself carries the live shape, so the clean pair is clean for the right reason', says(RECORD_ON_9AF9.body, '121/121') && pairRows(completed).length === 0);
45414622

45424623
battery('the exit register is distinct in every direction it must be');
45434624
const codes = [EXIT_OK, EXIT_USAGE, EXIT_INCOMPLETE, EXIT_PREREQUISITE_NOT_MET, EXIT_PAIR_ADVERSE];

0 commit comments

Comments
 (0)