Skip to content

test: unified-start test kit hooks and ten start planted bugs (stacked on #291) - #293

Draft
unbalancedparentheses wants to merge 5 commits into
feat/unified-startfrom
test/unified-start-kit-planted
Draft

unbalancedparentheses wants to merge 5 commits into
feat/unified-startfrom
test/unified-start-kit-planted

Conversation

@unbalancedparentheses

Copy link
Copy Markdown
Contributor

Stacked on #291 (unified start). Two pieces of the unified-start scope that #291 leaves out:

  • Test kit (design section 10): Mock::on_started(|ctx| Init::...) sets what the mock's started() returns. start_delay(d) makes a slow initialiser (virtual time under the simulator in tasks mode). drop_flag(flag) sets flag when the mock's state is dropped, so a test can check that a failed start answered only after publication. These work in both modes. Tests: mock_on_started_error_answers_after_drop and mock_start_delay_hits_init_timeout (testing/tests/tasks_kit.rs).

  • Ten unified-start planted bugs (design 16.5), verification/planted/patches/25-34, listed in INDEX.tsv:

    • the init timer overrides a ready start;
    • a trapping parent's link notice is delivered instead of diverted;
    • a Normal failed-start notice is delivered;
    • the requested reason is reported instead of the final one;
    • a held administrative stop is lost;
    • an administrative stop fails init (revision 3's row 3);
    • a trapping child fails on a held signal;
    • a link is made to a parent that is already exiting;
    • a held signal outranks a kill;
    • a start goes ready in a closing group.

    The runner's V layer now also records the lifecycle_trace and start_trace traces. CI's git apply --check covers the new patches.

Runner results (layers T, S, V and a baseline control, on fede) will be posted as a comment.

Model: no change because this PR only adds test-kit hooks (testing crate) and planted-bug patches; no modelled code changes.

@unbalancedparentheses

Copy link
Copy Markdown
Contributor Author

Planted-bug matrix, patches 25–34 (fede, head bd74962a)

Layers: T = tests with failpoints (real Tokio), S = simulated suites, V = TLA+ trace validation. The baseline control was missed by all three layers, as it should be.

patch T S V
25 timer overrides ready caught caught —
26 trapping parent's notice delivered caught caught caught
27 failed start_monitor's Down delivered (replaced) caught caught caught
28 answer before publication (replaced) caught caught caught
29 held admin stop lost caught caught —
30 admin stop fails init caught caught —
31 trapping child fails on held signal caught caught —
32 link to an exiting parent caught caught —
33 kill below a held signal caught caught —
34 ready in a closing group caught caught —

Every start bug is now caught by at least 2 layers.

New concurrency/tests/start_races.rs pins each interleaving with gates or a failpoint (start.init_timer_fire), not timing. Its sim_tests also run under the simulator. It covers:

  • 25: the timer reaching the cell after the ready commit (failpoint), plus a simulator race where started() returns at the timer's own instant;
  • 32: start_link after the parent's own ctx.stop() in the same turn;
  • 33: an exit signal and then a kill during started();
  • 34: the newest root's slow stopped() holding the shutdown coordinator, so admission is closed while the child is still in started().

Two patches were replaced:

  • 28 (answer the requested reason) was an equivalent mutant. A non-ready decision freezes the reason, so the requested and final reasons never differ. It now answers a failed start before the child's publication. That is caught by a multi-thread slow-drop test and a new start trace (FailureAfterPublication).
  • 27 (deliver a Normal notice to a waiting non-trapping parent) had no behavioural effect: the parent cannot change its trap flag while it waits, and an untrapped Normal is ignored. Only trace validation saw it. It now delivers a failed start_monitor's Down instead of consuming it.

@unbalancedparentheses
unbalancedparentheses force-pushed the test/unified-start-kit-planted branch from 5862b81 to 40d5f47 Compare November 21, 2026 16:26
…nd 28 replaced

start_races.rs pins each interleaving with gates or a failpoint
(start.init_timer_fire), run on real Tokio and, as sim_tests, under the
simulator: the init timer reaching the cell after a ready commit (25), a
kill outranking a held signal (33), start_link through a parent already
exiting in its own turn (32), a ready return after the group's admission
closed during shutdown (34).

Replaced: 28 (answer the requested reason) was an equivalent mutant, since
a non-ready decision freezes the reason, so requested and final never
differ; now a failed start answered before the child's publication, caught
by a multi-thread slow-drop test and a new start trace. 27 (deliver a
Normal failed-start notice to a waiting non-trapping parent) has no
behavioural effect (the parent cannot change its trap flag while it waits,
and an untrapped Normal signal is ignored), so only trace validation saw
it; now a failed start_monitor's Down delivered instead of consumed.
@unbalancedparentheses
unbalancedparentheses force-pushed the test/unified-start-kit-planted branch from 40d5f47 to 2b983ed Compare November 21, 2026 17:01

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant