beads/internal/workapi
Karel Bourgois e8f318316f
feat(count): --include-ephemeral, the plane knob bd count never had (#6240)
* feat(count): --include-ephemeral, the plane knob `bd count` never had

`bd count` can admit the wisps table only through `--include-infra`, which
makes four changes at once. This adds the flag that makes just the first one,
mirroring the `--include-ephemeral` that `bd list` gained in #6098.

## Why the plane is unreachable on its own

The write path routes on STORAGE CLASS, not type — dolt's `useWispsTable` is
`Ephemeral || NoHistory || WispType != "" || IsInfraType`. So a `no_history`
task lives in the wisps TABLE while remaining ordinary durable work, and a
default `bd count` never sees it.

Recovering it today means `--include-infra`, which this repo's own doc calls
"FOUR changes at once and not one": it admits the plane, drops the infra-type
exclusions, changes the template treatment, and reconciles cardinality with
`bd list --all`. Its template exclusion then silently drops template rows of
the named type — so a caller who wanted the plane trades one silent undercount
for another.

`ListRequest.IncludeEphemeral` has been the narrow answer on the listing side
since #5476, and #6098 gave it a CLI flag. `CountRequest` had no equivalent
field at all. This is the missing half of that pair.

## The change

- `issueops.CountRequest.IncludeEphemeral` — the plane knob alone: exactly the
  first of `IncludeInfra`'s four changes, with none of the other three.
- `internal/workapi/count.go` — one line, `} else if !in.IncludeEphemeral {`.
- `cmd/bd/count.go` — flag registration, matching `bd list`'s wording.
- `internal/httpapi` — `include_ephemeral` on `countIssues`, in the spec; the
  generated `types.gen.go` is `make api-gen` output, not hand-edited.

Unset, the count is durable-plane only: the historical answer, unchanged. Every
default is untouched.

It does NOT promise a count and a listing agree. They already differ on
TEMPLATES without this flag and still do with it — a count includes template
rows unless `IncludeInfra` excludes them, a listing excludes them unless
`IncludeTemplates` admits them. That predates this and is unchanged by it; only
`IncludeInfra` sets out to reconcile cardinality, and it pays with three
changes beyond the plane.

## Verification

    ok  github.com/steveyegge/beads/internal/workapi
    ok  github.com/steveyegge/beads/internal/httpapi
    ok  github.com/steveyegge/beads/issueops
    --- PASS: TestEmbeddedCountIncludeEphemeral (39.71s)
    --- PASS: TestCountIncludeInfraFlagShape
    --- PASS: TestParseCountRequestCarriesEveryFilterFlag

`TestEmbeddedCountIncludeEphemeral` was run with `BEADS_TEST_EMBEDDED_DOLT=1`
and really executed — 39.71s, not a skip. The default fast tier would have
skipped it and reported `ok`.

`make api-gen` reproduces `types.gen.go` byte-for-byte from the spec hunk, so
the two cannot drift apart in review. `go build ./...`, `go vet` and `gofmt`
clean.

Claude-Session: https://claude.ai/code/session_01X1jMLQTSrCwtzFRS1xeUC6

* count: reframe the comments for this repo, not the fork they came from

Review on #6240 (bee-ghosttrack): five comment blocks were written from the
fork's point of view and become false once merged here — "belongs upstream",
"the half that still has to go upstream", "the fork's old wide default",
and "upstream's default" meaning the current default.

Find-and-replace, as asked: the reasoning is kept, only the frame of reference
changes. "upstream's default" -> "the default before this change"; the bd
list sibling "landed in #6098"; the infra-type divergence is "pinned, not
fixed, here" with the reason; the embedded test's fork-maintenance history is
replaced by what it actually pins. No code changes.

* build(bazel): list the two test files this PR adds in their go_test srcs

Maintainer review fixes for #6240, review iteration 1. The synthesis and the
quality scorecard both returned approve with no required changes; this commit
takes the one minor whose subject is the PR's own added files.

Taken:

- Change Impact / Blast Radius (minor, gate impact minor). The PR adds
  cmd/bd/count_include_ephemeral_embedded_test.go and
  internal/workapi/count_skipwisps_test.go, but neither was listed in its
  package's explicit go_test srcs, so the PR's own assertions were invisible to
  `bazel test`. Both rows are now listed.

  Gazelle's verdict, not a hand-guess: `make bazel-sync` was run (bazel 9.2.0 is
  available here) and it produced exactly these two entries. Its full output
  also rewrote 12 other BUILD.bazel files -- pre-existing base drift from other
  PRs' files, plus dep/select churn -- which is out of scope for this PR, so the
  generated result was reverted and only the two rows this PR is responsible for
  were re-applied, at the slots gazelle chose. Both srcs lists remain sorted
  with no duplicates (cmd/bd bd_test 637 entries, internal/workapi workapi_test
  24 entries).

  The cgo build tag on count_include_ephemeral_embedded_test.go does not exempt
  it: the repo lists tag-gated *_embedded_test.go files anyway (99 of the 101 in
  cmd/bd are listed, and the sampled ones are simultaneously listed and tagged).

Declined:

- Test Evidence Quality (nit, gate impact none). The filing lane itself marked
  it optional and explicitly said not to gate on it, and its own reasoning holds:
  internal/storage/dolt/counts.go and internal/storage/embeddeddolt/counts.go
  both delegate to the same issueops.CountIssuesInTx, differing only in
  transaction acquisition.

