Skip to content

Reconcile main and the unified 0.1.13-rc.2 candidate; retain strict listening gates - #27

Closed
RyanTheTide wants to merge 149 commits into
mainfrom
fu-speakerguardd-rc
Closed

RyanTheTide wants to merge 149 commits into
mainfrom
fu-speakerguardd-rc

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Reconcile main's Neo 0.1.12 line (028702964884, #17/#20/#29) with RC #27/#28 into one 0.1.13-rc.2 source for all shipped profiles: add7f9610d68b3ff898275d3e7d1cdcd8587c47c.

The seven original conflicts retain the RC implementation, generation-3 state and #20 compatibility, C1 fail-closed state writes, /run/speakerguardd.unlocked outside RuntimeDirectory, and C2 latched starts on V/I or multi-model profiles. Only the J700 single-model path uses evidence. Main is an ancestor; stacked #30 merges cleanly at the fetched head and remains separate.

Fix the rejected legacy unknown-start bound with that model's own conservative drain interval peak. From 135/135 C through a 0.5 s full-scale J700 left-channel drain, the continuous RC coil bound was 202.875711672 C while legacy substeps reach 202.877427892 C. The start now bounds it at 203.081940413 C and keeps independent hot-node and safe-level equilibrium floors. Nonfinite drain endpoints and interval peaks remain visible to the guard, with separate regressions. The original independent oracle and its 1e-8 assertion are byte-identical. No thermal limit, onset reserve, qualification or ownership check is relaxed.

Rejected pin 526790d failed three tests in Fedora 41194590811, Arch 41194590761 and Nix 41194590907: both listening gates plus the unknown-start safety oracle. A controller buildbox run reproduced 397/3/3. The earlier unsupported protection-identity claim is withdrawn.

Exact-source native Rust results: 400 passed / 2 failed / 3 ignored on Fedora 41229015766, Arch 41229183256, and Nix 41229333668. The original 1e-8 hot-node oracle, both simulated 20-minute hot-start tests and both overflow regressions pass everywhere. Only the two unchanged listening gates fail; all 32 LISTENING_COST rows match the reproduced baseline at printed precision on each distro.

Exact-source controller validation is complete: both 30,144-case campaigns (fallback and reference), the 5,000-case J700 oracle, long V/I sweep, clippy, release build, retention, Neo acceptance fixtures, transfer checks and xlim all pass. Both artifacts were collected and hash-verified; 98 source files match this Git commit and remained unchanged during the run. The standard Rust suite is 400/2/3 with only the two listening gates failing; the overall validation exit remains nonzero. These results do not waive release acceptance or independent safety review.

All 116 source-file contents in the public archive match Git. Archive SHA-256: b016469ad71ae791b2d0b2b0837b7a48708211bee9330c7975588bc939be0c6e. Draft packaging pins this same source: Fedora #78, Arch #62, Nix #65. Static recipe/source checks pass 14, 2 plus syntax, and 6 respectively; all pins/hash and the Nix Cargo lock agree.

Keep draft; not deployable. The two listening gates remain required follow-up work. No native package or release acceptance is claimed while they fail. Do not publish rc.2 as a fleet release or package/install it for M1 Pro, M2 or J616s. Any eventual reviewed activation must preserve one governing owner and fallback across an orderly reboot. Independent safety review of the final combined source is required before any deployment; the previous #28/#29 review does not approve this integration. Live-recording certification #26 remains excluded. No reference-Mac access, playback, deployment, PR merge or closure was performed.

PR #6 brought configurations for the machines whose amplifiers sense
voltage and current (the SN012776 laptops: J316, J413, J616), the S16
sense words they deliver and the controls they need. This ports that
groundwork onto 0.1.8 without any new governor yet.

The configuration gains the governor choice, shadow mode, the sense
format, the amplifier level at full scale, the unified governor's
horizon, release, headroom and caps, a per-machine max_reduction, and
per speaker the current channel and scale, the feed-forward resistance
r_ff, the measured-power thermal constants and the resistance
coefficient. A current channel on the voltage channel, a nonpositive
scale or constant and an implausible amplifier level are refused.

The capture reads S16 sense words and widens them to S32 full scale,
so every reader sees the same words. Where the device refuses a
4096-frame hardware period (the 12-channel S16 sense allows 64 KiB) it
asks for the largest even fraction instead; the buffer still holds
four sense periods and the reader still waits for a whole one. On the
V/I machines the daemon turns the sense switches on and the amplifier
gain to its maximum, the level the models assume, and checks both.

The review of PR #6 (F8) found the J616 profile shipping as governing
with nothing qualifying its sense map or thermal transfer. The
configuration now has a qualified flag, and the daemon refuses an
unqualified machine before it touches the card unless the command line
allows it. j616.conf says false. So do j316.conf and j413.conf: none of
the three is qualified on the machine yet, and installing the package
must not displace speakersafetyd on the reference Macs. The flag
arrives with the engine; until then this build also refuses every
governor but legacy, so the V/I files cannot be governed by the J700's
model by accident.

The legacy model's power and worst case are now V^2 against r_ff,
which defaults to z_nominal. The J700 is unchanged. On a V/I machine
the feed-forward constants are paired with the DC resistance they were
tuned for, not the higher nominal impedance.

Adapted tests: model.rs's speaker and globals literals gain the new
fields. worst_case_power_is_a_full_scale_square_wave_at_the_card_gain
sets r_ff with z_nominal, as the parser does, and now also checks that
a lower r_ff is the one charged.

New tests: S16 widening, parsing the V/I files (the J616 slot order,
r_ff), the three unqualified machines refused without the flag, and
the unified governor refused without its opt-in.

90 of 90 pass.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
PR #6 added an asahi governor (speakersafetyd's equations on measured
V*I power) and a unified one (a look-ahead regulator on the
feed-forward model), but under its own guard. Its review found four
blockers and four major gaps there (F1 to F8). This ports the engine
onto 0.1.8's guard and its one rule for uncovered time instead, so the
engine's models live under the same account, interlock and restart
rules as the J700's model. The J700's default (legacy, no shadow) runs
no engine at all.

Every model gets exactly the legacy model's account. Measured frames
over time not yet accounted are integrated as they are. Frames partly
over accounted time count only for the rest, at the most power of the
blocks covering it. Every other interval is charged as a full-scale
signal at each speaker's least reduction since the last verified
boundary, and verified closed time cools. Whichever model governs, its
reductions are written per speaker, linked by group, and its hard
latch hands the card to the kernel by giving the lock up.

F1: the asahi model multiplied the sensed power by its own requested
gain, so a gain the card rejected made it model less heat than the
speaker got. Measured power is now the sensed power, whatever was
asked for. The guard keeps one written value per control and records
them per speaker. A failed or partial write leaves each at the smaller
of the old and new reduction, and an unknown one stays at full gain.
Charges take each control's own least since the last verified boundary.

