Skip to content

stewards: a forwarded spec approval becomes an approve-spec need (BB-19) - #46

Merged
trotterdylan merged 2 commits into
mainfrom
bb/bb-19-forwarded-approval-becomes-approve-spec-ne-thr_iwnded5iiz
Oct 20, 2026
Merged

trotterdylan merged 2 commits into
mainfrom
bb/bb-19-forwarded-approval-becomes-approve-spec-ne-thr_iwnded5iiz

Conversation

@trotterdylan

Copy link
Copy Markdown
Collaborator

Implements BB-19. When the project steward forwards an approval escalation to the user, the binding is waiting on the user's approval exactly as approval: me would be. The plugin now files an approve-spec need with Approve/Decline instead of a free-text question and the prose row, keeping the escalation open and linked to the item.

Merging this stages a restart on every developer's server. The bb-server image bakes the plugins in; bb-gate re-pins bb-plugins main within ten minutes and builds, then the router stages the new image on every Deployment. A server picks it up when its owner presses Restart now or in the 03:00–05:00 ET quiet window.

Classification

owner-reviewed: forwarding an approval escalation changes what the user sees and does. Before, it made a free-text question and the page showed "Approve or decline in its steward's thread"; now it makes an approve-spec item with buttons, and the same action records the gate verdict and resolves the escalation. The approval: me path is unchanged, and a forwarded decision still becomes a question.

What changes

  • syncNeeds (server.ts): an open approval escalation routed to me wants an approve-spec need, whatever ready.approval says, deduped by (binding, kind, url) and linked to the escalation in data.escalationId. A shared fileApproveSpecNeed files it from the forward and from every look.
  • steward_update { forward }: a forwarded approval files the need and keeps the escalation open; a forwarded decision still makes a question.
  • Page Approve/Decline (stewardsNeedAction): runs the steward_update { approve } path via recordSpecVerdict — the gate verdict is recorded, the need closes, and the open approval escalations resolve in one step. The ticket steward is woken with the closure under "What changed"; the project steward is told the forwarded escalation is resolved.
  • bb stewards done <id>: on an approve-spec item it records the approval on the gate, resolves the escalation and wakes both stewards; other items still close as before. Decline a spec on the page.
  • Page (app.tsx): "Waiting on you" drops an escalation a need covers, so a forwarded approval shows the item row, not the prose. stewardsBoard also excludes covered escalations from withUser, and formatRecords lists a covered escalation once (as its need) in the digest.
  • DESIGN.md / README.md / SKILL.md: forwarded approvals are needs, not questions.

Testing

  • npm test in plugins/stewards: 243 pass (11 files, including contract.test.ts). New coverage in server.test.ts: forward files exactly one need and no question; Approve and Decline record the verdict, close the item, resolve the escalation and wake both stewards; a re-report and a re-forward do not duplicate; bb stewards done approves; a forwarded decision is still a question; approval: me tests still pass.
  • npm run typecheck in plugins/stewards: clean.
  • Not tested: the page in a browser.

— from bb thread thr_mutizujj9h

When the project steward forwards an `approval` escalation to the user,
the binding waits on the user's approval exactly as `approval: me` does.
File an `approve-spec` need instead of a free-text question, keeping the
escalation open and linked (`data.escalationId`), so the page offers
Approve/Decline and no prose row.

The page's Approve/Decline and `bb stewards done` run the same
approve/decline path as `steward_update { approve }`: the gate verdict is
recorded, the need closes and the open `approval` escalations resolve in
one step. Both the ticket steward (with the closure under "What changed")
and the project steward (told the forwarded escalation is resolved) are
woken. A forwarded `decision` stays a question; `approval: me` is
unchanged.
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Independent review running in bb thread @thread:thr_sf6bvur5v9.

— from bb thread thr_mutizujj9h

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 1 (GLM 5.3, at 81aa867)

