Skip to content

Move tidy to Effect - #303

Merged
DocksDocks merged 3 commits into
mainfrom
295-move-tidy-to-effect
Dec 2, 2026
Merged

DocksDocks merged 3 commits into
mainfrom
295-move-tidy-to-effect

Conversation

@DocksDocks

@DocksDocks DocksDocks commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Plan run: #295 Move tidy to Effect

Child of #290 (step tidy). Reviewed head: b7c49363. Checks: see the pull request.

What changed

  • cli/src/engine-native/syncConcurrency.ts: runBounded runs Effect tasks. Its workers cannot fail. After a task fails, no queued task starts, the started tasks finish, and the failure with the lowest index is reported. No started task is interrupted. index.ts keeps its exports.
  • tidy.ts and tidyReport.ts: the host methods return Effects. File work goes through the FileSystem service, and each call keeps its old outcome. The old throws are tagged failures (TidyCheckFailed, ReportSectionFailed, TidyLockFailed) that keep the original error as cause. Calls into exec.ts, processes.ts, scratch.ts, ompFileDeploy.ts, and home.ts go through bridge.ts.
  • cli/src/commands/tidy.ts: Effect.promise is gone. The apply lock is one tryAcquireKitLock try in Effect.acquireRelease. At the command boundary, a typed failure dies with its original error.
  • Signals: tidy exits 130 at once on SIGINT or SIGTERM, as before (exitOnSignal, now exported from cli/src/engine.ts). During --apply, a signal waits until the apply result is printed. A signal during a git or docker call of the apply still exits at once (deferSignalExit, signalExitPoint).
  • Tests:
    • The runner cases moved to syncConcurrency.test.ts, which adds the two error-order cases of the first comment of Move the engine-native layer to Effect #290.
    • The tidy and report tests use Effect stubs.
    • New cases cover network removal, log rotation, the --repo listing, the scratch recheck at apply time, and --repo input resolution.
    • Spawned cases cover a plain tidy, tidy --report, and the signal paths.
  • Guidance: the tidy-context skill describes the lock scope, the signal rules, the section failure rule, and the runBounded gotcha.
  • No version bump: the output, the exit codes, and the signal behavior do not change.

Delegated decisions

Reviews

Verification (on 9939bb6c)

  • runner: exit 0, 8 passed. Red baseline: both error-order cases failed against an Effect.forEach runner.
  • tidy, untested: exit 0, 92 passed, 1 skipped. commands: exit 0, 9 passed. Red baseline: both deferral cases failed with the deferral disabled.
  • scan: exit 1, no match. bridges: 7 matches, each an allowed wrap.
  • goldens: OK, no golden change. red-dry, red-mut: exit 1 with prove-red OK.
  • guidance, dry, types, ci-tools, smoke: pass. gate (bun run check): exit 0, 6507 passed, 12 skipped.

Limits and failures

  • Local checks ran on Linux x64 only. Full CI covers Ubuntu, macOS, and Windows. The spawned signal cases run on Linux and macOS only.
  • The first Full CI run (46798663884) failed on Ubuntu and Windows: two assertions used RegExp.escape, which the Node of those runners lacks. Commit b7c4936 compares those paths as strings; tidy.test.ts passed after it (63 passed).

Kept resources

  • After Merge now: none.
  • After Leave pull request open: the worktree issue-295 and the local and remote branch 295-move-tidy-to-effect.

After merge

Checklist

  • bun run check passes
  • Tested locally end to end (runner, tidy, untested, commands, scan, bridges, goldens, prove-red, guidance, dry, types, ci-tools, smoke, gate)
  • Code review passed

Closes #295

Step tidy of #295 (child of #290):
- runBounded runs Effect tasks with workers that cannot fail; a failure drains the started
  tasks and the lowest-index cause wins, so no started task is interrupted.
- tidy.ts and tidyReport.ts: the host returns Effects, file work goes through FileSystem with
  the base outcome per call, base throws are tagged failures, legacy calls are bridged.
- commands/tidy.ts: the apply lock is a scoped tryAcquireKitLock; the command runs inside
  exitOnSignal; the apply defers the signal exit except at its git and docker calls
  (deferSignalExit, signalExitPoint in engine.ts), until its result is printed.
- Runner cases move to syncConcurrency.test.ts with the two error-order cases; tidy and report
  tests run on Effect stubs; new cases cover the untested paths and the spawned CLI.

Verified: bun x --no-install vitest run cli/test/unit/syncConcurrency.test.ts cli/test/unit/engine-di.test.ts cli/test/unit/tidy.test.ts cli/test/unit/tidyReport.test.ts cli/test/unit/kitLock.test.ts cli/test/unit/scratch.test.ts cli/test/unit/skillMetadata.test.ts; bun run check:types; bun run lint; bun run check
Step guidance of #295: tidy-context names the scoped tryAcquireKitLock, the signal exit and
deferral of the apply, the section failure rule, the runBounded gotcha, the paths that stay
untested, and the new source line ranges.

Verified: git grep -n -e 'a throw becomes' -e 'acquireUseRelease' -e 'Network removal, log rotation' -- .agents/skills/tidy-context; bun x --no-install vitest run cli/test/unit/skillMetadata.test.ts
@DocksDocks DocksDocks linked an issue Dec 2, 2026 that may be closed by this pull request
@DocksDocks
DocksDocks marked this pull request as ready for review December 2, 2026 02:55
@DocksDocks
DocksDocks marked this pull request as draft December 2, 2026 03:01
Full CI failed on Ubuntu and Windows: RegExp.escape is not a function in the Node of the
runners. The two assertions now compare the path part as a string.

Verified: bun x --no-install vitest run cli/test/unit/tidy.test.ts; bun run lint; bun run format
@DocksDocks
DocksDocks marked this pull request as ready for review December 2, 2026 03:03
@DocksDocks
DocksDocks merged commit 7728465 into main Dec 2, 2026
10 checks passed
@DocksDocks
DocksDocks deleted the 295-move-tidy-to-effect branch December 2, 2026 03:34
@DocksDocks DocksDocks mentioned this pull request Dec 2, 2026
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.

Move tidy to Effect

1 participant