Skip to content

Persist speaker state with fail-closed cross-boot handling (review draft) - #24

Closed
RyanTheTide wants to merge 1 commit into
fix/pr8-deployed-base-2f7d16dfrom
fix/instant-boot-thermal-state
Closed

RyanTheTide wants to merge 1 commit into
fix/pr8-deployed-base-2f7d16dfrom
fix/instant-boot-thermal-state

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Scope

This draft is based directly on the deployed pr8 commit 2f7d16db0313 and preserves its V/I fault-detector thresholds. It replaces the V/I cold-start hard mute with a governed hot start while retaining the J700 latch.

  • Save the complete thermal model atomically in /var/lib/speakerguardd/state every 9 s, on suspend, and after a clean stop. A 10 s maximum playable checkpoint age and 11 s unclean full-gain charge bound missed playback.
  • Credit exact coupled exponential cooling only from same-boot time bounded by CLOCK_BOOTTIME and nonnegative realtime. A matching clean Linux shutdown record may resume within 90 s across boots, with zero cooling credit. Other cross-boot, missing and damaged records start from the profile's cross-OS design envelope.
  • During that hot start, bound unknown full-scale power over the next second against each model's working ceiling. The V/I profiles permit up to 60 dB governed attenuation so the card can unlock promptly at reduced volume. The extra bound is saved with the model and retires after all nodes cool to ambient. Hard limits and invalid model states still hand the card to the kernel.
  • Package PR Preserve recorder evidence across service restarts #23's recording-preservation helper. The deployment note replaces only a local destructive ExecStartPre line and retains all other admission and ownership gates.

Host verification

CI run 40495092212 passed all 230 Rust tests, the recording-helper tests, and Fedora 44/45 RPM jobs at c29bd9385e8be9a327001837be81eff487539ecd. The fake-card first governed handover was 0.171 s on J316, J413 and J616. In the 120 s host-model pink and max-power sweep checks, the independent peak coil/magnet temperatures stayed below the 140 °C working ceiling. The attenuation curves are in docs/deployment-boot-state.md.

Target RPM SHA-256
Fedora 44, M1 Pro/M2 speakerguardd-0.1.10-15.pr8.c29bd9385e8b.fc44.aarch64.rpm 824cca93243338de32d32e9daac7a716b463343f89b9695acb0af975ef8e196b
Fedora 45, J616s speakerguardd-0.1.10-15.pr8.c29bd9385e8b.fc45.aarch64.rpm 043c8738302e1bc370272068e73958efa55583f20e2281cfa3bc8c3b76455921

The downloaded RPM hashes match CI's SHA256SUMS. This branch has no hardware playback, reboot, install or local override change. The orchestrator must verify the profile, effective owner policy, local -m overrides, card handover time, thermal behavior and rollback on each device before deployment. The short clean-reboot marker is an operational fast-restart signal; it cannot independently exclude an intervening OS.

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent safety review of 6fb4618: BLOCK pending the following fixes/proofs. No hardware or playback was used.

  1. Cross-OS ownership: src/guard.rs:723-752 accepts an old Linux checkpoint without proving no intervening macOS playback. A saved 50°C model remains ~50°C even if macOS heated the speakers before the next Linux boot. Under a conservative 150°C coil/magnet shutdown bound and 30 s of silence, the J616/J316 woofer V/I model is still 138.4°C coil / 135.9°C magnet (tweeter 117.6°C / 116.4°C). This is numerically no worse than speakersafetyd's ambient cold-start baseline, but that baseline does not prove this transition safe. Require a continuity marker covering every boot route, or use a conservative hot-start envelope on unknown/missing state and prove the ramp.
  2. Clock credit: src/checkpoint.rs:84-103 compares CLOCK_REALTIME and RTC, but the former may have been initialized from the latter. A paired forward step passes and can award arbitrary extra cooling. Backwards and divergent steps are handled; paired error and drift are not. Cross-boot credit needs a proven lower bound on real silent time, otherwise zero credit/hot start.
  3. Deployed-line equivalence: Base 9b54f813 is one commit past the installed 2f7d16db0313. It changes low-resistance detection from ratio 1.35 immediate to 1.6 after 1 s, and power-factor fault detection at 0.3–0.5 Vrms from immediate to up to 2 s. The PR RPM includes this outside the PR diff. Rebase the five PR commits onto the installed commit and preserve its detectors, or separately qualify the changed thresholds with a missed-energy bound.
  4. Unclean bound: src/state.rs:331-350 conservatively charges 11 s of full gain only if playable time since the previous save is at most 11 s. src/guard.rs:1538-1546 schedules after a completed tick and 10 s since the prior completed save; it has no hard maximum-latency/disarm rule. Include the 250 ms interlock and 500 ms queue tail in a deadline proof and fault-injection tests.
  5. Artifact identity: I downloaded the successful fc45 CI RPM for this head; its SHA-256 is 45b5791547a57c92c37805e679939fd7feedc207c140ce205fb2387646ca7838, matching CI's checksum file, but the task brief says 45b55791…. Reconcile before installation.

The exact exponential zero-power cooling formula matches the configured two-node model, and the fixed-name temporary file + file/directory sync provides atomic, bounded-size checkpoints. The 10 s schedule implies ~8,640 durable writes/day (~3.15 million/year) plus startup/suspend/stop writes; confirm SSD wear/performance on the target. CI passed; no device validation is claimed.

@RyanTheTide
RyanTheTide force-pushed the fix/instant-boot-thermal-state branch from 6fb4618 to 9746850 Compare October 27, 2026 10:52
@RyanTheTide RyanTheTide changed the title Persist V/I speaker model for prompt cold-boot audio Persist speaker state with fail-closed cross-boot handling (review draft) Oct 27, 2026
@RyanTheTide
RyanTheTide changed the base branch from unified/rework-20261024 to fix/pr8-deployed-base-2f7d16d October 27, 2026 10:52
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #28 and #29. The evidence start now on main covers the boot case. A clean Linux marker can't prove another OS didn't heat the speakers between boots, so cross-boot resume from this branch stays out.

@RyanTheTide
RyanTheTide deleted the fix/instant-boot-thermal-state branch October 31, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant