Repository navigation
feat(state): forget a pull request that is done - #105
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 mergeforgets 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: aKeysservice 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, orprKey@…for runs and reports). A namespace added later is covered too.src/cli/forget.tsandsrc/cli/merge.ts:dw-mc forget <pr>, andmergeforgetting 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 namesdw-mc forget./dw-mcskill and aminorchangeset.Test plan
pnpm check: pass, 769 testssrc/domain/forget.test.ts: every namespace, runs and reports at any head,#28never matching#280or another repository, nothing kept is not an errorsrc/cli/forget.test.ts: forgets one PR and leaves its neighbour, empty state is not an error, a fix worktree survives and is namedsrc/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 keysrc/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)node dist/bin.js forget 'o/r#5'against a temporary state directory forgot 4 records, kepto/r#50and named the fix worktreedw-mc mergeon a real stamped pull request, then check that the state directory holds nothing about itRisk
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.
isAboutis tested against neighbouring numbers and repositories. Way back:git revert.🤖 Generated with Claude Code