8000 refactor(bucket): give the prs namespace a domain module by dominikwozniak · Pull Request #128 · dominikwozniak/dw-mc · GitHub
[go: up one dir, main page]

Skip to content

refactor(bucket): give the prs namespace a domain module - #128

Merged
dominikwozniak merged 1 commit into
mainfrom
refactor/127-prs-module
Sep 20, 2026
Merged

dominikwozniak merged 1 commit into
mainfrom
refactor/127-prs-module

Conversation

@dominikwozniak
Copy link
Copy Markdown
Owner

prs was the one namespace the state directory holds with no module in domain/. Its shape, Facts, already sat in src/domain/bucket.ts; its storage sat in two commands, and the sweep carried the open store down through its own signature to reach it. The read and the write join the shape, which is where every other namespace keeps them.

What changes

  • src/domain/bucket.ts — gains factsFor and recordFacts, beside Facts.
  • src/cli/sweep.ts — sweepPr drops its store parameter; the Store alias and the KeyValueStore import go with it.
  • src/cli/pr.ts — swept reads through factsFor and keeps its own sentence, that nothing is known until a sweep has run.

Done when

No file in src/cli/ calls storeFor("prs", …). Verified: none does.

Why bucket.ts and not a new module

Facts is already there, and src/domain/review.ts is the precedent for one module holding a shape, its keys, its reads and its rules. The cost is worth naming: bucket.ts was adapter-free before this and now reaches the key-value store. src/domain/stamp.ts already mixes pure rules with storage, so the shape is not new — and place and group stay pure.

Test plan

  • pnpm check — pass: lint, format, typecheck, 817/817 tests, build
  • no new test: the keys, the schema and the written bytes are unchanged, and src/cli/status.test.ts drives both the read and the write through the sweep

Risk

None to the state directory: same namespace, same key, same schema, so a directory written before this reads the same after. If factsFor were wrong every pull request would look new to the quiet rule and the sweep would pay for reads it used to skip — visible on the first run, and the way back is the revert.

Closes #127

Facts was the one shape in the state directory whose storage lived in the
commands: the sweep opened the namespace and passed the handle down, and
swept opened it a second time to read one pull request back.

The read and the write join Facts. The sweep stops carrying a store
through its own signature, and the one sentence that was genuinely the
command's - that nothing is known until a sweep has run - stays in the
command.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dominikwozniak
dominikwozniak merged commit c306917 into main Sep 20, 2026
1 check passed
@dominikwozniak
dominikwozniak deleted the refactor/127-prs-module branch September 20, 2026 18:33
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(bucket): give the prs namespace a domain module

1 participant

0