Skip to content

feat: add ledger unbind command - #12

Merged
Din-es merged 1 commit into
Din-es:mainfrom
JasonColapietro:codex/unbind-decision
Aug 5, 2026
Merged

Din-es merged 1 commit into
Din-es:mainfrom
JasonColapietro:codex/unbind-decision

Conversation

@JasonColapietro

Copy link
Copy Markdown
Contributor

Summary

  • add ledger unbind <id> to retire a decision record
  • preserve the rationale document and print its retained path
  • reject path-like ids so deletion cannot escape .ledger/
  • document the command and cover successful, missing, and unsafe-id paths

Closes #2.

Testing

  • go test -count=1 ./...
  • go vet ./...
  • go build ./cmd/ledger
  • manual command smoke test

@Din-es

Din-es commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Reviewed and verified locally — this is good, and the path guard is a nice
catch that wasn't in the issue.

What I checked (in an isolated container, network disabled):

  • gofmt, go vet, go test ./... — clean
  • Cross-compiles for all five release targets
  • The repo's own decision gate passes; all four anchors stay fresh
  • Happy path: record removed, rationale kept, retained path printed
  • Unknown id exits non-zero with a useful message

I also tried to break validDecisionID — ../victim/secret,
..\victim\secret, ../../victim/secret, .., ., sub/dir, and empty.
All rejected, and a file planted outside .ledger/ survived. Blocking the
separators outright is the right call here, since recordPath joins straight
onto LedgerDir.

Keeping the note by default is the behaviour I wanted, and the comment
explaining why — that prose is durable history even when the constraint is
gone — is exactly the kind of thing this project should be documenting.

One small nit, not a blocker: TestCmdUnbindUnknownDecision and
TestCmdUnbindRejectsPathLikeID don't Chdir into a temp dir the way
TestCmdUnbindRemovesOnlyRecord does. They pass today because there's no
.ledger/ beside the test binary, but they'd be more robust with the same
setup. Happy to merge as-is and tidy that separately.

Thanks again — that's two.

@Din-es
Din-es merged commit a0aa9df into Din-es:main Aug 5, 2026
5 checks passed
Din-es added a commit that referenced this pull request Aug 5, 2026
Adds `ledger unbind`, contributed by @JasonColapietro in #12,
closing #2. The VS Code extension is unchanged and stays at 1.1.0.
@JasonColapietro
JasonColapietro deleted the codex/unbind-decision branch September 28, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ledger unbind <id> to remove a decision

2 participants