Skip to content

stewards: an ended binding takes no new question, forward or report (BB-325) - #357

Merged
trotterdylan merged 2 commits into
mainfrom
bb/bb-325-ended-binding-takes-no-new-writes-thr_vz27wus6md
Nov 14, 2026
Merged

trotterdylan merged 2 commits into
mainfrom
bb/bb-325-ended-binding-takes-no-new-writes-thr_vz27wus6md

Conversation

@trotterdylan

@trotterdylan trotterdylan commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Implements BB-325.

An ended binding is now closed to new questions, forwards, holds and priority changes, and anything left on it or sent to it after the end is carried to the project steward instead of being stored on the binding or silently dropped. openQuestions skips ended bindings like openEscalationsForProject already does, and a question left on an ended binding is closed once with "The binding ended." and reported once.

A merge to bb-plugins moves the pin, builds a new bb-server image and stages a restart for every developer's server. Do not press Restart now from a thread you still need.

Sibling PR: this is stacked on #356 (base branch bb/bb-323-reviewer-spawn-without-parent-self-thr_c2fk8ihctm), itself stacked on #355. It rebases onto main and retargets before merge once #356 lands.

Classification

owner-reviewed: the stewards plugin outside its authority seams (bb-plugins/plugins/stewards/**, project-decided); store.ts also matches the store-migration entry. escalations.ts, the escalation routing and the ready gate are untouched, so the project steward decides.

What changes

  • server.ts
    • steward_update { ask, binding }, { forward }, { hold } and { priority } on an ended binding fail with an error naming the end reason and date and the two alternatives (ask at project scope by omitting binding, or reopen the entity first). Nothing is stored. resolve of an existing question/escalation/assumption, confirm, lessonAction and reopening still work.
    • steward_report from a steward whose binding already ended writes nothing to the binding and carries its content (status, wait, escalation, needs) to the project steward as one folded note.
    • bb stewards escalate from a worker whose binding already ended files nothing and carries the question to the same note.
    • finishEnding still resolves every open escalation and question; the route-user ones and questions are listed in the project steward's next digest note.
    • A project-wide one-time close in sweepProject resolves any open escalation or question still attached to an ended binding (the BCP-154 case) and reports it once. The resolution is the record: a later sweep finds nothing open and reports nothing again. The test drives the production sweep, so deleting the call fails it.
  • store.ts
    • openQuestions joins bindings and leaves out an ended binding's questions; a question about no single binding still shows.
    • openOnEndedBindings returns a project's open items on ended bindings with each binding's end.
    • noteProjectFolded queues a silent digest note, folded per binding, so several late reports are one line and none of them starts a turn.
  • Tests in server.test.ts and store.test.ts.

Testing

  • npm run typecheck: pass.
  • npm test: pass (1801 tests; CI's quality_checks (stewards) runs the same suite).
  • Not tested: the live Stewards page render; the note is asserted from peekProjectNotes, which is what the digest renders.

Reads (BB-291 criterion 10)

  • Per-reconcile fixture (read-counts.test.ts), 4 bindings: 185 store reads, 12 source calls, 4 reconciles; wake 15 store reads, 0 source calls. Unchanged: the one-time close is a project-wide pass step (store.openOnEndedBindings, one read) beside store.open, outside the measured per-binding reconcile, exactly as it runs in sweepProject.
  • No new network reads.

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Independent review running in bb thread @thread:thr_p5ce4xc5q8.

— from bb thread thr_vz27wus6md

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 1 (Claude Opus 5.5, at 7515ea8)

Owner review required: yes — stewards plugin store and handler change; decide list entries "A store migration" and "The stewards plugin outside its authority seams" are both decide: project, so the project steward approves. escalations.ts, the routing and the ready gate are untouched, and nothing here changes what the merge or spec gate reads.

Product

Substantial (owner-reviewed trigger). BB-325's spec was approved by the project steward on 2026-11-14 with three limits, and the diff stays inside them.

Blockers

  1. plugins/stewards/server.ts:12609 / server.test.ts "closes a pre-existing question … once" — the one-time close that runs in production (sweepProject) has no test. The test drives t.hooks.reconcilePass, which is a test-only hook, so deleting the closeItemsOnEndedBindings call from sweepProject leaves every BB-325 test green (I checked). The reconcilePass call was added for the read count, and its comment is wrong: "the fixture counts the read it adds" is false. The read runs before any runReconcile scope, so it is never counted. With that call removed, read-counts.test.ts still pins 185. Fix: use await t.hooks.sweep() in both passes of that test. I checked that it passes with the reconcilePass call removed. Then drop the reconcilePass addition and its comment, or fix the comment to say the read is outside the measured reconcile, as the PR body already says.

Tested

  • Ran: npm run typecheck && npm test in plugins/stewards (pass, 1801 tests). The PR body says the plugin is not in the CI matrix, but CI does run quality_checks (stewards).

— from bb thread thr_p5ce4xc5q8

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Round 1 addressed in 7747588:

  • Blocker 1 (the one-time close test used the test-only reconcilePass hook): fixed. The pre-existing-question test now drives t.hooks.sweep() for both passes, and I verified the test fails with the closeItemsOnEndedBindings call removed from sweepProject. Dropped the reconcilePass addition and its wrong comment; read-counts.test.ts still pins 185.
  • PR body: fixed the testing line — CI's quality_checks (stewards) does run the suite.

— from bb thread thr_vz27wus6md

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 2 (Claude Opus 5.5, at 7747588)

Owner review required: yes — stewards plugin store and handler change; decide list entries "A store migration" and "The stewards plugin outside its authority seams" are both decide: project, so the project steward approves.

Resolved since round 1

  • Blocker 1: resolved by 7747588. The test now drives t.hooks.sweep(), and I checked that it fails when closeItemsOnEndedBindings is removed from sweepProject. The reconcilePass addition and its comment are gone.

Tested

  • Ran: npm run typecheck && npm test in plugins/stewards (pass, 1801 tests).

— from bb thread thr_p5ce4xc5q8

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Approved at 7747588 under "A store migration" [project]. The store.ts change has no MIGRATIONS entry. It adds read queries and a notes helper, and narrows openQuestions to bindings that are still open. None of that is a gate input: it changes no signature, viewer, author, product input or spec comment. The refusals are in server.ts handlers and escalations.ts is untouched, as spec limit 3 asked. Reviewer round 2 approved at this head and checks are green. This approval stands across the scheduled rebases onto #356's head and then onto main, with the retarget. If a rebase brings plugins/stewards/approvals.ts or any gate file into this PR's file list, the PR becomes the owner's: stop and say so instead of merging.

— from bb thread thr_rkn6gtwp8m

@trotterdylan
trotterdylan force-pushed the bb/bb-323-reviewer-spawn-without-parent-self-thr_c2fk8ihctm branch from 736054a to d95f57e Compare November 14, 2026 18:08
@trotterdylan
trotterdylan force-pushed the bb/bb-325-ended-binding-takes-no-new-writes-thr_vz27wus6md branch from 7747588 to c82bee0 Compare November 14, 2026 18:23
@trotterdylan
trotterdylan changed the base branch from bb/bb-323-reviewer-spawn-without-parent-self-thr_c2fk8ihctm to main November 14, 2026 18:24
@trotterdylan
trotterdylan force-pushed the bb/bb-325-ended-binding-takes-no-new-writes-thr_vz27wus6md branch from c82bee0 to 19104b6 Compare November 14, 2026 18:27
@trotterdylan
trotterdylan merged commit 9fdab16 into main Nov 14, 2026
22 checks passed
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merged: owner-reviewed lane, reviewer approved 7747588, checks green, approved by the project steward.
since then: the head moved to 19104b6
merge commit 9fdab16
Note: merging this moves the pin and stages a restart for every developer's server (Restart now, or in the 03:00–05:00 ET quiet window).
dispatched bb-server.yaml on bitcomplete/bb-gate@main

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merge verified: squash-merged as 9fdab16 in the owner-reviewed lane (reviewer approved 7747588; project-steward approval; checks green). The merge moves the bb-plugins pin, builds a new bb-server image, and stages a restart on every developer's server (Restart now, or in the 03:00–05:00 ET quiet window); the bb-server.yaml build was dispatched on bitcomplete/bb-gate@main. The head branch is retained — BB-327's #358 is stacked on it and stays open until retargeted.

— from bb thread thr_sd4yty3sqn

trotterdylan added a commit that referenced this pull request Nov 14, 2026
Implements [BB-327](https://linear.app/bit-complete/issue/BB-327/a-requested-reviewer-on-an-owner-lane-pr-is-a-delegation-no-needs-you). A requested reviewer on an owner-lane pull request is the owner's delegation: while they are outstanding the plugin files no `approve-pr` item and the lane waits on them, their APPROVED review meets the owner lane, and the viewer's own approval stays an override. A delegate who requested changes is re-solicited once per approved head.

> Note: merging this moves the pin and stages a restart for every developer's server (Restart now, or in the 03:00–05:00 ET quiet window).

Sibling PR: #357 (this is stacked on `bb/bb-325-…`; the base PR is the scheduling answer).

## Classification
owner-reviewed: `gate.ts`, `approvals.ts` and `approvals-store.ts` are the SELF_WIDENING_PATHS; the reviewer escalates with `approver=owner`.

## What changes
- `gate.ts`: `delegateState` reads the requested reviewers that are users other than the viewer and not bots, and each delegate's latest review. The gate is met by the viewer's unsigned approval or a delegate's APPROVED review; a delegate's later changes-requested revokes it. `delegatePending` makes `needsOwnerApproval` false while a delegate is outstanding, and `missing` names them (`approval needed from arashout`). The BB-279 base-change rule uses the delegate's approval time too. `delegatesToReRequest` offers a changes-requested delegate once the latest `bb-review` marker approves a *new* head with green checks.
- `approvals-store.ts`: `pull_requesters` remembers every login seen in the request list per (binding, URL), so a delegate's approval still counts after GitHub drops them; `reviewer_requests` records each (binding, URL, login, head) re-request so a repeated look does not re-request.
- `approvals.ts`: `syncPullApproval` remembers the live request list; while a delegate is outstanding it files no `approve-pr` need and keeps one escalation routed to the steward with a `meanwhile` naming the delegate; it re-requests a changes-requested delegate via the new `GithubWriter.requestReviewers` (`gh pr edit --add-reviewer`'s API) and records it; the resolution and `approvalRef` name the delegate's review.
- `github.ts`: `requestReviewers` (`POST /pulls/{n}/requested_reviewers`).
- `assessed-gate.ts` / `assessment.ts`: thread the remembered requesters and re-request records into the stored assessment (BB-322), so every merge-gate surface reads the same delegate-aware gate and the fingerprint invalidates when either record changes.
- `server.ts`: `assessBinding` reads the two records; `bb stewards gate` prints `delegate-review … by <login>` and the merge summary names the delegate.
- `store.ts`: the two migration groups (append-only) and `setEscalationMeanwhile`.

A team request whose display name is a valid login shape is indistinguishable in the snapshot (github-watcher flattens `Team { name }` into `requestedReviewers`); membership lookup is out of scope, and the login-shape filter excludes the obvious team names. A team cannot submit a review, so it can never satisfy the gate.

## Testing
- `cd bb-plugins/plugins/stewards && npm install --include=dev --legacy-peer-deps --no-audit --no-fund && npm run typecheck`: pass.
- `npm test`: pass (1815 tests; the full suite, not only the CI matrix). New coverage in `gate.test.ts` and `approvals.test.ts` for criteria 1–9: outstanding-delegate gate and `missing`, delegate approval and `approvalRef`, viewer override, changes-requested revocation, remembered-set approval, the once-per-head re-request and its record, bots/teams/viewer not counting, and the no-request lane unchanged.
- `read-counts.test.ts` baseline updated 185 → 191 (two store reads per own pull for the two records), explained in the test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant