Repository navigation
refactor(review): write the runs namespace from its own module - #126
Merged
Merged
Conversation
Every namespace the state directory holds is read and written from the domain module that owns its shape. The runs namespace half-obeyed: the shape, the keys and both reads were already there, and the three writes stayed in the command that starts a review. They move as one function rather than three. Recording a run without its head leaves lastRun reading an index that points at nothing, and one without its report leaves a run dw-mc findings can name and cannot show; a single function is what makes those states unreachable. 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.
Every namespace the state directory holds is read and written from the domain module that owns its shape, so two commands asking the same question get the same answer.
runshalf-obeys: the shape, the three keys and both reads sit insrc/domain/review.ts, while the writes sit in the command that starts a review. The writes move to the module that already owns the rest.What changes
src/domain/review.ts— gainsrecordRun, besiderunAtandlastRun. It opens the three stores and writes the run, its head and its report.src/cli/review.ts— callsrecordRunonce and no longer opens a store, spells a key or builds a report document.Why one function and not three
The three writes are one act. Split apart, a caller can record a run without its head, leaving
lastRunreading an index that points at nothing, or without its report, leaving a rundw-mc findingscan name and cannot show. One function makes both states unreachable.Test plan
pnpm check— pass: lint, format, typecheck, 817/817 tests, buildsrc/cli/review.test.tsalready drives the recording path through the commandRisk
None to the state directory: the keys, the schemas and the written bytes are the same, so a state directory written before this change reads the same after it. If
recordRunwere wrong, a review would record nothing anddw-mc reviewwould repeat; the way back is the revert.Closes #125