beads/issueops
Harry Miller dfdedf5dfb
fix(status): disclose the counted rows bd list will not show (#5763)
* feat(stats): count the rows the default listing suppresses

bd status counts the issues table; bd list hides gates and templates on
account of what they are. The two therefore disagree, and nothing
reconciles them: a teardown driven by bd list leaves a gate behind and
status reports a total the operator cannot account for from any listing.

Break the suppressed rows out as their own counts. TotalIssues keeps
counting the database, which is what a command titled "Issue Database
Status" should report; these say how much of that total no default
listing will show. Every backend's statistics path funnels through
ScanIssueCountsInTx, so one query serves all of them.

Infra types need no counterpart here: they live on the wisp plane, which
this query does not read.

* fix(status): disclose the counted rows bd list will not show

bd status reported "Total Issues: 2" for a workspace whose every listing
showed one, because gates and templates are suppressed from a default
bd list. Nothing connected the two numbers, so the remainder read as a
phantom -- most visibly after a teardown driven by bd list, which leaves
its gates behind and then cannot see them.

Report the suppressed rows under the summary they qualify, naming the
flag that reveals each kind. The breakdown is printed rather than a
single hidden-total, since a template gate would otherwise be counted
twice. Nothing is printed when there is nothing suppressed.

Stacked on the statistics counts that make this reportable.

* docs(api): put gate_issues and template_issues on the Statistics schema

The Statistics schema is pinned to types.Statistics, so the two new
counts were on the wire the moment the struct grew them, and
TestWireTagBijection fails the openapi gate until the spec says so:

    Go fields with no spec property: [gate_issues template_issues]

Document both as a breakdown of total_issues rather than an addition to
it — they count rows the default `bd list` suppresses, which
total_issues already includes — and warn against summing them, since a
row can be both a gate and a template.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(status): give --assigned the same disclosure, and test the behavior

Three points from review.

1. `bd status --assigned` never printed the line. AssigneeStats does not
   go through ScanIssueCountsInTx - it folds one actor's rows through
   workapi.FoldStatsAssigneeSummary, which left both new fields zero. That
   route's filter sets only Assignee, so IsTemplate stays nil and the
   actor's gates and protos really ARE in those rows while
   `bd list --assignee` suppresses both: the same reconciliation gap, one
   scope down. The fold now counts them, and its doc says they are set
   deliberately rather than borrowed from a workspace-wide answer.

2. The infra-type suppression is now explained rather than asserted away,
   and the answer is that a durable infra row is NOT unreachable, so the
   third breakdown is filed as GH#6439 rather than dismissed. Both the
   plane routing and the listing's exclusions read the workspace-configured
   types.infra set, and writing that key only invalidates a cache
   (dolt/config.go) - it never moves rows already written. So durable rows
   created while a type was not infra stay durable once it becomes one, and
   a type evicted from the set creates durable rows outright, which the
   create contract already pins ("evicted infra type",
   issue_operations_contract.go). Counting them needs that configured set,
   which ScanIssueCountsInTx - portable SQL with no config seam, called
   from six backend sites - cannot reach; guessing with the built-in names
   would be wrong in exactly the workspaces where it matters.
   suppressedTypeSummary's doc now carries that reasoning.

3. The behavior itself had no test - both existing cases exercised a pure
   string formatter, and would pass with the render call site deleted. Now:

   - TestRenderStatusEmitsTheSuppressedRowsLine captures renderStatus's
     stdout, asserts the line and both parts, and asserts it sits after the
     totals it reconciles rather than in the extended block. It fails with
     the call site removed ("renderStatus did not emit the disclosure
     line"), plus a companion asserting the line is absent when there is
     nothing to disclose.
   - Three conformance cases in stats_reporter_contract.go, wired into all
     three role wirings (dolt, embeddeddolt, uow), so the new SQL is
     checked cross-backend rather than at one call site:
     BreaksOutTheRowsTheDefaultListingSuppresses (with the negative rows a
     loose predicate would also move), BreaksOutAGateThatIsAlsoATemplate
     (the two suppressions are independent, so a proto's gate step counts
     in both), and AssigneeStatsBreaksOutTheSuppressedRows for the fold.
     statsReporterCounts and assertStatsReporterDelta carry the two fields.
     All three are behavioral reds against zeroed counts, not compile
     errors:

         GateIssues moved by 0 (0 -> 0), want 1
         TemplateIssues moved by 0 (0 -> 0), want 1
         GateIssues = 0, want 1 - the actor's gate is in this answer but
           not in `bd list --assignee`

4. Nit: pluralCount takes both spellings instead of appending "s", so a
   caller with an irregular plural is not silently mis-served.

Also adds the CHANGELOG entry the behavior change was missing, including
the GH#6439 gap.

Reported-by: bee-ghosttrack
Agent-Signature: claude-code-opus-5-unknown-reasoning on behalf of Harry Miller

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(conformance): declare the new stats cases in the order the table runs them

TestRoleContractCasesCoverEveryContractCase checks more than coverage: the
roleContractCases table has to list cases in the order their contract file
DECLARES them, because that is the order the unit-of-work leg's runners use
and the order its config-writing cases depend on.

I declared all three new cases together, then registered the assignee one
with the other assignee cases in the table, so the two orders disagreed:

    roleContractCases is out of declaration order at position 449: table
    has RunStatsReporterAStatusOutsideTheTalliesIsCountedOnlyInTotal,
    source has RunStatsReporterAssigneeStatsBreaksOutTheSuppressedRows

Fixed by moving the declaration rather than the table entry, since the
assignee case belongs beside the other assignee-scoped ones anyway - the
grouping the table already had was the correct one. Caught by CI because I
ran go vet over backend/conformance but not its tests; both now pass.

Agent-Signature: claude-code-opus-5-unknown-reasoning on behalf of Harry Miller

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* docs(changelog): move this PR's entry under [Unreleased]

The 1.3.0 cut renamed the old [Unreleased] block, so the entry this branch
added there now merges cleanly into the released [1.3.0] section (#6643).

Agent-Signature: claude-code-opus-5-5-unknown-reasoning on behalf of Harry Miller
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(status): complete the disclosure's remedy and pin its population

Maintainer review fixes for PR #5763 (adopt-pr iteration 1). Four of the
five review findings taken; the nit is declined with its measurement.

Finding 2 (minor, gate impact minor) - the printed remedy was incomplete.
The two counters come from the same scan as TotalIssues and are status-blind
with it, but the flags they named lift only the TYPE exclusion, so a CLOSED
gate was counted while `bd list --include-gates` still would not show it.
Gates are closed as the work they guard completes, so that is the ordinary
case rather than an edge.

Took the "complete the hint" arm over the "scope the counters" arm. Every
other field ScanIssueCountsInTx fills is workspace-wide; the disclosure
exists to account for TotalIssues, a database number printed three lines
above it; and scoping these two to the listing's population would leave them
explaining nothing about the total they are broken out of. `--all` "replaces
the status exclusions only" and lifts no type exclusion of its own
(backend/conformance/reader_contract.go:487), so the two flags together are
exactly the remedy. Recorded the population in the types.go field comment,
the status.go doc, and the CHANGELOG, which printed the old example verbatim.

Finding 3 (minor) - the three new conformance cases seeded only open rows,
so a backend counting over every status and one counting only the listing's
population returned identical numbers on all of them. Added a closed gate and
a closed proto to the first case. Proved it now decides the question: scoping
both SQL SUMs with `AND status <> 'closed'` reds exactly that case
("GateIssues moved by 1 (0 -> 1), want 2") while the all-open sibling
BreaksOutAGateThatIsAlsoATemplate stays green.

Finding 4 (minor) - the normative role doc in issueops/statsreporter.go
enumerated only the six prior counts. Added the two to that scan's bullet and
corrected two statements this PR had falsified: the headline "six counts of
one set", and the AssigneeStats bullet's "the fold ... tallies the five
statuses and nothing else", which stopped being true when the fold gained the
two increments.

Finding 1 (minor, gate impact minor) - ran `make bazel-sync`. It proposed
exactly one line, `+ "status_suppressed_test.go"` in cmd/bd/BUILD.bazel, and
nothing else, confirmed by porcelain rather than by bazel-sync-check.
Generator-owned, not hand-edited.

Finding 5 (nit) - declined. The three helpers already in package main
(pluralIssue, pluralize, plural) all DERIVE the "s" and cannot render a
caller-chosen pair; the tree's one two-form helper, pluralWord, is unexported
in internal/storage/issueops, and exporting it so a CLI string could reach it
would add exported surface to a storage role for a cosmetic. Recorded that
trade in pluralCount's doc comment instead.

Validation: `go build ./...` and `go vet` (6 pkgs) clean, gofmt clean,
`git diff --check` clean; cmd/bd 4/4 named PASS, internal/httpapi
TestWireTagBijection|TestSpec* PASS, internal/workapi PASS,
internal/storage/uow TestStatsReporterContract 18/18 subtests PASS. Both new
pins are mutation-proved: reverting `--all` reds all four table cases, both
flag subtests and the render-path pin, while the absence assertion stays
green.

Not done here: the PR body carries the same stale example line
("1 gate (--include-gates)"). Review iterations do not touch the PR surface,
so that correction is stamped for finalize.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
2026-09-30 15:44:40 -07:00
..
batchapplier.go Add issueops.BatchApplier: one plan, one transaction (#5480) 2026-08-09 06:59:34 -07:00
batchcloser.go Pin the is_blocked invariant as a postcondition of the roles that maintain it (#5436) 2026-08-08 11:23:34 -07:00
batchcreator.go feat(create): put bd create --file behind the BatchCreator role (bd-lu170) 2026-08-05 16:43:11 +00:00
blockedstate.go Pin the is_blocked invariant as a postcondition of the roles that maintain it (#5436) 2026-08-08 11:23:34 -07:00
blockingannotator.go feat(list): put bd list behind Reader.List and the new BlockingAnnotator role (bd-5k21g) 2026-08-06 02:56:57 +00:00
bootstrapper.go feat(init): put bd init's identity seam behind Bootstrapper and InitVerifier (bd-zl3u8) 2026-08-06 03:01:33 +00:00
BUILD.bazel test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
claimer.go chore: retire a zombie test, drop a dead field, true up two leaf docs (#5492) 2026-08-09 10:42:34 -07:00
claimer_external_test.go Add issueops.Claimer and route the HTTP claim through it (#5334) 2026-08-04 08:40:18 -07:00
commenter.go chore: retire a zombie test, drop a dead field, true up two leaf docs (#5492) 2026-08-09 10:42:34 -07:00
counter.go feat(count): --include-ephemeral, the plane knob bd count never had (#6240) 2026-09-29 16:56:23 -07:00
cycledetector.go feat(issueops): put bd dep cycles behind the CycleDetector role (bd-wfkbv) 2026-08-05 09:36:14 +00:00
deleter.go Add DeleteRequest.ExpectedVersion: a compare-and-delete on the named row (#5481) 2026-08-09 07:17:54 -07:00
dependencyeditor.go feat(purge): live-dependent protection, --wisps-plane selector, hour-precision --older-than, --limit (#6883) 2026-09-28 00:57:24 -07:00
edgereader.go feat(issueops): put multi-id bd dep list behind the EdgeReader role (bd-nhsno) 2026-08-05 09:42:06 +00:00
errors.go Add issueops.Releaser: give a claim back, optionally only a named holder's (#5482) 2026-08-09 07:48:56 -07:00
graphcounter.go docs: the ext-api-store documentation tranche — post-#5516 auth sweep, wave doc coherence, role checklist refresh (#5545) 2026-08-10 08:05:07 -07:00
importer.go fix(import): seed issue_prefix from config.yaml before the batch guard needs it (#6624) 2026-09-26 15:01:04 -07:00
initverifier.go feat(init): put bd init's identity seam behind Bootstrapper and InitVerifier (bd-zl3u8) 2026-08-06 03:01:33 +00:00
issueops.go chore(api): mark new exported packages experimental before v1.3.0 (#6036) 2026-08-29 16:01:30 -07:00
issueops_external_test.go feat(issueops): name the two dependency-endpoint refusals (bd-yby99.9) 2026-08-07 19:45:54 +00:00
metadatacas.go docs: the ext-api-store documentation tranche — post-#5516 auth sweep, wave doc coherence, role checklist refresh (#5545) 2026-08-10 08:05:07 -07:00
querier.go fix(query): apply bd list's piped-output limit policy to bd query (#6229) (#6744) 2026-09-26 02:50:09 -07:00
reader.go fix(list): expose comment bodies in bd list/show --json (be-73x) (#6473) 2026-09-27 02:12:13 -07:00
reader_ready_scope.go fix(list): honor --status when combined with --ready (#5924) 2026-09-02 18:12:07 -07:00
readyclaimer.go feat(workapi,storage): opt-in Brief projection for the list and ready pages (#5554) 2026-08-10 10:45:23 -07:00
readycounter.go feat(ready): put bd ready's published total behind the ReadyCounter role (bd-s10oa) 2026-08-05 09:47:24 +00:00
relations.go feat(issueops): put every issue capability behind one library surface 2026-08-04 12:27:56 -07:00
releaser.go fix: canonicalActor collapses the --/__ axes correctly; claim-verify uses ActorMatches (be-p7dzx, bundled be-vc51) (#5856) 2026-08-19 13:23:35 -07:00
statsreporter.go fix(status): disclose the counted rows bd list will not show (#5763) 2026-09-30 15:44:40 -07:00
sweeper.go feat(purge): live-dependent protection, --wisps-plane selector, hour-precision --older-than, --limit (#6883) 2026-09-28 00:57:24 -07:00
treewalker.go Converge Offset and MaxRows on all three legs, and fix the panic and the breaker hole under them (#5435) 2026-08-08 11:37:09 -07:00
versionreconciler.go feat(issueops): put the startup version reconciler behind the VersionReconciler role (bd-gkmft) 2026-08-05 16:35:01 +00:00
workspaceconfig.go Refuse kv.* point reads on the settings role and stop printing them (#5493) 2026-08-09 11:06:51 -07:00