Repository navigation
fix(contract_test): restore supervised children unconditionally - #688
Merged
Merged
Conversation
`take_supervised/1` registered its `on_exit` restore AFTER calling
`start_supervised!/1`. If that call raised — or anything between the delete and
the registration failed — the child had already been terminated and deleted
from Hypatia.Supervisor and was NEVER restored.
`Supervisor.terminate_child/2` keeps a child dead until something explicitly
restarts it, and there is no `restart_child` call anywhere in this repository.
So every later test needing that module also failed, with
** (exit) exited in: GenServer.call(Hypatia.Neural.Blackboard, :clear, 5000)
** (EXIT) no process: the process is not alive
⚠ THIS EXACT BUG WAS ALREADY DIAGNOSED AND FIXED — IN ONE FILE.
test/reflexive_test.exs carries the correction and a comment describing the
same cascade: "the child was deleted from Hypatia.Supervisor and NEVER
restored. Every later test needing that module then failed too, which is why
one root failure cascaded into ~20 and why the failing set changed with the
seed." contract_test.exs was missed.
on_exit callbacks still run when setup raises, so registering first makes the
restore unconditional. `restore_supervised/1` is idempotent and RAISES on an
unexpected result rather than discarding it — a silent restore failure is what
made the original cascade invisible.
⚠ THIS IS A PARTIAL FIX, AND THE HEADLINE NUMBER BARELY MOVES: 75 failures
before, 74 after. The suite is NOT DETERMINISTIC EVEN AT A FIXED SEED — three
runs at `--seed 0` gave 75, 82 and 74, with different failing SETS each time.
Seed control cannot help, because the variance does not come from test ordering:
these tests manipulate the LIVE application supervisor, so they share global
named processes and their outcome depends on process state and timing.
That is the foundational problem, and it is architectural: tests should start
isolated instances rather than taking children away from the running
Application. Until then hypatia's CI cannot distinguish a good pull request
from a bad one — it currently fails on every PR, including ones that touch no
Elixir at all.
Co-Authored-By: Claude Opus 5 <[email protected]>
Signed-off-by: Jonathan D.A. Jewell <[email protected]>
This comment has been minimized.
This comment has been minimized.
This file tore GenServers out of Hypatia.Supervisor via a `take_supervised/1`
helper — `terminate_child/2` + `delete_child/2`, then a private instance.
It was never necessary. Every test here already isolates by KEY, not by
process: bot names, quarantine subjects and query keys are all built with
`unique_id()`, and the GenServers store state keyed by exactly those. The file
passes 19/19 with the helper removed entirely.
It was also actively harmful. `terminate_child/2` keeps a child dead until
something explicitly restarts it, and there is NO `restart_child` call anywhere
in this repository — so any failure between the delete and the restore left the
singleton dead for the rest of the run, and every later test touching it failed
with "no process: the process is not alive".
⚠ NO IMPROVEMENT FIGURE IS CLAIMED, DELIBERATELY. The full suite returns a
different failure count on IDENTICAL input: three consecutive runs at
`--seed 0` on this exact tree gave 77, 79 and 16. A before/after number from it
would be noise dressed as evidence. What is verifiable is that this file passes
on its own and that the helper's failure mode is gone by construction.
⚠ WHY THE PATTERN EXISTED, so it is not reintroduced. RateLimiter, Quarantine,
VCL.Client, Blackboard and SelfDiagnostics all hardcode
GenServer.start_link(__MODULE__, opts, name: __MODULE__)
and IGNORE `opts[:name]`. A second instance therefore cannot coexist with the
supervised one, so taking the child away was the only way to get a fresh
process. If a future test genuinely needs a clean process rather than a clean
key, fix it there first — honour `opts[:name]` — and start an isolated instance
under the test supervisor. Do not mutate the application supervisor.
Supersedes #688, which made the same helper safer rather than removing it.
Co-Authored-By: Claude Opus 5 <[email protected]>
Signed-off-by: Jonathan D.A. Jewell <[email protected]>
…ile blind spot OSSF Scorecard's Pinned-Dependencies check reads workflows for inline SHA refs and cannot see .github/workflows/actions.lock, which is what actually pins this repository's actions — resolving each symbolic ref to a verified commit plus the transitive dependencies of composite actions. Satisfying the check inline would reduce coverage rather than raise it: gh actions-lock rejects a ref that no tag or branch contains, so inline pinning drops actions from the lockfile. Measured 2026-08-07 on this repository — it put 14 workflows into startup_failure and removed dtolnay/rust-toolchain from 7 lockfile entries. Recorded with the reasoning rather than fixed, because the finding is a limitation of the external tool, not a defect here.
hyperpolymath
added a commit
that referenced
this pull request
Aug 7, 2026
…ervision)
watcher.ex: supervisor child ids like Bandit's {module, make_ref()} were
inspect/1-ed into the Prometheus queue-depth label — a fresh
broke the exposition test's label parsing once the 30s queue poll had
fired (why it only failed in-suite). Ids now collapse to the module.
metrics_test.exs: byte-equality of two renders raced uptime_seconds'
1s granularity; the claim under test is that the plug serves render/0's
output, so the comparison now strips each line's sample value.
diagnostics/monitor.ex + config/test.exs: the monitor's 30s tick is now
config-gated and off in the test env — its recovery path GenServer.stops
supervised children mid-suite, the invisible order-dependence source
flagged in #643. check_now/0 still drives checks explicitly.
(The contract_test.exs half of this work was dropped on rebase: #688
landed a better fix upstream — it deleted take_supervised/1 outright,
since those tests already isolate by unique key rather than by process.)
Co-Authored-By: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
take_supervised/1registered itson_exitrestore afterstart_supervised!/1. If that raised, the child had already been terminated and deleted fromHypatia.Supervisorand was never restored — and there is norestart_childcall anywhere in the repo. Every later test needing that module then failed with "no process: the process is not alive".This exact bug was already diagnosed and fixed — in one file
test/reflexive_test.exscarries the correction and a comment describing the same cascade:contract_test.exswas missed. This applies the same pattern, plus an idempotentrestore_supervised/1that raises on an unexpected result rather than discarding it — a silent restore failure is what made the original cascade invisible.⚠ This is a partial fix, and the number barely moves
75 failures before, 74 after. More importantly, the suite is not deterministic even at a fixed seed — three runs at
--seed 0gave 75, 82 and 74, with different failing sets each time.Seed control cannot help, because the variance isn't from test ordering: these tests manipulate the live application supervisor, so they share globally-named processes and their outcome depends on process state and timing.
That is the foundational problem and it is architectural — tests should start isolated instances rather than taking children away from the running Application. Until then this repo's CI cannot distinguish a good PR from a bad one: it currently fails on every PR, including ones touching no Elixir at all.
🤖 Generated with Claude Code