beads/cmd/bd/testdata
Julian Knutsen 9893f9020d
fix(setup): leave a current agents-file beads section untouched (#7693)
* fix(setup): leave a current agents-file beads section untouched

installAgents rewrote the instructions file whenever it found a beads
marker, discarding ReplaceSectionWithOpts' changed flag and error. A rerun
of `bd setup claude` (and `bd init`, which runs it) replaced a byte-identical
CLAUDE.md with a new file (new inode, fresh mtime, mode reset to 0644) and
reported "Updated existing beads section", while bd init's updateAgentFile
reported AGENTS.md current in the same run. A section whose END marker was
lost or came before BEGIN was likewise "updated" without change.

Mirror updateAgentFile: write only when the section changes, report
"<file> already has the current beads section" otherwise, and return
ErrMalformedMarkers instead of rewriting. claude/gemini warn and continue;
factory/opencode/mux fail (mux before installing its .mux hooks), per their
existing error policies. Tests pin inode, mode and mtime of the untouched
file and the claude/mux policies for both malformed-marker shapes. Goldens
updated for the new rerun message.

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

* fix(setup): keep CLAUDE.md's beads block when the AGENTS.md update fails

When CLAUDE.md is an @AGENTS.md stub that still holds a beads block,
installClaude strips that block once the redirect is active, gated only on
installAgents not having skipped a symlinked AGENTS.md. It ignored
installAgents' error, so now that installAgents returns ErrMalformedMarkers
instead of writing a malformed AGENTS.md back, the strip deleted the stub's
block while AGENTS.md kept no usable section, and the warning named
CLAUDE.md. Base had the same end state behind a false "Updated" report; the
new error is what makes the failure detectable, so the gate belongs here.

Gate the strip on a nil installAgents error too, so it runs only once
AGENTS.md holds the current section (written now or already current), and
name the file that failed in the warning (AGENTS.md when redirected). A
redirect subtest in TestInstallClaudeWarnsOnMalformedMarkers pins both, for
both malformed shapes: dropping the gate reds it on CLAUDE.md's content,
inode, mtime and mode, and naming CLAUDE.md again reds it on the warning.

Also correct updateBeadsSectionWithProfile's doc comment, which claimed an
error string it never returned: it returns the content unchanged when the
section cannot be replaced. The CHANGELOG entry notes the redirect case.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com>
2026-10-19 08:45:04 +00:00
..
agent_artifacts fix(setup): leave a current agents-file beads section untouched (#7693) 2026-10-19 08:45:04 +00:00
command_tree test(cmd/bd): pin the command tree and representative --help output (#7675) 2026-10-19 05:56:15 +00: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
compact-gc-fixture.go fix(bazel): remove host-go dep from compact GC test; drop frozen shard blocks (#7478) 2026-10-10 19:24:21 +00:00
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
preflight-go.go fix(preflight): share checkout lint authority (#5780) 2026-09-30 22:41:55 -07:00
prime_content.txt
quickstart.txt
ready.txt
search.txt
show.txt
show_errors.txt
stats.txt
update.txt
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