Repository navigation
Effect Service Conventions: 1 issue found
apps/server/src/terminal/Manager.ts(lines 620-630):snapshotFailuremanufactures a syntheticErrorsolely to populatecauseand encodes the snapshot verdict (code,timedOut,stdoutTruncated) inside that string instead of as structural attributes onTerminalSubprocessCheckError. Model the context as fields on the error class and derivemessagefrom them;causeshould carry only the real spawn failure. With structural fields in place the helper is a bare error construction and can be inlined at the two failure boundaries.
Details
Note
Your check run agent prompt is: .macroscope/check-run-agents/effect-service-conventions.md
More information about how Check Run Agents work can be found in our Help Center.
Scope reviewed: apps/server/src/terminal/Manager.ts and apps/server/src/terminal/Manager.test.ts.
Checked and found compliant:
- Namespace subpath imports for Effect modules;
import { ChildProcessSpawner } from "effect/unstable/process"in the test matches the established repo-wide pattern for that package subpath. TerminalSubprocessCheckErrorremains aSchema.TaggedErrorClasswith a message derived from its attributes; thecommanddiscriminator has multiple values, so it is not a redundant singleton, and removingterminalPidis consistent with the snapshot now being process-table wide rather than per terminal.- Dependency acquisition:
posixProcessTableSnapshot,windowsProcessTableSnapshot, andresolvePosixPsCommandacquireProcessRunner.ProcessRunner/FileSystem.FileSystemfrom the environment and expose those requirements in their types; noManagedRuntime.make,runPromise,runPromiseExit, or newLayer.succeedimplementations were introduced.options.subprocessInspectorremains a test seam. Effect.catchinpollSubprocessActivityintentionally handles the whole error channel, socatchTagsis not required; logged annotations stay bounded and do not copy command output.- The new tests cover a real behavior change (shared snapshot, non-authoritative failed snapshot), so they are not tests added solely for a mechanical refactor.
🔍 Agent activity — 1 tool call
💭 Looking at the changed file, I'm evaluating whether the error class conventions are being followed. The
TerminalSubprocessCheckErrorremoves theterminalPidfield and derives the message fromcommandalone, which acts as a discriminator betweenpowershellandps. ThesnapshotFailurehelper seems to be building an error object, though the thought cuts off before I can fully assess whether it violates the guideline about not creating helpers that just wrap error construction.… Looking at whethersnapshotFailureviolates conventions — it's a helper that constructs an error with a formatted message and encodes structural data like exit codes and timeouts into the message string rather than as proper attributes. This runs counter to the principle of not creating helpers that just wrap error construction, and also conflicts with the guidance against manufacturing errors solely to populate acausefield. The fix is straightforward: addexitCode,timedOut, andtruncatedas actual fields onTerminalSubprocessCheckErrorinstead of embedding them in a fabricated error message. On the imports side, the test file pullsChildProcessSpawneras a named import from"effect/unstable/process", but the convention expects subpath imports to come in as namespaces — so it should beimport * as UnstableProcess from "effect/unstable/process"and then reference it asUnstableProcess.ChildProcessSpawner.… The test imports look standard across the codebase, so that's fine. The real issue is howsnapshotFailureis creating anErrorobject just to use as a cause, which violates the principle of not manufacturing errors for that purpose. Instead, I should be capturing the actual domain context—like the operation or stage—in a normalized, serializable way.… SoEffect.catchproperly handles the entire channel, which is acceptable. The error being logged is the actual error object, and its cause is a synthetic Error with exit code information—following the convention of keeping direct error attributes safe without copying raw wire data or command arguments. The only real issue I'm seeing is thatsnapshotFailurecreates a fabricated Error cause with an unstructured message, and I'm weighing whether that's a clear enough convention violation to warrant failing the check. The convention explicitly forbids manufacturing an Error just to populatecause, and says to capture context as structural attributes instead. Yeah, I think I should flag this with an inline comment. The fix would involve adding fields to the error class and removing the fabricated cause—that's a multi-hunk change across the same file, so I'll describe it rather than provide a diff. I'm also considering whether the helper function itself should be removed since it only wraps the error construction, but it's used twice and builds the message, so that's worth thinking through once the class gets proper fields. Now I need to figure out the diff line numbers in…
1. modify_pr — One convention finding on the new snapshot failure path in apps/server/src/terminal/Manager.ts: the snapshot failure is modeled by fabricating an Error whose message carries the structural context, instead of putting that context on TerminalSubprocessCheckError as attributes.
Agent Credits: 66 credits