Skip to content

Reject non-finite flux-summary numerics - #273

Draft
FlorianPfaff wants to merge 4 commits into
mainfrom
agent/validate-flux-summary-numerics
Draft

Reject non-finite flux-summary numerics#273
FlorianPfaff wants to merge 4 commits into
mainfrom
agent/validate-flux-summary-numerics

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Member

Summary

  • validate summarize_flux() timing metadata before computing scientific summaries
  • reject fractional/non-finite frame counts and non-finite frame rate, duration, or belt-velocity metadata
  • reject non-finite derived summary values, including arithmetic overflow in velocity conversion
  • make beltmap-flux-summary reject NaN/infinite frame rates during argument parsing, before writing artifacts
  • add regressions for package autoloading, invalid metadata, derived overflow, CLI failure behavior, and patch reload idempotence

Root cause

beltmap-flux-summary parsed --frame-rate-hz with plain float(). Comparisons such as nan <= 0 are false, so NaN was forwarded to summarize_flux() instead of being treated as absent or invalid.

The shared summarizer also accepted non-finite timing metadata directly. It stores frame_rate_hz in the result and multiplies per-frame velocities by it, so NaN, infinity, or finite arithmetic overflow could reach particle_flux_summary.json as bare NaN/Infinity tokens. Python's encoder permits those by default, but they are not valid strict JSON and can also make the reported science metrics meaningless.

Impact

Malformed timing metadata now fails clearly rather than producing non-standard JSON or non-finite velocity/flux statistics. Normal finite inputs and the CLI's existing zero-as-unspecified behavior are unchanged.

Validation

  • isolated executable harness reproduced and rejected NaN frame rates
  • isolated executable harness rejected overflowed derived velocity values
  • repeated patch reloads preserved the true original summarizer
  • all changed Python sources syntax-parse successfully
  • branch is 4 commits ahead of and 0 commits behind main

GitHub Actions will provide the repository-wide test and lint result.

@github-actions

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 10 0 0 0.93s
✅ COPYPASTE jscpd yes no no 3.47s
✅ MARKDOWN markdownlint 24 0 0 0 2.25s
✅ PYTHON ruff 208 1 0 0 0.36s
✅ REPOSITORY git_diff yes no no 0.07s
✅ YAML prettier 12 0 0 0 1.45s
✅ YAML v8r 12 0 0 5.02s
✅ YAML yamllint 12 0 0 0.88s

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

See detailed reports in MegaLinter artifacts

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

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