Skip to content

Commit ee0cd03

Browse files
committed
fix(test): resolve accumulated main-red drift from 3 recent merges
Three independent test/doc mismatches accumulated on main from recently merged PRs, each blocking every subsequent PR's validate-code: - queue.test.ts: 4 disposition-metric assertions predated #3946's repo label redaction and still expected the unredacted literal repo name. - predicted-gate-engine-coverage.test.ts: 3 duplicate-winner assertions predated #3956's anti-backdating fix and asserted the old createdAt- based ordering instead of the new claim-time-only, fail-closed one. - gittensory.full.yml: missing the review.shared_config (#2046) doc section that .gittensory.yml.example already had, breaking their required byte-identical-from-marker sync.
1 parent 979a285 commit ee0cd03

3 files changed

Lines changed: 19 additions & 7 deletions

File tree

config/examples/gittensory.full.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,13 @@ gate:
355355
# Review output controls. These tune review output without changing the
356356
# deterministic gate policy above. Omit the block to keep the byte-identical
357357
# defaults.
358+
#
359+
# SELF-HOST ONLY (`review.shared_config`, #2046): when `GITTENSORY_REPO_CONFIG_DIR` is mounted,
360+
# place a shared review base at `${GITTENSORY_REPO_CONFIG_DIR}/_shared/.gittensory.yml` (see
361+
# `config/examples/shared.gittensory.yml`). Per-repo `review:` keys overlay it field-by-field —
362+
# repo value wins when set, shared fills gaps, defaults stay byte-identical. Absent shared base is
363+
# the common case and changes nothing. A malformed shared base warns and is ignored (never blocks a
364+
# review). The loader records provenance at runtime in `review.sharedConfigSource` (not a YAML key).
358365
review:
359366
# Deterministic AI review eligibility filters (`review.auto_review`, #1954 / #2038–#2065). Each knob quietly
360367
# skips the advisory AI review for matching PRs — never a gate failure. When the Orb review check is enabled,

test/unit/predicted-gate-engine-coverage.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ describe("predicted-gate engine module coverage (#2283)", () => {
106106
});
107107

