fix: production hardening for merge races, timeouts, and webhook ops
Pin merge SHA, lock conflict repair, bound subprocess/proxy output, fail-fast incomplete R2/webhook config, redact validation/stderr secrets, and document that webhook 202 is best-effort after ACK. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
d6f33a71c3
commit
039acabd96
29 files changed
+1163
-240
No files matched your search
@@ -0,0 +1,46 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import path from "node:path";
|
||||
import test from "node:test";
|
||||
|
||||
function loadConfigWith(overrides: Record<string, string | undefined>) {
|
||||
const env = { ...process.env };
|
||||
for (const [key, value] of Object.entries(overrides)) {
|
||||
if (value === undefined) {
|
||||
delete env[key];
|
||||
} else {
|
||||
env[key] = value;
|
||||
}
|
||||
}
|
||||
return spawnSync(process.execPath, ["--import", "tsx", "--eval", "import('./src/config.ts')"], {
|
||||
cwd: path.resolve(process.cwd()),
|
||||
env,
|
||||
encoding: "utf8"
|
||||
});
|
||||
}
|
||||
|
||||
test("config rejects enabled webhook without a secret", () => {
|
||||
const result = loadConfigWith({ WEBHOOK_ENABLED: "true", WEBHOOK_SECRET: "" });
|
||||
assert.notEqual(result.status, 0);
|
||||
assert.match(`${result.stdout}${result.stderr}`, /WEBHOOK_SECRET/);
|
||||
});
|
||||
|
||||
test("config rejects partially configured R2 settings", () => {
|
||||
const result = loadConfigWith({
|
||||
WEBHOOK_ENABLED: "false",
|
||||
R2_ENDPOINT: "https://example.r2.cloudflarestorage.com",
|
||||
R2_BUCKET_NAME: "bucket",
|
||||
R2_ACCESS_KEY_ID: "",
|
||||
R2_SECRET_ACCESS_KEY: ""
|
||||
});
|
||||
assert.notEqual(result.status, 0);
|
||||
assert.match(`${result.stdout}${result.stderr}`, /R2_ENDPOINT/);
|
||||
});
|
||||
|
||||
test("config defaults the provider base URL explicitly", () => {
|
||||
const result = loadConfigWith({
|
||||
WEBHOOK_ENABLED: "false",
|
||||
GOOSE_BASE_URL: ""
|
||||
});
|
||||
assert.equal(result.status, 0, result.stderr);
|
||||
});
|
||||
Reference in new issue
Block a user