Skip to content

stewards: the pull merge gate becomes the github contributor's (BB-387) - #430

Merged
trotterdylan merged 2 commits into
mainfrom
bb/bb-387-github-contributor-owns-the-pull-merge-ga-thr_52dg5mc7r6
Nov 23, 2026
Merged

trotterdylan merged 2 commits into
mainfrom
bb/bb-387-github-contributor-owns-the-pull-merge-ga-thr_52dg5mc7r6

Conversation

@trotterdylan

Copy link
Copy Markdown
Collaborator

Implements BB-387. Slice C3 of BB-291 criterion 8 (design in BB-376, C2 in BB-380). The per-pull merge-gate derivation (pullGate/prGate, gateInputKey, the gate options and the BB-321 forwarded-owner rule) moves from assessed-gate.ts/assessment.ts to the github contributor's home in contribution.ts; assess() composes the contributor's merge gate items instead of naming the pull-specific code itself. assessed-gate.ts keeps the store read/refresh helpers. Refactor only: the stored assessment's shape and every gate result are unchanged, and the redundant shadow compose.gate comparison is removed.

A merge to bb-plugins main moves the pin, builds a new bb-server image and stages a restart for every developer's server, including this one. The restart happens when each developer presses Restart now, or in the 03:00-05:00 quiet window.

Classification

no-review: a refactor of the existing merge-gate code with no behaviour change. It touches no authority-seam or self-widening path; the reviewer decides the lane.

What changes

  • contribution.ts is now the github contributor's home: pullGate (the single prGate call site), gateOptions, gateInputKey, assessedPullGate, rememberedFor and forwardedToOwner move here from assessment.ts/assessed-gate.ts, and composeGate() folds the contributors' gate items into the Assessment["gate"] shape (with the core ready gate filled in).
  • assessment.ts calls composeGate(input) (or takes an already-composed answer) and no longer imports assessedPullGate or prGate. compare keeps the waits/holds comparisons and drops the compose.gate one.
  • assessed-gate.ts keeps assessedGate, storedGates, storedPullGate, currentStoredGate and the stored types; it imports the computation from contribution.ts and re-exports assessedPullGate for the existing tests.
  • server.ts's assessBinding composes once and hands the answer to assess and compare, so the gate is no longer computed twice per reconcile.

