Fail fast when a plan cannot finish as declared - #11
Open
minerva-sky wants to merge 1 commit into
Open
Conversation
execute_plan silently returned a result with status :in_progress when the declared graph was unsatisfiable - a pending task depending on an id that names no task in the plan, or a dependency cycle among pending tasks - stranding those tasks in :pending forever with no error. Validate the graph up front, mirroring the existing ensure_agents_resolvable! fail-fast and rewire_task's did-you-mean diagnostics, naming every offender in one pass. Scoped deliberately: only pending tasks are validated, so a plan pruned with cancel_task still runs its remainder; validation is a snapshot at execute time, so forward references still work and tasks added mid-run by hooks are not re-checked. Also: drop a no-op statement in schedule_dependent_tasks and reattach transition_task_state's doc comment, which had drifted onto monotonic_now.
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.
What
execute_planon a graph with an unknown dependency id or a dependency cycle silently returned aPlanExecutionResultwith status:in_progress— from a method that had already returned — leaving the affected tasks stranded in:pendingwith no error, no log, and no record. Reproduced on main:This PR validates the graph at the top of
execute_plan, following the two precedents already in the file:ensure_agents_resolvable!(fail fast at execute time) andrewire_task(ArgumentError withSuggestionsdid-you-mean hints). All offenders are named in a single raise.Deliberate scoping (shaped by adversarial review, see Panel below):
cancel_task(the only prune available for a cycle member) still executes its remainder exactly as before. A pending task wired to a canceled/failed dependency is not a structural error; it strands the same way as a dependency that fails mid-flight (that gap is Dependents of failed tasks finish the plan stranded in :pending with no execution record #10).add_task(b, [a])beforeais added) keep working, and tasks added mid-run by hooks are not re-checked — the docs say so explicitly.Also in the diff, found during the same review pass: a no-op statement (
@dependencies[task_id]) removed fromschedule_dependent_tasks, andtransition_task_state's YARD doc reattached (it had drifted ontomonotonic_now).Tests
Seven new examples: unknown dep raises with did-you-mean hint; multiple offenders aggregated; cycle raises naming unrunnable tasks (incl. downstream); self-dependency; positional and
needs:forward references still execute; cancel-pruned plan still runs its remainder. Full suite: 617 examples, 0 failures; standardrb clean.Release note for the maintainer
Raising where a (contract-violating) result was previously returned should ride the next 0.3.0 with a Changed entry — per the repo's changelog-at-release convention I left CHANGELOG.md untouched. Suggested line: "execute_plan raises ArgumentError on unknown-dependency ids and dependency cycles among pending tasks; previously the runnable portion executed and the result reported :in_progress."
Intended labels:
loop:quality(fork PRs can't self-label).Panel
@raisedoc onexecute_plan).knownbuild,Regexp.escapeon interpolated ids).execute_plan's own documented contract → bug fix, no deprecation cycle; ships coherently with the unreleasedensure_agents_resolvable!as execute-time validation in 0.3.0. Nitpick folded in (release-note request above).