Repository navigation
stewards: report the backlog in the digest (BB-334) - #365
Conversation
39e9c1f to
2a8e1c1
Compare
d3668de to
11a3242
Compare
|
Independent review running in bb thread @thread:thr_jzg5irjggp. — from bb thread thr_ud45kiz59c |
Review round 1 (Claude Opus 5.5, at 11a3242)Owner review required: yes — adds the Blockers
Tested
— from bb thread thr_jzg5irjggp |
11a3242 to
e29a822
Compare
|
Round 1 addressed at e29a822. #365 is rebased onto
— from bb thread thr_ud45kiz59c |
Review round 2 (Claude Opus 5.5, at e29a822)Owner review required: yes — adds the Resolved since round 1
Tested
— from bb thread thr_jzg5irjggp |
|
Approved #365 at e29a822 under "A store migration" [project]. The change is additive: a nullable backlog_snapshot column, and a backlog section in the digest computed from stored looks, which never writes to Linear or touches a gate input. One limit: #365 now conflicts with main because #362 merged (main's MIGRATIONS ends with CHECK_FINDING_MIGRATIONS). Rebase onto main and append BACKLOG_LOOK… no, only BACKLOG_SNAPSHOT_MIGRATIONS after CHECK_FINDING_MIGRATIONS, leaving every entry already on main, BACKLOG_LOOK_MIGRATIONS included, where it is. Update the order test and migrations.snapshot.json to match. The approval stands across that rebase. Merge once checks are green, and tell BB-333's worker (stacked on this branch) to rebase onto main and append its migration last. — from bb thread thr_rkn6gtwp8m |
e29a822 to
869965e
Compare
|
Merged: owner-reviewed lane, reviewer approved e29a822, checks green, approved by the project steward. |
Implements [BB-333](https://linear.app/bit-complete/issue/BB-333/bb-291-criterion-4-typed-waits-design-the-report-shape-then-derive), PR 1 of 3 for BB-291 criterion 4. It adds the typed wait to `steward_report`, its named refusals, the append-only `bindings.wait` migration, storage and rendering, and the four characterization fixtures. It derives nothing from the wait yet; the shadow derivation is PR 2. Based on `main` (rebased after #365 merged); BB-335 stacks on this PR. > **Restart note.** Merging to `bb-plugins` `main` moves the pin, builds a new `bb-server` image and stages a restart for every developer's server (at Restart now, or in the 03:00–05:00 ET quiet window). ## Classification owner-reviewed: `steward_report` is a public contract (a new field and named refusals) and a store migration is added. The reviewer classifies via `bb stewards gate`. ## What changes - **`steward_report { wait: { kind, ref } }`**, optional and additive. The eight kinds: `pull`, `review`, `deployment`, `worker`, `binding`, `date`, `person`, `external`. Free text stays the human annotation (`waitingOn`); the wait is the structured form. `kind` is a plain string in the zod schema, validated in `execute` against `WAIT_KINDS`, so an unknown kind is a named refusal rather than a zod type error. - **Named refusals** (new module `wait.ts`), and they fire only when a wait is sent, so a report with today's free-text wait and no kind is accepted unchanged: - Hard (nothing written): `unknown_kind`, `missing_reference`, `malformed_reference`, `date_wait_without_date`. - Downgrade (accepted and stored as `external`, named in the reply): `reference_is_self` (a `pull`/`review` ref that is the binding's own pull), `unvalidatable_reference` (a well-formed ref the plugin cannot resolve — repo not watched, no deployment watch, unknown worker/binding, closed page item). - **`namesUserAsBlocker` is skipped when a wait is sent** (the `person` kind plus a page-item ref is its structured replacement). For a no-kind report it fires exactly as today; the regex is retired in PR 3. - **Store**: one append-only migration, `ALTER TABLE bindings ADD COLUMN wait TEXT` (nullable JSON `{kind, ref}`), appended at the end of `MIGRATIONS` after BB-328's check-findings table and BB-334's backlog columns; `migrations.snapshot.json` extended. A store from before reads `wait = null` = today's behaviour. - **Render**: `bb stewards show` / `list` and the Stewards card (overview and board) show the typed wait. `stewardsOverview`, `stewardsBoard` and `stewardsSidebar` carry it as a nullable field. - **Nothing derives from the wait.** `noWakeSource`, `unheardWait`, `namesUserAsBlocker`, `requeueUntil` and the merge gate are untouched; a `date` wait does not yet set the requeue (PR 2). ### Retires **Nothing.** `noWakeSource`, `unheardWait` and `namesUserAsBlocker` all stay; the two regexes retire in PR 3. ## Fixtures The four fixtures are added as characterization tests that pin **today's** `noWakeSource` result, with the intended typed-wait result named in each comment (PR 2 asserts it): | fixture | typed ref | today | under typed waits (PR 2) | |---|---|---|---| | BB-266 | own gate-met pull → `external` | not marked (the second open own pull is a live source) | stalls | | bb-plugins#294 | `pr` binding's own pull → `external` | marked (a `pr` binding's own pull is never a source) | stalls | | bc-prod#422 / BCP-157 | closed `approve-pr` need → `external` | not marked (the open pull watch masks it) | stalls | | bc-prod#430 / BCP-160 | foreign open pull, accepted as `pull` | marked (nothing leases it) | not stalled | This is the design's "Characterization (tests only): pin ... the four fixtures' current results" step, folded into PR 1 by the spec. The step-2 spec's PR 1 bullet lists the *target* outcomes; those are what PR 2 asserts. ## Latency and load (against the BB-291 baseline) - Live baseline: **18.8 store reads / 1.4 source calls per reconcile; 16.2 store reads per wake.** - Fixture (`read-counts.test.ts`, 4 bindings, 4 reconciles): **193 store reads / 12 source calls = 48.25 reads per reconcile; wake 15 reads / 0 source calls.** This is unchanged from `main`, which pins the same 193/12/15. (The design recalls 194/48.5; the branch pins 193, one read fewer after BB-334.) - **No added network reads and no added source calls.** The typed wait is a column on the binding row the reconcile and report already hold. The `ownPullKeys` read the validation performs for a `pull`/`review` self-check is the same read the report already performs later (the worker branches are cached), so it adds no store read and no source call. One column write per report. No `source-contract.ts` copy changes. ## Testing - `npm test` in `plugins/stewards`: pass (1883 tests). - `npm run typecheck`: pass. - `migrations.test.ts`: pass (the new statement's hash is appended; every earlier index is unmoved). - `store.test.ts`: the append-only migration-order tests extended with the new group (they assert the group order, so a new appended group is added there). - New `wait.test.ts`: the eight kinds, and all six named cases. - New `server.test.ts` "a typed wait (BB-333)": storage and render, no-wait accepted unchanged and clearing a stored wait, the four hard refusals, the self and unvalidatable downgrades, an accepted watched pull ref, and the four fixtures. - Not tested: the live handler latencies (the live server runs the pre-change build; the change adds no read and the field is not on a handler path). ## Stacking Based on `main`. BB-335 stacks on this PR, so the head branch is not deleted on merge. _— from bb thread thr_jemqkhe3h4_
Implements BB-334. PR 3b of the Stage 1 backlog steward: the digest "### Backlog" section. It is stacked on 3a (#364) and must merge after it.
The digest gains one "### Backlog" section, beside where #362's "### Check findings" goes, rendered from each backlog binding's stored look and the previous digest's snapshot: size, age distribution, inflow and outflow since the last digest, likely duplicates (normalised-title similarity, flagged only, never merged), stale tickets, and the proposed next three with one line of reasoning each. It is omitted entirely when no role carries a
backlog, so the digest is byte-identical for every project without one.Sibling PR: #364 (3a — the
project.jsonblock and the ops-linear source/binding), which is this branch's base.Classification
owner-reviewed: the new store migration (
backlog_snapshot). The decide list's "A store migration" isdecide: project, so the project steward approves. Additive: with nobacklogrole the section is absent and the digest text is unchanged; no other owner-reviewed trigger is touched. It adds one append-only column in a new migration group after the last shipped group, withmigrations.snapshot.jsonappending its hash.What changes
nightly.ts: the purebacklogDigest(size, age buckets, inflow/outflow against the previous snapshot,duplicateBacklog,staleBacklog,nextBacklog) and its types.wake.ts:DigestRecords.backlogand the "### Backlog" renderer, omitted when empty.store.ts/ops.ts: the append-onlybacklog_snapshotcolumn and its schema.server.ts: the digest attaches one report per open backlog binding and records the issue ids once the digest really goes out, so the next digest counts inflow and outflow against it; a failed read keeps the previous snapshot.nightly.test.ts(pure functions and the rendered section from a fixture) andserver.test.ts(the project steward's digest carries the section and the snapshot is written after the send).Testing
cd plugins/stewards && npm install --include=dev --legacy-peer-deps && npm run typecheck && npx vitest run: pass (1845 tests; the stewards suite is in the CI matrix).