Fail-closed is unchanged: a missing or head-stale stored gate is still never met (assessedGate recomputes and stores it for the pull's current head).

Testing

  • npm run typecheck: pass.
  • npx vitest run (full stewards suite): pass (56 files, 2352 tests).
  • read-counts.test.ts unchanged and passing: reconcile { storeReads: 197, sourceCalls: 12, reconciles: 4, bindings: 4 }, wake { storeReads: 15, sourceCalls: 0, wakes: 1 }. No added store or source read - the composition is in-process.
  • Live shadow baseline from the ticket (2026-11-23): 12.3 reads per reconcile (18.3 before), 15.4 per wake. Unchanged by this slice; the fixture pins the same counts.
  • assess() latency over the read-count fixture's gate-met binding (20k iterations; mean / median / p95, milliseconds):
    • before: assess 0.0152 / 0.0136 / 0.0226
    • after: assess 0.0183 / 0.0169 / 0.0219 (standalone assess now also derives waits/holds)
    • the reconcile path, which is what runs per binding: before assess + composeAssessment 0.0351 / 0.0301 / 0.0470; after composeAssessment + assess(composed) 0.0192 / 0.0163 / 0.0256 (about 45% lower, because the gate is computed once instead of twice).
  • New tests in contribution.test.ts: a stubbed githubContributor.contribute changes assess()'s gate; assessment.ts has no assessedPullGate/prGate import; prGate has exactly one call site in the plugin source (pullGate in contribution.ts).
  • The C1 characterization tests (characterization-assessment.test.ts), assessment.test.ts and assessed-gate.test.ts pass unchanged.

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Independent review running in bb thread @thread:thr_ww9vb3hfww.

— from bb thread thr_52dg5mc7r6

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 1 (Claude Opus 5.5, at 024d5f6)

Owner review required: no — none of the owner-reviewed triggers apply. The PR moves the per-pull gate code and leaves its inputs alone (same gateOptions, same productGateOptions, same forwarded-owner rule). The composed roll-up matches the old assess() roll-up field for field. Decide list entry "The stewards plugin outside its authority seams…" is decide: project.

Suggestions

  • assessment.ts:402 and contribution.ts:309 — two comments still describe the compose.gate comparison as live. The compare docstring lists compose.gate among the C2 surfaces, and compose() says a disagreeing composer "is visible to compare". This PR retires that comparison, so both comments are now wrong about what the divergence log records.
  • contribution.test.ts:417 — the "one prGate call site" test reads only the top-level directory, so a call added under lib/ (which holds plugin source) would pass it. Walk the tree recursively (readdirSync(dir, { recursive: true }), skipping node_modules) so the test covers what its name says.

Tested

  • Ran: npm run typecheck (pass; no lint script) and the full stewards vitest run (56 files, 2352 tests, pass). The characterization, assessment, assessed-gate and read-counts tests are not touched by the diff.

Looks good.

— from bb thread thr_ww9vb3hfww

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 1 (approved, no-review) addressed in 351f762:

  • assessment.ts:402 / contribution.ts:309 (comments describe the retired compose.gate comparison): fixed. The compare docstring now lists compose.waits and compose.holds and says C3 retired compose.gate; the compose() roll-up comment now says the roll-up reads the contribution fields so assess() returns the contributor's answer.
  • contribution.test.ts:417 (top-level-only prGate scan): fixed. The scan now walks the tree recursively (readdirSync(dir, { recursive: true, encoding: "utf8" }), skipping node_modules), and still finds exactly one call site.

Re-ran npm run typecheck (pass) and the full stewards vitest run (56 files, 2352 tests, pass) on the new head.

— from bb thread thr_52dg5mc7r6

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 2 (Claude Opus 5.5, at 351f762)

The round-1 approval stands. This push changes comments and one test only.

Resolved since round 1

  • Stale compose.gate comments: resolved, both now describe the retired comparison correctly.
  • Call-site test scope: resolved, the scan is recursive and skips node_modules.

Tested

  • Ran: npm run typecheck and vitest run contribution.test.ts (pass).

— from bb thread thr_ww9vb3hfww

@trotterdylan
trotterdylan merged commit 5015a66 into main Nov 23, 2026
25 checks passed
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merged: no-review lane, reviewer approved 351f762, checks green.
merge commit 5015a66
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
trotterdylan deleted the bb/bb-387-github-contributor-owns-the-pull-merge-ga-thr_52dg5mc7r6 branch November 23, 2026 00:41
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merged: no-review lane, reviewer approved 351f762, checks green, approved by the owner.
merge commit 5015a66
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 added a commit that referenced this pull request Nov 23, 2026
Implements [BB-379](https://linear.app/bit-complete/issue/BB-379). Follow-up to BB-375: `steward_report` still wrote `noWakeSource` for an ops binding because `reconcileOps` never ran the assessment. `reconcileOps` now derives the flag itself, from `observedStall(b, liveWakeSourceFor(b, new Set()), now())`, before the per-target dispatch, and the report stores nothing for any kind.

> A merge to `bb-plugins` `main` moves the pin, builds a new `bb-server` image and stages a restart for every developer's server, including this one. The restart happens when each developer presses Restart now, or in the 03:00-05:00 quiet window.

Sibling PR: #430 (this PR's base; BB-387). This is a stacked PR.

## Classification
no-review: the reviewer's lane. The change moves the ops write of `noWakeSource` to the reconcile, the same move BB-375 made for tickets; the flag's value and every surface that reads it are unchanged, and the merge/spec gates are untouched. The `store.ts` change is a comment only.

## What changes
- `server.ts` `reconcileOps` derives `noWakeSource` from `observedStall(b, liveWakeSourceFor(b, new Set()), now())` before the per-target dispatch, patching only when it changes, so every ops target kind (dependabot, sentry-project, alertmanager, backlog, generic look) and its early returns get it.
- `server.ts` `steward_report` drops the `...(b.source === "ops" ? { noWakeSource } : {})` spread and its carve-out comments; it still computes the sentence for its reply.
- Docs/comments updated: README "A wait with no wake source (BB-154)", DESIGN.md, `assessment.ts`, `store.ts`, the `wait-divergences` CLI description.
- `server.test.ts` ops test rewritten: the report stores nothing, the ops reconcile sets the mark, a cleared wait clears it on the next reconcile.

## Testing
- `npm run typecheck`: pass.
- `npx vitest run` (full stewards suite): pass (56 files, 2352 tests; in the CI matrix).
- `read-counts.test.ts` passes unchanged: the pinned fixture has no ops binding, so the +4 store reads per ops reconcile do not enter the budget. No budget raised.
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