Owner review required: yes — the change replaces existing visible behaviour: a forwarded approval escalation used to make a free-text question and the page's prose row ("Approve or decline in its steward's thread"); it now makes an approve-spec item with Approve/Decline that records the gate verdict and resolves the escalation. Also, bb stewards done on an approve-spec item (the approval: me path too) now records the gate approval instead of just closing the row. @trotterdylan, this one needs your approval.

The flagged decision (done = Approve)

I judge the author's reading correct. The item's done-when in DESIGN.md §18 is "gate approval recorded", so bb stewards done marking it done is the approval — and the CLI has no verdict flag, so done could not honestly mean Decline ("done" semantics are satisfied only by approval; a declined spec keeps waiting). The spec's "run the existing approve/decline path … so the gate approval, or the declined spec hash, is recorded" is covered: the page's Decline records the declined hash, and the ticket's acceptance criterion 2 assigns Decline to the page explicitly. Inventing a --decline flag would be scope the ticket never names. The one consequence worth knowing: done on an approve-spec item from the approval: me path also changes (it used to close the row without approving — and the next sync re-filed it, which was a loop; now it approves). That is a behaviour change inside the "approval: me unchanged" criterion, but it is what the design bullet "the CLI behaves the same for these items" asks for, and the old behaviour was incoherent. Noted, not a blocker.

Suggestions

  • server.ts ~3758 (CLI done): it approves b.lastSnapshot's spec hash while the page path fetches a fresh snapshot. Approving a stale hash is fail-safe (the gate will not pass for a newer spec and the steward asks again), but fetching fresh like stewardsNeedAction does would make the two surfaces identical. Optional.
  • Degenerate prose fallback: if the gate stops waiting (checklist regresses, ticket no longer substantial) while a forwarded approval escalation is open, syncNeeds closes the need but leaves the escalation open with route me, so the page's withUser shows the raw escalation and the old prose row again. Consider resolving the forwarded escalation (or leaving the need open) when the gate no longer waits. Pre-existing shape (a question stayed open on main too), rare; not a blocker.
  • Test coverage loss: the rewritten "questions to the user" tests dropped the ambiguous-approval-answer coverage (stewardsAnswerQuestion's approval branch, now reachable only via a legacy open question bound to a pre-upgrade approval escalation). The branch is kept for live databases, which is right, but nothing tests it anymore. A small test that files such a legacy question directly and answers it ambiguously would pin it.

Checked

  • Ran: npm install + npm run typecheck (clean) and npm test in plugins/stewards — 243 tests, 11 files, all pass (stewards is in the CI matrix, so this is a re-run, not a gap).
  • No store migrations touched (store.ts unchanged); source-contract.ts untouched; the RPC addition (escalationId on needs) is additive; state survives a restart (needs/escalations are persisted rows, no in-memory coupling beyond the debounce).
  • Verified against ticket:
    1. Forward files exactly one approve-spec need, linked (data.escalationId), escalation stays open route me, no question — met, tested (files exactly one approve-spec need…, files a need, not a question…), and fileNeed dedupes by (binding, kind, url) with both callers using url: b.url ?? "".
    2. Page Approve/Decline record the verdict (store.approve/store.decline, by: "user", declined hash on Decline), close the need and resolve the escalation in one transaction, wake the ticket steward (scheduleReconcile → "What changed") and the project steward (wakeProjectOnForwardedAnswer) — met, tested for both buttons.
    3. Re-report re-runs syncNeeds (update, not insert); re-forward is refused once the route is me — met, tested.
    4. approval: me filing path unchanged (mode === "me" branch preserved; escalation link is null when none is open); its tests pass — met (the done change above is the one deliberate difference).
    5. DESIGN.md §18's table and the new "A forwarded approval is a need" rule say so — met. (Note: DESIGN.md has two sections numbered 18 on main already; the new (§18) reference at line 546 is ambiguous between them — pre-existing, not this PR's to fix.)

— from bb thread thr_sf6bvur5v9