F2: hot, restored and damaged starts unlocked at 0 dB before the
asahi gain was computed, and its hold and gain were not saved. The
governors now compute in Guard::start before anything may unlock. The
engine's state (temperatures, holds, gain, latch, peak) is saved in the
same file as the legacy model. The file keeps format 2 with extra asahi
and unified lines; a J700 file without them is exactly 0.1.8's, and a
reader older than the engine refuses a file with them. As for the
legacy model, only a clean stop's state is resumed (r3 T2, T4, T7).
Anything else, and any model the file does not carry, starts latched
at its limit.

F3: negative V*I periods were skipped while the card stayed armed. A
period (or a closing tail) whose mean V*I is below -0.01 W, or
nonfinite, is now uncovered time. It is charged at full scale at the
least gains held and never measured, the card is handed off at once,
and the count of complete periods restarts.

F4: the asahi loop checked the hard limit only at the end of a period.
It now checks coil and magnet at every sample, NaN included. A crossing
latches and leaves the model at the limit, because the negative V*I
after it cools the model, never the coil.

F5: missing state started at speakersafetyd's 119 C cold boot. It now
starts latched. The guard also reads speakersafetyd's warm-boot flag
(the 2.0.x and 1.0.2 paths, path and format only). If it is present,
speakersafetyd ran this boot and may have driven the speakers since,
so every model starts latched. Its absence proves nothing.

F6: the engine gets the base's coverage accounting, and so 0.1.8's
rule for gaps, losses and frames over charged time (r3 T6).

F8: the qualified flag now gates Guard::start too. udev still starts
the daemon on the J700 only; the J316, J413 and J616 are unqualified
and need an explicit enable. The unified governor stays shadow-only
behind --experimental-unified. A file naming it now parses, so the
command line's opt-in can apply. A shadow changes nothing the
governing model writes.

The unified model restores its minute budget with the energy as late
as it could have been (r3 T5). Its feed-forward and measured models
latch at their hard limits. The measured-power worst case is a
full-scale square wave into the smaller of z_nominal and r_ff.

New flags are --governor, --shadow, --horizon, --ctrl-headroom,
--unified-caps, --experimental-unified and --allow-unqualified. -m
defaults to the configuration's max_reduction. The service conflicts
with speakersafetyd.service.

Adapted tests:
- small_gaps_are_charged_not_filled_with_the_next_period,
  time_around_a_hand_off_is_charged_at_the_gain_it_may_have_played_at
  and frames_over_charged_time_add_nothing set the written reductions
  and the gains record as per-speaker vectors (a type change).
- The DelayedWait and CopyQueue test cards forward set_reductions.
- PR #6's engine tests now start their governing run from ambient.
  PR #6 started the asahi models at 119 C and checked only the end;
  the first full-scale period took the J316 tweeter to about 174 C.
  asahi_governing_keeps_its_model_under_the_hard_limit now runs 20 dB
  under full scale, and checks that full scale latches on the J316.

Each review witness is a test asserting the safe outcome:
- F1: the sensed power whatever was asked; volume failures; a partial
  per-speaker write; rate failures from the start
- F2: a 139 C clean stop and a damaged file; holds, gain and latch
  across a clean stop
- F3: alternating and single bad periods (fails without the rule)
- F4: coil, magnet and NaN crossings in the engine and at the loop
- F5: a missing state; a 0.1.8 state without the engine; a held
  snapshot; speakersafetyd's flag
- F6: a 240 ms loss versus a queued backlog; 1.5 ms gaps
- F8: the three unqualified machines refused and not started by udev;
  unified shadow-only
- r3 on the engine: a late event wake (T1), no events (T1), the
  hand-off charged per speaker at the least held with no write (T2,
  T3), a held snapshot and a v1 file latched (T4, T7), the unified
  minute budget (T5), frames over and partly over charged time (T6),
  and a clean stop that accounts the engine before its final state (T2)
- R4 on the engine: a latched clean stop rearms only under the ceiling

134 of 134 pass.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
PR #6's recordings held complete periods, timestamps and gains, but
nothing that told closed speakers from lost sense data. Its replay
cooled every separation of more than four periods as silence, never ran
the guard's decisions, and had no clipping bound. The review (F7) found
two zero periods 0.5 s apart replayed as a 0.4 s cooling gap, while the
live guard charged the same interval and handed off.

A recording (format 2) now keeps the guard's environment and its
decisions. It holds every sample-rate change and change event, every
sense open, and every complete period's words with whether it was a
measurement. Each period carries the most reduction the card may have
applied over it: its safe level wherever the lock was not held all
through it, so the program rebuilt from the words is never quieter
than it was. It also holds the frames read at each close, every short,
stalled or failed period, failed control writes, the lock taken and
handed back with the reason, the governing latch, and the model the
guard started from (as a clean stop's state at that instant, so the
replayed guard resumes it unchanged). It stops at its size limit and
marks the end.

The replay runs the real guard on a simulated card driven by the
recording. The card keeps the kernel's lease in playing time, its
one-shot notice and its safe level. The program before the card's gain
is rebuilt from the words and the recorded gain, then played through
the per-speaker gains the replayed guard writes. Both are rounded up to
the control's 0.5 dB step, the program is --gain-db louder if asked,
and it is clipped at full scale. --governor replays another governor
on the same program.

The guard can keep a trace of its account. The replay reports how
much it measured, charged and cooled, and lists every uncovered
interval as charged, not measured. It marks what it cannot reproduce as
unqualifiable: lost frames, bad sense data, failed rate reads and
opens, failed control writes and the daemon's own lateness (neither is
replayed), periods played louder than recorded where the card may have
held more than 30 dB or the words clipped, and an early end. With the
recorded governor at 0 dB it compares its lock and latch transitions
with the live ones within 300 ms. It certifies only a recording with
nothing unqualifiable, matching transitions, and no measured span over
frames the recording lost or rejected. Otherwise it says why and exits
with status 3. A certificate says the replay saw what the live daemon
saw, not that the speakers are safe.

Not replayed, and so only marked: control write failures, the
daemon's scheduling delays, the PCM pointer's own timing (periods
arrive when they were read), and anything after a fatal error, which
the live daemon does not survive to record.

New tests:
- a clean J700 recording replays to the live decisions and certifies,
  its stream edges listed as charged
- so does a clean J413 one, whose muted periods before the lock
  replay muted; played louder they are not certified
- the F7 witness: a 500 ms gap in an open stream is charged, never
  measured, handed off by the replayed guard, and not certified
- bad sense data replays charged, not measured, with the live
  hand-off, and is not certified
- the recording keeps the start state, the lock changes with their
  reasons, a stall and failed control writes
- +20 dB replays clip at full scale and govern harder
- a recording stopped at its size limit is not certified

141 of 141 pass.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Brings #7's 0.1.9 (the fourth review's U1-U6) to every model here.  The
fixes are ported, not taken, where the rework had made the guard per
speaker: the gain history keeps each speaker's value and whether the
card's safe level may have applied, the budgets of the legacy and the
unified models undo each block at the most reduction that can have
delivered it, and the unified models restore their budget means as late
as the energy can have come.  0.1.9's witnesses run here too.

