mirror of
https://github.com/garrytan/gbrain.git
synced 2026-07-27 22:15:33 +00:00
fix(e2e): align dream-cycle-phase-order + onboard-full-flow with v0.41/v0.42 reality
Two stale E2E assertion files surfaced by a full local E2E run against
real Postgres (the gbrain-test-pg container on port 5434). Neither file
is in the CI E2E job (CI only runs mechanical.test.ts + mcp.test.ts +
skills.test.ts + zeroentropy-live.test.ts), so the drift has been latent.
1. `test/e2e/dream-cycle-phase-order-pglite.test.ts`
EXPECTED_PHASES was missing 4 phases that landed in master since the
list was last revised:
- extract_atoms (v0.41 T9 — atom extraction, after extract_facts)
- synthesize_concepts (v0.41 T9 — concept synthesis, after patterns)
- conversation_facts_backfill (v0.41.11.0, after calibration_profile)
- skillopt (v0.42.0.0 — self-evolving skills, between
conversation_facts_backfill and embed)
Updated to 21 entries in the actual runtime dispatch order (matches
ALL_PHASES exactly). 5/5 tests in the file pass after.
2. `test/e2e/onboard-full-flow.test.ts`
`runAllOnboardChecks` shape test asserted exactly 4 checks; v0.42's
type-unification cathedral (PR #1542, T13-T15) added 3 more
(`pack_upgrade_available`, `type_proliferation`, `dangling_aliases`)
for a total of 7. And `empty brain returns 0 remediations` regressed
because `pack_upgrade_available` can emit a manual_only remediation
on brains where gbrain-base@1.x is active and gbrain-base-v2 is
registered as a successor. Tightened that assertion to `total <= 1`
AND kept a per-check guard asserting takes_count remediations stay 0
(the original test's load-bearing claim — A12 two-gate consent).
13/13 tests in the file pass after.
Honest scope: 4 other E2E files still fail locally after this commit
(cycle.test.ts, dream.test.ts, phantom-redirect.test.ts,
sync-lock-recovery.test.ts), each for a distinct pre-existing master
bug unrelated to v0.42 skillopt work:
- cycle.test.ts (5 fails): PostgresEngine.getConfig falls back to
db.getConnection() singleton via the `get sql()` getter when no
poolSize is set; the new conversation_facts_backfill phase chain
hits this fallback even though the test's setupDB() connects both
the singleton AND the engine. Race condition between the test's
singleton lifecycle and the phase's getConfig call. Deeper fix
needed in PostgresEngine.getConfig (use this._sql directly with
explicit fallback only on user-driven CLI paths).
- dream.test.ts (1 fail): expects "concepts/testing" slug to appear
in dream cycle output, gets empty array. Related to v0.42 concept
type-unification semantics.
- phantom-redirect.test.ts (2 fails): concurrent-sync race +
postgres-js text-string embedding survival. Master-level data-path
bug; would need its own fix wave.
- sync-lock-recovery.test.ts (1 fail): `gbrain sync --break-lock
--all` exits 0 but test expects 1 with a shell-loop hint. CLI
behavior changed in a master commit; need to either restore the
refusal behavior or update the assertion.
None of these 4 block CI (E2E job doesn't run them). Filed as a
TODOS.md entry for a follow-up wave; the 2 in this commit are the
ones that mirror v0.42 work landing.
Local: 130/136 E2E files green, 927/940 tests pass (was 925/940
before these fixes; the 2 files this commit fixes added 7 newly-
passing tests).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
cceeacb500
commit
4d7210778e
@@ -113,13 +113,17 @@ const EXPECTED_PHASES: CyclePhase[] = [
|
|||||||
'synthesize',
|
'synthesize',
|
||||||
'extract',
|
'extract',
|
||||||
'extract_facts', // v0.32.2 — reconcile fence → DB facts index
|
'extract_facts', // v0.32.2 — reconcile fence → DB facts index
|
||||||
|
'extract_atoms', // v0.41 T9 — atom extraction (pack-gated)
|
||||||
'resolve_symbol_edges', // v0.33.3 — within-file symbol resolution
|
'resolve_symbol_edges', // v0.33.3 — within-file symbol resolution
|
||||||
'patterns',
|
'patterns',
|
||||||
|
'synthesize_concepts', // v0.41 T9 — concept synthesis (pack-gated)
|
||||||
'recompute_emotional_weight', // v0.29
|
'recompute_emotional_weight', // v0.29
|
||||||
'consolidate', // v0.31
|
'consolidate', // v0.31
|
||||||
'propose_takes', // v0.36.1.0 — hindsight calibration wave
|
'propose_takes', // v0.36.1.0 — hindsight calibration wave
|
||||||
'grade_takes', // v0.36.1.0
|
'grade_takes', // v0.36.1.0
|
||||||
'calibration_profile', // v0.36.1.0
|
'calibration_profile', // v0.36.1.0
|
||||||
|
'conversation_facts_backfill', // v0.41.11.0 — opt-in conversation backfill
|
||||||
|
'skillopt', // v0.42.0.0 — self-evolving skills (default OFF)
|
||||||
'embed',
|
'embed',
|
||||||
'orphans',
|
'orphans',
|
||||||
'schema-suggest', // v0.39.0.0 — passive schema-suggest after orphans
|
'schema-suggest', // v0.39.0.0 — passive schema-suggest after orphans
|
||||||
|
|||||||
@@ -54,15 +54,21 @@ describe('onboard E2E — captureMetric', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('onboard E2E — runAllOnboardChecks', () => {
|
describe('onboard E2E — runAllOnboardChecks', () => {
|
||||||
test('returns all 4 check shapes', async () => {
|
test('returns all 7 check shapes', async () => {
|
||||||
|
// v0.42 (T13-T15): type-unification cathedral added 3 onboard checks
|
||||||
|
// — pack_upgrade_available, type_proliferation, dangling_aliases — for
|
||||||
|
// a total of 7. Pre-v0.42 was 4.
|
||||||
const results = await runAllOnboardChecks(engine);
|
const results = await runAllOnboardChecks(engine);
|
||||||
expect(results.length).toBe(4);
|
expect(results.length).toBe(7);
|
||||||
const names = results.map((r) => r.check.name).sort();
|
const names = results.map((r) => r.check.name).sort();
|
||||||
expect(names).toEqual([
|
expect(names).toEqual([
|
||||||
|
'dangling_aliases',
|
||||||
'embed_staleness',
|
'embed_staleness',
|
||||||
'entity_link_coverage',
|
'entity_link_coverage',
|
||||||
|
'pack_upgrade_available',
|
||||||
'takes_count',
|
'takes_count',
|
||||||
'timeline_coverage',
|
'timeline_coverage',
|
||||||
|
'type_proliferation',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -75,12 +81,20 @@ describe('onboard E2E — runAllOnboardChecks', () => {
|
|||||||
expect(byName.takes_count).toBe('warn'); // 0 takes is a warn
|
expect(byName.takes_count).toBe('warn'); // 0 takes is a warn
|
||||||
});
|
});
|
||||||
|
|
||||||
test('empty brain returns 0 remediations (takes_count gated by bootstrap_enabled=false)', async () => {
|
test('empty brain remediations: takes_count gated, pack_upgrade_available may surface', async () => {
|
||||||
const results = await runAllOnboardChecks(engine);
|
const results = await runAllOnboardChecks(engine);
|
||||||
const total = results.reduce((s, r) => s + r.remediations.length, 0);
|
const total = results.reduce((s, r) => s + r.remediations.length, 0);
|
||||||
// takes_count warns but does NOT emit a remediation because
|
// takes_count warns but does NOT emit a remediation (takes.bootstrap_enabled
|
||||||
// takes.bootstrap_enabled defaults to false (A12 two-gate consent).
|
// defaults to false — A12 two-gate consent).
|
||||||
expect(total).toBe(0);
|
// v0.42 (T13): pack_upgrade_available CAN emit a manual_only remediation
|
||||||
|
// when gbrain-base@1.x is active and gbrain-base-v2 is declared as the
|
||||||
|
// successor (the unify-types Minion handler). Allow 0-1 remediations
|
||||||
|
// depending on whether a successor pack is registered in the test brain.
|
||||||
|
expect(total).toBeLessThanOrEqual(1);
|
||||||
|
const takesRemediations = results
|
||||||
|
.filter((r) => r.check.name === 'takes_count')
|
||||||
|
.reduce((s, r) => s + r.remediations.length, 0);
|
||||||
|
expect(takesRemediations).toBe(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user