8000 refactor(review): give the recording rule back to the domain by dominikwozniak · Pull Request #130 · dominikwozniak/dw-mc · GitHub
[go: up one dir, main page]

Skip to content

refactor(review): give the recording rule back to the domain - #130

Merged
dominikwozniak merged 1 commit into
mainfrom
refactor/129-ranby-domain
Sep 20, 2026
Merged

dominikwozniak merged 1 commit into
mainfrom
refactor/129-ranby-domain

Conversation

@dominikwozniak
Copy link
Copy Markdown
Owner

src/domain/review.ts owns what a review run is: the Outcome schema, the record it is kept in, and every rule that reads one back - reportedBy, detailOf, reviewedBy. The one rule that writes an outcome lived in the command, and the price showed in two places: the policy that a run which never started and a run whose output does not validate are the same failure was stated twice, and the only way to reach any of its branches was to drive an agent through a command test. The rule sits with the words it decides in, and its three policies are tested over plain values.

What changes

  • src/domain/review.ts - holds ranBy, Answered and Ran. Answered is what the rule is allowed to know about a run that reached the agent, the way Asked is for the re-run rule.
  • src/cli/review.ts - spawns the turns, folds the two reporting failures into one shape and calls the rule. The policy behind that fold is now stated once, where the rule is.
  • src/domain/review.test.ts - five cases over ranBy: a run that never started, a run that answered in a shape that does not validate, the session and prose kept when the reporting failed, a run that reported, and the report written from the findings where a schema left no prose.

The signature, and why it is this one

ranBy read Result<Reviewed, AgentFailed>. Reviewed was the interface local to the command, not src/adapters/claude.ts's of the same name; what the rule reads of the pair is sessionId, prose, reported and, on the failure side, detail alone.

It now takes what it reads. The two alternatives do not hold:

  • Move it as it stood. src/domain/review.ts already exports a Reviewed - what the stamp rule reads out of the runs on one head - so the command's would arrive under a second name anyway. And the domain would hold AgentFailed for one string, which is the layer direction spent on nothing: an outcome keeps a failed run's detail and never the error that carried it.
  • Make them words in src/terms/review.ts. The shape carries Result<typeof Reported.Type, …>, and Reported is src/domain/findings.ts's. terms/ is the bottom layer and may not import the domain, so the file cannot hold this shape without the findings schema moving down with it - a much larger decision than this one, and not one the layout asks for. What ReviewTurn earns its place with is being read on both sides of the adapter seam; Answered is read on one.

Test plan

  • pnpm check - pass (lint, format, typecheck, 822 tests, build)
  • src/domain/review.test.ts - 27/27, five new cases over ranBy

Risk

None to behaviour: the rule's body is unchanged and the command calls it with the same values. If the narrowing is wrong, pnpm typecheck says so.

Closes #129

🤖 Generated with Claude Code

The rule that turns what a review run came back with into the outcome it
is recorded under sits beside the outcome itself, next to the rules that
read one back. It took the command's tests an agent to reach; it now has
its own, over plain values.

It reads the run it is given rather than the adapter's types: the shape
the turn answered in, and a failed run as the detail an outcome keeps of
one. A word the terms layer would hold cannot hold the findings schema,
which is the domain's.

Closes #129

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dominikwozniak
dominikwozniak merged commit d3d3412 into main Sep 20, 2026
1 check passed
@dominikwozniak
dominikwozniak deleted the refactor/129-ranby-domain branch September 20, 2026 19:29
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): give the recording rule back to the domain

1 participant

0