Centralize system suspend rail#44
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR centralizes system sleep coordination into a single “suspend rail” so logind (PrepareForSleep) and NetworkManager (pre-down) can cooperate deterministically via shared lifecycle state, while keeping user-facing documentation focused on observable behavior and validating the new install topology in release smoke tests.
Changes:
- Introduces a cooperative suspend rail with persisted per-cycle outcome state and a bounded NetworkManager wait/retry path.
- Updates lifecycle monitoring to handle logind pre-sleep events (including acquiring/releasing a logind delay inhibitor) and clears the new cycle state on resume.
- Refreshes docs and release-bundle validation to reflect the cooperative suspend topology and removal of legacy hooks/handlers.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/test-release-bundle.sh | Adds explicit validation of the “cooperative lifecycle topology” and asserts legacy sleep artifacts are absent. |
| README.md | Updates installation summary wording to describe cooperating suspend sources. |
| docs/user-guide.md | Simplifies system sleep/wake explanation to user-observable behavior and notes legacy cleanup. |
| docs/testing-strategy.md | Documents the smoke test’s coverage of the current lifecycle topology. |
| docs/runtime-event-handler-map.md | Updates event mapping to reflect the centralized suspend rail behavior. |
| docs/release-process.md | Expands smoke test description to include topology checks. |
| docs/architecture-overview.md | Updates architecture narrative to reflect cooperative suspend rail and per-cycle state. |
| crates/lg-buddy/tests/support/mod.rs | Extends mock logind to support Inhibit for delay inhibitor tests. |
| crates/lg-buddy/tests/runtime_entrypoints.rs | Updates/extends entrypoint tests for cycle state clearing and logind pre-sleep handling. |
| crates/lg-buddy/src/state.rs | Adds persisted system_sleep_cycle outcome file and related state helpers. |
| crates/lg-buddy/src/sources/linux/network_manager.rs | Extends NM tests to cover waiting on/observing rail outcomes and retry behavior. |
| crates/lg-buddy/src/session/runner.rs | Updates lifecycle monitor to run pre-sleep handling and manage logind delay inhibitor. |
| crates/lg-buddy/src/lifecycle.rs | Implements the suspend rail owner/join logic, bounded wait, and retryable failure handling. |
| crates/lg-buddy/src/commands.rs | Routes sleep-pre through the new suspend rail and clears cycle state during resume cleanup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+355
to
+359
| acquire_lifecycle_sleep_delay_inhibitor_if_enabled( | ||
| writer, | ||
| bus, | ||
| config_path, | ||
| &mut sleep_inhibitor, |
Comment on lines
+368
to
+376
| fn write_state_file(path: &Path, content: &str) -> io::Result<()> { | ||
| let mut file = OpenOptions::new() | ||
| .write(true) | ||
| .create(true) | ||
| .truncate(true) | ||
| .custom_flags(libc::O_NOFOLLOW) | ||
| .open(path)?; | ||
| file.write_all(content.as_bytes()) | ||
| } |
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
Validation
cargo fmt --allcargo test -p lg-buddy --lib network_teardown_waits_for_retryable_owner_before_retrying -- --nocapturecargo test -p lg-buddy --lib pre_down_ -- --nocapturecargo test -p lg-buddy --lib system_suspend_rail -- --nocapturecargo test -p lg-buddy --lib network_teardown_ -- --nocapturecargo test -p lg-buddy --libcargo test -p lg-buddy --test runtime_entrypoints