beads/cmd/bd/testdata
Julian Knutsen f624530287
fix(events): journal delete and cascade dep_remove rows carry the request actor; notice when reading a disabled journal (#5985) (#6061)
* fix(events): thread the request actor through the issueops delete door

`bd delete --actor A` journaled its `delete` row and every cascade
`dep_remove` row with actor='' — the #5985 finding. The actor was in hand
at the role body (DeleteInTx already passes req.Actor to the reference
rewrite) and dropped one call below it.

Widen the delete workers with an explicit `actor string` parameter, the
house style PR #5908 used for the rest of the journal (never ambient
context): DeleteResolvedSetInTx, DeleteIssue(s)InTx, deleteIssueRowInTx,
and the RecordDependencyRemovals* family. DeleteInTx passes req.Actor and
SweepInTx passes SweepRequest.Actor, so sweep deletions become attributable
for free.

The genuinely actorless system surfaces — storage.DeleteIssue(s),
Tx.DeleteIssue, the dolt wisp deletes, the source-repo wipe behind
`bd repo remove` — pass "" explicitly, which the 0066 contract reads as
system/unknown. Their comments now say why rather than claiming the
plumbing cannot carry an actor.

No storage.Storage interface change and no migration: 0066 already added
`actor VARCHAR(255) NOT NULL DEFAULT ''`.

The domain/db repository call sites keep their existing "" for now; the
next commit threads the UOW door's actor to them.

Refs #5985

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

* fix(events): thread the request actor through the domain repository delete seam

The UOW door (proxied-server `bd delete`, HTTP API deleteIssues, `bd sweep`
over a unit of work) had the actor as far down as domain.deleteMany and lost
it at the repository interface, so its `delete` and cascade `dep_remove` rows
landed with actor=''.

Widen the seam the way PR #5908 widened IssueRepository.MovePersistence, for
the same reason: an explicit trailing `actor string` on
IssueSQLRepository.Delete / DeleteByIDs and DependencySQLRepository.
DeleteAllForIDs. deleteMany passes the actor its use case was already given,
so DeleteIssue / DeleteWisp / DeleteIssues / DeleteWisps keep their surfaces
unchanged and both doors now agree.

No variadic and no default: a new caller has to say whose delete this is, or
say "" and mean it.

Refs #5985

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

* feat(events): say when the journal being read is disabled; correct the actor docs

Zero rows is indistinguishable from caught-up. A consumer polling a workspace
whose writers never enabled the journal gets a successful, empty read forever
and concludes it is up to date — the "nothing to read and no way to tell why"
trap behind the field report's "0 rows" claim, which was default-off
activation and not a write-path gap.

`bd events export` and `bd events tail` now print a one-line stderr notice when
the target workspace resolves to disabled, and still serve whatever rows exist:
exporting the ledger a now-disabled workspace recorded while it WAS enabled is
legitimate, so this is a notice and not a refusal. It is the CLI mirror of the
HTTP API's EventsJournalDisabled 409, which can refuse because it has no
historical-export case. stderr, not the JSONL stream, and the exit code is
unchanged.

The default stays off. Flipping it changes write amplification and retention
for every workspace, which is not release-branch material.

Also fixes two now-false statements about attribution — the `bd events tail`
record contract and the docs page both said deletes never carry an actor — and
documents the requirement that every WRITER workspace enable the journal, not
just the one a consumer reads.

The golden gains the delete/dep_remove attribution, regenerated deliberately.
It keeps an actorless delete alongside the attributed one: the fixture used to
be the only evidence a consumer had, and reading it as "deletes are never
attributed" would mis-resolve every delete conflict.

Refs #5985

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

* test(events): pin delete/cascade attribution at the DB on every plumbing

Four levels, because the drop happened at a seam no single one of them can
see:

- internal/storage/dolt: a ROLE-path delete (store.Deleter(), Force, an
  explicit actor) reads back `deleter-1` on both the delete row and the
  cascade dep_remove row. The store.DeleteIssue stanza in
  TestEventsJournal_ActorAttribution keeps asserting '' and its comment now
  says WHY — that surface is the actorless system interface, so the pin is
  meaningful instead of aspirational.
- internal/storage/domain/db: the repository seam itself — Delete,
  DeleteByIDs and DeleteAllForIDs each journal under the actor they are
  handed — plus the cascade through the use case. journalRow gains Actor, so
  the existing suite can see the column at all.
- internal/storage/uow: the same promise through the unit-of-work Deleter,
  the door #5908's review caught drifting once already.
- internal/storage/embeddeddolt: a per-op matrix over the DEFAULT LOCAL
  WORKSPACE. One mutation of every journaled kind, asserted at the DB, both
  directions — every attributed op names its actor, and the only rows that
  may carry none are the derived is_blocked updates.
- cmd/bd: #5985's repro verbatim through the real binary, and the
  disabled-journal notice (present on export and tail, on stderr, absent
  when enabled).

Also corrects the two remaining "actorless delete plumbing" claims in the
journalops.Row and issueops.RecordEventInTx contract comments.

Closes #5985

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

* test(events): fix the CLI repro's flag and read stdout where stderr now speaks

`bd delete` has no --yes; --force is what makes it a real delete rather than
a preview.

TestRoutedCreateJournalsIntoTheTargetWorkspace asserted "the launching
workspace journaled nothing" against COMBINED output, which the new
disabled-journal notice now legitimately writes to. Its subject is journal
ROWS, so it reads stdout.

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

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-29 04:14:23 -07:00
..
auto_export.txt fix(init): make JSONL auto-export opt-in (#4063) 2026-05-21 16:21:00 -07:00
blocked.txt
close.txt
close_errors.txt
comments.txt
config.txt
create.txt
create_errors.txt
delete.txt
delete_errors.txt
dep_add.txt
dep_errors.txt
dep_remove.txt
dep_tree.txt
events_journal_records.jsonl fix(events): journal delete and cascade dep_remove rows carry the request actor; notice when reading a disabled journal (#5985) (#6061) 2026-08-29 04:14:23 -07:00
export.txt fix: remove nonexistent -i flag from bd import references (#3200) 2026-04-11 12:31:38 -07:00
formula_help.txt fix(docs-tooling): harden the CLI-docs pipeline per PR #4722 review 2026-07-12 11:07:12 -07:00
help.txt
import.txt fix: remove nonexistent -i flag from bd import references (#3200) 2026-04-11 12:31:38 -07:00
init.txt
label.txt
lint.txt
list.txt
prime_content.txt feat: surface quality/lifecycle commands in prime, template, and doctor (fix-merge PR #2664) 2026-03-20 17:50:24 -07:00
quickstart.txt
ready.txt
search.txt
show.txt
show_errors.txt
stats.txt
update.txt docs(claim): standardize start-work semantics to --claim (#2070) 2026-02-24 22:11:39 -08:00
update_errors.txt fix(update): exit nonzero when a multi-ID update partially fails (#4726) 2026-07-18 19:34:20 -07:00
version.txt