The same lines carry two of the #8 review's V/I findings:

P8-2: after bad sense data the lock is not taken again, idle or not,
before REARM_PERIODS valid periods in a row (the closing tail's bad data
no longer hands off and rearms in one pass).  A clean stop carries the
state.

P8-3: every model integrates the frames over time not yet accounted, and
only those, the oldest of them for its new part only: a whole period stays
whole whatever the clock's rounding, and the asahi models take every new
sample (no block means for a partly accounted period).  A latched asahi
model that starts exactly at its limit can cool from it again.

The controls go to their minimum at the start, so their unknown earlier
value counts in the budgets only for the copy queue's half second (on a
machine whose budgets ask for more than --max-reduction at full scale the
lock never came back otherwise).

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Assisted-by: LLM
Brings #7's 0.1.10 (the fifth review's V1-V6) and its randomized oracle
harness to every model here.  As with 0.1.9 the fixes are ported where
the rework made the guard per speaker.

* Each history entry holds every speaker's range of values.  A failed
  write may have left anything from the old value to the new one, one
  step either way.  Where the lease may have run out the card's safe
  level is a candidate as well.
* Every frame is inverted at the most likely of its candidate gains,
  for the legacy, the unified and the asahi models alike, not the mean
  of a block at one gain.
* The card rounds what it is given, and the history keeps what it
  applied.
* A period's place in time is bounded from the reads around it.  Only
  the frames certain to lie in the accounted span are credited, each
  at its most energetic alignment.
* The state is read under the card's lock.
* The restart gap is charged at full scale before the gain.
* The final save's clock reads are paired, and any pause between them
  is charged once more at full scale and full gain.

0.1.10's witnesses run here too, with the harness's h01-h12.  The
version is 0.1.10.

Two defects turned up while porting.

The asahi models were stuck at their limit.  Each period's uncertain
frame, charged at full scale, took a model a little over the limit, and
the rule that holds a crossing at the limit then kept it there for good.
Now the crossing still latches, but the model is held at the limit only
when negative V*I follows the crossing (what the rule is there for).  A
latched model that sees no negative power cools.

The harness found the second (h13).  The recording hooks read the boot
time even with no recording running.  A 0.16 s hold-up in one such read,
just after the rate read that showed a stream, came before the time
without sense data was counted, so the lease was renewed 0.596 s blind.
The hooks now read the clock only while recording.  The time without
sense data is now counted from before the rate read, however long the
daemon is held up after it.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Assisted-by: LLM
The #8 review found a recording that certified while the replay accounted
nothing.  Four delayed event wakes at closed speakers were charged live
(15 ms at full scale).  The rate never read as open, so the recording held
only wakes, and the replay, driven by rate changes alone, ran no look
there.  It still said the replay matched the live decisions.

A recording (format 3) now keeps two more things.

* Every span of the guard's account, measured, charged or cooled (C).
* Each look at closed speakers that charged, with the span it charged and
  the change events it saw before and after its rate read (K).

The replay looks at closed speakers where the live daemon did.  It looks
nowhere inside a span the live daemon charged at its next look, and those
looks see the live events.  It ends with the look that ended the live
account, once every period is read.  Its account is then compared with
the live one, outside 5 ms at each end of each live span.  The
certificate is refused when the replay measured or cooled time the live
daemon charged, cooled time it measured, or its account ends before the
live one.  This holds whatever governor or gain is replayed.

A period or tail whose words the file does not hold now ends the
recording there, whatever a seek past the end says.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Assisted-by: LLM
The harness witness h13 reaches it through a recording hook's clock
read.  This one holds a rate read up 0.12 s: the blind time must count
from before the read, not from 120 ms after the look.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Assisted-by: LLM
This adds a LADSPA plugin for the J700 speaker graph in PipeWire's
filter-chain.  It predicts the cone displacement of every sample from
the driver's lumped model.  The model is a closed box with no coil
inductance:

    X/V = (Bl/Re) / (Mms s^2 + (Rms + Bl^2/Re) s + Kms)

It is bilinear-mapped and prewarped at resonance.  The plugin lowers the
gain just enough, ahead of time, that the cone stays under 0.9 of Xmax
and no sample passes full scale.  A velocity limit is there too, off by
default.

The gain is a sliding minimum of each frame's requirement, ramped by a
running mean over 3.333 ms.  The ramp ends 4 ms before the frame that
needs it goes out.  Those 4 ms are the cone's memory: its ringing at
resonance decays by e in 1.2 ms, and a gain falling while the cone still
rings is not a gain applied to it.  Without the hold the cone passed
Xmax by up to 13 % on random programs.  The model's prediction is held
at 0.89 of Xmax, so the gain changes left inside the memory keep the
true cone under 0.9.  The release is 200 ms.  The two channels share
one gain.

The latency is 351 frames at 48 kHz (7.3 ms), reported on the latency
port.  The defaults are the MacBook Neo's driver values: Bl 0.74 T m,
Mms 0.16 g, Kms 1720 N/m, Rms 0.14 kg/s, Re 4.3 ohm, 7.30/7.33 V at full
scale, Xmax 0.565 mm.

The audio thread never allocates.  The memory for the longest window
and hold is taken at instantiation, and a control change only
reconfigures.  An invalid control keeps the last valid set; before any
valid set the output is silence.  A sample that is not finite is taken
as silence.

Tests (make filter-test, on x86_64 and aarch64 Linux):
- the model's DC gain and resonance;
- transparency: below the limits the output is the delayed input, bit
  for bit;
- the limits on loud tones and bursts;
- an impulse delayed by exactly the reported latency, within a 352-frame
  budget;
- non-finite input;
- no drift after ten minutes of limiting;
- no allocation in run() (glibc);
- invalid controls.
test_random drives the limiter against an independent model of the
cone: its continuous equation of motion, integrated by Runge-Kutta at
eight steps a sample.  The inputs are random programs (tones, bursts,
chirps, square waves, steps, impulses, noise, random block sizes) plus
172 worst-case shapes: steps, impulse trains around resonance, square
waves at it and its odd fractions, and quiet-to-full-scale jumps.  Over
87000 random programs and the shapes, the worst cone was 0.8956 of
Xmax.  With the prediction held at 0.9 instead, or with a 2 ms hold,
the test fails.

make filter and make install-filter build and install the plugin apart
from the daemon.  The daemon is unchanged.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Assisted-by: LLM
measure() and block_powers() are used only by the tests since the guard
places every period and converts frame by frame.  A release build (the
static aarch64-musl one too) warned that they were never used.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Assisted-by: LLM
The second #8 review (X1) found a latched asahi model that never let go.
After a hand-off the volume controls keep the governed value, 0 dB in its
case, so each period's sliver of uncovered time was charged at full scale
at 0 dB.  That put the tweeter's model back over its limit, and the next
negative V*I sample held it there.  With +-1 LSB of noise on V and I the
latch never cleared and the lock was never taken back while the stream
played, so the speakers sat at the card's safe level.

