FFFF feat(state): forget a pull request that is done by dominikwozniak · Pull Request #105 · dominikwozniak/dw-mc · GitHub
[go: up one dir, main page]

Skip to content

feat(state): forget a pull request that is done - #105

Merged
dominikwozniak merged 2 commits into
mainfrom
feat/58-forget-pr
Sep 19, 2026
Merged

dominikwozniak merged 2 commits into
mainfrom
feat/58-forget-pr

Conversation

@dominikwozniak
Copy link
Copy Markdown
Owner

Nothing removes a key from the state directory, and a sweep only searches open pull requests. So a pull request that lands leaves its facts, review runs, reports and marks behind for good. dw-mc merge forgets the pull request it merged as its last step, because that is the one moment the tool knows a pull request is finished. dw-mc forget <pr> does the same by hand for one that closed another way.

Closes #58.

What changes

  • src/adapters/store.ts: a Keys service lists what the state directory holds. A key/value store never lists keys, and a review run is kept per head, so nothing else names every head a pull request was reviewed at.
  • src/domain/forget.ts: removes every key of one pull request, in any namespace, by the key's shape (prKey, or prKey@… for runs and reports). A namespace added later is covered too.
  • src/cli/forget.ts and src/cli/merge.ts: dw-mc forget <pr>, and merge forgetting after it lands. A fix or resolve worktree on the pull request stays and is named, with the deleted branch where the merge just took it. A forget that fails after a merge is reported beside the merge and names dw-mc forget.
  • CONTEXT.md: the Forgetting term. Also the ADR 0006 wording on domain reads, the README, the /dw-mc skill and a minor changeset.

Test plan

  • pnpm check: pass, 769 tests
  • src/domain/forget.test.ts: every namespace, runs and reports at any head, #28 never matching #280 or another repository, nothing kept is not an error
  • src/cli/forget.test.ts: forgets one PR and leaves its neighbour, empty state is not an error, a fix worktree survives and is named
  • src/cli/merge.test.ts: a merge forgets in every namespace, a refused merge forgets nothing, a resolve worktree on the deleted branch survives and is reported, and a store that cannot list keys still reports the merge (regression)
  • src/cli/status.test.ts: a sweep after an empty search and after a failed search leaves every key
  • src/adapters/store.test.ts: keys listed off the disk, clone and cut directories excluded, a file whose name no key could encode is skipped (regression)
  • by hand: node dist/bin.js forget 'o/r#5' against a temporary state directory forgot 4 records, kept o/r#50 and named the fix worktree
  • by hand, still to do: dw-mc merge on a real stamped pull request, then check that the state directory holds nothing about it

Risk

Forgetting deletes records, which a sweep and a review run can rebuild, and never a worktree. A wrong match would drop another pull request's records. isAbout is tested against neighbouring numbers and repositories. Way back: git revert.

🤖 Generated with Claude Code

dominikwozniak and others added 2 commits September 19, 2026 08:51
Nothing ever removed a key from the state directory, so a pull request
that landed left its records, review runs and reports behind for good.
Merging is the one moment the tool knows a pull request is finished, so
dw-mc merge forgets it as its last step, and dw-mc forget does the same
by hand. A sweep still removes nothing: a pull request missing from one
search is not one that is gone.

A key/value store cannot list its keys, and a review run is kept per
head, so the store now exposes the keys it holds. Session worktrees stay
and are named.

Closes #58

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The merge has already happened by the time the records are forgotten, so
a store that cannot list its keys now says so beside the merge and names
dw-mc forget, rather than failing the command. A file in the state
directory whose name no key could encode is skipped instead of throwing.

Also shares the glossary's name for a session between cleanup and
forget, and lets ADR 0006 say that a domain read may list the keys.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dominikwozniak
dominikwozniak merged commit 5fd4f25 into main Sep 19, 2026
1 check passed
@dominikwozniak
dominikwozniak deleted the feat/58-forget-pr branch September 19, 2026 07:01
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.

state: forget a pull request that is done

1 participant

0