From 5fd5ad425e1dd21d42861206f7a2a7b6a28b5d93 Mon Sep 17 00:00:00 2001 From: Daniel Fugere Date: Mon, 30 Nov 2026 16:54:22 +0000 Subject: [PATCH 1/5] fix: reproduce unit tests occupying a Mac heavy lane --- .../xrvxyr-unit-lane-classification/loop.json | 59 +++++++++++++++++++ .../trace.ndjson | 2 + .../with-mac-heavy-test-lane.test.ts | 12 +++- 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 specification/loops/xrvxyr-unit-lane-classification/loop.json create mode 100644 specification/loops/xrvxyr-unit-lane-classification/trace.ndjson diff --git a/specification/loops/xrvxyr-unit-lane-classification/loop.json b/specification/loops/xrvxyr-unit-lane-classification/loop.json new file mode 100644 index 00000000000..5e0c7940040 --- /dev/null +++ b/specification/loops/xrvxyr-unit-lane-classification/loop.json @@ -0,0 +1,59 @@ +{ + "name": "xrvxyr-unit-lane-classification", + "goal": "Keep standard unit checks out of the Mac heavy test lanes while direct E2E and full checks still reserve a lane.", + "createdAt": "2026-11-30T16:46:07.940Z", + "updatedAt": "2026-11-30T16:46:21.984Z", + "template": "bug-fix", + "templateLineage": [ + "bug-fix" + ], + "enforceOrder": true, + "regressionCommits": 1, + "steps": [ + { + "id": "spec", + "title": "Identify the failing behavior, expected behavior, and reproduction.", + "status": "complete", + "completedAt": "2026-11-30T16:46:21.984Z", + "evidence": "The root test:unit shell command reserves a Mac test lane because its exclusion glob contains .e2e.test.; it should use only ordinary resource admission." + }, + { + "id": "coverage", + "title": "Explain why existing standardized tests missed the bug; name the scenario, fixture, lifecycle or assertion gap and reusable test change.", + "status": "pending" + }, + { + "id": "red", + "title": "Strengthen the existing standardized test; commit it before repair, run it failing with loop record --phase red, and preserve the assertion.", + "status": "pending" + }, + { + "id": "implement", + "title": "Implement the smallest repair without weakening the regression test.", + "status": "pending" + }, + { + "id": "green", + "title": "Rerun the same unchanged regression test at a separate fix commit with loop record --phase green; preserve passing proof.", + "status": "pending" + }, + { + "id": "siblings", + "title": "Run harness loop siblings to record the root cause and evaluate the same pattern across committed source.", + "status": "pending" + }, + { + "id": "verify", + "title": "Run relevant project checks and affected UI browser flows with fresh inspected screenshots and no unexpected browser errors; preserve diagnostics and keep pending until proof passes.", + "status": "pending" + } + ], + "evaluators": [ + { + "id": "check", + "title": "Run the project check script.", + "command": "bun run check", + "step": "verify" + } + ] +} diff --git a/specification/loops/xrvxyr-unit-lane-classification/trace.ndjson b/specification/loops/xrvxyr-unit-lane-classification/trace.ndjson new file mode 100644 index 00000000000..6ccd885ab07 --- /dev/null +++ b/specification/loops/xrvxyr-unit-lane-classification/trace.ndjson @@ -0,0 +1,2 @@ +{"event":"loop.created","timestamp":"2026-11-30T16:46:07.940Z","name":"xrvxyr-unit-lane-classification","goal":"Keep standard unit checks out of the Mac heavy test lanes while direct E2E and full checks still reserve a lane.","template":"bug-fix","templateLineage":["bug-fix"]} +{"event":"step.completed","timestamp":"2026-11-30T16:46:21.984Z","loop":"xrvxyr-unit-lane-classification","step":"spec","evidence":"The root test:unit shell command reserves a Mac test lane because its exclusion glob contains .e2e.test.; it should use only ordinary resource admission."} diff --git a/test/utils/execution-runtimes/with-mac-heavy-test-lane.test.ts b/test/utils/execution-runtimes/with-mac-heavy-test-lane.test.ts index c1db45fc6a9..6577e6db14c 100644 --- a/test/utils/execution-runtimes/with-mac-heavy-test-lane.test.ts +++ b/test/utils/execution-runtimes/with-mac-heavy-test-lane.test.ts @@ -14,10 +14,20 @@ test('recognizes the standard suite commands without queuing routine type checks ['bun', 'scripts/run-checks.ts', '--part', 'desktop'], ['sh', '-c', 'PROJECT_REPORTS_ASSET_STORAGE=local playwright test && bun run test:shell'], ['sh', '-c', 'bun run --cwd packages/hub check && bun run --cwd packages/hub test:e2e'], - ['vitest', 'run', 'test/resources-cli.e2e.test.ts'] + ['vitest', 'run', 'test/resources-cli.e2e.test.ts'], + ['sh', '-c', "vitest run --exclude='test/desktop e2e/*.e2e.test.ts' test/cli.e2e.test.ts"], + ['vitest', 'run', '--exclude', 'test/**/*.e2e.test.ts', 'test/cli.e2e.test.ts'] ]; expect(commands.every(isHeavyTestCommand)).toBe(true); expect(isHeavyTestCommand(['sh', '-c', 'tsc --noEmit "$@"', '--'])).toBe(false); + const unitCommands = [ + ['sh', '-c', 'vitest run --exclude "test/**/*.e2e.test.ts" "$@"', '--'], + ['sh', '-c', "vitest run --exclude='test/desktop e2e/*.e2e.test.ts' test/queue.test.ts"], + ['vitest', 'run', '--exclude', 'test/desktop e2e/*.e2e.test.ts', 'test/queue.test.ts'], + ['vitest', 'run', '--exclude=test/**/*.e2e.test.ts', 'test/queue.test.ts'] + ]; + for (const command of unitCommands) + expect(isHeavyTestCommand(command), command.join(' ')).toBe(false); }); test.skipIf(process.platform !== 'darwin')( From fc401d8c8767cc771f99b5f9c1debb0b8bbf25f1 Mon Sep 17 00:00:00 2001 From: Daniel Fugere Date: Mon, 30 Nov 2026 16:54:27 +0000 Subject: [PATCH 2/5] fix: keep unit suites out of Mac heavy test lanes --- .../xrvxyr-unit-lane-classification/loop.json | 14 ++++++++--- .../trace.ndjson | 3 +++ specification/tracker-native-service.md | 25 +++++++++++-------- .../withMacHeavyTestLane.ts | 17 ++++++++++--- 4 files changed, 41 insertions(+), 18 deletions(-) diff --git a/specification/loops/xrvxyr-unit-lane-classification/loop.json b/specification/loops/xrvxyr-unit-lane-classification/loop.json index 5e0c7940040..9443658321f 100644 --- a/specification/loops/xrvxyr-unit-lane-classification/loop.json +++ b/specification/loops/xrvxyr-unit-lane-classification/loop.json @@ -2,7 +2,7 @@ "name": "xrvxyr-unit-lane-classification", "goal": "Keep standard unit checks out of the Mac heavy test lanes while direct E2E and full checks still reserve a lane.", "createdAt": "2026-11-30T16:46:07.940Z", - "updatedAt": "2026-11-30T16:46:21.984Z", + "updatedAt": "2026-11-30T16:49:31.888Z", "template": "bug-fix", "templateLineage": [ "bug-fix" @@ -20,17 +20,23 @@ { "id": "coverage", "title": "Explain why existing standardized tests missed the bug; name the scenario, fixture, lifecycle or assertion gap and reusable test change.", - "status": "pending" + "status": "complete", + "completedAt": "2026-11-30T16:47:03.973Z", + "evidence": "The existing heavy command classification case has a positive E2E path and a negative tsc case. Add the real unit wrapper plus direct and shell exclude forms with positive E2E controls." }, { "id": "red", "title": "Strengthen the existing standardized test; commit it before repair, run it failing with loop record --phase red, and preserve the assertion.", - "status": "pending" + "status": "complete", + "completedAt": "2026-11-30T16:48:55.027Z", + "evidence": "10b585a8b failed the standard unit wrapper assertion: expected true to be false. The two macOS-only cases were skipped on Linux." }, { "id": "implement", "title": "Implement the smallest repair without weakening the regression test.", - "status": "pending" + "status": "complete", + "completedAt": "2026-11-30T16:49:31.888Z", + "evidence": "Exclude Vitest glob values from lane detection and preserve explicit E2E targets and suite commands." }, { "id": "green", diff --git a/specification/loops/xrvxyr-unit-lane-classification/trace.ndjson b/specification/loops/xrvxyr-unit-lane-classification/trace.ndjson index 6ccd885ab07..30eaaa14868 100644 --- a/specification/loops/xrvxyr-unit-lane-classification/trace.ndjson +++ b/specification/loops/xrvxyr-unit-lane-classification/trace.ndjson @@ -1,2 +1,5 @@ {"event":"loop.created","timestamp":"2026-11-30T16:46:07.940Z","name":"xrvxyr-unit-lane-classification","goal":"Keep standard unit checks out of the Mac heavy test lanes while direct E2E and full checks still reserve a lane.","template":"bug-fix","templateLineage":["bug-fix"]} {"event":"step.completed","timestamp":"2026-11-30T16:46:21.984Z","loop":"xrvxyr-unit-lane-classification","step":"spec","evidence":"The root test:unit shell command reserves a Mac test lane because its exclusion glob contains .e2e.test.; it should use only ordinary resource admission."} +{"event":"step.completed","timestamp":"2026-11-30T16:47:03.973Z","loop":"xrvxyr-unit-lane-classification","step":"coverage","evidence":"The existing heavy command classification case has a positive E2E path and a negative tsc case. Add the real unit wrapper plus direct and shell exclude forms with positive E2E controls."} +{"event":"step.completed","timestamp":"2026-11-30T16:48:55.027Z","loop":"xrvxyr-unit-lane-classification","step":"red","evidence":"10b585a8b failed the standard unit wrapper assertion: expected true to be false. The two macOS-only cases were skipped on Linux."} +{"event":"step.completed","timestamp":"2026-11-30T16:49:31.888Z","loop":"xrvxyr-unit-lane-classification","step":"implement","evidence":"Exclude Vitest glob values from lane detection and preserve explicit E2E targets and suite commands."} diff --git a/specification/tracker-native-service.md b/specification/tracker-native-service.md index ab0f600aeb8..5ab16e8eb30 100644 --- a/specification/tracker-native-service.md +++ b/specification/tracker-native-service.md @@ -429,11 +429,13 @@ emergency value of 5. Carry forward 20 on `daniel-primary-mbp`. Preserve any explicit `nonHarborSessionLimit` if configured. Verify both installed ceilings and each host's RAM-limited free slots after activation. -Managed full checks and browser suites use the separate macOS heavy test -lanes. On a Mac with at least 10 cores, the first two suites can run at -background priority and subsequent suites wait for a free lane and lower -load. Use `harness resources run --heavy-test -- ` for other heavy -suites. In a managed session, `tracker host-work ssh auto -- ` +Managed full checks and browser or E2E suites share the macOS account's +heavy test lanes across worktrees. A Mac with at least 10 cores has two +lanes. Smaller Macs have one. Suites run at background priority and wait +for a free lane and acceptable load before starting. Standard unit suites +use ordinary CPU and RAM admission. Use +`harness resources run --heavy-test -- ` for other heavy suites. +In a managed session, `tracker host-work ssh auto -- ` chooses an eligible Mac for a portable CPU-heavy command and runs it through the managed lane with the estimated budget. Remote execution uses the existing SSH route for that Tracker computer. The command must use paths @@ -533,14 +535,17 @@ or recovery attempt. An external driver owns its own host and is not sampled. and 1% of inodes free. An unreadable filesystem holds the launch. - On the primary Mac, MB2 and the box, the home filesystem needs 30 GB free. Disk percentage does not hold a launch. -- The Macs need at least 25% free memory (unknown holds) and a one-minute load - under 15. They also hold when the five-minute load exceeds 1.5 per core. Other - hosts use that sustained-load threshold and hold while free memory is under 10%. +- Mac session launches need a known free-memory reading of at least 25% and + enough RAM above the reserve for one more session. New Mac heavy test lanes + wait while the one-minute load is at least 15 or the five-minute load exceeds + 1.5 per core. Other hosts apply that sustained-load threshold to session + launches and hold while free memory is under 10%. - The shared box also waits while busy: load over 1.0 per core, free memory under 15%, or under 100,000 or 3% free inodes. -On MB2, Harbor is the home project and its requests are considered first. All -other work gets one session at a time, only while the one-minute load is under 4. Its worker runs under `nice -n 10` with a four-core budget in +On MB2, Harbor is the home project. An explicitly configured +`nonHarborSessionLimit` caps concurrent sessions for other projects. Their +workers run under `nice -n 10` with a four-core budget in `TRACKER_CPU_BUDGET` and the CMake, Cargo, Make, OpenMP, Rayon and Go parallelism variables, and its brief states the budget. These cap cooperating build tools; they do not enforce a hard CPU limit. diff --git a/src/utils/execution-runtimes/withMacHeavyTestLane.ts b/src/utils/execution-runtimes/withMacHeavyTestLane.ts index 6e6081cee8d..1ef409013e9 100644 --- a/src/utils/execution-runtimes/withMacHeavyTestLane.ts +++ b/src/utils/execution-runtimes/withMacHeavyTestLane.ts @@ -19,13 +19,22 @@ const legacyLock = '.harness-full-check.lock'; const lockBusy = 75; // The runner argv and shell scripts used by Harness package commands. -const heavyRunner = - /\bplaywright\s+test\b|\btest:(?:e2e|native|package|all)\b|\bvitest\s+run\b[^;\n]*\.e2e\.test\./; +const heavyRunner = /\bplaywright\s+test\b|\btest:(?:e2e|native|package|all)\b/; +const vitestE2e = /\bvitest\s+run\b[^;\n&|]*\.e2e\.test\./; +const shellExclusion = /(^|\s)--exclude(?:=|[ \t]+)(?:"[^"\n]*"|'[^'\n]*'|[^\s;&|]+)/g; export function isHeavyTestCommand(args: readonly string[]): boolean { if (args[0] === 'bun' && args[1] === 'scripts/run-checks.ts') return true; - if (args[0] === 'sh' && args[1] === '-c') return heavyRunner.test(args[2] ?? ''); - return heavyRunner.test(args.join(' ')); + if (args[0] === 'sh' && args[1] === '-c') { + const script = args[2] ?? ''; + return heavyRunner.test(script) || vitestE2e.test(script.replace(shellExclusion, '$1')); + } + if (heavyRunner.test(args.join(' '))) return true; + const filters = args.filter( + (arg, index) => + arg !== '--exclude' && !arg.startsWith('--exclude=') && args[index - 1] !== '--exclude' + ); + return vitestE2e.test(filters.join(' ')); } /** Apply the same lane budget across worktrees and resource homes for the OS account. */ From 9b66d1bf5086bbf6b8c50461b77e048efc1d4413 Mon Sep 17 00:00:00 2001 From: Daniel Fugere Date: Mon, 30 Nov 2026 16:54:30 +0000 Subject: [PATCH 3/5] chore: record heavy test lane regression proof --- .../loops/xrvxyr-unit-lane-classification/loop.json | 10 +++++----- .../loops/xrvxyr-unit-lane-classification/trace.ndjson | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/specification/loops/xrvxyr-unit-lane-classification/loop.json b/specification/loops/xrvxyr-unit-lane-classification/loop.json index 9443658321f..fb597ebf475 100644 --- a/specification/loops/xrvxyr-unit-lane-classification/loop.json +++ b/specification/loops/xrvxyr-unit-lane-classification/loop.json @@ -2,11 +2,9 @@ "name": "xrvxyr-unit-lane-classification", "goal": "Keep standard unit checks out of the Mac heavy test lanes while direct E2E and full checks still reserve a lane.", "createdAt": "2026-11-30T16:46:07.940Z", - "updatedAt": "2026-11-30T16:49:31.888Z", + "updatedAt": "2026-11-30T16:52:18.028Z", "template": "bug-fix", - "templateLineage": [ - "bug-fix" - ], + "templateLineage": ["bug-fix"], "enforceOrder": true, "regressionCommits": 1, "steps": [ @@ -41,7 +39,9 @@ { "id": "green", "title": "Rerun the same unchanged regression test at a separate fix commit with loop record --phase green; preserve passing proof.", - "status": "pending" + "status": "complete", + "completedAt": "2026-11-30T16:52:18.028Z", + "evidence": "Committed f1385bada passed the unchanged classification regression in the same Linux Bun profile as the red record." }, { "id": "siblings", diff --git a/specification/loops/xrvxyr-unit-lane-classification/trace.ndjson b/specification/loops/xrvxyr-unit-lane-classification/trace.ndjson index 30eaaa14868..892e7442918 100644 --- a/specification/loops/xrvxyr-unit-lane-classification/trace.ndjson +++ b/specification/loops/xrvxyr-unit-lane-classification/trace.ndjson @@ -3,3 +3,4 @@ {"event":"step.completed","timestamp":"2026-11-30T16:47:03.973Z","loop":"xrvxyr-unit-lane-classification","step":"coverage","evidence":"The existing heavy command classification case has a positive E2E path and a negative tsc case. Add the real unit wrapper plus direct and shell exclude forms with positive E2E controls."} {"event":"step.completed","timestamp":"2026-11-30T16:48:55.027Z","loop":"xrvxyr-unit-lane-classification","step":"red","evidence":"10b585a8b failed the standard unit wrapper assertion: expected true to be false. The two macOS-only cases were skipped on Linux."} {"event":"step.completed","timestamp":"2026-11-30T16:49:31.888Z","loop":"xrvxyr-unit-lane-classification","step":"implement","evidence":"Exclude Vitest glob values from lane detection and preserve explicit E2E targets and suite commands."} +{"event":"step.completed","timestamp":"2026-11-30T16:52:18.028Z","loop":"xrvxyr-unit-lane-classification","step":"green","evidence":"Committed f1385bada passed the unchanged classification regression in the same Linux Bun profile as the red record."} From 5dda9b9cc0ad32e220af1ed7019819f036e96425 Mon Sep 17 00:00:00 2001 From: dafuga Date: Mon, 30 Nov 2026 17:46:25 +0000 Subject: [PATCH 4/5] fix: reproduce absolute shell unit lane classification --- test/utils/execution-runtimes/with-mac-heavy-test-lane.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/utils/execution-runtimes/with-mac-heavy-test-lane.test.ts b/test/utils/execution-runtimes/with-mac-heavy-test-lane.test.ts index 6577e6db14c..212d4139ad8 100644 --- a/test/utils/execution-runtimes/with-mac-heavy-test-lane.test.ts +++ b/test/utils/execution-runtimes/with-mac-heavy-test-lane.test.ts @@ -15,13 +15,14 @@ test('recognizes the standard suite commands without queuing routine type checks ['sh', '-c', 'PROJECT_REPORTS_ASSET_STORAGE=local playwright test && bun run test:shell'], ['sh', '-c', 'bun run --cwd packages/hub check && bun run --cwd packages/hub test:e2e'], ['vitest', 'run', 'test/resources-cli.e2e.test.ts'], - ['sh', '-c', "vitest run --exclude='test/desktop e2e/*.e2e.test.ts' test/cli.e2e.test.ts"], + ['/bin/sh', '-c', "vitest run --exclude='test/desktop e2e/*.e2e.test.ts' test/cli.e2e.test.ts"], ['vitest', 'run', '--exclude', 'test/**/*.e2e.test.ts', 'test/cli.e2e.test.ts'] ]; expect(commands.every(isHeavyTestCommand)).toBe(true); expect(isHeavyTestCommand(['sh', '-c', 'tsc --noEmit "$@"', '--'])).toBe(false); const unitCommands = [ ['sh', '-c', 'vitest run --exclude "test/**/*.e2e.test.ts" "$@"', '--'], + ['/bin/sh', '-c', 'vitest run --exclude "test/**/*.e2e.test.ts" test/queue.test.ts'], ['sh', '-c', "vitest run --exclude='test/desktop e2e/*.e2e.test.ts' test/queue.test.ts"], ['vitest', 'run', '--exclude', 'test/desktop e2e/*.e2e.test.ts', 'test/queue.test.ts'], ['vitest', 'run', '--exclude=test/**/*.e2e.test.ts', 'test/queue.test.ts'] From af544a2deaa0633d6aff7e1bb8993d0d093a1c68 Mon Sep 17 00:00:00 2001 From: dafuga Date: Mon, 30 Nov 2026 17:47:17 +0000 Subject: [PATCH 5/5] fix: recognize absolute sh in Mac test lane classification --- src/utils/execution-runtimes/withMacHeavyTestLane.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/execution-runtimes/withMacHeavyTestLane.ts b/src/utils/execution-runtimes/withMacHeavyTestLane.ts index 1ef409013e9..f303a00f36c 100644 --- a/src/utils/execution-runtimes/withMacHeavyTestLane.ts +++ b/src/utils/execution-runtimes/withMacHeavyTestLane.ts @@ -25,7 +25,7 @@ const shellExclusion = /(^|\s)--exclude(?:=|[ \t]+)(?:"[^"\n]*"|'[^'\n]*'|[^\s;& export function isHeavyTestCommand(args: readonly string[]): boolean { if (args[0] === 'bun' && args[1] === 'scripts/run-checks.ts') return true; - if (args[0] === 'sh' && args[1] === '-c') { + if ((args[0] === 'sh' || args[0] === '/bin/sh') && args[1] === '-c') { const script = args[2] ?? ''; return heavyRunner.test(script) || vitestE2e.test(script.replace(shellExclusion, '$1')); }