Two changes.

* Once a hand-off has drained, uncovered time is charged at each
  control's value or the card's safe level, whichever is more, until the
  next renewal.  The card holds its lock from the moment it is given up
  (or taken at start) and applies at least its safe level to anything it
  converts after that.  What was converted before is gone after the drain.
* After a crossing, only negative V*I beyond a noise floor of 1 mW holds
  the model at the limit.  The floor comes from the M1 Pro recording of
  the first review.  Its 14.4 million quiet samples carry 7 to 9 LSB of
  noise, 45% of them have negative V*I, and the most negative is -44.6
  uW.  In its playback periods the tweeters go down to -50 mW and the
  woofers to -0.93 W.

The latch still clears only once the model's coil, magnet and their
peaks are all under the working limit.

Tests that set up a held lease by hand now also say the card's lock is
not held.

Witnesses, each failing when its change is reverted:
- vi_a_drained_hand_off_charges_at_the_safe_level
- a_latched_model_over_the_limit_cools_through_sense_noise
- vi_a_latch_after_a_hand_off_clears_through_sense_noise (the review's
  case with no noise and with +-1, +-3 and +-9 LSB plus offsets; with
  both changes reverted it stays at 150.000 C)

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
A charge at constant power bounded the coil over the interval by where
its drive started whenever the coil sat below a falling drive, however
short the interval.  After a latch the asahi model re-armed at about
20 dB on the J316 with its tweeter's magnet at 138 C.  The first sliver
of uncovered time, a hundred microseconds at 0.42 W, was then bounded at
157.5 C for a coil at 139.9 C.  That latched the model again at every
renewal, and the lock went back and forth for as long as the stream
played.  The V/I harness of the next commit found it with its quiet-tail
property.

The coil under a constant power is a constant plus two exponentials, so
it has one extremum at most.  The bound is now the larger end of the
interval or that extremum, computed in closed form.  Equal time
constants keep the old bound.

Witness: a_constant_power_step_bounds_its_inside_tightly (the case
above bounds at 139.9 C, not 157.5 C, and over 400 random states,
powers and intervals the bound is never under the coil inside and never
more than a fine step over its maximum).  It fails with the old bound.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The second #8 review (X2) found that the harness brought in with 0.1.10
runs only the J700's legacy model.  It never builds the engine, never
sees V/I words, and never governs with asahi or unified or writes a
control per speaker.

src/harness/vi.rs adds a V/I world, the J316 and the J413 with their own
configuration files at a shorter period.  The card, its lease and events,
the capture, the clock, the faults and the restarts behave as in the J700
world.  What is new:

* the program has a share for each speaker and plays a sine or a square
  at the Nyquist rate;
* each speaker's current is its voltage over an impedance of random
  magnitude and phase (up to 60 degrees), never past the current sense's
  full scale, so V*I goes negative over part of every cycle;
* the sense words are S16 V and I with up to 20 LSB of noise and a fixed
  offset of up to 10 LSB per channel, as on the M1 Pro, and periods can
  be bad sense data or reach the daemon late;
* the gain is the amplifier's own, applied as the samples play, or a
  copy queue's, applied as they are converted;
* the asahi governor writes a control per speaker, with the unified
  models in shadow or governing (the opt-in);
* a quiet tail can follow, the speakers open and silent.

The oracle integrates every sample's true power into three models of its
own per speaker (RK4): the measured-power constants on V*I, and the
feed-forward ones on V^2 over z_nominal and over r_ff.  After every pass
it checks (a) every model the daemon runs against its truth, (b) the
asahi ramp on the true coil and magnet against what the card applies
while the lease is held, and no lease at a true hard limit or a true
need over --max-reduction, (c) the J700 world's rules, no lock before two
good periods after bad sense data, and none with the governing model
latched, and (d) at the end of a quiet tail as long as the daemon's own
models need to cool, the latch cleared and the lock back.

A model that does not govern is checked against its truth only while a
start from no clean stop still bounds it: the latched start stands for a
run whose governing model kept the coil under its limit, which says
nothing of a shadow model's truth.

It found the hold bound of the previous commit with (d).  It also finds
X1 reverted ((d), seed 25), a margin under the measured power ((a)), bad
sense data taken as a measurement, the wait for good periods after it
dropped, a latch that does not hand the card over ((c)), and a worst case
under the full-scale square ((a)).

Default 60 cases; SPEAKERGUARDD_VI_CASES and SPEAKERGUARDD_VI_SEED as for
the J700 harness.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The second #8 review (X3) found that a start without a clean stop held
the V/I machines at the card's safe level for 163 s on the J413 and
127 s on the J316, which is every boot there.  A latched start put the
coil at the hard limit plus what half a second of drain at full scale
adds, and the magnet where steady state would put a coil that hot:
736 C for the J413 tweeter.

What the start stands for is a run that kept its model's coil and magnet
under the hard limit (its latch hands the card over at either), may have
left its gain on samples still to play for up to the drain at full
scale, and then left the card at its safe level.  The engine's models
now start at that bound: coil and magnet at the limit, the drain held
exactly from there, and no lower than the safe level's steady state.
The two-node model is monotone in its state and its power, so this
holds every such past from then on, however long ago the drain ended.
The J413 tweeter starts at 1096 C with its magnet at 203 C.  The lock
comes back after 58 s on the J413 and 84 s on the J316, mostly the time
their magnets take to cool from the limit.  The legacy model (the J700's
default) is unchanged.

A unified line without its measured-power model, resumed from a clean
stop, now starts that model with its magnet at the limit too, not at
steady state.

The README also describes X1's noise floor and drained hand-off.

Witnesses:
- a_latched_start_bounds_every_past_it_stands_for: on the J316, J413
  and J700, from every corner and middle of the limit box, any part of
  the drain and any time after it, the truth is never hotter than the
  start's model over the next ten minutes, nor under the working limit
  first.  It fails with the magnet at steady state for the limit.
- vi_a_start_with_nothing_known_takes_the_lock_back_sooner: under 70 s
  on the J413 and 95 s on the J316 (162.9 s with the old start).

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The second #8 review (X4) found that the unit conflicted with
speakersafetyd.  Started on an M1 Pro, M2 or J616 (udev does not, but a
person or a dependency might), it stopped speakersafetyd first, then
refused the unqualified configuration and exited.  After five tries it
gave up, and neither daemon ran.  The card held its safe level, so the
speakers were safe, but muted, and nothing brought speakersafetyd back.

The unit has no Conflicts= now.  The card's interlock is exclusive:
whichever daemon takes it first protects the speakers, and the other
cannot start.  A configuration the daemon refuses to govern (unqualified,
a missing opt-in, an unreadable file) exits with status 78 before the
card is touched, and the unit does not restart on it, so a drop-in that
switches a machine with Conflicts= and OnFailure=speakersafetyd.service
hands the speakers back at once.  The README says so.

Witness: a_refusal_to_govern_leaves_the_other_protection_running checks
the unit (no Conflicts= on speakersafetyd, RestartPreventExitStatus=78)
and that the J316, J413 and J616 files and a missing one are refused
with 78 while the J700's loads.  It fails with the Conflicts= line put
back, and with the restart prevention taken out.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The second #8 review (X5) found that the P8-8 comparison left out 5 ms
at each end of every live span, so a span of 10 ms or less was never
compared.  A recording whose live daemon charged 8 ms that the replay
cooled reported nothing missed and certified.

Each live span is now compared whole.  The replay places frames to a
frame of where the live daemon did (with no allowance at all the
existing recordings differ by one frame, 20.8 us at 48 kHz), so a span
may differ by a frame at each end at the recording's fastest rate and by
nothing more.  Any time beyond that the live daemon charged and the
replay measured or cooled, or measured and the replay cooled, refuses
the certificate.

Witness: a_short_live_charge_the_replay_cools_is_refused (8 ms, 1 ms and
200 us charged live and cooled by the replay are refused).  It fails with
the 5 ms band put back.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
X1's change to the charge after a hand-off, in the module's list of
rules: while the card holds its lock, once what it converted before has
drained, uncovered time is charged at the card's safe level at least.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The V/I harness compared the card with speakersafetyd's ramp on the
true state, and refused a lease held with that need over
--max-reduction, whatever governed.  The unified governor regulates to
its own target and does not follow the ramp, so for it only the hard
limit is checked.  No case had failed on it.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
A 2M-case J700 harness run on #8 found the 1 s budget before the gain
0.5% under the truth (seed 8100719359), and 0.16% at a stream's start
(seed 8100823990).  Both fail on 0.1.10 as well.  Fleet found the cause
for #7.  measure_shifted gave each block its own mean, but the models
take the blocks as equal shares of the run's time, so when the frames
do not split evenly the longer blocks lose energy.  In the first case
274 frames went into nine blocks of 30 and 31, and the loud end, in a
31-frame block, lost 1.8% of its energy.  Whole periods (16 blocks of
256 frames) were never affected.

Each block's sum is now spread over the equal share, in the guard (the
legacy model and its budgets) and in the engine (the unified models and
their budgets), so the run's energy is exact.  The asahi models
integrate every sample and were not affected.

Witnesses:
- h14_uneven_blocks_keep_their_energy and
  h15_uneven_blocks_at_a_streams_start (the two harness cases), which
  fail with the guard's change reverted;
- uneven_blocks_keep_the_runs_energy (the unified minute of power holds
  the exact energy of 274 frames in nine blocks), which fails with the
  engine's change reverted.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…n be

The third #8 review (Z2) found that the current sense clips at 3.75 A
while a full-scale program into the J316 and J616 woofers' 2.7 ohm draws
4.4 A.  V*I then read up to 15% low, and the asahi model ran as much
cooler.  speakersafetyd computes power from the same words.

A current word at its rail now stands for |V| times the most current the
amplifier can drive into the speaker: its peak voltage over the smallest
impedance the speaker can present.  The review proposed V^2 over the
DC resistance, which holds for a resistive load only.  A reactive load's
current peaks while the voltage is low, and the V/I harness found a case
(seed 500010338) where V^2 over the resistance still read low.  Below the
rail nothing changes.  The asahi models and the unified models' power
before the gain both take the bound.

The V/I harness now lets the current clip: a load can go down to the
speaker's smallest impedance, the word clips at its rail, and the
speaker still gets the whole current.

Witnesses:
- a_current_word_at_its_rail_is_bounded_by_the_voltage (a clipped period
  heats the model exactly as the bound does), which fails with the bound
  removed;
- the V/I harness on the clipping world, 30,000 cases (seeds
  500000001-500030000) pass.  With the bound removed it fails at seed 659
  ((a), Left Woofer 1), and with V^2 over the resistance at seed
  500010338.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The third #8 review (Z5) found that the X4 witness loaded conf/apple
from the source tree when it ran.  Outside the tree its refusal half
passed because a missing file is also a refusal, and its J700 half
failed (the one failure of 195 under QEMU there).  The configurations
are now built in and written to a directory of the test's own.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The account charges at least a frame at full scale before every period,
because a period's frames are placed only to a frame.  The unified
regulator took that frame's full scale as the program for its next
horizon, attacked at once and released over 20 s, so the cut never went
away.  On the J616 a live shadow log showed unified asking 13.7 dB on
tweeters at 52 C and 1 mW, and 11 dB on the woofers, for a whole
session.  The replays of the first recordings had no such charges and
did not show it.

A charge still heats every model at the worst case and still counts in
the power budgets.  It no longer becomes the regulator's prediction.
Frames the card may have converted at more than 30 dB of reduction (its
safe level, an unknown control) do not either: inverted at -99.5 dB a
muted card's noise read as a full-scale program, which would have kept
a stream that plays through a restart muted.  The prediction stays where
the last frames at a known gain left it.

