From 365a6def19de56f5bf91f565108e286beefad723 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 12 Oct 2026 15:03:03 -0500 Subject: [PATCH] Isolate historical instruction fixture reads from ambient Git state Co-Authored-By: Paperclip --- .../native-instruction-consolidation.test.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/runner-e2e/native-instruction-consolidation.test.ts b/tests/runner-e2e/native-instruction-consolidation.test.ts index 407ed385ed1..4096905dba6 100644 --- a/tests/runner-e2e/native-instruction-consolidation.test.ts +++ b/tests/runner-e2e/native-instruction-consolidation.test.ts @@ -2,12 +2,13 @@ import { execFileSync } from "node:child_process"; import { createHash } from "node:crypto"; import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; -import { join } from "node:path"; +import { join, resolve } from "node:path"; import { pathToFileURL } from "node:url"; import { describe, expect, it } from "vitest"; import { runnerSuites, buildRunnerMatrix } from "./catalog.js"; import { gradeNativeDefault, NATIVE_MASTER_DEFAULT_SHA256 } from "./native-completion-defaults.js"; import { nativeCompletionTasks } from "./native-completion-cases.js"; +import { nativeCompletionPreflightEnvironment } from "./native-completion-admission.js"; import { assertNativeInstructionLineage, assertNativeInstructionSelection, nativeInstructionVariant, validateNativeInstructionMeasurement, NATIVE_INSTRUCTION_BASE_SHA, NATIVE_INSTRUCTION_DEFAULT_SHA256, NATIVE_INSTRUCTION_SUITE, NATIVE_INSTRUCTION_VARIANTS } from "./native-instruction-consolidation.js"; describe("native instruction comparison admission", () => { @@ -67,12 +68,15 @@ describe("native instruction comparison admission", () => { }); it("accepts each complete source variant and rejects a mixed variant", () => { const files = Object.keys(NATIVE_INSTRUCTION_VARIANTS.baseline); - const baseline = new Map(files.map(file => [file, execFileSync("git", ["show", `${NATIVE_INSTRUCTION_BASE_SHA}:${file}`])])); + const historicalFile = (sha: string, file: string) => execFileSync("git", ["--no-replace-objects", "show", `${sha}:${file}`], { + cwd: resolve(import.meta.dirname, "../.."), env: nativeCompletionPreflightEnvironment(process.env), timeout: 30_000, + }); + const baseline = new Map(files.map(file => [file, historicalFile(NATIVE_INSTRUCTION_BASE_SHA, file)])); expect(nativeInstructionVariant(file => baseline.get(file)!)).toBe("baseline"); // This historical admission intentionally rejects later production changes. // Exercise the retained qualified tree rather than requiring HEAD to remain // one of this completed comparison's frozen variants forever. - const candidate = new Map(files.map(file => [file, execFileSync("git", ["show", `16ef1a5744b23bb043a8b286e6288921da1de98f:${file}`])])); + const candidate = new Map(files.map(file => [file, historicalFile("16ef1a5744b23bb043a8b286e6288921da1de98f", file)])); const currentVariant = nativeInstructionVariant(file => candidate.get(file)!); expect(["baseline", "candidate", "corrected", "feedback", "opencodeFeedback", "opencodeFeedbackSettlement", "opencodeFeedbackResponses"]).toContain(currentVariant); candidate.set(files[0]!, currentVariant === "candidate" ? baseline.get(files[0]!)! : Buffer.from("unknown source"));