fix(engine): cascade on_error through Build-mode GC sweep#1999
Merged
Conversation
Resolves the spec's §4.2 observability gap: previously, orphan-delete failures during a normal update's commit phase (when a parent's `process()` no longer declared a child it had declared on a prior run) hit the framework's default `error!` log instead of routing through the parent's user-installed exception handler chain. Only `App.drop()` (a Delete-mode root with a raising on_error) propagated descendant failures; `coco.mount`-mounted parents had no observability. Symmetric with `ComponentDeleteContext::on_error`: - `ComponentBuildContext` gains an `on_error: Option<OnError>` field. - `ComponentProcessingAction::new_build` and `new_processor_context_for_build` accept it. - `Component::mount` stores its `on_error` argument on the child's Build context (in addition to passing it to `run_in_background`) — one handler, two surfaces. - `LiveComponentController::update_full` and `run_op`'s `Op::Update` branch mirror the same pattern for the live-component dispatch path. - `App::update` (root), `Component::use_mount` (foreground), and `mount_inner_live`'s synthetic parent context pass `None` — the prior log+swallow default is preserved where intentional. `launch_child_component_gc` switches from `delete_action_on_error()` to the new unified `processing_action_on_error()`, so it cascades the parent's on_error regardless of mode. `delete_action_on_error()` stays as the Delete-only accessor used by `Component::delete`'s spawned task (a Build context's on_error is meant for cascades, not for invoking on the build's own failure — that flows through `run_in_background`'s `on_error` argument directly). Adds `test_orphan_delete_failure_routes_through_parent_handler` in test_exception_handlers.py: parent mounts child A on update #1, doesn't mount A on update #2, sink fails during the orphan delete. Verifies the handler fires exactly once (mount_kind="mount"). Toggling `launch_child_component_gc` back to `delete_action_on_error()` confirms the test fails without this change. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
coco.mount-mounted parent's commit-phase GC sweep now route through the parent's exception handler chain (previously:error!log + swallow).ComponentDeleteContext::on_errorcascade used byApp.drop():ComponentBuildContextgains the same field;launch_child_component_gcreads via a new unifiedprocessing_action_on_error()accessor.on_errorpassed toComponent::mountcatches both the child's own task failure (existing) and orphan-delete failures from the child's commit (new).LiveComponentController::update_full/Op::Updatemirror the same pattern.use_mountand rootApp::updatepassNone(preserves the prior log+swallow default by design).Test plan
test_orphan_delete_failure_routes_through_parent_handlerin test_exception_handlers.py confirms the cascade.launch_child_component_gcback todelete_action_on_error()confirms the test fails without the fix (seen == []+ framework's defaulterror!print).pytest python/— 674 passed, 138 skipped, 0 failed locally.cargo test,uv run mypyclean.🤖 Generated with Claude Code