Witnesses:
- a_charge_before_each_quiet_period_holds_no_reduction (J316 and J616: a
  one-frame charge before each quiet period asks for nothing, and each
  model is hotter than without the charges by at least half of one
  frame's full-scale heat), which fails when a charge sets the
  prediction again;
- a_full_scale_onset_is_attacked_at_once, the guard on the fix: a
  full-scale period at a known gain gets the whole need within its own
  period, and fails when measured frames stop setting the prediction;
- frames_at_the_cards_safe_level_are_not_the_prediction and
  a_muted_card_does_not_amplify_noise, which fail when every frame
  counts as at a known gain.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
`--governor unified --guard asahi` (or `guard = asahi` in a
configuration) makes the feed-forward model primary on the machines with
V/I sense, with the measured-power governor as protection.  Every period
each speaker's control gets the larger of the two governors' reductions,
group-linked, and either one's hard latch hands the card to the kernel.
The card is therefore never less protected than under the asahi governor
alone.  The guard needs V/I sense on every speaker, guards the unified
governor only, and is that governor's opt-in to write the card, so it
does not need --experimental-unified.

Under the guard the regulator holds the feed-forward model only.  The
measured-power side is the guard's.  Unified's own measured-power model
has the same constants under a look-ahead.  On a J316 recording played
10 dB louder it asked for more than speakersafetyd's ramp on the
tweeters and kept the card at its safe level for 50 s of 338, against
20.5 s for the asahi governor and 18.6 s for the guarded feed-forward
regulator.  It still runs, latches and is logged.

Current that reads too little (a dead or switched-off current line) is
not bad sense data, since V*I is 0.  The asahi models then see no power,
the guard adds nothing, and the feed-forward model governs alone, as on
a machine without current sense.  Sense data that is not a measurement
(mean V*I below -0.01 W, or nonfinite) stays a fault exactly as before,
because the feed-forward model's voltage comes from the same words.

Recordings carry the guard in the start record's governor code, and a
replay uses it by default when it replays the recorded governor.  A
configuration without a guard fingerprints as before, so recordings
made by 0.1.10 still match.  The shadow log names the guard.

Witnesses:
- the_asahi_guard_lets_the_unified_governor_write_the_card, which fails
  if the guard needs no V/I sense or unified writes alone without the
  flag;
- the_asahi_guard_gives_each_speaker_the_larger_reduction (the asahi ramp
  binds the tweeters and the regulator the woofers, the card holds the
  larger every period, and the asahi latch alone hands the card over),
  which fails if the guard adds nothing or its latch is ignored;
- under_the_guard_the_regulator_holds_the_feed_forward_model, which fails
  if the guarded regulator tightens on its measured-power model;
- a_dead_current_line_leaves_the_feed_forward_model_governing (120 s with
  the current words at 0: no hand-off, the card is the regulator's, the
  feed-forward model stays at or under 140.3 C, while the asahi governor
  alone plays at 0 dB with that model past 150 C), which fails if the
  guard replaces the regulator or zero power is taken for bad data;
- the V/I harness now runs a third of its cases guarded, a share of them
  with a current line that dies for up to 2 s.  Under the guard it checks
  that each card reduction is at least what speakersafetyd's ramp asks
  for on the true state, and that the lock is never held with the
  feed-forward truth at its hard limit.  With the guard adding nothing
  it fails within 1,500 cases.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The unified regulator inverts each measured frame through the most
reduction the card may have converted it at that the word has room for.
Where the possible gains span a wide range that makes any audible word
full scale.  Two ranges are that wide: an unknown control value at a
start that did not follow a clean stop (0 dB to mute), and a write still
in flight across a large step.  Fed such frames, the J316 regulator asked
for 13.6 dB on its tweeters and 9.5 dB on its woofers.  The frames at the
card's safe level that followed never replaced that prediction, 85 s on.

Frames whose possible gains lie more than 1 dB apart are now left out of
the prediction, as frames at more than 30 dB already are.  A step of the
release stays well inside that.

On the V/I machines neither range reaches audible frames today.  When the
owner dies its control locks go with it, and the SN012776 amplifiers apply
the card's safe level as they play, so the frames after a crash restart
are 100 dB down and already left out.  A failed write spans only its own
step, and the guard hands the card off then.  The wide range over audible
frames appears with the next release's write history, which records the
old and the new value from before each write: unlocking from the safe
level then leaves 0 to 99.5 dB over the first audible frames.  The rule
is needed there and costs nothing here.

Witness: frames_at_an_ambiguous_gain_are_not_the_prediction, which fails
with the rule removed.  a_guarded_start_into_a_playing_stream_takes_the_lock_back
is a regression test of the crash restart.  It holds with or without the
rule, because those frames are at the card's safe level.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The fourth #8 review (CC1) found that the 1 dB spread test drops too
much.  A period's candidate gains are every value the controls held
from half a second before its frames played, which is the J700's copy
queue.  The V/I amplifiers apply a new gain as they play, so after an
attack or a retake the frames fit both the old value and the new one.
The spread test dropped them, and the regulator was blind for half a
second after every gain change over 1 dB, the asahi ramp's under the
guard included.  On a dead current line, a full-scale square on the
J316 took the measured-power truth to 208 C after a retake, where
2dc7351 holds 90 C.

A frame is now left out only when it fits one candidate range wider
than 1 dB: an unknown control value, or a failed write.  A frame that
fits several exact values keeps the most that fits, as before
2fa0346.  That is the newer value after an attack and the right one
after a retake.  This still closes what 2fa0346 was for: the unknown
value at a start that did not follow a clean stop, a write from the
safe level in flight, and the review's CC2, a partly failed first
write after an unlock that held the card silent until the stream
closed.

Witnesses:
- frames_that_fit_several_exact_gains_are_the_prediction (a retake at
  4 dB with 0 dB still a candidate, at full scale): the program is
  predicted and the regulator attacks.  It fails under 2fa0346's
  spread test.
- frames_at_an_ambiguous_gain_are_not_the_prediction: unchanged, and
  it fails with the rule removed.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Each control's write is atomic, so a write that fails part way leaves
each control at its old value or the new one, never between them.  The
controls' history kept the span from the smaller to the larger, and
under 80ba1bb's rule a frame that fits a span wider than 1 dB is left
out of the unified regulator's prediction.  The fourth #8 review
(addendum 2) found the cost of that.  A full-scale onset during a
partial failure of the first write after an unlock, from the unlock's
minimum to 0 dB, was invisible to the regulator.  In its family 2 the
feed-forward model alone then took the measured-power truth past 150 C
in 425 of 7,020 cases, against 173 under 2dc7351.  Read at its most
instead, as 2dc7351 did, the same span held an audible program as if
it were full scale (CC2).

The guard now keeps each control's candidate values, the old ones and
the new one up to a step above it, and gives the engine each as its
own range.  80ba1bb's rule stays for a value that is really unknown
(a start that did not follow a clean stop).  The least and the most
each control holds are unchanged, and so are the charges.

Witness: a_failed_first_write_after_an_unlock_leaves_either_value.
After the first write after an unlock fails part way, every control
has the two values and no span.  A full-scale onset under it is
attacked (over 3 dB on every speaker of the J316), and a 2.5 V program
is not held.  Read as the span under 80ba1bb's rule, the onset gets
0 dB.  Read as the span at its most, the 2.5 V program is held 9.6 to
11.3 dB down.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The fourth #8 review's one major finding (BB1): a current line that
reads nothing, ISENSE off or a broken line, is not bad sense data (V*I
is 0), so the asahi models saw no power.  speakersafetyd and the asahi
governor alone did nothing at all, and under the guard the feed-forward
model governed alone.  Over 120 s steady programs on the J316 that let
the measured-power truth reach 176-186 C.

A line is now lost for a period when, at 0.1 V rms or more, a 10 ms
block's current is under a tenth of what the speaker's nominal
impedance would draw, or a 1 ms block's under a hundredth.  A live line
through a reactive load of up to 60 degrees stays well under both for
sines down to 20 Hz.  While it is lost every measured-power model, the
asahi governor's and unified's, takes V^2 over the speaker's smallest
impedance, as at the sense's rail, and the guard logs the change both
ways.  What a line lost too briefly for a block to show may have
under-read at a period's end or start (the most current less what was
read) is charged as an instant of heat after the period, unless the
period next to it shows the line reading, and at once when measurement
stops.  Heat charged later is never cooler than the same heat earlier
in this model.  A line that reads low but plausibly is not caught.

