mirror of
https://github.com/garrytan/gbrain.git
synced 2026-07-31 04:07:52 +00:00
After merging origin/master (which landed v0.40.8.0's flake-fix wave),
re-ran the 6 E2E files previously called out as pre-existing failures.
v0.40.8.0 had already fixed 3; the remaining 3 had real root causes:
1. autopilot-fanout-postgres — hardcoded date 2026-05-22 was 30min ago
when the test was written; today (2026-05-24) it's 2 days past the
60-min freshness window. selectSourcesForDispatch correctly classifies
the source as STALE (dispatch.length=1) instead of FRESH (length=0).
Fix: replace literal date with Date.now() - 30 * 60 * 1000 so the
timestamp stays relative-fresh forever.
2. ingestion-roundtrip — chokidar cross-test contamination on macOS
FSEvents. Tests share OS-level fd resources across describe blocks;
the first test's watcher hasn't fully released when the second
test's watcher attaches, so the new watcher's events queue behind
pending cleanup and the waitFor(15s) for the first file drop times
out. Fixes:
- Move fs.mkdirSync(inboxDir) BEFORE createInboxFolderSource +
daemon.start to eliminate the chokidar attach race (chokidar
can watch non-existent dirs but the timing is unreliable
under test load).
- Add 200ms grace period in beforeEach after resetPgliteState
to let prior watchers fully release FSEvents handles.
- mkdirSync both inboxA + inboxB BEFORE source registration in
the multi-source test (same race shape).
- Bump waitFor timeouts 6s → 15s for fs.watch flake tolerance.
3. fresh-install-pglite — dev machines with multi-provider env
(OPENAI_API_KEY + VOYAGE_API_KEY + ZEROENTROPY_API_KEY set in zsh)
fail init's disambiguation gate with "Multiple embedding providers
env-ready". The test sets ZE_API_KEY but doesn't NEGATE the others.
Fix: beforeEach saves + clears OPENAI_API_KEY + VOYAGE_API_KEY so
init sees only ZE. afterEach restores. Hermetic per dev machine.
4. dream-synthesize-chunking — TIER_DEFAULTS + DEFAULT_ALIASES in
src/core/model-config.ts had BARE Anthropic model ids (e.g.
'claude-sonnet-4-6' instead of 'anthropic:claude-sonnet-4-6'). The
v0.40.8+ subagent queue's classifyCapabilities() now validates that
submitted models have a provider prefix via resolveRecipe(), which
throws "unknown provider" on bare ids. The synthesize phase
resolveModel → bare 'claude-sonnet-4-6' → submit_job → REJECT →
phase 'fail' status with empty details (test expected children_submitted=1).
Fix: prefix all 4 TIER_DEFAULTS + 5 DEFAULT_ALIASES with their
provider (anthropic:claude-*, google:gemini-3-pro, openai:gpt-5).
Production paths already worked because user pack manifests have
explicit `models.tier.subagent = anthropic:...`; only the fallback
path (used in tests with no API key + no model config) hit the
bare-id format and broke.
Verification (all run against DATABASE_URL=...:5434/gbrain_test):
test/e2e/autopilot-fanout-postgres.test.ts → 6/6 pass
test/e2e/dream-cycle-phase-order-pglite.test.ts → 5/5 pass
test/e2e/dream-synthesize-chunking.test.ts → 4/4 pass
test/e2e/fresh-install-pglite.test.ts → 2/2 pass
test/e2e/http-transport.test.ts → 8/8 pass
test/e2e/ingestion-roundtrip.test.ts → 3/3 pass
test/e2e/mechanical.test.ts → 78/78 pass
Total: 106/106 pass, 0 fail.
Adjacent unit tests verified green:
test/anthropic-model-ids.test.ts → 6/6 pass
test/model-config.serial.test.ts → 19/19 pass
typecheck clean.
Plan: v0.41 wave (~/.claude/plans/system-instruction-you-are-working-toasty-milner.md).
Post-merge polish — every E2E failure surfaced in the v0.41 ship reports is now green.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>