8000 refactor(review): write the runs namespace from its own module by dominikwozniak · Pull Request #126 · dominikwozniak/dw-mc · GitHub
[go: up one dir, main page]

Skip to content

refactor(review): write the runs namespace from its own module - #126

Merged
dominikwozniak merged 1 commit into
mainfrom
refactor/125-runs-write
Sep 20, 2026
Merged

dominikwozniak merged 1 commit into
mainfrom
refactor/125-runs-write

Conversation

@dominikwozniak
Copy link
Copy Markdown
Owner

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. runs half-obeys: the shape, the three keys and both reads sit in src/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 — gains recordRun, beside runAt and lastRun. It opens the three stores and writes the run, its head and its report.
  • src/cli/review.ts — calls recordRun once 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 lastRun reading an index that points at nothing, or without its report, leaving a run dw-mc findings can name and cannot show. One function makes both states unreachable.

Test plan

  • pnpm check — pass: lint, format, typecheck, 817/817 tests, build
  • no new test: behaviour is unchanged, and src/cli/review.test.ts already drives the recording path through the command

Risk

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 recordRun were wrong, a review would record nothing and dw-mc review would repeat; the way back is the revert.

Closes #125

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>
@dominikwozniak
dominikwozniak merged commit 4d4fd78 into main Sep 20, 2026
1 check passed
@dominikwozniak
dominikwozniak deleted the refactor/125-runs-write branch September 20, 2026 18:32
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.

refactor(review): the runs namespace writes from its own module

1 participant

0