The V/I harness now checks the measured-power truth after a dead line
too, less what the bound can miss there (under the blocks' floor, at a
dead stretch's two ends, inside a cycle of a reactive load).  Dead lines
also come under the asahi governor alone and unified alone, and some
cases end in the review's two onsets, a staircase to full scale and a
full-scale onset inside a partial write failure.  A long class (BB2)
runs steady programs for minutes under the asahi governor and the
guard, with the lines live and dead, and asserts that the
measured-power truth never reaches its limit: six by default, all 120
of 120 s with SPEAKERGUARDD_VI_LONG.

Witnesses:
- a_dead_current_line_is_bounded_by_the_voltage (engine): a dead line's
  models match a live line's at the smallest impedance.
- a_dead_current_line_is_governed_as_the_most_current_there_can_be
  (guard, replaces a_dead_current_line_leaves_the_feed_forward_model_
  governing): under the guard and under the asahi governor alone the
  card is held as a live line at the smallest impedance holds it.
- what_a_lost_line_hides_is_charged: a line lost in a period's last 30
  frames, the same then closed, one reading again 40 frames in, and a
  loud program's line lost for 5 ms; each is never cooler than the
  bound from the moment the line died.
- a_live_line_through_a_reactive_load_is_not_lost.
- vi_long_programs_keep_the_properties.
Each fails with its part removed (detection, the bound in either
model, the short block, the long block, the end's charge, the start's
charge, the charge at a gap).

Also a comment on the failed-write candidate cap (r4 addendum 3's
MINOR): no value is lost at it, and the guard does not reach it today.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The fourth #8 review (addendum 4, DD1) found that f8715a7 bounds a dead
line and one reading far too little, but not one that reads low but
plausibly, or a dead line carrying a DC offset.  Over 120 s programs
those took the measured-power truth back to 176-186 C under the guard
and up to 434 C under the asahi governor alone.  speakersafetyd does
the same.

Two more tests now mark a line lost, bounded like a dead one by V^2
over the speaker's smallest impedance:

- Its current does not follow its voltage.  Over a period with at least
  0.1 V and 20 mA rms, sum(v i) under 0.2 of sqrt(sum(v^2) sum(i^2)).
  A live load of up to 60 degrees keeps it over 0.4.  This catches
  every offset line in the review's table (62-114 C).
- Its low-band resistance is more than a live coil can show.  Over the
  last 3 s of program with at least 20 mA rms below 120 Hz, sum(v i)
  over sum(i^2) above 1.35 times z_min, raised with the measured-power
  model's coil temperature at the coil's temperature coefficient.  On
  the J616s's woofers at full volume it reads 1.28 to 1.49 times z_min,
  so a fixed bound near 1.6 would have flagged hot coils, and a line
  reading half doubles it.  This catches fraction lines down to half
  on programs with bass (108 C).

What V and I cannot tell apart is a line reading a fraction of its
current on a program with no low-band current from a higher impedance.
That is every tweeter, and treble-only programs on the woofers: the
review's square and 3 kHz rows stay at 180-434 C for 0.11-0.5 of the
current, and a line reading 0.7 sits at 148-156 C everywhere.  A
left/right twin check comes next.

Also from the review: the short-block test needs two lost blocks in a
row (DD2; the review's 20 Hz, 60 degree, 4x corner at 8 kHz is now a
witness), and lost-line logging holds for 2 periods lost and 5 reading
(the bound follows the line at once).  The V/I harness's dead-line
allowance applies only at a dead stretch's ends until the engine has
charged them (DD3).  A speaker can set its own z_min (a unit's DC
resistance), never above the default.

Witnesses:
- a_line_that_reads_low_or_off_its_voltage_is_lost: a line reading 0.4
  and a dead line with 0.2 A of offset are lost; a live line is not; a
  live line at 1.45 times z_min is lost with the model at 20 C, not at
  120 C.
- a_line_at_the_threshold_is_logged_once.
- a_line_lost_anywhere_is_charged_by_the_next_stretch: 600 randomized
  deaths at 8, 16 and 48 kHz; once charged the models are no cooler
  than ones fed the bound.  It catches each of BB1's charge and block
  mutations on its own.
- a_live_line_through_a_reactive_load_is_not_lost: the noisy 8 kHz
  corner.
- z_min_can_only_be_lowered.
- The V/I long class gains 24 low and offset lines on programs the
  tests can see, asserted under the limit.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
812e42e's power-factor test marked the M2's right woofer lost in a
quiet passage of today's 14:33-17:37 recording: 0.10 V rms, just at the
test's 0.1 V gate, against 25 mA at a power factor of -0.015 to 0.014,
for four periods.  It was bounded for those periods (2.5 mW) and logged
both ways.  The test now needs 0.3 V rms; what a dead line carrying an
offset can hide under that is at most 0.3^2 W over the smallest
impedance, 22 mW at 4 ohm.  The other tests keep their gates.

Witness: a_quiet_line_at_a_right_angle_is_not_judged (that passage's
numbers: 0.1 V is not judged, the same current at 1 V reads as lost).
It fails with the old gate.

All seven of today's V/I recordings (the J616s 14:01-14:34, the M1 Pro
13:22-13:44 and 14:28-15:19, the M2 12:28-14:33, 14:33-17:37 and
17:44-18:01, and the M1 Pro session) replay with no lost line and
identical to f8715a7.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The fourth #8 review (addendum 5) found both new line tests misfiring
on healthy speakers at +10 dB of replay gain, and the low-band flag
sticky once set.

