Repository navigation
Check the tasks under a stopped task, and a non-owner's ready and status - #26
Open
rogers-andrew wants to merge 4 commits into
Open
rogers-andrew wants to merge 4 commits into
rogers-andrew wants to merge 4 commits into
Conversation
Four of the 29 statements about Lua's `tasks` table have a part that no test checks: the code can be broken there and every test still passes. The plan adds the checks to three existing tests and lists the five breaks that must each fail a test afterwards. Plan: /plan/2026-11-18-1-tasks-unchecked-statements.plan.md Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…status` Four statements about Lua's `tasks` table had a part that no test checked: with the code broken there, every test still passed. Three existing tests now check those parts. No test is added, and no production code changes. - `a_returning_owner_abandons_its_running_task_as_owner_returned` and `cancel_ends_a_parked_task_idempotently_and_reports_task_canceled_once`: the task that is abandoned or canceled now owns a task that has started. That inner task must end `Abandoned`, report one start and one terminal, name `OwnerAborted` as the reason, and report before its owner does. `OwnerAborted` was the one abandon reason no test named. Both tests make the checks through one new helper, `TaskRecorder::assert_aborted_with_its_owner`. - `a_non_owner_is_refused_with_task_not_owned`: the caller gains a sibling, and its `tasks.ready` on itself and on the sibling and its `tasks.status` on the sibling must each raise `task_not_owned`. - Each of five breaks of the scheduler, which all passed before, now fails one of these tests: a stopped chain's tasks left running, their terminal event dropped, their reason changed, and `ready` and `status` answering any caller. Plan: /plan/2026-11-18-1-tasks-unchecked-statements.plan.md Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Each of the five breaks now fails a test, and the workspace keeps its 4,049 tests. The plan also records the one helper the two stopped-owner tests share and why it exists. Plan: /plan/2026-11-18-1-tasks-unchecked-statements.plan.md Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The pull request is cppalliance#26. Plan: /plan/2026-11-18-1-tasks-unchecked-statements.plan.md Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the test-only changes strengthening task ownership and descendant-cleanup coverage.
No open issues 🎉
What changed in this PR
Strengthens three existing Engine tests for Lua’s tasks API, covering ownership checks and task cleanup when an owner stops. No production code or new test functions are added.
Changes:
- Checks that
tasks.readyandtasks.statusreject non-owner callers. - Verifies that started descendants of canceled or abandoned tasks end as
Abandoned, with exactly one terminal event namingOwnerAborted, before their owner’s terminal event. - Adds a shared assertion helper and records the regression checks and verification results.
| File | Description |
|---|---|
plan/2026-11-18-1-tasks-unchecked-statements.plan.md |
Documents coverage gaps, planned assertions, and verification results. |
crates/runvil-internal/runtime/src/execute/tests/waits.rs |
Extends non-owner checks and cancellation coverage to a started grandchild. |
crates/runvil-internal/runtime/src/execute/tests/tasks.rs |
Adds a shared helper for descendant abandonment events and ordering. |
crates/runvil-internal/runtime/src/execute/tests/tasks-chain-end.rs |
Checks descendant abandonment when a returning owner leaves a live task. |
Review effort: Balanced
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.
Four statements about Lua's
taskstable each had a part that no test checked: with the code broken there, all 4,052 tests still passed. This PR adds the checks to three existing tests. It adds no test and changes no production code.Plan:
plan/2026-11-18-1-tasks-unchecked-statements.plan.mdWhat was unchecked
tasks.cancel(task)stops a task and every task it owns.tasks.readyandtasks.statuscalled by a task that is not the ownerTaskStartedevent and exactly one terminal event.The code is correct today. These are missing checks, not bugs.
The proof
Each break below is one small change under
crates/runvil-internal/runtime/src/execute/scheduler/. Before this PR every test passed with the break applied. Now each one fails a test.chain.rs,abort_subtreea_returning_owner_abandons_its_running_task_as_owner_returned,cancel_ends_a_parked_task_idempotently_and_reports_task_canceled_oncetask_end.rs,abandon_owned_tasksOwnerReturned, notOwnerAbortedchain.rs,abort_subtreetasks.readyanswers any callerwaits.rs,dispatch_readya_non_owner_is_refused_with_task_not_ownedtasks.statusanswers any callerwaits.rs,task_statusa_non_owner_is_refused_with_task_not_ownedWhat changed in the tests
All three are in
crates/runvil-internal/runtime/src/execute/tests/.a_returning_owner_abandons_its_running_task_as_owner_returned(tasks-chain-end.rs) andcancel_ends_a_parked_task_idempotently_and_reports_task_canceled_once(waits.rs): the task that is abandoned or canceled now owns a task that has started. That inner task must endAbandoned, report one start and one terminal, nameOwnerAbortedas the reason, and report before its owner does.a_non_owner_is_refused_with_task_not_owned(waits.rs): the caller gains a sibling. Itstasks.readyon itself and on the sibling, and itstasks.statuson the sibling, must each raisetask_not_owned.TaskRecorder::assert_aborted_with_its_ownerintasks.rs. Both stopped-owner tests use it. Without it the cancel test was 107 lines, over the limit of 100 on a function.TaskCanceled.For review
OwnerAbortedwas the one abandon reason of the five that no test named.aborting_a_chain_abandons_the_tasks_it_ownspasses even when the abort leaves owned tasks running, because the end of the run marks every leftover task abandoned. I left it as it is. The two stopped-owner tests now prove what its name says.Verification
cargo nextest run --locked --workspace --all-features: 4,049 passed, the same count as before.cargo clippy --workspace --all-targets --all-featureswithCARGO_BUILD_WARNINGS=deny,cargo fmt --all --check, bothcargo doccommands withRUSTDOCFLAGS="-D warnings",cargo +nightly-2026-09-05 xtask api --check,cargo test -p build-xtask, andnode --test tools/docs-claims.mjs: all pass.cargo dylintdid not run, because it is not installed on the machine that built this.vibelighton the two changed test files gives the same two leads for each as before the change, all on code that was already there.🤖 Generated with Claude Code
Summary by CodeRabbit