Commit 2fd23d0
fix(pm): post-stamped exits non-zero when the platform did not store the body (#18690)
Fixes #18663
Clause-②: no
## The defect
`scripts/pm/post-stamped.mjs` already DETECTED the write the platform
never stored — it read the
artefact back, classified the difference as `mutated`, printed the byte
counts and the first
differing offset — and then returned `0`. On the filed hit (a seat-post
body refresh, 2026-09-17)
it sent 263,533 bytes, the platform stored 257,945 — the byte count of
the version BEFORE that
write — with the first difference at byte 6792, where the new block
began: the old body had been
kept whole and not one byte of the new one was there. A caller obeying
every discipline this file's
own header prescribes — no pipe, `$?` captured before any pipe — was
still told the body had
landed, and went on to post the comments that say the conclusion had
already been written into it.
That is the opposite direction from the pipeline trap the header already
warns about: that one is
about a caller throwing the code away, this was the tool handing out a
zero.
## The discriminating predicate, and the verdict fields it reads
One question decides the exit code: **did every byte this act sent reach
the platform?**
All three benign classes answer yes by construction and are untouched —
`identical` by definition,
`trailing-newline-stripped` gives up only newlines the platform does not
keep, `footer-appended`
adds without removing. `mutated` is the only class the rule reads, and
it splits in two:
```js
export function sentBodyLanded(readBack) {
if (!readBack || readBack.class !== 'mutated') return true;
return readBack.footerReAnchored === true;
}
```
Two fields of `readBackVerdict`'s own verdict object, and nothing else:
| field | what it is |
|:---|:---|
| `readBack.class` | the existing declared vocabulary — unchanged, and
`classifyReadBack` is not touched |
| `readBack.footerReAnchored` | new, and a MEASUREMENT: the stored body
is the sent body — or its newline-trimmed form — followed by EXACTLY
`PLATFORM_COMMENT_FOOTER`. `footerReAnchoring()` is the one spelling of
that comparison, shared with the classifier's comment-only
`footer-appended` class rather than written a second time |
⛔ Not a byte-count heuristic. The platform normalises blank lines around
a trailing rule in both
directions, so a length comparison answers a different question: "stored
is shorter" is neither
necessary (a re-anchored footer is LONGER) nor sufficient (an
equal-length substitution loses just
as much). ⛔ And it does not need the pre-write body, which only `--body`
ever holds: "the platform
kept the old one" is one INSTANCE of the class, not its definition —
whatever is stored, a byte
that differs INSIDE the body this act sent is a byte this act did not
get onto the platform. The
same predicate therefore covers the filed hit, a truncation, a sanitizer
substitution, and a
`--comment` write.
`--comment` **does** share the verdict: `main` builds one
`readBackVerdict` for both acts and passes
`mode`, so the same predicate judges both. A comment the sanitizer
chewed now exits non-zero; the
comment footer append it is built to forgive is already clean one class
earlier.
⛔ What did NOT change: `classifyReadBack`'s classes and exemptions, the
warning line, the offset
line, `body_mutated` in `--json`, what is SENT, and the stamp contract.
There is no retry logic.
**The one shape that must stay at 0, and does.** A `--body` refresh
where the platform appends its
58-byte footer classifies as `mutated` — the issue-body footer cell is
unmeasured, and this PR does
not forgive it in the classifier. It exits 0 because nothing was lost.
Measured on the fixture,
byte-for-byte the shape the seat hits on every seat-post refresh:
```
--- FOOTER RE-ANCHORED (control) --- exit=0 landed=true mutated=true
1 parent f8eaf67 commit 2fd23d0
1 file changed
Lines changed: 240 additions & 21 deletions
0 commit comments