test(control): record the early exits meeting a binding protection - #814
Merged
Conversation
Three branches of ComputeDispatch walk away from a cycle before the safety pipeline: idle mode, the holdoff window, and the reactive deadband. The golden corpus had no record of any of them meeting a protection that binds. Of the 590 records, 33 returned no targets — 25 idle, 1 holdoff, 8 deadband — and every one of the 8 deadband records ran with site_fuse_amps=0 and peak_import_ceiling_w=0. Nothing was over any limit to defend, so 590 recorded ticks could not see the deadband exit skipping every protection. That is the bug #803 fixed, and #803 left this gap open on purpose: recording new records is a corpus change, not a fix. early_exit_protections adds 21 records, 611 in total. Each shape appears twice — once where the protection binds, once where the same site is configured identically and nothing is over its limit. The quiet half is not filler: a corpus of only-firing records cannot tell a fix from an over-fire, and a fuse-saver that discharges on every tick drains the pack as surely as one that never fires trips the breaker. Covered: deadband against a tariff peak ceiling, against a fuse ceiling left above the breaker by a misconfigured peak limit, against a phase over the breaker on three-phase and on single-phase services, with a safety-amp margin, split across two batteries by discharge headroom, denied by a pack under the 5 % floor, and reached through a stale plan's reactive fallback; idle and holdoff against the peak ceiling and against both phase counts. One record is an export-side phase 10 A over the breaker that must stay quiet, because forceFuseDischarge's only lever is more discharge and honouring per-phase relief there would push that phase further over. Single-phase sites get their own records because the phase count is the conversion #812 gave one owner: on one phase the aggregate meter and the phase are the same wire, so relief is the overage once. Under the bare `* 3.0` those records would command three times the overage. This family records the law as fixed, not a bug. slew_limiter deliberately holds a known defect still so its fix reads as a diff in watts; these records were taken after #803 landed and state what dispatch is supposed to do, so a record that moves is a protection that stopped protecting. The family doc comment says so. Verified against the un-fixed code. Reverting #803's dispatch.go hunk locally moves 7 of the 611 records, all of them deadband records where a protection binds, each reading as the commanded discharge disappearing — deadband_per_phase_3p_binds goes from -1380 W clamped to no targets. The 6 quiet deadband records and all 8 idle and holdoff records hold still, because idle and holdoff already ran the fuse-saver before #803. Re-recording to silence the failure does not work either: the coverage assertions fail on what was just written, naming the deadband exit as unguarded again. The eight existing families are byte-identical; only the new file is added. A full re-recording on this machine rewrites 27 of the 590 old records with float noise up to 8.5 microwatts — a thousandth of the 0.01 W tolerance, and nothing a reviewer should have to read. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The family carried ftw_commit fe2c904, a SHA that is not on master and never was. The other eight families name real commits — seven at c7fe6c9, where #790 recorded them, and the new one at c85bfe1. fe2c904 is the pre-squash tip of #809's branch: `git cat-file` finds it locally with #809's subject line, and `git merge-base --is-ancestor fe2c904 origin/master` says it is not an ancestor of master. GitHub squash-merged that branch as c85bfe1, and `git log -- testdata/golden/slew_limiter.json` shows c85bfe1 as the last commit to rewrite the file: #809's fix moved 94 lines of records, and they were re-recorded in the branch worktree before the squash. So the behaviour these 155 records hold is the behaviour at c85bfe1, which is what the field now says. No record changes; only the provenance line. It matters because the field is the one thing telling a reader which dispatch produced these watts, and a SHA that resolves nowhere on master sends anyone tracing the file's history to a dead end. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Test data only. No changeset — nothing ships.
The hole
Three branches of
ComputeDispatchwalk away from a cycle before the safetypipeline: idle mode, the holdoff window, and the reactive deadband. The golden
corpus had no record of any of them meeting a protection that binds.
Of the 590 records, 33 returned no targets — 25 idle, 1 holdoff, 8 deadband —
and every one of the 8 deadband records ran with
site_fuse_amps=0andpeak_import_ceiling_w=0. Nothing was over any limit to defend. That is why590 recorded ticks did not catch the deadband exit skipping every protection,
which is the bug #803 fixed. #803 left this gap open deliberately: recording
new records is a corpus change, not a fix.
What is added
early_exit_protections, 21 records, 611 in total.Each shape appears twice — once where the protection binds, once where the same
site is configured identically and nothing is over its limit. The quiet half is
not filler. A corpus of only-firing records cannot tell a fix from an over-fire,
and a fuse-saver that discharges on every tick drains the pack as surely as one
that never fires trips the breaker.
The export-side record is the direction gate:
forceFuseDischarge's only leveris more discharge, which relieves an import-side phase and pushes an
export-side one further over. It must stay quiet, and now there is a record
that says so in watts.
Single-phase sites get their own records because the phase count is the
conversion #812 gave one owner. On one phase the aggregate meter and the phase
are the same wire, so relief is the overage once — 1610 W by both routes. Under
the bare
* 3.0#812 removed, these records would command 4830 W and drive themeter through zero into an export-side violation.
This family records the law as fixed, not a bug
slew_limiterdeliberately holds a known defect still so its fix reads as adiff in watts. This one is the opposite: every record was taken after #803
landed and states what dispatch is supposed to do. A record here that moves is
a protection that stopped protecting. The family doc comment and the header of
golden_test.goboth say so, since the corpus's standing disclaimer is thatnothing in it was reviewed as correct.
Verified against the un-fixed code
Reverting #803's
dispatch.gohunk locally and replaying moves 7 of 611records — all 7 deadband records where a protection binds, each reading as the
commanded discharge disappearing:
The 6 quiet deadband records and all 8 idle and holdoff records hold still,
because idle and holdoff already ran the fuse-saver before #803. Restoring the
fix, all 611 replay clean.
Re-recording to silence the failure does not work either.
TestGoldenDumpruns the coverage assertions over what it just wrote, and against the un-fixed
code they fail:
All 21 recorded values matched the prediction written down before recording.
Second commit: a provenance wart
slew_limiter.jsoncarriedftw_commit: fe2c904f, a SHA that is not on masterand never was. It is the pre-squash tip of #809's branch —
git cat-filefindsit locally with #809's subject,
git merge-base --is-ancestor fe2c904f origin/mastersays it is not an ancestor, andgit log -- slew_limiter.jsonshows the squash c85bfe1 as the last commit to rewrite the file. So the
behaviour those 155 records hold is the behaviour at c85bfe1, which is what
the field now says. No record changes.
Why the diff adds only one corpus file
The eight existing families are byte-identical. A full re-recording on this
machine rewrites 27 of the 590 old records with float noise up to 8.5 µW — a
thousandth of the 0.01 W tolerance, and nothing a reviewer should have to read.
make verifyclean on both commits.🤖 Generated with Claude Code