108108
it("exercises duplicate-winner election helpers", () => {
109-
expect(isDuplicateClusterWinnerByClaim({ number: 1, createdAt: "2026-01-01T00:00:00.000Z" }, [{ number: 2, createdAt: "2026-01-02T00:00:00.000Z" }])).toBe(true);
109+
// #dup-winner anti-backdating: createdAt is deliberately NOT an ordering signal (a contributor can edit an
110+
// old placeholder PR to add a linked issue later), so a pair with only createdAt and no linkedIssueClaimedAt
111+
// has no comparable claim time and fails closed, regardless of which createdAt is earlier.
112+
expect(isDuplicateClusterWinnerByClaim({ number: 1, createdAt: "2026-01-01T00:00:00.000Z" }, [{ number: 2, createdAt: "2026-01-02T00:00:00.000Z" }])).toBe(false);
110113
expect(
111114
isDuplicateClusterWinnerByClaim(
112115
{ number: 2, linkedIssueClaimedAt: "2026-01-02T00:00:00.000Z" },
@@ -124,8 +127,10 @@ describe("predicted-gate engine module coverage (#2283)", () => {
124127
{ number: 1, createdAt: "2026-01-01T00:00:00.000Z" },
125128
[{ number: 2, createdAt: "2026-01-01T00:00:00.000Z" }],
126129
),
127-
).toBe(true);
128-
expect(resolveDuplicateClusterWinnerNumber({ number: 2, createdAt: "2026-01-02T00:00:00.000Z" }, [{ number: 1, createdAt: "2026-01-01T00:00:00.000Z" }])).toBe(1);
130+
).toBe(false);
131+
// Same fail-closed reasoning: resolveDuplicateClusterWinnerNumber mirrors isDuplicateClusterWinnerByClaim,
132+
// so a createdAt-only pair with no linkedIssueClaimedAt is not a determinable election either.
133+
expect(resolveDuplicateClusterWinnerNumber({ number: 2, createdAt: "2026-01-02T00:00:00.000Z" }, [{ number: 1, createdAt: "2026-01-01T00:00:00.000Z" }])).toBeNull();
129134
expect(resolveDuplicateClusterWinnerNumber({ number: 1, createdAt: null }, [{ number: 2, createdAt: null }])).toBeNull();
130135
});
131136

test/unit/queue.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27223,7 +27223,7 @@ describe("auto-action convergence: end-to-end plan+execute for the general heuri
2722327223
// #terminal-outcome-audit: the disposition counter's "close" action_class, with the actual gate-blocker
2722427224
// code (missing_linked_issue, from the default linkedIssueGateMode:block + no-linked-issue body) as the
2722527225
// bounded blocker_class -- proof this reaches the real gate.blockers, not just a hardcoded label.
27226-
expect(await renderMetrics()).toContain('gittensory_agent_disposition_total{action_class="close",autonomy_level="auto",blocker_class="missing_linked_issue"} 1');
27226+
expect(await renderMetrics()).toContain('gittensory_agent_disposition_total{action_class="close",autonomy_level="auto",blocker_class="missing_linked_issue",repo="redacted-1"} 1');
2722727227
const nativeDecision = await env.DB.prepare("select decision, summary, source from review_audit where event_type = 'gate_decision' and target_id = ?").bind(`${REPO}#60`).first<{ decision: string; summary: string; source: string }>();
2722827228
expect(nativeDecision).toMatchObject({ decision: "close", summary: "missing_linked_issue", source: "gittensory-native" });
2722927229
});
@@ -27266,7 +27266,7 @@ describe("auto-action convergence: end-to-end plan+execute for the general heuri
2726627266

2726727267
expect(seen.merged).toBe(false);
2726827268
expect(seen.closed).toBe(false);
27269-
expect(await renderMetrics()).toContain('gittensory_agent_disposition_total{action_class="hold",autonomy_level="auto",blocker_class="guardrail_hold"} 1');
27269+
expect(await renderMetrics()).toContain('gittensory_agent_disposition_total{action_class="hold",autonomy_level="auto",blocker_class="guardrail_hold",repo="redacted-1"} 1');
2727027270
const holdAudit = await env.DB.prepare("select metadata_json from audit_events where event_type = 'agent.action.hold' order by created_at desc limit 1").first<{ metadata_json: string }>();
2727127271
expect(JSON.parse(holdAudit?.metadata_json ?? "{}")).toMatchObject({
2727227272
repoFullName: REPO,
@@ -27394,7 +27394,7 @@ describe("auto-action convergence: end-to-end plan+execute for the general heuri
2739427394
const mergeAudit = await env.DB.prepare("select count(*) as n from audit_events where event_type = 'agent.action.merge'").first<{ n: number }>();
2739527395
expect(mergeAudit?.n).toBeGreaterThanOrEqual(1);
2739627396
// #terminal-outcome-audit: the disposition counter's "merge" action_class, on the actual live call site.
27397-
expect(await renderMetrics()).toContain('gittensory_agent_disposition_total{action_class="merge",autonomy_level="auto",blocker_class="none"} 1');
27397+
expect(await renderMetrics()).toContain('gittensory_agent_disposition_total{action_class="merge",autonomy_level="auto",blocker_class="none",repo="redacted-1"} 1');
2739827398
});
2739927399

2740027400
// #terminal-outcome-audit: end-to-end proof that the LIVE runAgentMaintenancePlanAndExecute call site (not just
@@ -27468,7 +27468,7 @@ describe("auto-action convergence: end-to-end plan+execute for the general heuri
2746827468
// early return -- this is the exact "hold, but no audit_events row at all" shape (the breaker downgrade
2746927469
// leaves no merge/close action) that previously had zero aggregate signal. close autonomy is unset in this
2747027470
// repo's settings (only merge/approve are configured), so it resolves to the default "observe".
27471-
expect(await renderMetrics()).toContain('gittensory_agent_disposition_total{action_class="hold",autonomy_level="observe",blocker_class="none"} 1');
27471+
expect(await renderMetrics()).toContain('gittensory_agent_disposition_total{action_class="hold",autonomy_level="observe",blocker_class="none",repo="redacted-1"} 1');
2747227472
const holdAudit = await env.DB.prepare("select detail, metadata_json from audit_events where event_type = 'agent.action.hold' order by created_at desc limit 1").first<{ detail: string; metadata_json: string }>();
2747327473
expect(holdAudit?.detail).toBe("auto-action held by precision circuit breaker");
2747427474
expect(JSON.parse(holdAudit?.metadata_json ?? "{}")).toMatchObject({

0 commit comments

Comments
 (0)