fix(workflows): sanitize release-docs git subprocess env - #1351
Conversation
Assistant-model: GPT-5.5
Review:
|
Assistant-model: GPT-5.5
Code Review —
|
|
Addressed the non-blocking feedback in
The branch is pushed and clean. |
* fix(workflows): sanitize release docs git subprocess env Assistant-model: GPT-5.5 * fix(workflows): use public atomic git env export Assistant-model: GPT-5.5
Summary
Strips repository-local Git environment variables (
GIT_DIR,GIT_WORK_TREE,GIT_INDEX_FILE, and others) from subprocesses in the release-docs workflow and test fixtures, preventing Git hook runners (e.g.prek) from silently redirecting commands at the wrong repository.Root Cause
Git honors repository-local env vars over
cwd— hook runners likeprekexport these vars into the hook process environment, so any transitively spawned Git command (includinggit initon a temp directory) operates on the hook-invoking repo instead of the intended one. In the worst case,git initpersistscore.worktreeinto the shared.git/configof the real repo, corrupting it.Changes
.atomic/workflows/lib/release-docs.ts: Passenv: createGitEnvironment()toexecFileSyncinsiderunCommand(), stripping all repository-local Git env vars so every Git subprocess always targets its explicitcwd.test/unit/release-docs-workflow.test.ts:createGitEnvironment()sanitization torunGit()in test fixtures, preventing fixture-repogit initcalls from corrupting the real repo under hook runners.commitAll()helper to deduplicate repeated commit invocations across tests.GIT_DIR,GIT_WORK_TREE,GIT_INDEX_FILEpointing at a detached decoy repo) and assertscurrentBranchName()still returns the correct branch of the target repo.Validation
bun run typecheckbun run lintAGENT=1 bun run test:unit