EE1.  2f7d16d's 0.3 V gate moved the power-factor misfires to louder
content rather than removing them: the M1 Pro's tweeters fired at 0.32
and 0.38 V.  Every misfire seen lasted at most four periods, while an
offset line stays offset.  The test is judged from 0.1 V again, and is
lost at once from 0.5 V rms; under that the condition has to hold for
2 s of judged program.  What it can hide meanwhile is at most 0.5^2 W
over the smallest impedance for 2 s, 67 mW on the J413's tweeters.
(EE3: 2f7d16d's "at most 22 mW" under its gate was 22 to 33 mW by
speaker, 7.4 K steady on the J413's tweeters.)

EE2.  The J616s's right woofer 2 read a low-band resistance of 1.55
times z_min at +10 dB with the model's coil at 59 C, over 1.35's bound,
and stayed flagged.  The bound is now 1.6 times z_min at 20 C, raised
with the model's coil temperature as before: the woofers at full volume
sit at about 0.7 of it, and a line reading half still doubles it.  R has
to stay over the bound for a second of program, and a flag with no
low-band current to judge it by clears after 30 s of program.

All seven of today's V/I recordings replay identical to f8715a7 with no
lost line, at their recorded level and at +10 dB.

Witnesses: a_quiet_line_at_a_right_angle_is_not_judged (the M2 passage
is not lost in four periods, 0.2 V for 3 s is, 1 V is at once);
a_line_that_reads_low_or_off_its_voltage_is_lost gains the review's
1.55 at 59 C (not lost), a hot coil at 1.75, a line reading low that
is not yet lost after five periods, and a flag that clears through 50 s
of treble.  Each fails with its part removed.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Review r4 addendum 6a held 9b54f81: its 1 s set-hold, LOW_R_RATIO 1.6
and 30 s clear let bad lines run up to 65 K hotter under the guard than
at 2f7d16d, while fixing the real-data misfires.  This keeps the
misfire fixes and gives the protection back.

Low band:
- LOW_R_RATIO is 1.35 again.
- From 1.25 times the bound the line is lost at once.  Under that (the
  marginal band, where the review's +10 dB misfire sat at 1.002) R has
  to stay over the bound for 1 s of program, and the stretch's power is
  bounded by V^2 / z_min while it waits; only the verdict (the log, the
  sticky flag) waits.
- The wait and the verdict are judged against the least bound since R
  went over it.  The bound rises with the model's coil, which the
  bounded line heats with the most power there can be: on a J316
  tweeter on bass with its line reading 0.65 the model ran from 95 to
  113 C in four periods of the wait, past the line's R, and the line
  was never bounded again (162.7 C against 111.0 at 2f7d16d).
- It reads again under 0.9 of that bound.  Only a marginal verdict
  (never past 1.15 times its bound) is forgotten, after 30 s of audible
  program with no low-band current; a line far over the bound stays low
  through any passage without bass.
- The low band is judged on audible program only: at the card's safe
  level the words are the sense's noise, and they cleared a line
  reading 0.65 at a hand-off.

Power factor:
- FF1: judged whenever the dead-line test's current is there
  (i >= v / (DEAD_RATIO z_nominal)) instead of from 20 mA, so the two
  tests meet: a dead line with a 10-19 mA offset on a quiet program was
  caught by neither.
- From 0.1 V rms; at once from 0.5 V, after 2 s of judged program
  under it.  What it can hide meanwhile is at most PF_FAST_V^2 / z_min
  for 2 s, once: 92.6 mW on the J316/J616 woofers, 78.1 mW on their
  tweeters, 62.5 mW on the J413 woofers, 67.2 mW on its tweeters (5.0 K
  after 2 s there).  This wait is not bounded: bounding it changed the
  guard's hand-off cycle at the safe level, where the test runs on the
  sense's noise, and put one offset row 0.6 K over 2f7d16d.

Against 2f7d16d on the review's own tooling (rv10patch.py): the matrix
(320 rows) is hotter in none and 0.7 K cooler in one; the schedule (96
runs) is identical.

Witnesses: a_line_that_reads_low_or_off_its_voltage_is_lost gains the
0.11 line bounded in its first period, the 0.6 line flagged, the 1.55
line at 59 C not lost in five periods but bounded while it waits (as a
dead line is), the same wait judged against its first bound while the
model climbs from 59 to 125 C, the verdict kept with the model at
165 C (where 0.9 of the bound now is over the line's R), a 15 mA offset at 0.4 V, a 0.2 line kept
through 80 s of treble, and a marginal flag kept at the safe level and
forgotten after 30 s of treble.  a_quiet_line_at_a_right_angle_is_not_judged:
the M2 passage (0.1 V, four periods) is not lost, 0.2 V for 3 s is,
1 V is at once.

Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
RyanTheTide and others added 2 commits October 31, 2026 21:49
Document the reviewed J700 evidence start and V/I latch, generation-3 compatibility, external marker and unresolved strict listening budgets. Keep protection and acceptance thresholds intact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adapt the #17 test adapter to the multi-machine Hw and model interfaces. Preserve both 20-minute full-scale witnesses (with and without events) and the independent hot-node comparison, alongside the RC suites.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RyanTheTide RyanTheTide changed the title Integrate 0.1.13-rc.1 unified protection stack with strict release gates Reconcile main and the unified 0.1.13-rc.2 candidate; retain strict listening gates Oct 31, 2026
RyanTheTide and others added 5 commits November 1, 2026 03:53
Restore main's interval-peak drain bound on the legacy model. The continuous Thermal endpoint can sit below the magnet-first substep state, failing the retained independent hot-node oracle at the J700 start. Keep independent node and safe-level equilibrium floors, the original oracle and its tolerance, and the V/I engine path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Apply the safe-level floors only to finite drain states, so f64::max cannot turn a NaN from a full-scale overflow back into an apparently valid temperature. Add a regression using finite constants accepted by the configuration parser; retain the original independent-start oracle and tolerance unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep the drain peak when it is nonfinite even if both endpoint temperatures are finite. A parser-accepted fast-coil configuration exercises this separate overflow path; the finite guard must reject it before any unlock. The original hot-node oracle and its 1e-8 assertion remain unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The J713's speakers were measured on the machine, under speakerguardd,
with each voice coil's resistance (from its amp's V/I sense) as its
thermometer. The method and the data are in speakerguardd#10.

The tweeters' total thermal resistance came out as the J413's: 226-245
K/W across two runs, against 234. But they cool faster than the J413
constants say. At a constant level, after the drive steps down, the coil
cools with about 1.8-2.0 s and the magnet with 24-30 s, against the
J413's 3.9 s (feed-forward) and 70 s. With those constants the model
lets a burst of a few seconds to tens of seconds through at a power the
real coil can't take. Use the VI set's 1.85 s for both coil time
constants and 25 s for both magnet ones. The thermal resistances stay.

Replayed offline on three J713 recordings, the change leaves the
tweeters' hold where it was (17.0 -> 16.5 dB and 15.0 -> 15.0 dB at the
median). With the recording played 10 dB louder, the modelled coil peaks
2 C higher.

The woofers measured at about 37 K/W against the J413's 52. The J413
constants overstate their heating, and they stay as they are.

The J713 parse test now allows these three tweeter constants to differ
from j413.conf.

Signed-off-by: Erik Bourget <erik@ebourget.net>
Qualification asks for evidence for every role and board variant, a review
of the constants, and an explicit change to `qualified`. For the J713,
which has one board variant, the evidence is in speakerguardd#10:

- Routing: playing each slot alone reaches only its own amp's sense. V*I
  is positive, and the measured voltage is 0.99-1.03 of what the amp's
  18.5 dBV full scale and the daemon's reduction predict, on all four
  speakers.
- Tweeters: their thermal resistance matches the J413's. Their time
  constants are the J713's own (the previous commit).
- Woofers: their measured heating, about 37 K/W, is under the J413's 52,
  so the J413 constants overstate it and stay.
- Certification: a recording of the daemon governing the J713 with this
  profile (test sounds) certifies on replay. It is complete, the replay
  matches the live decisions, and there are no ambiguous intervals. It was
  recorded with `qualified = false` and --allow-unqualified; the flag only
  gates starting. Against the J413's tweeter constants the replay refuses
  it as not the recorded configuration.

This is a proposal, for the maintainers to take or leave: it rests on one
J713. Mark the profile qualified, and have udev start the daemon on the
J713 as on the J700. The tests that refused it as unqualified now expect
it to govern.

Signed-off-by: Erik Bourget <erik@ebourget.net>
RyanTheTide and others added 2 commits November 4, 2026 14:52
Inert until the kernel's grant is fully qualified (linux #697); every
other path keeps its existing onset reserve.

Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Superseded: the head 4a8a049 is v0.1.13-rc.2, contained in v0.1.13-rc.3 (f8f401b).

@RyanTheTide
RyanTheTide deleted the fu-speakerguardd-rc branch November 28, 2026 04:51
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.

2 participants