Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(test): clear the stale sanitized summary when a drag gate attempt starts

M95a00e50f9af
diff --git a/control-ui/e2e/run-gfs-drag-and-drop.mjs b/control-ui/e2e/run-gfs-drag-and-drop.mjs
index 00b370f57..1057b9af0 100644
--- a/control-ui/e2e/run-gfs-drag-and-drop.mjs
+++ b/control-ui/e2e/run-gfs-drag-and-drop.mjs
@@ -334,6 +334,21 @@ export function writeSanitizedRunSummary({
return summary
}
+/**
+ * Remove every artifact a PREVIOUS attempt left behind, before this attempt
+ * can fail ahead of writing its own.
+ *
+ * The raw report and selection were already cleared at run start; the
+ * SANITIZED SUMMARY was not. A previous PASS summary that survives a launch
+ * which then fails early — refused setup, unreachable endpoint, missing or
+ * unreadable report — reads as evidence for a run that never happened.
+ */
+export function invalidatePreviousAttemptArtifacts(dir) {
+ fs.rmSync(path.join(dir, 'playwright-summary.json'), { force: true })
+ fs.rmSync(path.join(dir, 'playwright-report.json'), { force: true })
+ fs.rmSync(path.join(dir, 'playwright-selection.json'), { force: true })
+}
+
/** Bounded reachability probe. Never prints the response body. */
export async function probeReachable(url, timeoutMs = PROBE_TIMEOUT_MS) {
try {
@@ -395,6 +410,10 @@ function readJson(filePath) {
async function main() {
const env = process.env
+ // A previous attempt's artifacts must not outlive the start of this one,
+ // whichever way it ends: an old PASS summary left behind by an early
+ // failure would read as evidence for a run that never happened.
+ invalidatePreviousAttemptArtifacts(artifactDir())
const problems = collectGateProblems(env)
if (problems.length > 0) {
process.stderr.write('[E2E-GATE] The EvenDrive drag-and-drop gate cannot run:\n')
@@ -424,9 +443,6 @@ async function main() {
const reportPath = path.join(dir, 'playwright-report.json')
const selectionPath = path.join(dir, 'playwright-selection.json')
const playwrightBin = resolvePlaywrightBin()
- // A previous successful run must never supply evidence for a failed launch.
- fs.rmSync(reportPath, { force: true })
- fs.rmSync(selectionPath, { force: true })
// Enumerate the journeys Playwright SELECTS before running them. The run's
// report is reconciled against this inventory, so a report that describes
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index b9d124208..bf3293b71 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.754",
+ "version": "0.1.755",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.754",
+ "version": "0.1.755",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/frontend-components": "file:../packages/frontend-components",
diff --git a/control-ui/package.json b/control-ui/package.json
index 863bcb778..8af4ea507 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.754",
+ "version": "0.1.755",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/control-ui/test/__tests__/gfsDragAndDropGate.test.ts b/control-ui/test/__tests__/gfsDragAndDropGate.test.ts
index ae73c1836..550057070 100644
--- a/control-ui/test/__tests__/gfsDragAndDropGate.test.ts
+++ b/control-ui/test/__tests__/gfsDragAndDropGate.test.ts
@@ -9,6 +9,7 @@ import {
collectGateProblems,
collectReportJourneys,
evaluateGateReport,
+ invalidatePreviousAttemptArtifacts,
tallyReportJourneys,
writeSanitizedRunSummary,
} from '../../e2e/run-gfs-drag-and-drop.mjs'
@@ -301,6 +302,52 @@ describe('EvenDrive drag-and-drop E2E gate', () => {
})
})
+ describe('stale attempt artifacts', () => {
+ it('removes a previous PASS summary when the next attempt starts (success → early failure)', () => {
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gfs-dnd-artifacts-'))
+ try {
+ // A previous attempt completed and passed, leaving its artifacts.
+ const report = journeyReport([{ title: 'journey one' }])
+ writeSanitizedRunSummary({
+ lane: LANE,
+ revision: 'abc123',
+ branch: 'feat/example',
+ command: COMMAND,
+ report,
+ run: { status: 0 },
+ selectedJourneys: collectReportJourneys(report),
+ verdict: 'pass',
+ filePath: path.join(dir, 'playwright-summary.json'),
+ })
+ fs.writeFileSync(path.join(dir, 'playwright-report.json'), '{}')
+ fs.writeFileSync(path.join(dir, 'playwright-selection.json'), '{}')
+ expect(fs.existsSync(path.join(dir, 'playwright-summary.json'))).toBe(true)
+
+ // The next attempt fails before it can write its own summary. The
+ // previous pass must not survive it as apparent evidence.
+ invalidatePreviousAttemptArtifacts(dir)
+ for (const name of [
+ 'playwright-summary.json',
+ 'playwright-report.json',
+ 'playwright-selection.json',
+ ]) {
+ expect(fs.existsSync(path.join(dir, name))).toBe(false)
+ }
+ } finally {
+ fs.rmSync(dir, { recursive: true, force: true })
+ }
+ })
+
+ it('tolerates an artifact directory with nothing to remove', () => {
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gfs-dnd-artifacts-'))
+ try {
+ expect(() => invalidatePreviousAttemptArtifacts(dir)).not.toThrow()
+ } finally {
+ fs.rmSync(dir, { recursive: true, force: true })
+ }
+ })
+ })
+
describe('report inventory', () => {
it('identifies a journey by its file and title path', () => {
const journeys = collectReportJourneys(journeyReport([{ title: 'journey one' }]))
diff --git a/desktop-app/test/__tests__/gfsDragAndDropGate.test.ts b/desktop-app/test/__tests__/gfsDragAndDropGate.test.ts
index 12728d54c..cf476f516 100644
--- a/desktop-app/test/__tests__/gfsDragAndDropGate.test.ts
+++ b/desktop-app/test/__tests__/gfsDragAndDropGate.test.ts
@@ -8,6 +8,7 @@ import {
collectGateProblems,
collectReportJourneys,
evaluateGateReport,
+ invalidatePreviousAttemptArtifacts,
tallyReportJourneys,
writeSanitizedRunSummary,
} from '../e2e-playwright/run-gfs-drag-and-drop.mjs'
@@ -307,6 +308,52 @@ describe('EvenDrive drag-and-drop Desktop E2E gate', () => {
})
})
+ describe('stale attempt artifacts', () => {
+ it('removes a previous PASS summary when the next attempt starts (success → early failure)', () => {
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gfs-dnd-artifacts-'))
+ try {
+ // A previous attempt completed and passed, leaving its artifacts.
+ const report = journeyReport([{ title: 'journey one' }])
+ writeSanitizedRunSummary({
+ lane: LANE,
+ revision: 'abc123',
+ branch: 'feat/example',
+ command: COMMAND,
+ report,
+ run: { status: 0 },
+ selectedJourneys: collectReportJourneys(report),
+ verdict: 'pass',
+ filePath: path.join(dir, 'playwright-summary.json'),
+ })
+ fs.writeFileSync(path.join(dir, 'playwright-report.json'), '{}')
+ fs.writeFileSync(path.join(dir, 'playwright-selection.json'), '{}')
+ expect(fs.existsSync(path.join(dir, 'playwright-summary.json'))).toBe(true)
+
+ // The next attempt fails before it can write its own summary. The
+ // previous pass must not survive it as apparent evidence.
+ invalidatePreviousAttemptArtifacts(dir)
+ for (const name of [
+ 'playwright-summary.json',
+ 'playwright-report.json',
+ 'playwright-selection.json',
+ ]) {
+ expect(fs.existsSync(path.join(dir, name))).toBe(false)
+ }
+ } finally {
+ fs.rmSync(dir, { recursive: true, force: true })
+ }
+ })
+
+ it('tolerates an artifact directory with nothing to remove', () => {
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gfs-dnd-artifacts-'))
+ try {
+ expect(() => invalidatePreviousAttemptArtifacts(dir)).not.toThrow()
+ } finally {
+ fs.rmSync(dir, { recursive: true, force: true })
+ }
+ })
+ })
+
describe('report inventory', () => {
it('identifies a journey by its file and title path', () => {
const journeys = collectReportJourneys(journeyReport([{ title: 'journey one' }]))
diff --git a/desktop-app/test/e2e-playwright/run-gfs-drag-and-drop.mjs b/desktop-app/test/e2e-playwright/run-gfs-drag-and-drop.mjs
index b02661b82..585a7e2bb 100644
--- a/desktop-app/test/e2e-playwright/run-gfs-drag-and-drop.mjs
+++ b/desktop-app/test/e2e-playwright/run-gfs-drag-and-drop.mjs
@@ -348,6 +348,21 @@ export function writeSanitizedRunSummary({
return summary
}
+/**
+ * Remove every artifact a PREVIOUS attempt left behind, before this attempt
+ * can fail ahead of writing its own.
+ *
+ * The raw report and selection were already cleared at run start; the
+ * SANITIZED SUMMARY was not. A previous PASS summary that survives a launch
+ * which then fails early — refused setup, unreachable endpoint, missing or
+ * unreadable report — reads as evidence for a run that never happened.
+ */
+export function invalidatePreviousAttemptArtifacts(dir) {
+ fs.rmSync(path.join(dir, 'playwright-summary.json'), { force: true })
+ fs.rmSync(path.join(dir, 'playwright-report.json'), { force: true })
+ fs.rmSync(path.join(dir, 'playwright-selection.json'), { force: true })
+}
+
/** Bounded reachability probe. Never prints the response body. */
export async function probeReachable(url, timeoutMs = PROBE_TIMEOUT_MS) {
try {
@@ -405,6 +420,10 @@ function artifactDir() {
async function main() {
const env = process.env
+ // A previous attempt's artifacts must not outlive the start of this one,
+ // whichever way it ends: an old PASS summary left behind by an early
+ // failure would read as evidence for a run that never happened.
+ invalidatePreviousAttemptArtifacts(artifactDir())
const problems = collectGateProblems(env)
if (problems.length > 0) {
process.stderr.write('[E2E-GATE] The EvenDrive drag-and-drop gate cannot run:\n')
@@ -433,9 +452,6 @@ async function main() {
const reportPath = path.join(dir, 'playwright-report.json')
const selectionPath = path.join(dir, 'playwright-selection.json')
const playwrightBin = resolvePlaywrightBin()
- // A previous successful run must never supply evidence for a failed launch.
- fs.rmSync(reportPath, { force: true })
- fs.rmSync(selectionPath, { force: true })
// Enumerate the journeys Playwright SELECTS before running them. The run's
// report is reconciled against this inventory, so a report that describes