8000 fix: one validator for targets, so no entry point keeps the old total-N rule (#316) by rafatahmed · Pull Request #317 · rafatahmed/Flahax · GitHub
[go: up one dir, main page]

Skip to content

fix: one validator for targets, so no entry point keeps the old total-N rule (#316) - #317

Merged
rafatahmed merged 2 commits into
mainfrom
fix/one-targets-validator
Nov 25, 2026
Merged

rafatahmed merged 2 commits into
mainfrom
fix/one-targets-validator

Conversation

@rafatahmed
Copy link
Copy Markdown
Owner

Root-cause fix for the class of bug behind #311: an old rule surviving under a unit test.

Why #311 happened

Targets were validated at several call sites by one function with a boolean flag (total_n). The restrictive old rule was the default, so every site that did not pass the flag kept it, and the tests only covered the entry point that had been fixed.

What changes

  • composition.validate_targets is the single validator for targets (all ions plus total N).
  • composition.validate_profile loses the flag; it is for water, maxima and assays and always rejects N.
  • engine, workflow, delivery quantities and the joint problem all use validate_targets.
  • tests/test_targets_validation.py: the flag is gone; an AST guard fails if any call validates a targets map with validate_profile; the same total-N targets go through recommend, solve_weights, gap_for, the workflow, rescore_with_reagent, the equilibrium delivery planner, the joint problem and the batch command, and none may keep the old rule. Reverting gap_for makes these fail.

Closes #316

@rafatahmed rafatahmed added the bug Something isn't working label Nov 25, 2026
@rafatahmed rafatahmed self-assigned this Nov 25, 2026
@read-the-docs-community
read-the-docs-community Bot commented Nov 25, 2026 •
Copy link
Copy Markdown

Documentation build overview

📚 Flahax | 🛠️ Build #36172891 | 📁 Comparing 1265fdb against latest (25dde65)

  🔍 Preview build  

1 file changed
± changelog.html

@codecov
codecov Bot commented Nov 25, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d96b97a) to head (1265fdb).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #317   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          141       141           
  Lines        17430     17441   +11     
  Branches      3552      3555    +3     
=========================================
+ Hits         17430     17441   +11     
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.

@rafatahmed
rafatahmed merged commit 09ffc33 into main Nov 25, 2026
79 of 81 checks passed
@rafatahmed
rafatahmed deleted the fix/one-targets-validator branch November 25, 2026 22:47
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.

One validator for targets: total N was blocked by call-site flags and an old default (follow-up to #311)

1 participant

0