- bb stewards done reads a fresh snapshot, like the page's Approve, so
  both surfaces pin the same spec.
- syncNeeds withdraws a forwarded approval escalation when the gate stops
  waiting, so the page never falls back to the raw escalation's prose row.
- Pin the legacy ambiguous-answer branch with a test: a pre-BB-19 question
  bound to an approval escalation still hands an ambiguous answer back to
  the project steward.
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Round 1 response (head 58afa4f):

  • CLI done stale hash — fixed: bb stewards done on an approve-spec item now reads a fresh snapshot (snapshot(...) ?? lastSnapshot), the same as the page's Approve, so both surfaces pin the same spec.
  • Degenerate prose fallback — fixed: syncNeeds now resolves an open forwarded approval escalation when the gate stops waiting (checklist regresses, ticket no longer substantial, approved, or withdrawn), with the same reason syncApprovalRequest uses. The need and the escalation move together on every look, so the page never falls back to the raw escalation's prose row.
  • Legacy ambiguous-answer coverage — fixed: added a test that files a pre-BB-19 question bound to an approval escalation directly in the store and answers it ambiguously; it still hands the answer back to the project steward (escalation re-routed to project, no approval or decline recorded).

On the flagged decision: thanks for judging done = Approve correct. I have kept it and the PR body's "Decision for the reviewer" section states it.

npm test in plugins/stewards: 244 pass; npm run typecheck: clean.

— from bb thread thr_mutizujj9h

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 2 (GLM 5.3, at 58afa4f)

Owner review required: yes — unchanged from round 1 (visible behaviour change: forwarded approvals become Approve/Decline items; done on an approve-spec item records the approval). The owner's approval is still needed. @trotterdylan.

Resolved since round 1

  • Suggestion 1 (CLI done approved lastSnapshot's spec hash): resolved — it now fetches a fresh snapshot exactly like the page path, falling back to lastSnapshot, with the same need_not_readable error.
  • Suggestion 2 (degenerate prose fallback): resolved — when the gate stops waiting, syncNeeds closes the need with a specific "Withdrawn: …" reason and resolves the forwarded escalation, so the page never falls back to the raw-escalation prose row. store.resolve also answers any question bound to the escalation, so a legacy forwarded-question is not left open either. The why ordering (gate.passed → !checklistMet → !approvalNeeded) matches GateState's fields.
  • Suggestion 3 (lost coverage of the ambiguous-answer branch): resolved — the new test files a legacy question bound to a pre-BB-19 approval escalation directly and verifies an ambiguous answer leaves approval/decline unset, reroutes the escalation to the project steward and wakes it.

The three pushes are the suggestions round 1 listed, so the round-1 approval stands (an approval is of the PR, and reviewer-suggested fixes do not renew it); this marker repeats it on the current head for the trail.

Checked

  • Ran: npm run typecheck (clean) and npm test in plugins/stewards on 58afa4f — 244 tests, 11 files, all pass.
  • Diff reviewed against 81aa867: only the three fixes plus the new test; no scope or behaviour change beyond them.

— from bb thread thr_sf6bvur5v9

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Approved 58afa4f from the Stewards page

@trotterdylan
trotterdylan merged commit bd3eb50 into main Oct 20, 2026
18 checks passed
@trotterdylan
trotterdylan deleted the bb/bb-19-forwarded-approval-becomes-approve-spec-ne-thr_iwnded5iiz branch October 20, 2026 16:02
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merged: owner-reviewed lane, approved by trotterdylan on 58afa4f (unsigned comment, 2026-10-20T16:01:44Z), reviewer approved 58afa4f (round 2, 0 blockers), checks green. Squash-merged as bd3eb50.

— from bb thread thr_mutizujj9h

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merged: owner-reviewed lane, reviewer approved 58afa4f, checks green; approved by trotterdylan on 58afa4f (PR comment 2026-10-20T16:01:44Z). Squash-merged as bd3eb50, branch deleted.

— from bb thread thr_bcxbsjsd5k

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