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 83464d0
Browse filesBrowse the repository at this point in the historyBrowse files
fix(pm): mailbox_branch_delete fences on the ref's sha, and a refused close-stroke delete names its bare re-send
Contract review should-fixes on #30782:
- execute.mjs: mailboxBranchPreflight reads GET /git/ref/heads/{branch}
as the last read before the DELETE and refuses unless the ref points at
the closed pull's head.sha, so the op deletes that PR's head and never a
commit pushed after the close. A ref already absent fences nothing (the
DELETE's 422 lands idempotent). Self-test: a moved ref and an unread ref
each refused with nothing sent; the good case reads the ref before the
DELETE.
- mailbox-open.mjs: when a --close stroke that carried the delete fails,
closeRemedy prints the one bare mailbox_branch_delete action to send
through fleet-write/dispatch.mjs, since --close refuses a closed pull.
Self-test pins the action and that the validator accepts it.
- The fence list now lives only in ops.mjs's header; execute.mjs and
mailbox-open.mjs point at it.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cwSv11c8FvyR8ZuWhv
if(pull?.status!==200||!pull.json||typeofpull.json!=='object')return[`${pull?.call} -> HTTP ${pull?.status}: the pull could not be read`];
913
908
constpr=pull.json;
914
909
constout=[];
@@ -918,16 +913,20 @@ export function mailboxBranchFenceFailures({ repo, branch, pull, open }) {
918
913
if(String(pr.head?.repo?.full_name??'').toLowerCase()!==repo.toLowerCase())out.push(`the pull's head lives on ${pr.head?.repo?.full_name??'no repository'}, not ${repo}`);
919
914
if(open?.status!==200||!Array.isArray(open.json))out.push(`${open?.call} -> HTTP ${open?.status}: the open pulls on ${branch} could not be read`);
920
915
elseif(open.json.length)out.push(`open pull(s) ${open.json.map((p)=>`#${p?.number}`).join(', ')} have ${branch} as head — the DELETE would close them`);
if(ref?.status!==404&&typeofat!=='string')out.push(`${ref?.call} -> HTTP ${ref?.status}: the ref ${branch} could not be read`);
918
+
elseif(ref?.status!==404&&at!==pr.head?.sha)out.push(`${branch} is at ${at.slice(0,12)}, not the pull's head ${String(pr.head?.sha??'unread').slice(0,12)} — a commit pushed after the close is not the mailbox's`);
921
919
returnout;
922
920
}
923
921
924
-
/** The fences, AUTHORITATIVE (header): the two reads, then `{}` to send or `{ fail }`, the DELETE NOT SENT. Never throws. */
922
+
/** The fences, AUTHORITATIVE (header): the three reads, then `{}` to send or `{ fail }`, the DELETE NOT SENT. Never throws. */
"the run_rerun_failed: the five fences judged HERE on the run and its pull, read immediately before ONE bodiless POST — the pull's current head by its own GET, never the run's embedded copy, and a run naming no pull refused by name; each refused with the POST not sent and accepted on the measured run; a run, pull, baseline or fence that fails is zero writes; the 201 confirmed only by reading attempt 2 back with its failed jobs queued or in progress, naming their job ids; attempt 2 never seen, a failed job completed, or a job list unread is FAILED; no annotation": 21,
1644
1643
"the hierarchy link: sub_issue_add and sub_issue_remove read the parent's and the child's own answers, then the child's parent (add) or the parent's whole list (remove), immediately before ONE write whose body is the child's REST id from its own answer — never its number, never replace_parent; a pull, a transferred or unread card, a child under another parent, one the parent does not list, or a read that is neither answer is zero writes; a child already under this parent is a no-op landed on the list; the answer confirmed only when the parent's list reads the child back (or no longer does) inside the window; a refused write, a list that never settles or never reads whole is FAILED; no annotation, and the rows ride a stroke beside other ops": 20,
1645
1644
"the advisory rows: advisory_report and advisory_create are ONE POST of their body each, landed on a 2xx carrying an id — a draft's reading state draft — that the row and a notice annotation name; advisory_collaborators_add, advisory_versions and advisory_state read the advisory first and send ONE PATCH — every existing login kept with the missing ones added, an all-present list a no-op, the versions entries alone, or the one state a legal transition reaches, the reopen and the publish among them — or nothing at all on a fence: an unread, other or wrong-state advisory, an illegal move, a list the versions may not replace or a publish whose versions are not set; each lands only when its answer shows the result, a publish only read back as published with the versions it was sent, and a landed publish alone is annotated with its id; ⛔ the marker in a report's or a draft's summary, description and packages and in every advisory answer's summary, description and vulnerabilities reaches no log line, row, step summary or annotation": 41,
1646
-
"the mailbox branch delete: the pull's own answer and the open pulls on its head read immediately before ONE DELETE of the ref under the App token — an open, unlabelled, other-headed or forked pull, an open pull on that head, or a read that does not answer is zero writes with every failing fence named; the DELETE lands only when the ref reads back absent, a ref already gone an idempotent landing and one still there FAILED; and mailbox-open's close stroke — comment, close, delete — leaves no branch, while a head outside claude/mailbox-* sends no DELETE": 7,
1645
+
"the mailbox branch delete: the pull's own answer, the open pulls on its head and the ref read immediately before ONE DELETE of the ref under the App token — an open, unlabelled, other-headed or forked pull, an open pull on that head, a ref moved off the pull's head, or a read that does not answer is zero writes with every failing fence named; the DELETE lands only when the ref reads back absent, a ref already gone an idempotent landing and one still there FAILED; and mailbox-open's close stroke — comment, close, delete — leaves no branch, while a head outside claude/mailbox-* sends no DELETE": 7,
1647
1646
"advisory_read: ONE GET after the sender gate and nothing written; the read, advisory and sender fences judged on that answer — target-write by the maintainer's ruling, a sender off the advisory's collaborators sealed for, one without write refused before the GET, any other gate closed — then the answer sealed to the seat's key and emitted as notice parts the reader parses back, opening byte for byte for that key and read alone; a failed or unsealed seal and an over-cap answer FAILED with nothing emitted; ⛔ the marker in the summary, description and vulnerabilities, and the advisory's id, reach no log line, row, step summary or annotation, and the sealed answer alone carries no marker": 18,
1648
1647
});
1649
1648
// Raised 17 → 18 with the governed-review follow-up battery, 18 → 19 with the run_rerun_failed battery, 19 → 20 with the
@@ -2510,37 +2509,41 @@ export async function selfTest() {
2510
2509
}
2511
2510
2512
2511
// ── the mailbox branch delete ───────────────────────────────────────────
2513
-
battery("the mailbox branch delete: the pull's own answer and the open pulls on its head read immediately before ONE DELETE of the ref under the App token — an open, unlabelled, other-headed or forked pull, an open pull on that head, or a read that does not answer is zero writes with every failing fence named; the DELETE lands only when the ref reads back absent, a ref already gone an idempotent landing and one still there FAILED; and mailbox-open's close stroke — comment, close, delete — leaves no branch, while a head outside claude/mailbox-* sends no DELETE");
2512
+
battery("the mailbox branch delete: the pull's own answer, the open pulls on its head and the ref read immediately before ONE DELETE of the ref under the App token — an open, unlabelled, other-headed or forked pull, an open pull on that head, a ref moved off the pull's head, or a read that does not answer is zero writes with every failing fence named; the DELETE lands only when the ref reads back absent, a ref already gone an idempotent landing and one still there FAILED; and mailbox-open's close stroke — comment, close, delete — leaves no branch, while a head outside claude/mailbox-* sends no DELETE");
t('the good case: the pull, then the open pulls on its head, then ONE DELETE of the ref under the App token, then the ref read back absent — exit 0, the row naming it deleted',[ok.exit,ok.seen.slice(1).map((s)=>s.call),writes(ok.seen).map((s)=>[s.call,s.body,s.auth]),ok.rows[0].result,ok.annotations],[EXIT_OK,[PULL,OPEN,DEL,BACK],[[DEL,null,`Bearer ${TOKEN}`]],`deleted ${BR} (read back absent)`,[]]);
2526
+
t("the good case: the pull, the open pulls on its head, the ref at the pull's head, then ONE DELETE of the ref under the App token, then the ref read back absent — exit 0, the row naming it deleted",[ok.exit,ok.seen.slice(1).map((s)=>s.call),writes(ok.seen).map((s)=>[s.call,s.body,s.auth]),ok.rows[0].result,ok.annotations],[EXIT_OK,[PULL,OPEN,BACK,DEL,BACK],[[DEL,null,`Bearer ${TOKEN}`]],`deleted ${BR} (read back absent)`,[]]);
t("the open-pulls read is filtered to this repository's owner and the branch — an unfiltered or mis-owned read would answer for other heads",urls[1],`https://api.test/repos/${REPO}/pulls?state=open&head=objectstack-ai%3Aclaude%2Fmailbox-ui-3`);
2529
2530
constfences=[
2530
2531
[{[PULL]: {status: 200,json: box({state: 'open'})}},'the pull is open, not closed'],
2531
2532
[{[PULL]: {status: 200,json: box({labels: [{name: 'pinned'}]})}},'does not carry pm:mailbox'],
2532
-
[{[PULL]: {status: 200,json: box({head: {ref: 'claude/mailbox-ui-2',repo: {full_name: REPO}}})}},"the pull's head is claude/mailbox-ui-2, not claude/mailbox-ui-3"],
2533
-
[{[PULL]: {status: 200,json: box({head: {ref: BR,repo: {full_name: 'someone/objectstack'}}})}},"head lives on someone/objectstack, not objectstack-ai/objectstack"],
2533
+
[{[PULL]: {status: 200,json: box({head: {ref: 'claude/mailbox-ui-2',sha: HEAD,repo: {full_name: REPO}}})}},"the pull's head is claude/mailbox-ui-2, not claude/mailbox-ui-3"],
2534
+
[{[PULL]: {status: 200,json: box({head: {ref: BR,sha: HEAD,repo: {full_name: 'someone/objectstack'}}})}},"head lives on someone/objectstack, not objectstack-ai/objectstack"],
2535
+
[{[BACK]: at('b'.repeat(40))},`${BR} is at bbbbbbbbbbbb, not the pull's head aaaaaaaaaaaa — a commit pushed after the close is not the mailbox's`],
2536
+
[{[BACK]: {status: 503,json: {message: 'down'}}},'the ref claude/mailbox-ui-3 could not be read'],
2534
2537
[{[OPEN]: {status: 200,json: [{number: 30999}]}},'open pull(s) #30999 have claude/mailbox-ui-3 as head — the DELETE would close them'],
2535
2538
[{[PULL]: {status: 404,json: {message: 'Not Found'}}},'the pull could not be read'],
2536
2539
[{[OPEN]: {status: 503,json: {message: 'down'}}},'the open pulls on claude/mailbox-ui-3 could not be read'],
t('⛔ each fence refuses with the DELETE NOT SENT and names itself: an open pull, no pm:mailbox, another head, a forked head, an open pull on the head, an unread pull, an unread open-pulls list',fenced,fences.map(()=>[EXIT_ACTION_FAILED,0,'not sent',true]));
t('⛔ each fence refuses with the DELETE NOT SENT and names itself: an open pull, no pm:mailbox, another head, a forked head, an open pull on the head, a ref moved past the head, an unread ref, an unread pull, an unread open-pulls list',fenced,fences.map(()=>[EXIT_ACTION_FAILED,0,'not sent',true]));
t('⛔ a 204 whose ref still reads back is a FAILED action, never a landing',[kept.exit,kept.rows[0].status,kept.rows[0].result.includes('the branch is still there')],[EXIT_ACTION_FAILED,204,true]);
2542
-
constgone=awaitrun(drop,{ ...good,[DEL]: {status: 422,json: {message: 'Reference does not exist'}}});
2543
-
t('a ref already gone — the DELETE answers 422, the ref reads back absent — is an idempotent landing',[gone.exit,gone.rows[0].result],[EXIT_OK,'already absent (idempotent)']);
2545
+
constgone=awaitrun(drop,{ ...good,[BACK]: {status: 404,json: {message: 'Not Found'}},[DEL]: {status: 422,json: {message: 'Reference does not exist'}}});
2546
+
t('a ref already gone — absent before (no sha to fence), the DELETE answering 422, absent after — is an idempotent landing',[gone.exit,gone.rows[0].result],[EXIT_OK,'already absent (idempotent)']);
0 commit comments