Skip to content

Commit 534dad7

Browse files
authored
fix(test): stop the local gate from failing on main (#5725)
Three independent, pre-existing gate breaks, none introduced by this branch -- found while chasing why release-please's PRs (#5710-5713) looked flaky under local parallel test runs, and confirmed to reproduce identically on a clean origin/main checkout: - test/unit/agent-sdk-driver.test.ts, ai-summaries.test.ts, upstream-ruleset.test.ts: each does real, non-trivial work (git subprocess round-trips, a 42-entry forbidden-word sweep, 29 sequential D1-backed scenarios) that reliably exceeds vitest's 15s default under load. Widened each to an explicit, realistic timeout instead of leaving them to flake. - test/unit/selfhost-grafana-dashboard.test.ts: 5f187c2 (#5716) fixed a real production bug -- Grafana's ${var:sqlstring} doesn't sql-quote a value that starts with $__, so the old $__all "All repos" sentinel leaked through unescaped and SQLite misparsed it as its own bind parameter, silently zeroing every "All"-filtered panel. That commit updated the dashboard JSON and two sibling test files but missed this one. - apps/gittensory-ui/public/openapi.json + 3 route/component .tsx files: 40e6cdf (#5715, the @gittensory -> @Loopover bot-mention rename) changed copy text but never regenerated the OpenAPI spec or ran prettier on the reflowed JSX text nodes, so ui:openapi:check and ui:lint both fail on main. Regenerated the spec (npm run ui:openapi) and ran eslint --fix on the affected files; both are mechanical, zero-semantic-diff outputs.
1 parent f7b2352 commit 534dad7

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

test/unit/agent-sdk-driver.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ describe("createAgentSdkCodingAgentDriver", () => {
8888
});
8989

9090
it("enumerates tracked and untracked worktree changes with git", async () => {
91+
// Real subprocess spawns (init, 2x config, add, commit, plus the driver's own diff enumeration) --
92+
// legitimately more wall-clock latency than the default 15s test timeout reliably covers under
93+
// concurrent CI shard/system load (observed timing out under heavy parallel contention with no logic
94+
// failure; passes in well under 1s in isolation). An explicit timeout says so instead of relying on
95+
// ambient headroom.
9196
const dir = await mkdtemp(join(tmpdir(), "gittensory-agent-sdk-"));
9297
try {
9398
await execFileAsync("git", ["init"], { cwd: dir });
@@ -114,7 +119,7 @@ describe("createAgentSdkCodingAgentDriver", () => {
114119
} finally {
115120
await rm(dir, { recursive: true, force: true });
116121
}
117-
});
122+
}, 30000);
118123

119124
it("derives changed files from the worktree after untracked mutating tools", async () => {
120125
const driver = driverWith({

test/unit/ai-summaries.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,16 @@ describe("optional deterministic-summary rewrite layer", () => {
409409
});
410410

411411
it("routes every forbidden public term through the canonical sanitizer and falls back when AI is unsafe", async () => {
412+
// Iterates every entry in FORBIDDEN_PUBLIC_COMMENT_WORDS (40+ words) as its own real round trip through
413+
// rewriteSignalBundleWithAi -- legitimately more work than the default 15s test timeout reliably covers
414+
// under load (observed timing out under concurrent CI shard contention, not a logic failure: every
415+
// assertion that DID run passed). An explicit timeout says so instead of relying on ambient headroom.
412416
for (const word of FORBIDDEN_PUBLIC_COMMENT_WORDS) {
413417
const run = vi.fn(async () => ({ response: `Looks great, includes ${word} detail.` }));
414418
const result = await rewriteSignalBundleWithAi(publicEnv({}, run), rewriteReq());
415419
expect(result, `forbidden word: ${word}`).toMatchObject({ status: "unsafe", text: DETERMINISTIC_BODY });
416420
}
417-
});
421+
}, 30000);
418422

419423
it("rejects reward, ranking, scoreability, and reviewability variants in public AI rewrites", async () => {
420424
const unsafeOutputs = [

test/unit/upstream-ruleset.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,10 @@ describe("upstream ruleset drift tracking", () => {
10851085
expect(calls.find((call) => call.method === "POST")?.body?.assignees).toEqual(["alice", "bob"]); // trimmed, empty segment dropped
10861086
});
10871087

1088+
// 29 distinct real-D1-backed scenarios run sequentially in this one test -- legitimately more work than
1089+
// the default 15s test timeout reliably covers under concurrent CI shard/system load (observed timing out
1090+
// under heavy parallel contention with no assertion failure). An explicit timeout says so instead of
1091+
// relying on ambient headroom.
10881092
it("handles edge cases while filing upstream drift issues", async () => {
10891093
const defaultRepoEnv = createTestEnv({ GITTENSORY_AUTO_FILE_DRIFT_ISSUES: "1", GITTENSORY_DRIFT_ISSUE_TOKEN: "token", GITTENSORY_DRIFT_ISSUE_REPO: "" });
10901094
await upsertUpstreamDriftReport(defaultRepoEnv, driftReport("source-fingerprint", { severity: "medium", affectedAreas: [] }));
@@ -1225,7 +1229,7 @@ describe("upstream ruleset drift tracking", () => {
12251229
const disabledEnv = createTestEnv();
12261230
delete (disabledEnv as Partial<Env>).GITTENSORY_AUTO_FILE_DRIFT_ISSUES;
12271231
await expect(fileUpstreamDriftIssues(disabledEnv)).resolves.toMatchObject({ status: "disabled" });
1228-
});
1232+
}, 45000);
12291233

12301234
it("finds the existing drift issue on page 2 when the repo has more than 100 open signals issues", async () => {
12311235
const env = createTestEnv({ GITTENSORY_AUTO_FILE_DRIFT_ISSUES: "true", GITTENSORY_DRIFT_ISSUE_TOKEN: "token" });

0 commit comments

Comments
 (0)