You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f619d31
Browse filesBrowse the repository at this point in the historyBrowse files
fix(pm): the record reader closes a fence only on a bare run and opens its scope only on an unindented heading; the writer refuses on a key LINE and names the two new causes
`contractReviewHeadSha` (check-half-states.mjs) closed a fence on any run of
the opening character, so a closing line with trailing text — fence content
to CommonMark — ended the fence and a `Head-sha:` line after it was read.
It also opened its heading scope on a `## Contract review` heading indented
four spaces or a tab, an indented code block to the renderer, while holding
the key line itself to three spaces. Both read the same as base and appear
in 0 of 713 live records; both are now closed, each pinned and ablated once.
`FENCE_CLOSE_LINE` admits whitespace only after the run; the scope opens on
`^[ ]{0,3}#` and the shared marker keeps its tolerance for the locator.
`post-stamped.mjs` tested the `Head-sha` key ANYWHERE in a record-shaped
comment, so one that quoted a record heading and named the key mid-sentence
was refused at write time. `HEAD_SHA_KEY_LINE` now asks for a line opening
on the key, however decorated (indent, blockquotes, a bullet or a list
number, bold, backticks), so every refused shape #28042 pinned stays refused
and the prose mention is not. The refusal's `why` and
`RECORD_KEY_SPELLINGS['Head-sha']` name the code-indented line and the line
under a quoted or code-indented heading. No new refusal class, no new gate.
`contract-review.md:33` now says the `Head-sha:` line sits 题头之下, at 120
bytes and line-neutral; the `--template` note says the same in English.
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czoR81DDKSnGWnBYqA
const m = CONTRACT_REVIEW_HEAD_SHA_LINE.exec(line);
@@ -33545,6 +33559,12 @@ Doubles as the fire's **write self-check** (step 0). \`201\` is not the reading.
33545
33559
// ⛔ A fence closes only on its OWN character and a run at least as long: a nested ``` inside ````, a ~~~ inside ```,
33546
33560
// are content, and a `Head-sha:` line between them stays fenced; a longer closing run closes; a never-closed one runs out.
33547
33561
t('⛔ record reader: a nested or mismatched fence does not close the open one — the `Head-sha:` line inside stays fenced; a longer run closes; an unmatched run leaves it open to the end', [contractReviewHeadSha(UNDER51('````', '```', `Head-sha: \`${HEAD51}\``, '```', '````', `Head-sha: \`${OLDHEAD51}\``)), contractReviewHeadSha(UNDER51('```', '~~~', `Head-sha: \`${HEAD51}\``, '```', `Head-sha: \`${OLDHEAD51}\``)), contractReviewHeadSha(UNDER51('```', `Head-sha: \`${HEAD51}\``, '`````', `Head-sha: \`${OLDHEAD51}\``)), contractReviewHeadSha(UNDER51('```', '~~~', `Head-sha: \`${HEAD51}\``, '~~~', `Head-sha: \`${OLDHEAD51}\``))].join('|'), [OLDHEAD51, OLDHEAD51, OLDHEAD51, ''].join('|'));
33562
+
// ⛔ A closing run with TRAILING TEXT is fence content, not a close (CommonMark): the fence stays open past it, so a
33563
+
// `Head-sha:` line after such a line is still fenced; a bare run later closes it; whitespace after the run still closes.
33564
+
t('⛔ record reader: a fence is closed only by a run on a line of its OWN — a run with trailing text is content, so the line after it stays fenced; a bare run later closes; trailing whitespace still closes', [contractReviewHeadSha(UNDER51('```', '``` not a close', `Head-sha: \`${HEAD51}\``)), contractReviewHeadSha(UNDER51('```', '``` not a close', `Head-sha: \`${HEAD51}\``, '```', `Head-sha: \`${OLDHEAD51}\``)), contractReviewHeadSha(UNDER51('~~~', '~~~ tail', `Head-sha: \`${HEAD51}\``, '~~~', `Head-sha: \`${OLDHEAD51}\``)), contractReviewHeadSha(UNDER51('```md', `Head-sha: \`${HEAD51}\``, '``` ', `Head-sha: \`${OLDHEAD51}\``))].join('|'), ['', OLDHEAD51, OLDHEAD51, OLDHEAD51].join('|'));
33565
+
// ⛔ A heading indented as CODE (four spaces or a tab) opens no scope — the same three-space bound the key line is held
33566
+
// to — while one indented up to three spaces does; the marker itself keeps its tolerance for the locator.
33567
+
t('⛔ record reader: a `## Contract review` heading indented four spaces or a tab opens no scope, one indented three does; the marker still finds the indented one', [contractReviewHeadSha([' ## Contract review', `Head-sha: \`${HEAD51}\``].join('\n')), contractReviewHeadSha(['\t## Contract review', `Head-sha: \`${HEAD51}\``].join('\n')), contractReviewHeadSha([' ## Contract review', `Head-sha: \`${HEAD51}\``].join('\n')), latestContractReviewOnHead([cm51(1, [' ## Contract review', `Head-sha: \`${HEAD51}\``].join('\n'), T51)], HEAD51), CONTRACT_REVIEW_HEADING_MARKER.test(' ## Contract review')].join('|'), ['', '', HEAD51, '', 'true'].join('|'));
33548
33568
t('⛔ record reader: the key folded INTO the span, a bare hex value, a lowercase key and a sub-floor span name no head', [contractReviewHeadSha(UNDER51(`\`Head-sha: ${HEAD51}\``)), contractReviewHeadSha(UNDER51(`Head-sha: ${HEAD51}`)), contractReviewHeadSha(UNDER51(`head-sha: \`${HEAD51}\``)), contractReviewHeadSha(UNDER51('Head-sha: `ba3d95`'))].join('|'), '|||');
33549
33569
// ⛔ The shapes the review of the line-form reader probed (2026-10-30): a `Head-sha:` line naming ANOTHER head above the
33550
33570
// record's own — placed before the heading, blockquoted, bulleted or fenced. Each is a citation, not the record's line,
Copy file name to clipboardExpand all lines: scripts/pm/post-stamped.mjs
+18-8Lines changed: 18 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -2060,17 +2060,20 @@ export function keyedLineRefusalText(rows) {
2060
2060
2061
2061
/** What the record's owner accepts, printed BY the refusal so the fix is one line away. */
2062
2062
exportconstRECORD_KEY_SPELLINGS=Object.freeze({
2063
-
'Head-sha': '`Head-sha: ` then the reviewed head as 7 to 40 hex in a code span of its OWN, at the START of a line BELOW the `## Contract review` heading — not blockquoted, not bulleted, not inside a fence, not before the heading; the first such line is the head the record names, and a record written before the line existed may omit it',
2063
+
'Head-sha': '`Head-sha: ` then the reviewed head as 7 to 40 hex in a code span of its OWN, at the START of a line (up to three spaces of indent) BELOW an unquoted, unindented `## Contract review` heading — not blockquoted, not bulleted, not inside a fence, not indented as code (four spaces or a tab), not before the heading, not under a quoted or code-indented heading; the first such line is the head the record names, and a record written before the line existed may omit it',
2064
2064
'Local-runs': '`Local-runs: none` at the START of a line, or `Local-runs: probe — REASON` naming the ONE local run the read-only rule was broken for and why; a record written before the line existed may omit it',
2065
2065
});
2066
2066
2067
-
/** PRESENCE only, case-blind: a `Head-sha` key anywhere in the body, however decorated or placed. Consulted solely to
2068
-
* tell "the author wrote the key and the reader cannot read it" (refused) from "no key at all" (not re-judged). */
2069
-
constHEAD_SHA_KEY_ANYWHERE=/head-sha[\t`*]*:/i;
2067
+
/** PRESENCE only, case-blind: a `Head-sha` key opening a LINE, however decorated or placed — any indent, blockquote
2068
+
* markers, a bullet or a list number, bold or backticks around the key — so a decorated, fenced, code-indented or
2069
+
* pre-heading key line still counts as written. Consulted solely to tell "the author wrote the key and the reader
2070
+
* cannot read it" (refused) from "no key at all" (not re-judged). ⛔ Not mid-sentence: a comment that quotes a record's
2071
+
* heading and then names the key in prose wrote no key line, and was refused for it until 2026-10-30 (loudness only). */
rows.push({key: 'Head-sha',line: headShaKeyLine(text),why: '`contractReviewHeadSha` reads NO head here — a `Head-sha` key is present, but no line below the `## Contract review` heading carries it plainly with a hex span of its own (a blockquoted, bulleted, fenced or pre-heading line, the key folded into the span, a bare hex value, a lowercase key and a sub-floor span all read as nothing). Every reader would file this record as a review of NO head.'});
rows.push({key: 'Head-sha',line: headShaKeyLine(text),why: '`contractReviewHeadSha` reads NO head here — a `Head-sha` key opens a line, but no line below an unquoted, unindented `## Contract review` heading carries it plainly with a hex span of its own (a blockquoted, bulleted, fenced or pre-heading line, a code-indented line — four spaces or a tab — a line under a quoted or code-indented heading, the key folded into the span, a bare hex value, a lowercase key and a sub-floor span all read as nothing). Every reader would file this record as a review of NO head.'});
2098
2102
construns=readLocalRuns(text);
2099
2103
if(!localRunsStand(runs))
2100
2104
rows.push({key: 'Local-runs',line: runs.line,why: '`readLocalRuns` reads the line and cannot grade its value — `none` and `probe — REASON` are the closed set, and a probe with no reason names no deviation.'});
@@ -5319,6 +5323,12 @@ export function selfTest() {
5319
5323
t('⭐ a quoted line ABOVE the record\'s own passes — the reader skips the quotation and reads the line below it',rkeys(SHA_WITH([`> Head-sha: \`${'f'.repeat(40)}\``,`Head-sha: \`${SHA_HEAD}\``]))==='');
5320
5324
t('⛔ ABSENT is NOT re-judged for this key either: a record with no `Head-sha` key at all passes untouched — the retired-dialect records carry none',rkeys(SHA_WITH([]))==='');
5321
5325
t('⛔ a fully QUOTED record, and a code-indented (four spaces or tab) line alone, are refused — a quoted heading opens no scope and an indented line is code',rkeys(SHA_WITH([`Head-sha: \`${SHA_HEAD}\``]).split('\n').map((l)=>`> ${l}`).join('\n'))==='Head-sha'&&rkeys(SHA_WITH([` Head-sha: \`${SHA_HEAD}\``]))==='Head-sha'&&rkeys(SHA_WITH([`\tHead-sha: \`${SHA_HEAD}\``]))==='Head-sha');
5326
+
// ⛔ PRESENCE is a key LINE, however decorated, ⛔ never a mid-sentence mention: a record-shaped comment that names the key
5327
+
// in prose wrote no line and is untouched; a key under a code-indented heading, or opening a numbered, doubly quoted
5328
+
// or `+`-bulleted line, is a written line the reader refuses, and is refused here.
5329
+
t('⭐ NOT a key line: a record-shaped comment that names `Head-sha:` mid-sentence, with no line opening on the key, is untouched — presence is a key LINE',rkeys('## Contract review\n\nThe seat\'s own record carries its Head-sha: line plainly, below the heading; see `Head-sha:` in the template.')===''&&rkeys(`> ## Contract review\n\nquoted above; the record\'s Head-sha: line is \`${SHA_HEAD}\` there`)==='');
5330
+
t('⛔ …while a decorated key LINE still counts as written and is refused when the reader names no head: numbered, doubly quoted, `+`-bulleted, and one under a CODE-INDENTED heading',rkeys(SHA_WITH([`1. Head-sha: \`${SHA_HEAD}\``]))==='Head-sha'&&rkeys(SHA_WITH([`> > **Head-sha:** \`${SHA_HEAD}\``]))==='Head-sha'&&rkeys(SHA_WITH([`+ Head-sha: \`${SHA_HEAD}\``]))==='Head-sha'&&rkeys(` ## Contract review\nHead-sha: \`${SHA_HEAD}\``)==='Head-sha');
5331
+
t('the `Head-sha` refusal and the printed spelling NAME the two causes the reader added — a code-indented line and a line under a quoted or code-indented heading',(()=>{consttext=recordLineRefusalText(recordKeyedLineRefusals(SHA_WITH([`\tHead-sha: \`${SHA_HEAD}\``])));construle=RECORD_KEY_SPELLINGS['Head-sha'];returntext.includes('a code-indented line — four spaces or a tab')&&text.includes('a line under a quoted or code-indented heading')&&rule.includes('not indented as code (four spaces or a tab)')&&rule.includes('not under a quoted or code-indented heading')&&rule.includes('BELOW an unquoted, unindented');})());
t('the `Head-sha` refusal prints the spelling that reads, names the owner, and quotes the offending line',(()=>{constrows=recordKeyedLineRefusals(SHA_WITH([`> Head-sha: \`${SHA_HEAD}\``]));consttext=recordLineRefusalText(rows);returntext.includes(RECORD_KEY_SPELLINGS['Head-sha'])&&text.includes('contractReviewHeadSha')&&rows[0].line.includes('> Head-sha');})());
5324
5334
t('⛔ NOT a record: a claim or a report carrying a quoted `Head-sha:` line is untouched — the reader runs on the record\'s heading only',rkeys(`Claim: x\n> Head-sha: \`${SHA_HEAD}\``)===''&&rkeys(`os-dev-report\n\n> Head-sha: \`${SHA_HEAD}\``)==='');
0 commit comments