Skip to content

Normalize Python scale validation, metadata, and exception returns - #986

Merged
wangyinz merged 4 commits into
masterfrom
codex/issue-861-scale-contract
Aug 22, 2026
Merged

wangyinz merged 4 commits into
masterfrom
codex/issue-861-scale-contract

Conversation

@wangyinz

@wangyinz wangyinz commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Closes #861

Summary

  • Correct scale method and amplitude metadata-key mappings.
  • Validate percentile levels while preserving object identity on documented data errors.
  • Treat only MsPASSError as a documented data failure: log Invalid, kill live affected data, and return the original object.
  • Propagate unexpected RuntimeError and TypeError unchanged, without mutation, logging, or life-state changes.
  • Preserve the established percentile rank floor(p * n); cap only the terminal p = 1 index to the last sample.
  • Keep native binding tests and Python wrapper tests in separate contract files.

Maintainer decisions

The percentile definition remains the one used since this function was introduced. Unexpected programming/runtime errors are not reclassified as waveform-quality errors. The shared function wrapper gains an opt-in propagation flag whose default remains unchanged; scale enables it explicitly.

Validation

  • Isolated Release native scale contract: passed
  • Native binding, Python wrapper, and adjacent window regressions: 135 passed
  • Shared decorator regressions: 11 passed
  • Black, Python byte compilation, and git diff --check: passed

@codecov

codecov Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.28%. Comparing base (6c6a3d7) to head (3196217).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #986      +/-   ##
==========================================
+ Coverage   71.15%   71.28%   +0.13%     
==========================================
  Files         180      180              
  Lines       35471    35475       +4     
  Branches     2506     2510       +4     
==========================================
+ Hits        25240    25290      +50     
+ Misses       9334     9285      -49     
- Partials      897      900       +3     

☔ 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.

@wangyinz
wangyinz marked this pull request as draft August 14, 2026 06:04

Copy link
Copy Markdown
Member Author

Draft decision required (renewed review)

An API owner must decide whether unexpected non-MsPASSError exceptions propagate or become Invalid logs plus waveform kills. The percentile path must also be retested against a corrected percentile contract; keep this PR draft until both decisions are resolved.

@wangyinz
wangyinz force-pushed the codex/issue-861-scale-contract branch from a5a99ee to 3196217 Compare August 22, 2026 01:01
@wangyinz
wangyinz marked this pull request as ready for review August 22, 2026 01:01
@wangyinz
wangyinz merged commit 431f962 into master Aug 22, 2026
18 checks passed
@wangyinz
wangyinz deleted the codex/issue-861-scale-contract branch August 22, 2026 08:23
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.

Normalize Python scale validation, metadata, and exception returns

1 participant