Validation: go build ./... and CGO_ENABLED=1 go vet on cmd/bd, internal/workapi
and issueops all clean; go test ./internal/workapi/ ./issueops/ ok. No
production code changed -- the commit is two generated-list rows.

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

---------

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 16:56:23 -07:00
..
storecounter build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00
storequerier build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00
storereader build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00
storereadycounter build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00
storestats build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00
storeversionreconciler build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00
storeworkspaceconfig build(bazel): side-by-side Bazel scaffold + policy tests (#6798) 2026-09-27 03:41:02 -07:00
testdata fix(list): honor --status when combined with --ready (#5924) 2026-09-02 18:12:07 -07:00
bootstrap.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
bootstrap_test.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
BUILD.bazel feat(count): --include-ephemeral, the plane knob bd count never had (#6240) 2026-09-29 16:56:23 -07:00
count.go feat(count): --include-ephemeral, the plane knob bd count never had (#6240) 2026-09-29 16:56:23 -07:00
count_skipwisps_test.go feat(count): --include-ephemeral, the plane knob bd count never had (#6240) 2026-09-29 16:56:23 -07:00
count_test.go feat(count): accept --has-metadata-key (#6282) 2026-09-29 13:16:37 -07:00
delete.go Add DeleteRequest.ExpectedVersion: a compare-and-delete on the named row (#5481) 2026-08-09 07:17:54 -07:00
delete_test.go Add DeleteRequest.ExpectedVersion: a compare-and-delete on the named row (#5481) 2026-08-09 07:17:54 -07:00
detail.go fix(list): expose comment bodies in bd list/show --json (be-73x) (#6473) 2026-09-27 02:12:13 -07:00
detail_test.go fix(contracts): JSON contract fixes before 1.3.0 freezes them — string revision tokens, --set-metadata scalar typing, create --json nano timestamps (#6053) 2026-08-29 05:20:27 +00:00
doc.go refactor(show): share issue-detail assembly and normalize not-found (bd-hc1) 2026-07-31 07:58:46 +00:00
list.go fix(list): honor --status when combined with --ready (#5924) 2026-09-02 18:12:07 -07:00
list_comments.go fix(list): expose comment bodies in bd list/show --json (be-73x) (#6473) 2026-09-27 02:12:13 -07:00
list_comments_test.go fix(list): expose comment bodies in bd list/show --json (be-73x) (#6473) 2026-09-27 02:12:13 -07:00
list_ephemeral_test.go Admit the ephemeral plane from a list request, on the facade and on the wire (#5476) 2026-08-09 05:06:36 -07:00
list_golden_test.go fix(human): respond/dismiss text sources, bd list parity, and proxied-server support (#5333) 2026-08-10 05:36:11 -07:00
list_keyset_test.go feat(httpapi): serve bd list's order with sort on listIssues (#5666) 2026-08-27 09:21:12 -07:00
list_pinned_test.go fix(list): honor --status when combined with --ready (#5924) 2026-09-02 18:12:07 -07:00
list_ready_status_test.go fix(list): honor --status when combined with --ready (#5924) 2026-09-02 18:12:07 -07:00
list_status_test.go refactor(list): route both bd list paths through internal/workapi and delete list_filter.go (bd-fv4) 2026-07-31 06:01:48 +00:00
metadata.go fix(workapi): refuse an invalid metadata key where the builders can name it 2026-07-31 18:37:25 +00:00
page.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
page_test.go docs(workapi): say where the shared epilogue stops, and what limit 0 does 2026-07-31 23:35:16 +00:00
query.go Merge branch 'facade/wave-3' into facade/wave-4 2026-08-06 21:39:05 +00:00
query_test.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
race_detector_off_test.go feat(issueops): put bd purge and bd prune behind the Sweeper role (bd-pn231) 2026-08-05 16:40:26 +00:00
race_detector_on_test.go feat(issueops): put bd purge and bd prune behind the Sweeper role (bd-pn231) 2026-08-05 16:40:26 +00:00
ready.go fix(list): honor --status when combined with --ready (#5924) 2026-09-02 18:12:07 -07:00
ready_count_test.go feat(workapi,storage): opt-in Brief projection for the list and ready pages (#5554) 2026-08-10 10:45:23 -07:00
ready_golden_test.go fix(deps): enforce external capability blockers across ready/claim/close (#4769) (#4753) 2026-09-02 16:56:23 -07:00
ready_test.go feat(issueops): add the Reader role and wire both front doors through it 2026-07-31 18:37:25 +00:00
release.go Add issueops.Releaser: give a claim back, optionally only a named holder's (#5482) 2026-08-09 07:48:56 -07:00
release_test.go Add issueops.Releaser: give a claim back, optionally only a named holder's (#5482) 2026-08-09 07:48:56 -07:00
sort.go fix(list): honor --status when combined with --ready (#5924) 2026-09-02 18:12:07 -07:00
stats.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
stats_test.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
sweep.go feat(purge): live-dependent protection, --wisps-plane selector, hour-precision --older-than, --limit (#6883) 2026-09-28 00:57:24 -07:00
sweep_test.go feat(purge): live-dependent protection, --wisps-plane selector, hour-precision --older-than, --limit (#6883) 2026-09-28 00:57:24 -07:00
versionreconcile.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
versionreconcile_test.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
workspaceconfig.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
workspaceconfig_test.go Refuse kv.* point reads on the settings role and stop printing them (#5493) 2026-08-09 11:06:51 -07:00