fix(mc-host): harden cross-harness lifecycle integration - #46
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
6f7136d to
1d171f8
Compare
| match observed.state { | ||
| // No lock-held incarnation: nothing to signal, unlink, or clean. | ||
| LifecycleState::Stopped => DaemonResult::new(command, true, "stopped", "already_stopped"), | ||
| // No lock-held incarnation exists. Selector cleanup is best-effort | ||
| // stale-state removal under the transaction ownership boundary. | ||
| LifecycleState::Stopped => match serve::clear_active_selection() { | ||
| Ok(()) => DaemonResult::new(command, true, "stopped", "already_stopped"), | ||
| Err("unsupported active harness selection schema") => { | ||
| DaemonResult::new(command, false, "wedged", "unsupported_state_schema") | ||
| } | ||
| Err(_) => DaemonResult::new(command, false, "wedged", "internal_error"), | ||
| }, |
There was a problem hiding this comment.
The comment says selector cleanup here is "best-effort," but the implementation does the opposite: any clear_active_selection() error — including a plain, transient I/O failure on active-selection.json (permission hiccup, disk error, etc.), not just the deliberate unsupported_state_schema quarantine case — turns a stop on an already-Stopped daemon into a hard failure (wedged/internal_error). The same pattern repeats for the Running branch below (lines 1199-1205): a stop that already succeeded at stop_phase can still be reported as wedged solely because of a bookkeeping-file read/write error, even though the daemon itself is confirmed stopped.
Previously Stopped => already_stopped was a trivially-successful, idempotent no-op. Now callers that rely on stop being safe to call defensively (cleanup scripts, uninstallers, retry loops) can get a wedged result — which per the release contract implies "inspect the daemon process" — even though there's no daemon at all.
If the intent is genuinely best-effort (as the comment claims), consider only hard-failing on the deliberate unsupported_state_schema quarantine case and swallowing/logging other I/O errors instead of surfacing them as wedged. If the strict fail-closed behavior for any selection-file error is intentional, the comment should be updated to say so rather than "best-effort," since the two read very differently to a future maintainer.
Review summaryFocused review of the lifecycle/credential-selection hardening in Overall: the core state machine is careful and well-tested. I traced through the
One finding posted inline: the No other correctness, security, or performance issues found in the |
Summary
startnon-preemptive while explicit restart merges qualified harness selectiontmp/pathsStack
PR 10 of 17. Base:
stack/mc-host-09-release-verification(#52).Focused review follow-ups:
Validation
cargo test -p mc-hostcargo test -p mc-modulecargo clippy --workspace --all-targets -- -D warningsbun run typecheck,bun run build,bun run lintKnown Residuals
MC_HOST_CANARY_*inputs.