8000 fix: validate custom products before batch chemistry by rafatahmed · Pull Request #243 · rafatahmed/Flahax · GitHub
[go: up one dir, main page]

Skip to content

fix: validate custom products before batch chemistry - #243

Merged
rafatahmed merged 1 commit into
mainfrom
fix/custom-input-validation
Nov 11, 2026
Merged

rafatahmed merged 1 commit into
mainfrom
fix/custom-input-validation

Conversation

@rafatahmed
Copy link
Copy Markdown
Owner

Summary

Custom batch records could crash input handling or silently change chemistry when two products shared a name. Valid products beginning with test_ were also rejected as placeholders.

custom batch input
  validate record structure, IDs, names and reagent density
  reject duplicate names with an entry-specific input error
  accept valid chemistry regardless of display-name prefix
  calculate and report the selected products

Preserve existing malformed-reagent error text while adding entry details. Actual unfinished formulas and invalid assays remain rejected. Update regressions and unreleased documentation; solver controls, tolerances and package version are unchanged.

Closes #240
Closes #241
Closes #242

Evidence

  • Before: malformed custom records raised uncaught exceptions; string reagent density reached arithmetic. After: plain input errors identify invalid input before calculation, without writing result files.
  • Before: identical custom KNO3/KH2PO4 records changed from pH 5.1351 to 6.9985 when their names collided, reversing the reagent direction. After: both orderings of duplicate names are rejected; distinct names preserve both records, independently checked nutrient totals and reports.
  • Before: changing valid names to test_KNO3 and test_KH2PO4 rejected the recipe. After: both product orders retain the control recipe's accounting and pH direction.
  • Full local suite: 159 modules, 1,463 tests run, 2 platform-specific skips, no failures. Fresh statement and branch coverage passes the unchanged 100% gate.
  • Independent checks: 15 custom calculation/accounting cases, one expected invalid-water-share rejection and six solver-boundary probes pass.
  • Clean wheel/source-package installation, lint, formatting and syntax checks pass. Specification and standards reviews have no remaining findings.
  • Earlier failed attempts are retained locally, including the error-message compatibility failure corrected before the final complete run. Hosted checks must validate this PR's head separately.

Merge Danger

Door: two-way

Revertible code and regression-test changes; no data migration.

Blast Radius: inputs

Batch and mix callers with duplicate product names must provide distinct names. Valid distinct-name custom inputs remain supported. This PR does not create a release.

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

Documentation build overview

📚 Flahax | 🛠️ Build #35808898 | 📁 Comparing 62c4795 against latest (813366f)

  🔍 Preview build  

1 file changed
± changelog.html

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

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (813366f) to head (62c4795).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #243   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          115       115           
  Lines        13717     13736   +19     
  Branches      2715      2721    +6     
=========================================
+ Hits         13717     13736   +19     
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 2d0429b into main Nov 11, 2026
13 checks passed
@rafatahmed
rafatahmed deleted the fix/custom-input-validation branch November 11, 2026 11:51
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

1 participant

0