8000 fix: composed plans refuse contradictory stage values, with the H5 rejection corpus (#348) by rafatahmed · Pull Request #354 · rafatahmed/Flahax · GitHub
[go: up one dir, main page]

Skip to content

fix: composed plans refuse contradictory stage values, with the H5 rejection corpus (#348) - #354

Merged
rafatahmed merged 1 commit into
mainfrom
test/h5-composed-plan-rejections
Nov 27, 2026
Merged

rafatahmed merged 1 commit into
mainfrom
test/h5-composed-plan-rejections

Conversation

@rafatahmed
Copy link
Copy Markdown
Owner

Closes #348 once the build/twine pinning (H8) lands; this PR is H5 only, so it says Part of #348 and does not close it.

Part of #348 (roadmap H5).

Method. I altered one field at a time in a valid composed plan and probed the stage planners with inconsistent records.

  • Stage planners were already strict. plan_ph rejected all 25 inconsistent water, curve and reagent records I tried (mismatched ids, changed assays, bad curves, missing measurements), and plan_pump_command rejected stale (inclusive 30-day limit), future, unreadable and unusable calibrations. These are now pinned by tests.
  • The composer was not. compose_delivery_plan accepted pH plans, pump commands and stock plans changed after planning, as long as volumes and channels still matched. For example a pH plan with a blank water id, a target of 99, a positive reagent volume with zero mass, or post_mix_measurement_required=False; a command with an empty calibration id or zero runtime; a stock plan with status 'garbage' or approved with an incomplete search.

Fixed. The check shared by compose_delivery_plan, delivery_report and transition_plan now raises cross_stage_constraint for:

  • pH plan (both types): blank record or channel ids, a target outside pH 0 to 14 or non-finite, a non-finite loss, no post-mix measurement, a positive reagent volume with zero mass; for a titration plan also an unknown direction and a positive volume with zero demand.
  • Pump command: a blank calibration id, a non-positive or non-finite runtime, a non-finite uncertainty.
  • Stock plan: status other than qualified or requires_review, approval that disagrees with the status, or an approved mixture with an incomplete search, unverified limits or a non-compatible assessment.

Left as it was on purpose

  • requires_operator_verification=False on a command is still accepted: an existing test documents that the explicit transition is the approval.
  • A zero-volume pH plan that keeps its original mass still composes (an existing test relies on it).

Known limit (documented). A stage value does not keep the records it was planned from, so a plan altered consistently (for example a reagent mass doubled with its volume) cannot be detected at composition. Closing that needs the source records or a digest on the stage values, which changes saved results; I left it out.

For your decision: a measured pH curve whose first point (demand 0) is at 7.4 is accepted with a water record whose pH is 7.9. The curve is a titration of that water, so the two should agree, but any tolerance would be a number I choose. I have not added one.

Added: tests/test_composed_plan_rejections.py (18 tests). Without the source change 27 of its checks fail.

Verified locally: the new tests on Python 3.11, 3.13 and 3.14; 108 delivery, stock, pH, pump, site and example tests; changelog, manifest, release-hygiene and documentation tests; ruff check and format; 100% coverage of the new lines.
Not run: the full pre-push suite (hours); CI runs the full gate.

…tradict each other, add the H5 rejection corpus (#348)
@rafatahmed rafatahmed added the bug Something isn't working label Nov 27, 2026
@rafatahmed rafatahmed self-assigned this Nov 27, 2026
@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 Flahax | 🛠️ Build #36220648 | 📁 Comparing c927413 against latest (765beae)

  🔍 Preview build  

2 files changed
± changelog.html
± developer/delivery-quantities.html

@rafatahmed
rafatahmed marked this pull request as ready for review November 27, 2026 22:22
@rafatahmed
rafatahmed merged commit bb879d1 into main Nov 27, 2026
27 checks passed
@rafatahmed
rafatahmed deleted the test/h5-composed-plan-rejections branch November 27, 2026 22:22
8000
@codecov
codecov Bot commented Nov 27, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (765beae) to head (c927413).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #354   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          151       151           
  Lines        17779     17816   +37     
  Branches      3584      3599   +15     
=========================================
+ Hits         17779     17816   +37     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0.7.1: edge-case corpus, convergence diagnostics and rejection tests (H2, H4, H5)

1 participant

0