Skip to content

fix(server): force LC_ALL=C on git diff HEAD --numstat for locale-saf…

MacroscopeApp / Macroscope - Effect Service Conventions failed Jul 29, 2026 in 3m 38s

Effect Service Conventions: 1 issue found

apps/server/src/vcs/GitVcsDriverCore.ts (lines 1533-1544) — the new unborn-HEAD fallback in readStatusDetailsLocal runs both runGitStdout calls with allowNonZeroExit = true, so a real git diff failure yields empty stdout instead of the typed GitCommandError this call site previously raised, causing statusDetails to silently report zero insertions/deletions. Suggested fix: drop the trailing true on both calls.

Previously flagged concerns that are now resolved:

  • The fallback is gated on an actual unborn-HEAD stderr check (isUnbornHeadStderr) and fails with GitCommandError otherwise.
  • Focused tests were added for combined staged+unstaged edits and for staged counts on an unborn HEAD.

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.

Checks performed:

  • Imports: no new consolidated "effect" named imports; no service-module alias imports introduced.
  • Service definition/layout: no service tag, make, or layer changes; no new files or compatibility shims.
  • Dependency acquisition: no service-instance parameters, Layer.succeed, ManagedRuntime.make, or .runPromise/.runPromiseExit added.
  • Errors: the new GitCommandError construction uses structured, bounded attributes (operation, command, cwd, argumentCount, exitCode, stdoutLength, stderrLength) consistent with the sibling failure path at line 1507; no raw stderr/args copied into detail; cause is legitimately absent (non-zero exit, no underlying error object). exitCode typing verified against GitCommandError in packages/contracts/src/git.ts and the branded ChildProcessSpawner.ExitCode.
  • Change discipline: backend behavior change (single git diff HEAD --numstat instead of summing diff + diff --cached) is now covered by focused tests.

The only remaining finding is the suppressed failure channel in the fallback commands, reported inline.


🔍 Agent activity — 1 tool call

💭 I'm checking whether the previous issues were actually fixed in the code. The main concern was that the fallback was treating any non-zero exit as an unborn HEAD, but now there's an isUnbornHeadStderr check that properly fails with GitCommandError instead. I need to verify the runGitStdout signature, particularly that fourth argument set to true, and then review the tests that were added. I need to look at the statusDetails code and check the runGitStdout function signature to understand how they work together. Looking at whether the fallback path for unborn repositories aligns with Effect service conventions—specifically around error handling. The concern is that passing allowNonZeroExit = true to those git commands means genuine failures would return empty stdout silently rather than surfacing as typed errors, which feels inconsistent with Effect's error handling philosophy. Though in practice, git diff --numstat and git diff --cached --numstat shouldn't fail in the unborn case anyway. There's also the detail string issue: it includes the literal command arguments like "diff HEAD --numstat," but since these are static and not user-supplied data, and gitCommandContext deliberately restricts exposure to just argument count, this might be acceptable under the convention. I'm noticing that exitCode: result.exitCode could potentially be null, and I need to verify whether GitCommandError's exitCode field can accept null values or if it requires explicit handling like the pattern at line 877 that conditionally includes exitCode. Line 1514 sets exitCode directly without null-checking, so there's precedent, but I should confirm the ExecuteGitResult.exitCode type to be sure. I need to verify what the ExitCode type actually is by checking the ChildProcessSpawner.ExitCode definition and the GitCommandError schema to see if it's number | null. The exitCode is fine and cause is optional since there's no underlying error object here. Looking at the remaining findings, the new detail about the git diff command failing is just a static description, not raw dynamic arguments or output, which aligns with the existing convention in the codebase where similar error messages like "git ls-files failed" are already used. On the allowNonZeroExit: true in the fallback calls — that's less about violating conventions and more about a correctness issue: it silently swallows real git failures and returns empty stdout, which makes statusDetails report zero insertions incorrectly. The prior check already flagged this and the code changed in response, but kept the true anyway, so re-flagging is fair. I should also verify the fallback ordering with the destructured array to make sure the order matches correctly. On unborn HEAD, the staged and unstaged diffs actually sum correctly to the worktree-versus-empty diff, so that's fine. I'm also noticing the code builds a synthetic numstat string by serializing insertions and deletions, then re-parsing it—which is a bit ugly and would mangle paths with tabs, but that's more of a code smell than a violation of the Effect service conventions I'm checking against. Let me review what those conventions actually specify. The fallback runGitStdout calls are using the right operation names, but I'm noticing that allowNonZeroExit = true is suppressing typed errors — this actually violates the convention about preserving typed failures in Effect rather than bypassing them. This is a silent-failure path that the PR introduced, since previously these numstat commands would have thrown typed GitCommandErrors on failure. I should check whether git diff --numstat actually exits non-zero on unborn HEAD — testing shows it returns 0 in modern git, so the true flag seems unnecessary. There's a small risk of false positives with older git versions, so I'll phrase this as a suggestion rather than a hard requirement and add an inline comment in that region. So the check defaults to failure when findings exist, which means I should flag this as a violation. Looking at the Effect Service Conventions, the allowNonZeroExit: true suppression falls under error handling discipline — it's bypassing the typed error system rather than keeping the failure within Effect. I'll post the suggestion and mark it as a failure, then identify the exact line positions for the comment on the right side. Refining the suggestion to remove the true arguments while keeping the multi-line array format for readability.

1. modify_pr — One residual finding on the new unborn-HEAD fallback in readStatusDetailsLocal. The classification via isUnbornHeadStderr addresses the earlier concern; the remaining issue is the suppressed failure channel in the fallback commands.


Agent Credits: 113 credits