Skip to content

Commit 79c9bce

Browse files
committed
test(approval): add regression test for container env var unavailability
Reproduces the exact container scenario: GIT_USER_NAME env var is unset at approval-process runtime, but git config user.name (set during boot) has the correct owner. Fails on main, passes with the git-config fix.
1 parent eadc721 commit 79c9bce

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

approval/__tests__/ownership.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,18 @@ describe("isOwnedRemotePush", () => {
262262
mockGitSpawn("alice", "https://github.com/victim-org/repo.git");
263263
expect(await isOwnedRemotePush("git push origin main")).toBe(false);
264264
});
265+
266+
// Regression: in the container, GIT_USER_NAME is only available during the
267+
// entrypoint boot sequence. The approval process inherits git config (set via
268+
// `git config --system user.name`) but NOT the env var. The ownership check
269+
// must use `git config user.name`, not process.env.GIT_USER_NAME.
270+
test("allows push when env var is unset but git config has correct owner", async () => {
271+
delete process.env.GIT_USER_NAME;
272+
mockGitSpawn("limbibot", "https://github.com/limbibot/claudetainer.git");
273+
expect(
274+
await isOwnedRemotePush(
275+
"git push -u origin feat/claude-install-verification",
276+
),
277+
).toBe(true);
278+
});
265279
});

0 commit comments

Comments
 (0)