hardening: clarify host phase authority and execution seams#79
Conversation
- separate warning emission from validation via diagnostics.rs - move live-run setup DTO authority into live_prep.rs - introduce ValidatedDriverInput for explicit driver-input phase - clarify process-driver host-stop and terminal failure ownership - replace generic capture-finalization transitions with domain-shaped methods - tighten import authority and phase boundaries across host usecases
🤖 Augment PR SummarySummary: This PR hardens the ergo-host execution pipeline by clarifying phase ownership boundaries (prep vs. run vs. runner internals) and making warning/diagnostic emission explicit. Changes:
Technical Notes: Behavior is preserved for direct runner construction while orchestration paths now own when/how warnings are emitted. 🤖 Was this summary useful? React with 👍 or 👎 |
| Ok(warnings) | ||
| } | ||
|
|
||
| pub struct HostedRunner { |
There was a problem hiding this comment.
crates/prod/core/host/src/runner.rs:367: Now that validate_hosted_runner_configuration() returns warnings only on Ok, warnings found before a later validation error (e.g. MissingEgressProvenance) will be dropped and never emitted. Previously those warnings would have been printed before the function returned an error—was that behavior change intentional?
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| /// `emit_warnings_to_stderr`. | ||
| pub(crate) fn emit_warnings<W: Write>(writer: &mut W, warnings: &[impl Display]) { | ||
| for warning in warnings { | ||
| let _ = writeln!(writer, "warning: {warning}"); |
There was a problem hiding this comment.
crates/prod/core/host/src/diagnostics.rs:32: Swallowing the writeln! result means a failing writer can silently drop warnings, which could make diagnostics unreliable if a future sink errors. Do we want warning emission to be explicitly best-effort everywhere, or should write failures be observable by the caller?
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
Greptile SummaryThis PR is a well-scoped hardening refactor of the host crate's execution pipeline, focusing on ownership boundaries, phase authority, and testability. It introduces a
Confidence Score: 5/5Safe to merge; all 208 tests pass and no correctness or logic issues found — only two non-blocking P2 style observations. The refactoring is well-scoped, thoroughly tested, and the design decisions are clearly documented. Both findings are P2 style issues: redundant command validation in run_process_driver (harmless, idempotent, immutable command) and asymmetric host-stop function signatures between the fixture and process drivers (both semantically correct). No logic, security, or data-integrity concerns were found. The PR resolves five tracked issues and the verification checklist (fmt, tests, layer boundaries) is complete. crates/prod/core/host/src/usecases/process_driver.rs — minor double-validation pattern; crates/prod/core/host/src/usecases/live_run.rs — host-stop signature asymmetry. Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant live_prep
participant runner
participant diagnostics
participant live_run
participant process_driver
Note over Caller,process_driver: Preparation phase (live_prep.rs)
Caller->>live_prep: prepare_live_runner_setup_from_assets()
live_prep->>runner: validate_hosted_runner_configuration()
runner-->>live_prep: Ok(Vec of EgressValidationWarning)
live_prep->>diagnostics: emit_warnings_to_stderr(warnings)
live_prep-->>Caller: Ok(PreparedLiveRunnerSetup)
Note over Caller,process_driver: Execution phase (live_run.rs)
Caller->>live_run: execute_run_graph_with_policy()
live_run->>live_run: validate_driver_input() returns ValidatedDriverInput
live_run->>runner: start_egress_channels()
alt Fixture driver
live_run->>live_run: run_prepared_fixture_driver(PreparedFixtureInput)
loop each event
live_run->>live_run: maybe_fixture_host_stop()
live_run->>runner: step(event)
runner-->>live_run: on_step_success / on_dispatch_failure / on_fatal_error
end
else Process driver
live_run->>process_driver: run_process_driver(command)
loop protocol loop
process_driver->>process_driver: check_host_stop()
process_driver->>runner: step(event)
runner-->>process_driver: domain transition method
end
end
Note over Caller,process_driver: Finalization phase (live_prep.rs)
live_run->>live_prep: finalize_hosted_runner_capture_with_stage()
live_prep->>runner: ensure_capture_finalizable()
live_prep->>runner: ensure_no_pending_egress_acks()
live_prep->>runner: stop_egress_channels()
live_prep->>runner: into_capture_bundle()
live_prep-->>live_run: Ok(CaptureBundle)
|
Summary
Clarifies ownership boundaries and phase authority across the host crate's execution pipeline.
Changes
Verification
Closes
Resolves #69, #72, #76, #77, #78