Skip to content

Commit 094a39c

Browse files
fix(pm): check-half-states H16 excludes changeset-release/* as H12 does (#25017)
Fixes #24856 Clause-②: no ## What this does A deletion in `scripts/pm/check-half-states.mjs`, the report-only half-state patrol. Scope is the triage answer on the card (comment 6292721219, scope (b)). H16 now excludes `changeset-release/*` the way H12 already does. H16 does not get a new row, any regeneration remedy text, or a threshold for that branch. H16's docblock assumed the Version Packages PR is "regenerated from `main` on every push". That stopped being true when the `version-pr` job moved to a six-hourly schedule (#11233). `release.yml`'s own header on `origin/main` says: "Between refreshes `changeset-release/main` is a static branch." So a dirty Version Packages PR is in its normal stale window. H16 flagged it after 2 h and told the reader to hand-merge `main` into a generated branch, which the next refresh overwrites. ## Changes (one file, +10 / -12) - `h16StuckMergeConflict` (the predicate, L4262): `if ((pr.head?.ref ?? '').startsWith('changeset-release/')) return null;`, H12's exact spelling. - `h16NeedsDetail` (the gathering gate, L4197): the same exclusion, returning `false`. - Docblock, replaced in place: the 6-line paragraph claiming the branch is "deliberately NOT excluded, unlike in H12 ... regenerated from `main` on every push" is now a 3-line reason that quotes `release.yml` and cites #11233 (L4191). The predicate's existing out-of-scope sentence gains one clause pointing to it (L4248), with no new line. Net prose: -3 lines. - Self-test: the two pins that asserted the old premise are flipped in place, and their comment is rewritten (3 lines down to 2): - `H16 gate: a changeset-release head is not a candidate (excluded, as in H12)` now expects `false`. - `H16: a dirty changeset-release/main PR past the threshold yields no row (the limb is deleted, #11233)` now expects `null`. - Every other H16 pin is unchanged, including the ordinary dirty-PR pins (`dirty beyond the threshold -> finding`, `dirty within the threshold -> clean`). The case count is 4916 before and after. ## Where the exclusion lives, and why both functions - **The live sweep cannot skip the gate.** It calls the predicate in one place only (L22472), and that call comes after `if (!h16NeedsDetail(pr)) continue;` (L22462). - **The gate alone is not enough.** The self-test's `never narrower than the predicate (every flagged row is fetched)` invariant requires the gate to fetch every row the predicate can flag. If only the gate excluded the branch, the predicate would still flag it and that invariant would go red. Ablation leg A below measured exactly that. So the predicate carries the exclusion, since every caller ends there. - **The gate mirrors it** because its own docblock defines it as "the halves of the predicate that do not need `mergeable_state`", and the head ref is one of those halves. Without the mirror, every sweep would spend one GET on the Version Packages PR, which the predicate can never flag. ## Tests (at `43d062e63`) - Before (`a7199ef97`): `node scripts/pm/check-half-states.mjs --self-test`, exit 0, `✓ check-half-states self-test: 4916 cases pass.` - After (`43d062e63`): the same command, exit 0, `✓ check-half-states self-test: 4916 cases pass.` **Ablation** (the fix was committed first; mutations went through `node scripts/ablation-replace.mjs`, which restores itself on exit): - **Leg A**, predicate line removed (gate kept), marker count 1, exit 1, `2 of 4916 case(s) failed`: - the new `yields no row` pin failed (it got the old hand-merge row text, expected `null`); - `H16 gate: never narrower than the predicate` failed (got false, want true). - Restore: blob `4cb17365` matches `HEAD`, and `git diff HEAD` is empty. - The first attempt at this leg was a no-op: the tool refused before mutating, because the replacement text already occurred in the anchor. I picked a new anchor and re-ran it. - **Leg B**, gate line removed, marker count 1, exit 1, `1 of 4916 case(s) failed`: `H16 gate: a changeset-release head is not a candidate` (got true, want false). Restore: blob matches `HEAD`, and `git diff HEAD` is empty. ## Gates I derived the local gates with `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` at `43d062e63`: 43 commands. All 43 were run on `43d062e63` and every one exited 0. `pnpm check:pm-dispatch-gates` was run detached, as its header prescribes: fast tier, 1913 cases pass, exit 0. The `--ran` reconciliation answered: `43 derived famil(ies) accounted for — 43 run, 0 NOT-MEASURED (a DERIVED zero — all 43 recorded an exit code and none of them is 3)`. It also warned that the tree is 46 commits behind `origin/main` `62bc12930`, and that 4 derivation-input files changed in that range. None of them is this file. `origin/main` does not touch `scripts/pm/check-half-states.mjs` since the base, and `git merge-tree` against it is clean, so I did not merge. CI runs on the merge ref. `release.yml` is untouched (Tier H). ## Acceptance notes - `H36`'s banner (now L8273-8276) gives a second reason for excluding `changeset-release/*` from the shared-file pairing, and that reason repeats the same stale premise: "it is regenerated from `main` on every push — it holds nothing." H36 behaves correctly: it excludes the branch on its first reason, that the Version Packages PR consumes every changeset and would pair with every open PR. Only the stated sub-reason is out of date. The fix would be a prose correction outside this card's declared surface (the claim names H16 only), so I left it alone. No carrier. - `scripts/pm/check-skill-line-ratchet.mjs` L1482 already describes that premise as false since #11233. No other row or tool cites H16's treatment of the branch: `.claude/skills/pm-dispatch/**` and `scripts/pm/**` have zero hits. --- _Generated by [Claude Code](https://claude.ai/code/session_01M82feuetLzrCiBz41BJb7L)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 58cd58f commit 094a39c

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

‎scripts/pm/check-half-states.mjs‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4188,15 +4188,13 @@ export function h16HeldCards(body) {
41884188
* it as a finding rather than as fresh (#4690), so a gate that skipped it here
41894189
* would drop exactly the row the predicate promises to surface.
41904190
*
4191-
* `changeset-release/*` is deliberately NOT excluded, unlike in H12. There the
4192-
* Version Packages PR would flag on every sweep BY DESIGN (born ready, never
4193-
* armed, the maintainer's alone to merge). A dirty one is nothing of the kind:
4194-
* it is regenerated from `main` on every push, so it has no normal state in
4195-
* which it sits conflicted for hours — if it ever does, that is a real finding
4196-
* about the release bot, not a false positive to suppress.
4191+
* `changeset-release/*` is excluded, here and in the predicate, as in H12,
4192+
* because "Between refreshes `changeset-release/main` is a static branch"
4193+
* (`release.yml`, #11233): dirty is its normal stale window, not a stuck PR.
41974194
*/
41984195
export function h16NeedsDetail(pr, nowMs = Date.now()) {
41994196
if (!pr || pr.draft !== false || pr.merged_at) return false;
4197+
if ((pr.head?.ref ?? '').startsWith('changeset-release/')) return false;
42004198
const updated = Date.parse(pr.updated_at ?? '');
42014199
if (!Number.isFinite(updated)) return true;
42024200
return (nowMs - updated) / 3_600_000 > MERGE_CONFLICT_STALE_HOURS;
@@ -4247,7 +4245,7 @@ export function h16DetailPassUnreadable(candidates, probed) {
42474245
*
42484246
* Drafts are out of scope (parked deliberately, H12's reading), and a row
42494247
* without a real `draft` field is out of scope too — this predicate must not
4250-
* flag a shape it cannot read.
4248+
* flag a shape it cannot read. So is `changeset-release/*` (`h16NeedsDetail`).
42514249
*
42524250
* ## Why `auto_merge` is NOT read here, unlike H12
42534251
*
@@ -4261,6 +4259,7 @@ export function h16DetailPassUnreadable(candidates, probed) {
42614259
*/
42624260
export function h16StuckMergeConflict(pr, nowMs = Date.now()) {
42634261
if (!pr || pr.draft !== false || pr.merged_at) return null;
4262+
if ((pr.head?.ref ?? '').startsWith('changeset-release/')) return null;
42644263
if (pr.mergeable_state !== 'dirty') return null;
42654264
const updated = Date.parse(pr.updated_at ?? '');
42664265
const ageHours = Number.isFinite(updated) ? (nowMs - updated) / 3_600_000 : null;
@@ -27455,11 +27454,10 @@ async function selfTest() {
2745527454
t('H16 gate: an unreadable updated_at IS a candidate (the predicate flags it)', h16NeedsDetail(conflictPr({ updated: 'not-a-date' }), NOW), true);
2745627455
t('H16 gate: an absent updated_at IS a candidate', h16NeedsDetail(conflictPr({ updated: undefined }), NOW), true);
2745727456
t('H16 gate: an absent row is not a candidate', h16NeedsDetail(undefined, NOW), false);
27458-
// The Version Packages PR is NOT excluded here, unlike in H12: it is
27459-
// regenerated from `main` on every push, so a dirty one is a real finding
27460-
// about the release bot rather than a by-design false positive.
27461-
t('H16 gate: a changeset-release head is still a candidate (unlike H12)', h16NeedsDetail(conflictPr({ head: { ref: 'changeset-release/main' }, updated: hoursAgo(200) }), NOW), true);
27462-
t('H16: …and a dirty Version Packages PR really does flag', typeof h16StuckMergeConflict(conflictPr({ head: { ref: 'changeset-release/main' }, updated: hoursAgo(200) }), NOW), 'string');
27457+
// The Version Packages PR is excluded, as in H12: between refreshes it is a
27458+
// static branch (`release.yml`, #11233), so dirty is its normal stale window.
27459+
t('H16 gate: a changeset-release head is not a candidate (excluded, as in H12)', h16NeedsDetail(conflictPr({ head: { ref: 'changeset-release/main' }, updated: hoursAgo(200) }), NOW), false);
27460+
t('H16: a dirty changeset-release/main PR past the threshold yields no row (the limb is deleted, #11233)', h16StuckMergeConflict(conflictPr({ head: { ref: 'changeset-release/main' }, updated: hoursAgo(200) }), NOW), null);
2746327461
// The never-narrower invariant, asserted over the whole fixture table rather
2746427462
// than case by case: for every row the predicate flags, the gate must fetch.
2746527463
const h16Rows = [

0 commit comments

Comments
 (0)