Repository navigation
feat: make hardware release scopes explicit and release v0.4.0 - #1
Merged
Merged
Conversation
Orderly service stop no longer clears saved native thresholds (Linux sysfs, Lenovo conservation mode, Intel BCLM). ChargeController::release now takes an explicit scope: Overrides (daemon-held gates, forced discharge, LED, idle assertion) or Everything (plus native thresholds). Stop re-applies the saved threshold instead of a temporary top-up; pause and reset release everything; enforcement errors release overrides and keep the saved threshold. Cleanup steps are independent and failures are merged with their step names. Reset is acknowledged only after hardware accepted it and the empty policy was saved. Sleep preparation steps are independent and wake reports unverified state until the first reconciliation. Queued requests get an explicit refusal during shutdown. Debian and RPM removal now runs `batterybridge reset` before stopping the service. The GUI refuses actions during a running request visibly, uses a green palette matching the icon, and the tray icon is white. The icon is redrawn and reproducible via assets/render-icons.py. Adds lifecycle tests with threshold, gate and combined fake backends, a real sysfs adapter lifecycle test, and docs/lifecycle.md. IPC and the saved policy format are unchanged.
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.
Problem and resulting behavior
Orderly service stop called
release(), which defaulted toapply(None, None). Every stop, restart and OS shutdown therefore wrote "no limit" to native thresholds (Linux sysfs, Lenovo conservation mode, Intel BCLM), lifting a saved limit (audit finding BATTERYBRIDGE-001). Daemon-held gates and persistent thresholds were treated the same.ChargeController::releasenow takes an explicit scope:Overrides(gates, forced discharge, LED, idle assertion) orEverything(plus native thresholds). Each backend implements both deliberately.batterybridge reset(starting the service if needed) before stopping it.assets/render-icons.pyregenerates the committed files byte for byte.docs/lifecycle.md; BATTERYBRIDGE-003 (socket group) fixed indocs/service.md.Persistence of any threshold or gate while the computer is off remains unverified on every device. SIGKILL, power loss and forced OS shutdown run no cleanup.
Validation
cargo test --locked: 94 passed.cargo test -p batterybridge-gui --locked: 30 passed.cargo clippy --workspace --all-targets --locked -- -D warnings: clean.cargo fmt --all --check: clean.python3 -m unittest discover -s packaging/tests: 11 passed.python3 -m unittest discover -s packaging/macos/tests: 17 ran, 1 skipped (needs a universal build).SysfsControlleron temporary files. Reverting the error-path change makes three of them fail.Not run:
windows.rscompilation (no Windows target locally),*.ps1tests, deb/rpm/pkg builds,packaging/linux/test-installer.sh, any hardware write, GUI visual check. No physical device testing was done; nothing here establishes real firmware behavior.Compatibility and documentation
statuswording (saved limit labelled as configuration, device threshold readback shown separately). Hence version 0.4.0 (Cargo, lockfile, macOS build 7, README links, dated changelog entry).ChargeController::releasesignature changed (internal workspace trait).