Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

docs(test): state why one alert assertion was kept and the other deleted\n\nComment-only. The two `queryByRole('alert')` assertions in this file look\nidentical and one was deleted in review, so the file now says what separates\nthem, and it is falsifiability rather than intent.\n\nIn the recovery test the alert was absent after a SUCCESSFUL recovery, and\nwould have been absent whether or not `setError(null)` ran — in both the broken\nand the fixed product. No change to Brain.tsx could make it fail. That one is\ngone.\n\nIn the characterisation test the alert is absent after a FAILED refresh, and\nabsent *because of* BUG-W4-3: the render cannot reach the alert branch while\n`graph` stays truthy, and the catch never clears `graph`. Fixing it — surfacing\nthe error beside stale data, or clearing `graph` on error — makes an alert\nappear and this line fail, which is the notification the test exists to give.\n\nMy previous comment claimed only "the unreachability IS the defect", which is\nnot that argument. Prompted by @YellowSnnowmann's review.\n

M3gA-Mind90ef8f721da2
diff --git a/app/src/pages/__tests__/Brain.errorRecovery.test.tsx b/app/src/pages/__tests__/Brain.errorRecovery.test.tsx
index 3c67b545f9..908971b01c 100644
--- a/app/src/pages/__tests__/Brain.errorRecovery.test.tsx
+++ b/app/src/pages/__tests__/Brain.errorRecovery.test.tsx
@@ -174,12 +174,24 @@ describe('Brain graph — transient failure recovery', () => {
// error — this test goes red and must be rewritten to assert whichever
// was chosen. That is the intent: right now the swallow is invisible.
//
- // The alert assertion below is STRUCTURAL, not behavioural: the render is
- // `graph ? <graph> : error ? <alert> : null`, so with `graph` truthy the
- // alert branch is unreachable whatever `error` holds. That unreachability
- // IS the defect, which is why it is asserted here and was deleted from the
- // recovery test above (where it proved nothing) — thanks to @YellowSnnowmann
- // for catching the difference.
+ // The alert assertion below looks like the one deleted from the recovery
+ // test above, and the difference is FALSIFIABILITY, not intent.
+ //
+ // Up there, the alert was absent after a SUCCESSFUL recovery — and it would
+ // have been absent whether or not `setError(null)` ran, in both the broken
+ // and the fixed product. No change to `Brain.tsx` could have made it fail,
+ // which is what made it worthless.
+ //
+ // Here the alert is absent after a FAILED refresh, and it is absent
+ // *because of BUG-W4-3*: `graph ? <graph> : error ? <alert> : null` cannot
+ // reach the alert branch while `graph` stays truthy, and the catch at
+ // `Brain.tsx:108-112` never clears `graph`. Fix that — surface the error
+ // beside the stale data, or clear `graph` on error — and an alert appears
+ // and this line fails. It is the notification, which is exactly the job.
+ //
+ // Thanks to @YellowSnnowmann for forcing the distinction; I had only
+ // asserted "the unreachability is the defect", which is not the same
+ // argument.
expect(screen.getByTestId('memory-graph')).toHaveTextContent('nodes:3');
expect(screen.queryByRole('alert')).not.toBeInTheDocument();
});