8000 refactor: apply Effect good practice across src by dominikwozniak · Pull Request #114 · dominikwozniak/dw-mc · GitHub
[go: up one dir, main page]

Skip to content

refactor: apply Effect good practice across src - #114

Merged
dominikwozniak merged 9 commits into
mainfrom
refactor/113-effect-good-practice
Sep 19, 2026
Merged

dominikwozniak merged 9 commits into
mainfrom
refactor/113-effect-good-practice

Conversation

@dominikwozniak
Copy link
Copy Markdown
Owner

The gate now holds src/ to node_modules/effect/AGENTS.md. The Effect preset's style rules sit at warn, and pnpm lint failed on none of them. With the gate strict, the next change keeps to the idioms this code already follows. dw-mc forget answers a configuration file it cannot read with the sentence every other command prints. The handful of things written more than once are written once.

What changes

  • Lint gate — pnpm lint, lint:fix and the pre-commit hook pass --deny-warnings. effecttsgo/deterministic-keys and effecttsgo/unnecessary-arrow-block land at error. ADR 0005 says a preset rule the repo disagrees with is switched off by name, never left at warn.
  • src/cli/forget.ts — maps ConfigMalformed to the user-facing sentence. src/cli/cli.test.ts runs every command and the picker against a malformed file. A new command has to say whether it reads the file.
  • src/adapters/gh.ts, src/adapters/config.ts — failedAs maps a failed gh call once and keeps the vector where no-gh-writes reads it. readOrEmpty and registeredIn read the configuration file for forPr, the sweep and the picker. Service keys carry their adapters/ path.
  • src/cli/*, tests — the effort flags read Effort.literals. --print and "No repositories registered…" are declared once, and span names match their functions. Eleven test helpers are Effect.fnUntraced. failing in review.test.ts keeps its pipe, because its argument feeds the provide and not the body.

Test plan

  • pnpm check — pass: lint with --deny-warnings, format, typecheck, 816 tests, build.
  • src/cli/forget.test.ts — the new regression case fails on main with expected 'ConfigMalformed' to equal 'UserError'. It passes here.
  • src/cli/cli.test.ts — without the fix, only dw-mc forget 28 fails. The other 11 commands and the picker pass.
  • node dist/bin.js forget 28 with a misspelled key under a scratch XDG_CONFIG_HOME prints the ERROR sentence naming the file and exits 1. On main it prints a stack. stamp 28 prints the same sentence.
  • A scratch src/scratch.ts holding new Date() fails pnpm lint, exit 1. An old service key put back fails deterministic-keys.
  • "--auto" added to the pr merge vector still trips dw-mc/no-gh-writes after failedAs.
  • --help for review, init, fix, resolve and status is byte-identical before and after.

Risk

A preset rule that fires on a future change now fails the gate instead of warning. The way back is to switch that rule off by name in .oxlintrc.json, with its reason. The service keys are in-memory Context keys, so nothing on disk moves.

Closes #113

dominikwozniak and others added 9 commits September 19, 2026 18:59
Nested ternaries in the header's built-ins and the watermark's draft check
read as branches, the block opener names its position before the template
uses it, allKeys is the service accessor it always was, and forget builds
its tracked suffix once instead of once per row. The header's const is
registration, because standing is the glossary's word for a session
worktree left on disk.

Refs #113

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
forPr reads the configuration file before forget does anything, and forget
was the one command reading it that let ConfigMalformed reach runMain, so a
misspelled key printed a stack trace where stamp and findings print the
sentence naming the file. One test now runs every command against a bad
file, and a command added to the CLI has to say whether it reads the file.

Refs #113

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The Effect preset ships its idioms at warn - Effect.fn over a wrapped
Effect.gen, DateTime over Date, Schema over JSON.parse - and pnpm lint
passed no --deny-warnings, so none of them could fail pnpm check. The tree
reports no warnings, so holding them costs nothing today and keeps the next
change to what node_modules/effect/AGENTS.md asks. ADR 0005 says so, and
says a rule the repo disagrees with is switched off by name, not left at warn.

Refs #113

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Effect's guide keys a service by the module it lives in, and
effecttsgo/deterministic-keys holds that once it is on; the preset leaves
it off. ConfigStore and Keys now carry their adapters/ path, Paint follows
by hand because the rule does not read a Context.Reference, and both
services are built through X.of the way the guide builds one. The keys are
in-memory Context keys, so nothing on disk moves.

Refs #113

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Four calls spelled the same catchTags, a gh that would not start as
unavailable and one that refused as GhReadFailed. failedAs is that mapping
piped onto capture("gh", [...]), so the vector stays in the call
no-gh-writes reads, and ci.ts no longer reaches for gh.ts internals.

Refs #113

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
forPr, the sweep and the picker each read the file, fell back to an empty
one and listed the registered repositories their own way. readOrEmpty and
registeredIn say it once beside read, so a malformed file still fails
every caller the same way and every command lists the repositories in one
order.

Refs #113

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Effect's guide asks for Effect.fnUntraced over a function that only returns
an Effect.gen, and eleven helpers in the suite were that shape. The one
that provides its own machine from its argument keeps the pipe, because
the argument belongs to the provide rather than the body. The rule for an
arrow whose block only returns lands at error, the way deterministic-keys
did.

Refs #113

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The effort flags restated the Effort literals the term already holds, and
ADR 0006 says a word declared twice has stopped being one, so both flags
read Effort.literals. resolve takes fix's --print, the three commands that
find no registered repository say it from one const, and the two spans
whose names did not match their function now do.

Refs #113

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
forget's suffix was named tracked, which is the glossary's word for a pull
request the tool follows, so it is branchGone. failedAs says which error a
refused gh call becomes, writes included, and the all-commands test title
finishes its sentence.

Refs #113

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dominikwozniak
dominikwozniak merged commit 6185da2 into main Sep 19, 2026
1 check passed
@dominikwozniak
dominikwozniak deleted the refactor/113-effect-good-practice branch September 19, 2026 17:23
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: apply Effect good practice across src

1 participant

0