mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 18:05:38 +08:00
test: fail loudly on setup refusals and assert exact MCP refusal and linkage facts (#15368)
* test(mcp): assert exact refusal, identity and Evidence linkage facts Replace isError-only, expect.any and oracle-mirror checks in MCP and CLI workflow tests with the exact code, reason, subject identity and Evidence links the producers report. The capability-unavailable unknowns test now opens its target, so it exercises the path it names instead of NoBinaryOpenError. * test: fail loudly on setup refusals, unrecorded paths and zombie liveness Three shared helpers remove weakness classes from the suite: - callOk (tests/support/mcp/toolResult.ts) fails at the setup step when a tool used as fixture setup refuses. It replaces the build-computer copy and the unchecked open_binary calls. serverUnknownsMcp's capability-unavailable test passed only because open_binary failed: its fixture refused health, and NoBinaryOpenError has the same "unavailable" category. The fixture now answers health, and the test asserts capability_unavailable for procedure_pseudo_code. - expectRemoved (tests/support/expectRemoved.ts) throws when no path was recorded; access(list[0] ?? "") passed because "" is also ENOENT. - expectProcessRunning checks ps state instead of signal 0, which still reaches a zombie that REA wrongly signalled. Also asserts the open target before and after an ordinary close, the written overwrite snapshot, and the comparison's links, status and supporting unknown. * test(mcp): compare delivered recovery with its owning projection
This commit is contained in:
@@ -777,7 +777,10 @@ an external oracle; comparing two paths through the same replacement algorithm
|
||||
does not preserve the old oracle. A negative probe inside a conditional or loop
|
||||
must assert that it ran. Check that the facts compared actually exist: `every`
|
||||
on an empty list, optional chaining, or comparing two missing values can pass
|
||||
without exercising the behavior. For a suspicious assertion, use an isolated
|
||||
without exercising the behavior. Call an MCP tool that the test uses as setup,
|
||||
such as `open_binary`, through `callOk` from `tests/support/mcp/toolResult.ts`:
|
||||
a refusal such as "nothing is open" also satisfies a later expected error,
|
||||
empty list, or null result. For a suspicious assertion, use an isolated
|
||||
controlled change that removes or alters the relevant fact; confirm the test
|
||||
fails at the intended assertion, then restore the change and rerun it.
|
||||
|
||||
@@ -977,7 +980,11 @@ To assert that a POSIX process or process group has stopped, use
|
||||
`processHasStopped` or `processGroupHasStopped` from
|
||||
`tests/support/process/observePosixProcess.ts`, not signal 0. Signal 0 still
|
||||
reaches a zombie, and an orphan stays one wherever PID 1 does not reap it, as in
|
||||
a container started without an init process.
|
||||
a container started without an init process. For the opposite claim, that a
|
||||
process REA must not signal is still running, use `expectProcessRunning` from
|
||||
the same module. Assert a removed path with `expectRemoved` from
|
||||
`tests/support/expectRemoved.ts`, which fails when no path was recorded;
|
||||
`access(list[0] ?? "")` passes then, because an empty path is also ENOENT.
|
||||
|
||||
| Scenario | Assertion and control |
|
||||
| --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
|
||||
Reference in New Issue
Block a user