|
35 | 35 | * organization / administration endpoint, so a payload naming one is refused |
36 | 36 | * at the validator with zero writes — the `--self-test` of `validate.mjs` pins |
37 | 37 | * that every path spelled here stays clear of those families and that the |
38 | | - * table's one `PUT` (`pr_update_branch`, below) reaches no whole-set replace |
39 | | - * of labels or assignees. The one re-run the table has re-runs a run's FAILED |
| 38 | + * table's two `PUT`s (`pr_update_branch` and `conversation_lock`, below) reach |
| 39 | + * no whole-set replace of labels or assignees. The one re-run the table has re-runs a run's FAILED |
40 | 40 | * jobs alone, once, on a closed list of workflows (`run_rerun_failed`, below). |
41 | 41 | * |
42 | 42 | * ## The one row that moves a branch — `pr_update_branch` |
|
77 | 77 | * reads back absent (`confirmMailboxBranch`): a ref already gone (the DELETE's |
78 | 78 | * 422) is an idempotent landing, one still there FAILED. |
79 | 79 | * |
| 80 | + * ## The two rows that lock and unlock a conversation — `conversation_lock`, `conversation_unlock` |
| 81 | + * |
| 82 | + * The repository is public, so any GitHub account can comment on a mailbox PR |
| 83 | + * (`mailbox-open.mjs`), and a comment there reaches the subscribed seat's |
| 84 | + * session. Locking the conversation leaves commenting to accounts with write |
| 85 | + * access to the repository — the fleet App and the maintainers among them — and |
| 86 | + * shuts everyone else out. `PUT /repos/{o}/{r}/issues/{n}/lock` with the body |
| 87 | + * `{ lock_reason: CONVERSATION_LOCK_REASON }` (`resolved`, the one reason sent: |
| 88 | + * the conversation is closed to outsiders, not heated, off-topic or spam) is |
| 89 | + * the whole lock row; a `DELETE` of the same path, no body, the whole unlock |
| 90 | + * row. Each takes one key, `issue` (a pull request's number is its issue |
| 91 | + * number), and no body key the caller can widen. GitHub's permission ledger |
| 92 | + * (the file cited below) lists the endpoint under `issues: write` and again |
| 93 | + * under `pull_requests: write`, either one sufficing; both are literal grants |
| 94 | + * on every stroke, so the rows spend `issues` and the mint widens nothing. |
| 95 | + * The unlock exists so that a lock is never one-way: `mailbox-open.mjs` posts |
| 96 | + * one relay comment on the conversation it has just locked, and unlocks it |
| 97 | + * when that comment is refused — a locked mailbox the relay cannot write to |
| 98 | + * would hear no knock (`mailbox-open.mjs` 〈Closed to outsiders〉). |
| 99 | + * |
| 100 | + * The fences, listed HERE only, are facts about the pull, judged by the |
| 101 | + * executor on the pull's own `GET`, the last read before the write |
| 102 | + * (`mailboxLockPreflight`): the number is a pull request (an issue's number |
| 103 | + * answers 404 there), it is open, and it carries `pm:mailbox`. Anything else |
| 104 | + * is refused, nothing sent, so a mistyped or injected number can neither lock |
| 105 | + * nor unlock a real PR's or card's conversation. A label fence stops a |
| 106 | + * mistake, not a hostile seat, which can add the label first. Each row lands |
| 107 | + * only when the issue reads back with `locked` as asked (`confirmMailboxLock`): |
| 108 | + * a write the platform refused whose conversation already reads that way is |
| 109 | + * an idempotent landing, and any other read FAILED. |
| 110 | + * |
80 | 111 | * ## The rows whose LATER requests read the FIRST's answer — `pr_create` with `assignees` or `labels` |
81 | 112 | * |
82 | 113 | * A pull request's assignees and labels are written on its issue endpoints, |
@@ -2867,6 +2898,8 @@ export const MAX_REF_BYTES = 255; |
2867 | 2898 | export const MAILBOX_BRANCH_SHAPE = /^claude\/mailbox-[a-z0-9]+(?:[._-][a-z0-9]+)*$/; |
2868 | 2899 | /** The label a mailbox PR carries — `mailbox-open.mjs` re-exports it, so it has one spelling. */ |
2869 | 2900 | export const MAILBOX_LABEL = 'pm:mailbox'; |
| 2901 | +/** The one `lock_reason` `conversation_lock` sends — a mailbox is closed to outsiders, not heated (header). */ |
| 2902 | +export const CONVERSATION_LOCK_REASON = 'resolved'; |
2870 | 2903 | /** Names per list-valued key; ten assignees is the platform's own cap, twenty labels is ours. */ |
2871 | 2904 | export const MAX_LABELS_PER_ACTION = 20; |
2872 | 2905 | export const MAX_LOGINS_PER_ACTION = 10; |
@@ -3203,7 +3236,11 @@ export function transferRemedy(source, target) { |
3203 | 3236 | * to have landed (`requestLanded`, execute.mjs); a |
3204 | 3237 | * `mailboxBranch` descriptor carries the pull and the branch |
3205 | 3238 | * the executor fences before the DELETE and reads back after |
3206 | | - * it (`mailboxBranchPreflight`, execute.mjs); an |
| 3239 | + * it (`mailboxBranchPreflight`, execute.mjs); a |
| 3240 | + * `mailboxLock` descriptor carries the pull and the `locked` |
| 3241 | + * state asked for, which the executor fences before the write |
| 3242 | + * and reads back after it (`mailboxLockPreflight` / |
| 3243 | + * `confirmMailboxLock`, execute.mjs); an |
3207 | 3244 | * `enqueueFront` descriptor carries the pull and the expected |
3208 | 3245 | * head the executor fences, sends as `expectedHeadOid`, and |
3209 | 3246 | * judges the queue read back against |
@@ -3372,6 +3409,21 @@ export const OPS = Object.freeze({ |
3372 | 3409 | optional: Object.freeze([]), |
3373 | 3410 | requests: (a) => [{ verb: 'POST', path: '/graphql', graphql: { mutation: 'dequeuePullRequest', query: DEQUEUE_MUTATION, pull: a.pull }, dequeue: { pull: a.pull, expectedHeadSha: a.expected_head_sha, cause: a.cause, reason: a.reason } }], |
3374 | 3411 | }), |
| 3412 | + // The two rows that lock and unlock a conversation — see the header. `issue` alone; the reason is the table's, |
| 3413 | + // never the caller's. The pull's fences are the executor's, on its own answer immediately before the write; the |
| 3414 | + // issue is read back `locked` as asked. |
| 3415 | + conversation_lock: Object.freeze({ |
| 3416 | + permission: 'issues', |
| 3417 | + required: Object.freeze(['issue']), |
| 3418 | + optional: Object.freeze([]), |
| 3419 | + requests: (a, repo) => [{ verb: 'PUT', path: `${issues(repo, a.issue)}/lock`, body: { lock_reason: CONVERSATION_LOCK_REASON }, mailboxLock: { pull: a.issue, locked: true } }], |
| 3420 | + }), |
| 3421 | + conversation_unlock: Object.freeze({ |
| 3422 | + permission: 'issues', |
| 3423 | + required: Object.freeze(['issue']), |
| 3424 | + optional: Object.freeze([]), |
| 3425 | + requests: (a, repo) => [{ verb: 'DELETE', path: `${issues(repo, a.issue)}/lock`, mailboxLock: { pull: a.issue, locked: false } }], |
| 3426 | + }), |
3375 | 3427 | // The one row that deletes a ref — see the header. `branch` is held to `MAILBOX_BRANCH_SHAPE` before the dispatch; |
3376 | 3428 | // the pull's fences are the executor's, on its own answers immediately before the DELETE; the ref is read back absent. |
3377 | 3429 | mailbox_branch_delete: Object.freeze({ |
|
0 commit comments