Repository navigation
Commit 412908c
fix(pm): the record writer refuses a Head-sha key followed by a hex span anywhere on a line; a backtick fence's info string holds no backtick (#28166)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DMzsEnY5eHjuNZKQgC1AUAt)_
domain:skills#2 · os-elon-musk · session_016WV4cwv77cYicgaKyj39Y2
Fixes #28111
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:PR #28103 契约复核留下的 should-fix 1–3。(1) `post-stamped.mjs` 发帖前的
`Head-sha` 拒收加第二条「有键」判据:行内任何位置「键名紧跟 7–40 位十六进制码段」也算作者写了键。#28103
把判据收窄到「以键开头的行」后,16 种读取器读不出 head
的写法(键前有单词、一行两个键、表格行、下划线强调、任务列表项、题头样式、unicode 项目符号或
emoji、项目符号后接引用、删除线、括号、NBSP 缩进、HTML 注释)悄悄通过了;现在又都拒收。(2)
`RECORD_KEY_SPELLINGS['Head-sha']`、拒收文案和函数注释改说题头「缩进最多三个空格」,不再说「不缩进」,与读取器一致。(3)
`check-half-states.mjs` 的 `FENCE_LINE`:反引号围栏的信息串含反引号时不开栏(CommonMark
§4.5),波浪线围栏不受此限。共 2 个文件,+45/−13。
- 为什么改:三项都是 #28103 复核记录 6523547564 点名的。第 1 项是响亮度:作者写了一条读取器读成「无
head」的记录,却听不到一句拒收。卡片给了 (a) 加判据 / (b) 记录边界两个选项,要求先测再选:实测第二判据在 2026-10-23
以来 11764 条评论(750 条带题头记录)上一条都不多拒,所以选 (a)。第 2、3 项是措辞与 CommonMark 规则,均属
cosmetic。无新门禁、无新拒收类。
- 风险与回滚:语料前后对比(基线 `27e0bd584` vs 本 head):750 条记录读法逐条相同(0 变),11764
条评论拒收逐条相同(0 变);#28103
放开的散文提及(只提键名、或码段在句子后面)仍不拒;新判据唯一会拒的散文形态是「键名紧跟码段」出现在读不出 head
的记录体里,这是卡片接受的边界,线上 0 例,已钉住。围栏规则只会让读取器读到更多本来就该读到的行(0 条线上记录含该形态)。回滚即
revert。
- 先看:`post-stamped.mjs` 的 `HEAD_SHA_KEY_SPAN` 与
`headShaKeyPresent`(两行),再看 `check-half-states.mjs` 的 `FENCE_LINE`(一行)。
- 两分钟验证:五个自测在本 head 全部 exit 0:half-states 5131(主干 5130,+1 钉)、recognisers
337、post-stamped 753(主干 747,+6 钉)、owed-reviews 65、guard
403。三条消融各恰红本项新钉:去掉第二判据 4 枚红、围栏规则还原 1 枚红、措辞还原 1 枚红。
- 需要你做的:无。本 PR 不碰四个契约面,不欠契约复审;落地档以登记册为准(本地 `--test`
读为两条路径均不在登记册上,普通队列落地)。
## What changes
- **`scripts/pm/post-stamped.mjs` — item 1, choice (a).** A second
presence limb, `HEAD_SHA_KEY_SPAN` (`/head-sha[`*_~]*[ \t]*:[
\t*_~|]*`[0-9a-f]{7,40}`/i`): the key directly followed by a 7-to-40 hex
code span, anywhere on a line, through the decoration a key or a value
may wear. `headShaKeyPresent` is the OR of the two limbs and replaces
the bare `HEAD_SHA_KEY_LINE.test` in `recordKeyedLineRefusals` and in
the `headShaKeyLine` locator. The refusal's `why` names both limbs. The
docblock records the 16 shapes the limb restores, the prose shapes that
stay free, the one prose shape it refuses (the key immediately followed
by a hex span inside a sentence) and the corpus measurement behind
accepting it.
- **`scripts/pm/post-stamped.mjs` — item 2.**
`RECORD_KEY_SPELLINGS['Head-sha']` says the heading is `itself indented
at most three spaces`; the refusal `why` and the
`recordKeyedLineRefusals` docblock say the same; `unindented` is gone
from all three.
- **`scripts/pm/check-half-states.mjs` — item 3.** `FENCE_LINE` is `/^[
]{0,3}(`{3,}(?!.*`)|~{3,})/`: a backtick run opens a fence only when the
rest of the line carries no backtick; a tilde run's info string may hold
one. `FENCE_CLOSE_LINE`, the walker and every other reader are
untouched; the docblock cites CommonMark §4.5 and the #28103 review's
F16.
- **Pins.** post-stamped: the 16 shapes in two pins (each refused AND
reader null), the freed prose cases (no span, span later in the
sentence, a sub-floor span, a non-hex span) stay free, the accepted
prose bound (refused in a reader-null body, passes beside a plain key
line), the locator quotes the span-limb line and the `why` names both
limbs, the spelling and the `why` grant the heading three spaces and
never say `unindented`; the existing wording pin is loosened to `BELOW
an unquoted`. check-half-states (H51 block): a backtick run with a
backtick in its info string opens nothing (the line below reads; after a
later bare run the FIRST plain line still wins), a backtick-free info
string opens, a tilde run with a backtick in its info string opens, and
such a line inside an open four-backtick fence stays fenced.
## Why
The contract review of PR #28103 (record 6523547564) left should-fixes 1
to 3, filed as #28111 and triaged p3 (6524831843: loudness only, no
wrong head admitted). Measured on `origin/main` `27e0bd584` before the
change (`skills-lane-seat2/28111/probe-shapes.mjs` in the project files,
both trees):
1. All 16 shapes the review listed (plus a second table-row spelling)
pass `recordKeyedLineRefusals` untouched and read `null` in
`contractReviewHeadSha`: a record that silently reads as no record.
2. The spelling said `unindented` of the heading while the reader opens
the scope on `/^[ ]{0,3}#/`.
3. ```` ``` a`b ```` opened a fence, so the record's own `Head-sha:`
line below it was skipped (fail-closed; CommonMark renders the line as a
paragraph).
**Item 1, (a) versus (b), measured before choosing.** The card prefers
restoring loudness where it costs no live false positive. The span
limb's false-positive population is a line that matches
`HEAD_SHA_KEY_SPAN` but is not a key line. On the 11764 issue comments
updated since 2026-10-23 (REST, 118 pages, fetched 2026-10-30T14:40Z;
750 carry the heading marker): **0** such lines in any comment, **0** in
any record, so **0** records newly refused; 0 records carry the key
anywhere without a key line. Choice (a) therefore costs no live refusal,
and the one synthetic prose false positive the review named (P3, the key
immediately followed by a hex span inside a sentence) is pinned as the
accepted bound so the next reader of the function knows it was chosen.
Choice (b) was not taken.
No new gate, no new refusal class: the writer's refusal fires on a
superset of what it fired on after #28103 and a subset of what it fired
on before (every shape it now refuses, base-before-#28103 refused too),
and the reader's accept set only grows by lines CommonMark already
rendered as paragraphs.
## Verification
- Self-tests on the committed head `30a0fbad`, exit captured before any
pipe: `check-half-states --self-test` 0 (5131 cases; main 5130),
`record-recognisers --self-test` 0 (337), `post-stamped --self-test` 0
(753 across 26 batteries; main 747), `check-owed-reviews --self-test` 0
(65 in 9 batteries), `check-governed-queue-guard --self-test` 0 (403).
- Ablation on the committed head
(`skills-lane-seat2/28111/ablation.log`), each leg one `sed`, restored
with `git checkout`, porcelain empty: (A) `headShaKeyPresent` back to
the line limb alone: post-stamped 4 of 753 red, all four the new
span-limb pins; (B) `FENCE_LINE` back to the base shape: half-states 1
of 5131 red (the new info-string pin), post-stamped 0; (C) the spelling
back to `unindented`: post-stamped 1 of 753 red (the new wording pin).
No other pin moves in any leg.
- Corpus (`skills-lane-seat2/28111/probe-corpus.mjs`,
`probe-corpus.out`): 11764 issue comments updated since 2026-10-23, 750
carrying the heading marker, driven through `contractReviewHeadSha` and
`recordKeyedLineRefusals` in a worktree at `origin/main` `27e0bd584` and
one at this head: 0 records read differently (the 2 nulls are the two
no-key legacy records on both trees), 0 comments refused differently
(the 1 refusal on each side is the pre-existing `Local-runs` row on
record 6517315440); 0 lines match the span limb without being a key
line; 0 comments carry a backtick fence opener with a backtick in its
info string.
- Shapes (`probe-shapes.out`): on this head each of the 17 shapes is
refused and reads null; P1 (no span) and P2 (span later in the sentence)
stay free; P3 (key then span in a sentence) is refused as the accepted
bound; P4 (a plain line above a prose mention) reads and passes.
- ESLint (`--no-inline-config`) on the two files: exit 0.
- Gates: `dispatch-gates --commands` at the committed head `30a0fbad`
derives 48 families (26 pnpm, 22 direct node); all 48 run in a second
worktree at this head after `pnpm install --frozen-lockfile
--ignore-scripts`, every exit 0
(`skills-lane-seat2/28111/gates-ran.clean.txt`); `--ran` reconciles 48
derived / 48 run / 0 NOT-MEASURED / 0 UNRUN. No changeset derived: no
published package is touched, `skip-changeset` rides the create.
- Landing tier: `check-governed-merges.mjs --test` on the two paths
answers 0 of 2 on the register (not governed, ordinary queue landing);
the register's reading at PR time is the seat's. No contract review is
owed: none of the four contract faces is touched.
## Human Minimum
Each item is one rule from
[CONTRIBUTING.md › Human
Minimum](https://github.com/objectstack-ai/objectstack/blob/main/CONTRIBUTING.md#human-minimum),
which links the AGENTS.md text that states it.
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(not touched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; the derived lint families pass.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset. (no published
package: `skip-changeset`)
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed. (not touched)
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English (the 维护者速读 block is the
one Chinese channel).
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_016WV4cwv77cYicgaKyj39Y2
Co-authored-by: Claude <noreply@anthropic.com>1 parent a3d24c9 commit 412908c
2 files changed
Lines changed: 45 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12710 | 12710 | | |
12711 | 12711 | | |
12712 | 12712 | | |
| 12713 | + | |
| 12714 | + | |
| 12715 | + | |
| 12716 | + | |
| 12717 | + | |
| 12718 | + | |
| 12719 | + | |
| 12720 | + | |
12713 | 12721 | | |
12714 | | - | |
| 12722 | + | |
12715 | 12723 | | |
12716 | 12724 | | |
12717 | 12725 | | |
| |||
33618 | 33626 | | |
33619 | 33627 | | |
33620 | 33628 | | |
| 33629 | + | |
33621 | 33630 | | |
33622 | 33631 | | |
33623 | 33632 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2060 | 2060 | | |
2061 | 2061 | | |
2062 | 2062 | | |
2063 | | - | |
| 2063 | + | |
2064 | 2064 | | |
2065 | 2065 | | |
2066 | 2066 | | |
2067 | | - | |
2068 | | - | |
2069 | | - | |
2070 | | - | |
2071 | | - | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
2072 | 2085 | | |
| 2086 | + | |
| 2087 | + | |
2073 | 2088 | | |
2074 | 2089 | | |
2075 | 2090 | | |
2076 | | - | |
| 2091 | + | |
2077 | 2092 | | |
2078 | 2093 | | |
2079 | 2094 | | |
| |||
2084 | 2099 | | |
2085 | 2100 | | |
2086 | 2101 | | |
2087 | | - | |
2088 | | - | |
| 2102 | + | |
| 2103 | + | |
2089 | 2104 | | |
2090 | 2105 | | |
2091 | 2106 | | |
| |||
2097 | 2112 | | |
2098 | 2113 | | |
2099 | 2114 | | |
2100 | | - | |
2101 | | - | |
| 2115 | + | |
| 2116 | + | |
2102 | 2117 | | |
2103 | 2118 | | |
2104 | 2119 | | |
| |||
5328 | 5343 | | |
5329 | 5344 | | |
5330 | 5345 | | |
5331 | | - | |
| 5346 | + | |
| 5347 | + | |
| 5348 | + | |
| 5349 | + | |
| 5350 | + | |
| 5351 | + | |
| 5352 | + | |
| 5353 | + | |
| 5354 | + | |
5332 | 5355 | | |
5333 | 5356 | | |
5334 | 5357 | | |
| |||
0 commit comments