Skip to content

fix(server): preserve tracked review diffs

MacroscopeApp / Macroscope - Effect Service Conventions failed Aug 10, 2026 in 2m 6s

Effect Service Conventions: 1 issue found

  • apps/server/src/vcs/GitVcsDriverCore.ts (line 2138): fileSystem.exists(gitIndexPath) in the new readWorkingTreeReviewDiff helper is not mapped to GitCommandError, so a raw PlatformError leaks into the helper's error channel (losing operation/cwd context that the adjacent copyIndex/copySharedIndex mappings capture) and bypasses the Effect.catchTags({ GitCommandError: ... }) fallback at the call site, silently producing an empty working-tree diff instead of falling back to readTrackedWorkingTreeReviewDiff.

Inline comment with a suggested fix has been posted.

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/vcs/GitVcsDriverCore.ts and apps/server/src/vcs/GitVcsDriverCore.test.ts.

Checked and found conforming:

  • Namespace subpath imports (effect/Effect, effect/FileSystem, effect/Path, etc.) in both touched files; the now-unused effect/Array import was correctly removed.
  • Service dependency acquisition unchanged: fileSystem, path, and executeGit come from the constructor environment; no ManagedRuntime.make, runPromise, or service-instance parameters were introduced in production code.
  • Error handling uses the existing GitCommandError (Schema.TaggedErrorClass) with stable structural attributes (operation, command, cwd, static detail) plus the real cause; no raw command output or wire payload is copied into detail.
  • Recovery uses Effect.catchTags({ GitCommandError: ... }) rather than catchTag/catchIf.
  • New tests cover real behavior changes (rename detection, staged deletions, split index, sparse checkout) and use ChildProcessSpawner test handles as legitimate test seams, not mocks of core logic.

The previously flagged unmapped copyFile for the shared index has been addressed in this revision.


🔍 Agent activity — 1 tool call

💭 Now I'm reviewing the new code for convention violations. The error handling looks correct—the GitCommandError has a static detail field rather than copying from the cause, which aligns with the guidelines. The Effect.catchTags is being used properly to handle the error type.… The previous issue has been resolved. Now I'm scanning for other convention violations in this scope. Looking at the GitCommandError definition in contracts—it does have a detail field, but it's a static description that follows the existing convention in the file, so that's acceptable. I'm noticing that fileSystem.exists(gitIndexPath) at line 2138 has an unmapped PlatformError leaking through the error channel, which is the same type of issue as the earlier finding with copyFile. Since fileSystem.exists returns Effect<boolean, PlatformError>, this needs the same treatment. Wait, I need to reconsider—the prior comment said copyFile was the only unmapped filesystem call, but exists is also unmapped, and fileSystem.remove is being ignored with Effect.ignore. Let me verify: fileSystem.exists yields Effect<boolean, PlatformError>, so readWorkingTreeReviewDiff's error channel includes PlatformError. The error handling catches only GitCommandError and then swallows the rest with Effect.orElseSucceed, which compiles but violates the convention about mapping failures where context is known instead of letting unmapped errors leak through a multi-step pipeline.… I'm noticing that fileSystem.exists at line 2138 isn't properly mapped to a typed error — it's leaking a raw PlatformError, which violates the convention that service operations should return domain errors with preserved context. This is the same pattern as the copyFile issue the author already fixed, and since this exists call is new code in this PR, it should probably be flagged.… Looking at whether exists being unmapped is actually a problem—I need to check the type signature of fileSystem.exists in effect v4, which is (path: string) => Effect<boolean, PlatformError>. The question is whether the driver's declared interface properly accounts for PlatformError leaking through in the result type of getReviewDiffPreview.… Checking the imports and verifying the exists finding by looking at the executeGit signature to confirm it produces GitCommandError, and making sure fileSystem is properly acquired through the constructor. The Effect.filter usage looks correct, and the environment variable setup with GIT_INDEX_FILE is fine, though the thought trails off at readWorkingTreeReviewDiff. Now I'm considering whether Effect.ensuring with fileSystem.remove should actually be Effect.acquireRelease or addFinalizer instead, but that's not a listed convention. The unmapped fileSystem.exists call is worth flagging — it's consistent with the copyFile issue I flagged before that the author fixed, and it undermines the intended catchTags fallback mechanism. Even if exists was unmapped in my previous review, flagging it now is still valid because it defeats the error handling discipline. The error channel for readWorkingTreeReviewDiff includes both GitCommandError and PlatformError, and getReviewDiffPreview catches GitCommandError to provide a fallback, but the PlatformError from exists would slip through. I'll post an inline suggestion on line 2138 that wraps the fileSystem.exists call with proper error mapping to GitCommandError, extracting the result into a variable first so the conditional logic stays clean.…

1. modify_pr — Reviewed the new working-tree review-diff helpers against the Effect service conventions. One unmapped platform failure remains in readWorkingTreeReviewDiff.


Agent Credits: 84 credits