test(gate): pin cross-implementation eventId vectors against GateTest #5625
1 changed file+33−1
Modifiedsrc/__tests__/gatetest-base-sha.test.ts+33−1View fileUnifiedSplit
@@ -16,7 +16,7 @@
1616 */
1717
1818import { afterEach, beforeEach, describe, expect, it } from "bun:test";
19import { notifyGateTestOfPush, runGateTestScan } from "../lib/gate";
19import { gateTestEventId, notifyGateTestOfPush, runGateTestScan } from "../lib/gate";
2020
2121const origFetch = globalThis.fetch;
2222const origUrl = process.env.GATETEST_URL;
@@ -133,3 +133,35 @@ describe("gateTestEventId — the idempotency key GateTest dedupes on", () => {
133133 expect(lastBody?.eventId).not.toBe(pushId);
134134 });
135135});
136
137describe("gateTestEventId — cross-implementation vectors (GateTest derives the same ids)", () => {
138 // GateTest independently derives an eventId for legacy bodies that arrive
139 // without one (gatetest@0737dc32), using the same six-input recipe. These
140 // literals were confirmed byte-identical against their implementation on
141 // 2026-09-02 — if one of these ever fails, the two sides have drifted and
142 // legacy retries will double-scan. Do not "fix" the expected values;
143 // coordinate with the GateTest repo (crclabs-hq/GateTest) instead.
144 const vec = {
145 repository: "ccantynz-alt/Gluecron.com",
146 ref: "refs/heads/main",
147 sha: "a".repeat(40),
148 };
149
150 it("vector A: with base, async", () => {
151 expect(
152 gateTestEventId({ ...vec, baseSha: "b".repeat(40), mode: "async" })
153 ).toBe("e55cfa53-e8fc-acba-f076-550ac4536180");
154 });
155
156 it("vector B: base omitted, async", () => {
157 expect(gateTestEventId({ ...vec, mode: "async" })).toBe(
158 "e3a07149-0dd0-7e8d-a9f6-10c26d507f40"
159 );
160 });
161
162 it("vector C: with base, blocking", () => {
163 expect(
164 gateTestEventId({ ...vec, baseSha: "b".repeat(40), mode: "blocking" })
165 ).toBe("ae845bf2-d76c-4e1b-cc2b-81a4023def58");
166 });
167});
136168
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts