Skip to content

fix: round the predictor window up, so it holds the points it promises - #90

Merged
test1card merged 11 commits into
masterfrom
fix/predictor-window-holds-its-points
Aug 20, 2026
Merged

test1card merged 11 commits into
masterfrom
fix/predictor-window-holds-its-points

Conversation

@test1card

Copy link
Copy Markdown
Owner

Not a flake

A required job failed on the conductivity panel guard with

assert 899.9999999999999 >= 900.0

The predictor window is the observed cadence times the minimum point count. The cadence is a measured median of gaps, so a nominal 30-second feed arrives as 29.999999999999996 and the product lands one unit in the last place below the window that holds the required number of points.

A window a hair too short holds one point fewer than the count the method exists to guarantee — which is exactly the "silently never producing a valid prediction" failure its own docstring names. So the fix belongs in production, not in a tolerance in the test.

What it costs

Measured at master on Ubuntu 22.04.5 with evidence/tools/flake_loop.sh: 1 run in 12 failed. Besides the defect, that is a lost CI round in eight, on a queue that is already the constraint on merging anything.

Where the test lives, and why not next to its neighbours

In a new sibling module, tests/gui/shell/overlays/test_conductivity_predictor_window.py.

tests/gui/shell/overlays/test_conductivity_panel.py is a registered guard file of record CONDUCTIVITY-AUTO-EVIDENCE-AUTHORITY-081, and a red-reproduction receipt binds its exact blob. Adding a test there invalidates the receipt and drags an unrelated governance repair into a one-line arithmetic fix.

That is measured, not assumed: the first attempt did exactly that. The receipt had to be re-run at its defective commit and its locator re-pointed, and the whole-tree documentation gate still refused. The sibling module costs nothing and leaves the guard's evidence untouched.

Evidence

The two new tests drive the real method rather than recomputing its arithmetic, and the first fails with production reverted to master. Panel suite plus the new module: 73 and 2 passed. ruff check src/ tests/ clean; the workflow-exact format check clean over 703 changed files.

Nothing rendered changes. The window is a numeric input to prediction and is not displayed anywhere.


Written with assistance from Claude (Anthropic).

A required job failed on the conductivity panel guard with

  assert 899.9999999999999 >= 900.0

and it is not a timing flake. The predictor window is the observed cadence times
the minimum point count. The cadence is a MEASURED median of gaps, so a nominal
30-second feed arrives as 29.999999999999996 and the product lands one unit in
the last place BELOW the window that holds the required number of points.

A window a hair too short holds one point fewer than the count the method exists
to guarantee, which is exactly the "silently never producing a valid prediction"
failure its own docstring names. Rounding up is therefore the fix in production,
not a tolerance in the test.

Measured at master on Ubuntu 22.04.5 with the workspace flake tool: the guard
failed 1 run in 12. So besides the defect it cost a CI round in eight, on a queue
that is already the constraint on merging anything.

The test lives in a NEW sibling module rather than in the panel's own test file.
That file is a registered guard of record CONDUCTIVITY-AUTO-EVIDENCE-AUTHORITY-081
and a red-reproduction receipt binds its exact blob, so adding a test there
invalidates the receipt and drags an unrelated governance repair into a one-line
arithmetic fix. Measured, not assumed: the first attempt did exactly that and the
whole-tree gate refused until the receipt was re-run and its locator re-pointed.

The new tests drive the real method and fail with production reverted to master.
Nothing rendered changes; the window is a numeric input to prediction and is not
displayed.
# Conflicts:
#	docs/architecture-montana-important.svg
#	docs/current_candidate_metrics.md
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@test1card

Copy link
Copy Markdown
Owner Author

The hosted job still fails here, and it is a DIFFERENT assertion

This branch fixes the window floor. The ubuntu-latest, gui job at this exact head fails on something else, and I only know that because the candidate artifact preserves the output the job summary does not print:

tests/gui/shell/overlays/test_conductivity_panel.py:1060
    assert pred is not None and pred.valid
E   AssertionError: the real predictor must yield a valid prediction for a 30-second
    cadence inside its cadence-derived window
E   assert ... valid=False, tau_s=0.0, amplitude=0.0, percent_settled=0.0 ...

Not 899.9999999999999 >= 900.0. The window assertion at line 1020 passed; the predictor then produced nothing valid.

What that most likely is, stated as a hypothesis rather than a finding

The test feeds thirty samples spanning now_wall - 870 … now_wall, then calls panel._predictor.update(_time.time()). The predictor prunes by wall-clock timestamp against a 900-second window. The span of thirty samples at a thirty-second cadence is 870 seconds, so the window carries exactly one cadence of slack — and the elapsed time of the feed loop itself eats into it. That job ran the GUI suite in 995 seconds; on a runner that loaded, ninety _handle_reading calls plausibly take more than thirty seconds, the oldest sample is pruned, twenty-nine points remain, and the predictor declares nothing.

I have not proved that. What is measured:

where runs failures
master, lab host 12 1 (the window floor, which this branch fixes)
this head, lab host 25 0
this head, hosted ubuntu-latest 1 1 (the assertion above)

So the branch removes one failure mode and does not remove this one. I am not claiming it does.

What I did not do

I did not touch tests/gui/shell/overlays/test_conductivity_panel.py. It is a registered guard file of record CONDUCTIVITY-AUTO-EVIDENCE-AUTHORITY-081 and a red-reproduction receipt binds its exact blob, so a change there is a governance repair as well as a test edit — and the correct change is not obvious yet: if the slack really is the issue, the question of whether production's window should carry more than one cadence of headroom is a real one, and it belongs in its own slice with its own evidence.

One thing worth fixing regardless

The job summary prints only FAILED NODE: <id>. The assertion, the traceback and the values are in stdout.bin inside the candidate artifact, which has to be downloaded and unzipped by hand. Every hosted failure therefore costs a round trip before anyone knows what failed — and this one was misread as the window floor until the artifact was opened.


Written with assistance from Claude (Anthropic).

…assumed

The hosted job kept failing this guard on a DIFFERENT assertion from the floor
this branch already fixed: the window check passed and the predictor then
returned nothing valid, with tau, amplitude and settled all zero.

Read from the predictor rather than guessed: it prunes at now - window_s and
refuses below min_points. N points spaced by one cadence SPAN (N-1) cadences, so
a window of exactly cadence times points fits the required points with a single
cadence to spare. Any delay longer than one cadence between the oldest sample and
the update tick drops that sample, leaves N-1 points, and the prediction goes
invalid -- the "silently never producing a valid prediction" failure this method
exists to prevent, arriving through the window instead of through the count.

Measured directly against the predictor, thirty points at a thirty-second
cadence, span 870 s:

  window 900s, tick  0s late -> valid True
  window 900s, tick 15s late -> valid True
  window 900s, tick 45s late -> valid FALSE
  window 930s, tick 45s late -> valid True
  window 930s, tick 90s late -> valid False

So one cadence of headroom is exactly the difference, and two cadences of lateness
still fails, which is the honest limit of this change.

For the laboratory this is the sweep-advance path of the conductivity feature: a
feed one cycle late would sit at twenty-nine points and never advance. The probe
is a workspace tool so the numbers can be re-run rather than believed.

Overlay suite: 534 passed, including the guard that was failing.
@test1card

Copy link
Copy Markdown
Owner Author

@codex review

Head is 50055c2accb59784b4fc23a88ea06eb811f62456. A lane closed the live review findings; the coordinator ran the landing gates on this tree -- byte-order-mark, encoding and parse checks on every changed file, a refusal on any tree that deletes more than it adds, ruff check and ruff format --check on the changed Python, the derived documentation pair regenerated to a fixed point, and the documentation gate green.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

# Conflicts:
#	docs/architecture-montana-important.svg
#	docs/current_candidate_metrics.md
@test1card

Copy link
Copy Markdown
Owner Author

@codex review

Head is a82a6414945fa84a8e3f79c803c754bf7be49dad. A lane closed the live review findings; the coordinator ran the landing gates on this tree -- byte-order-mark, encoding and parse checks on every changed file, a refusal on any tree that deletes more than it adds, ruff check and ruff format --check on the changed Python, the derived documentation pair regenerated to a fixed point, and the documentation gate green.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

The protected evidence gate refuses evidence from any run attempt after the first, so a cancelled round cannot be repaired by re-running it. This commit changes no content and exists only to produce the fresh run the gate requires.
@test1card

Copy link
Copy Markdown
Owner Author

@codex review

Head is 5d447bf9703d8bf5973e45f08c47d257998ae0e9. A lane closed the live review findings; the coordinator ran the landing gates on this tree -- byte-order-mark, encoding and parse checks on every changed file, a refusal on any tree that deletes more than it adds, ruff check and ruff format --check on the changed Python, the derived documentation pair regenerated to a fixed point, and the documentation gate green.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@test1card

Copy link
Copy Markdown
Owner Author

This change has now been shown to fix a real, random Linux failure — and here is exactly how much it fixes

While tracing why test (ubuntu-latest, gui) was red on #89, which touches nothing in this area, the artifact named this assertion:

tests/gui/shell/overlays/test_conductivity_panel.py:1060
    assert pred is not None and pred.valid
E   AssertionError: the real predictor must yield a valid prediction for a 30-second
    cadence inside its cadence-derived window

That is the test this change exists for, failing on a branch that cannot have caused it, on Linux, while master's own gui job had been green on it the same day. So it is not a branch defect — it is a margin that is zero by construction on master.

The arithmetic, and then the measurement

Master derives the window as max(300, cadence × 30). A 30-second cadence gives 900 s. Thirty points spaced 30 s apart span 870 s, and the predictor refuses below 30 points. The slack between the newest sample and the tick that reads the prediction is therefore exactly 30 seconds. One pruned point takes the count to 29, and the prediction goes invalid.

Measured against the predictor directly, with no GUI in the path, the delay expressed in the now handed to update() — the same variable the pruning uses (evidence/tools/predictor_headroom_probe.py):

window tick 0 s late 15 s 45 s 90 s
900 s — master today valid valid invalid invalid
930 s — this change valid valid valid invalid

What this change does, stated without overclaiming

It widens the tolerance by exactly one cadence — from about 30 seconds of lateness to about 60. It does not remove the knife edge; it moves it one sample further out. A tick 90 seconds late still yields nothing valid.

That is still the right change, for a reason that does not depend on the test: asking for min_points samples inside a window cadence × min_points wide leaves no room for the arrival jitter that a real instrument always has. Asking for one extra cadence of window is the smallest correction that makes the requirement satisfiable rather than exactly-satisfiable.

What it means for the laboratory, which is the part that matters

On the instrument the samples arrive continuously, so the window holds its thirty points as long as the tick is not late. A late tick does not lose data and does not stop acquisition — the sweep shows stabilizing for that tick and recovers on the next one. So the cost of the present margin is a sweep that occasionally refuses to advance, not a measurement that is lost or misreported.

That is a lower severity than a data fault, and it is still worth fixing before a week of running, because a sweep that will not advance needs a person in front of it.

# Conflicts:
#	docs/architecture-montana-important.svg
#	docs/current_candidate_metrics.md
@test1card

Copy link
Copy Markdown
Owner Author

@codex review

Head is 3455b99587c296cc6f098fdd29d4ef94e730b67f. A lane closed the live review findings; the coordinator ran the landing gates on this tree -- byte-order-mark, encoding and parse checks on every changed file, a refusal on any tree that deletes more than it adds, ruff check and ruff format --check on the changed Python, the derived documentation pair regenerated to a fixed point, and the documentation gate green.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@test1card
test1card merged commit df4e8ef into master Aug 20, 2026
29 checks passed
@test1card
test1card deleted the fix/predictor-window-holds-its-points branch August 20, 2026 00:19
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