test(idle): the idle pin says WHICH brain narrated, and asserts the attributable half first
Some checks failed
CI / Node 22 (push) Waiting to run
CI / Node 24 (push) Waiting to run
CI / Integration + conformance (Node 22) (push) Waiting to run
CI / Bun (latest) (push) Waiting to run
Delta Gate / Delta gate — candidate vs control (push) Failing after 8s
Some checks failed
CI / Node 22 (push) Waiting to run
CI / Node 24 (push) Waiting to run
CI / Integration + conformance (Node 22) (push) Waiting to run
CI / Bun (latest) (push) Waiting to run
Delta Gate / Delta gate — candidate vs control (push) Failing after 8s
"An idle brain prints nothing" is pinned two ways in this case, and only one of them is attributable. The spies are bound to THIS brain's providers, so they answer "did this brain flush?" exactly. The console filters cannot: the gate config runs the whole suite in ONE process (pool: 'forks', singleFork: true — verified, two files report the same process.pid), so console.log carries the narration of every brain alive in that process, including one a previous file opened and never closed whose unref'd cadence timer is still doing honest work. Ordered as it was, a neighbour's honest flush and this engine breaking its own law produced the same red, with a message that truncated the evidence to "[ …(4) ]" — no way to tell which had happened, and nothing to chase. So the spies assert first: their failure means the engine broke the law. The console assertion follows, keeps both patterns, and carries the captured lines in its message. vitest prefixes each stdout block with "stdout | <file> > <test>", so the lines plus the surrounding log name the brain that printed them, and the next red is diagnosable from the log alone. No assertion is removed and no window is widened — the same two laws are pinned, in the order that makes a failure readable.
This commit is contained in:
parent
d7444ae804
commit
87d3a945a5
1 changed files with 27 additions and 2 deletions
|
|
@ -88,11 +88,36 @@ describe('an idle brain costs nothing', () => {
|
|||
}
|
||||
|
||||
// (a) + (b): nothing ran, nothing was said.
|
||||
expect(logged.filter((l) => /All indexes flushed to disk/.test(l))).toEqual([])
|
||||
expect(logged.filter((l) => /Flushing Brainy indexes/.test(l))).toEqual([])
|
||||
//
|
||||
// THE SPIES COME FIRST, AND THEY ARE THE ATTRIBUTABLE HALF. They are bound
|
||||
// to THIS brain's providers, so they answer "did this brain flush?" and
|
||||
// nothing else. The console filters below cannot: the gate config runs the
|
||||
// whole suite in ONE process (`pool: 'forks'`, `singleFork: true`), so
|
||||
// `console.log` carries the narration of every brain alive in that
|
||||
// process — including one a previous file opened and never closed, whose
|
||||
// unref'd cadence timer is still doing honest work. A neighbour narrating
|
||||
// is a REAL finding about suite hygiene, but it is not this brain failing
|
||||
// its own law, and the two must not be reported as the same thing.
|
||||
//
|
||||
// So: spies first (whose failure means the engine broke the law), console
|
||||
// second (whose failure means SOMETHING in the process narrated), and the
|
||||
// console assertion carries the captured lines in its message. vitest's
|
||||
// stdout blocks are prefixed `stdout | <file> > <test>`, so those lines
|
||||
// plus the surrounding gate log name the brain that printed them.
|
||||
expect(countsSpy).not.toHaveBeenCalled()
|
||||
expect(metadataSpy).not.toHaveBeenCalled()
|
||||
expect(graphSpy).not.toHaveBeenCalled()
|
||||
|
||||
const flushChatter = logged.filter(
|
||||
(l) => /All indexes flushed to disk/.test(l) || /Flushing Brainy indexes/.test(l)
|
||||
)
|
||||
expect(
|
||||
flushChatter,
|
||||
`a flush narrated during the ${IDLE_WATCH_MS}ms idle window. This brain's own ` +
|
||||
`providers were NOT called (asserted above), so the lines below were printed by ` +
|
||||
`another brain alive in this process — find it by the 'stdout | <file> > <test>' ` +
|
||||
`prefix in the run log:\n${flushChatter.join('\n')}`
|
||||
).toEqual([])
|
||||
}, 180_000)
|
||||
|
||||
it('an explicit flush over a clean brain calls no provider and prints nothing', async () => {
|
||||
|
|
|
|||
Reference in a new issue