Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: strip reporter color codes before planning CI crash retries

[._.]/ Adam Eivy9a25539a7fca
diff --git a/scripts/run-ci-tests.js b/scripts/run-ci-tests.js
index d28d21bd29..646081714f 100644
--- a/scripts/run-ci-tests.js
+++ b/scripts/run-ci-tests.js
@@ -1,6 +1,7 @@
#!/usr/bin/env node
import { spawn } from 'child_process';
+import { stripVTControlCharacters } from 'node:util';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import { prepareCliSpawn } from '../server/lib/bufferedSpawn.js';
@@ -28,7 +29,7 @@ const WORKER_CRASH_PATTERN = /Worker exited unexpectedly with exit code \d+.*?wh
const MAX_CAPTURED_OUTPUT = 200_000;
export function extractCrashedTestFile(output) {
- const match = WORKER_CRASH_PATTERN.exec(String(output || ''));
+ const match = WORKER_CRASH_PATTERN.exec(stripVTControlCharacters(String(output || '')));
return match ? match[1].trim() : null;
}
@@ -82,7 +83,7 @@ const ERRORS_SUMMARY_PATTERN = /Errors\s+(\d+)\s+errors?/;
* miss can never mask a real regression.
*/
export function hasOtherTestFailures(output) {
- const text = String(output || '');
+ const text = stripVTControlCharacters(String(output || ''));
const filesSummary = TEST_FILES_SUMMARY_PATTERN.exec(text);
const testsSummary = TESTS_SUMMARY_PATTERN.exec(text);
const errorsSummary = ERRORS_SUMMARY_PATTERN.exec(text);
diff --git a/scripts/run-ci-tests.test.js b/scripts/run-ci-tests.test.js
index cb6c24dbf9..2b46a42527 100644
--- a/scripts/run-ci-tests.test.js
+++ b/scripts/run-ci-tests.test.js
@@ -171,6 +171,14 @@ describe('planCrashRetry', () => {
});
});
+ it('removes reporter color resets from the retry filename', () => {
+ expect(planCrashRetry('server', '\u001b[31m' + CRASH_OUTPUT + '\u001b[39m')).toEqual({
+ retry: true,
+ relPath: 'server/services/sprites/importer.test.js',
+ selector: './services/sprites/importer.test.js',
+ });
+ });
+
it('declines to retry a crash reported in the other workspace', () => {
// A server-shard crash never gets replayed as a client-scoped selector.
expect(planCrashRetry('client', CRASH_OUTPUT)).toEqual({
@@ -209,6 +217,12 @@ describe('hasOtherTestFailures', () => {
))).toBe(true);
});
+ it('parses colored summaries without masking assertion failures', () => {
+ const colored = CLEAN_RUN_SUMMARY.replace(/(\d+ (?:passed|error))/g, '\u001b[32m$1\u001b[39m');
+ expect(hasOtherTestFailures(colored)).toBe(false);
+ expect(hasOtherTestFailures(colored.replace('798 passed', '797 passed | \u001b[31m1 failed'))).toBe(true);
+ });
+
it('reads true when a second, unrelated unhandled error shares the run with the crash', () => {
expect(hasOtherTestFailures(CLEAN_RUN_SUMMARY.replace('1 error', '2 errors'))).toBe(true);
});