Skip to content

Reject masked update diagnostic integers#4492

Merged
FlorianPfaff merged 2 commits into
mainfrom
agent/reject-masked-update-diagnostics-integers
Jul 17, 2026
Merged

Reject masked update diagnostic integers#4492
FlorianPfaff merged 2 commits into
mainfrom
agent/reject-masked-update-diagnostics-integers

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Bug

MeasurementUpdateDiagnostics validates active_measurement_indices and measurement_count through operator.index. NumPy masked integer scalars expose their hidden payload to that conversion, so a genuinely missing value such as np.ma.array(7, mask=True) was silently accepted as the integer 7.

This can make diagnostics report measurements as active, or accept a measurement count, based on inaccessible masked data.

Fix

  • reject NumPy masked scalars and arrays whenever any value is genuinely masked
  • retain support for ordinary Python/NumPy integer-like scalars
  • retain support for MaskedArray integer scalars whose mask is false
  • add focused regressions for active indices, measurement counts, and unmasked compatibility

Validation

  • reproduced operator.index(np.ma.array(7, mask=True)) == 7 before the fix
  • syntax-compiled the patched module in isolation
  • ran focused behavior checks for masked rejection and unmasked compatibility
  • branch comparison: 2 commits ahead of main, 0 behind; only the diagnostics helper and its validation test changed

The full repository CI matrix should provide integration and backend coverage.

@github-actions

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 16.01s
✅ JSON prettier 7 0 0 0 0.69s
✅ JSON v8r 7 0 0 3.6s
✅ MARKDOWN markdownlint 68 0 0 0 1.32s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.61s
✅ PYTHON black 1551 200 0 0 67.28s
✅ PYTHON isort 1551 371 0 0 1.79s
✅ REPOSITORY betterleaks yes no no 1.99s
✅ REPOSITORY checkov yes no no 38.98s
✅ REPOSITORY gitleaks yes no no 10.82s
✅ REPOSITORY git_diff yes no no 0.22s
✅ REPOSITORY secretlint yes no no 42.95s
✅ REPOSITORY syft yes no no 4.34s
✅ REPOSITORY trivy-sbom yes no no 4.28s
✅ REPOSITORY trufflehog yes no no 25.23s
✅ YAML prettier 11 0 0 0 0.48s
✅ YAML v8r 11 0 0 8.31s
✅ YAML yamllint 11 0 0 0.36s

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

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.6.0 --custom-flavor-setup --custom-flavor-linters PYTHON_BLACK,PYTHON_ISORT,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_BETTERLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

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

@FlorianPfaff
FlorianPfaff marked this pull request as ready for review July 17, 2026 13:15
@FlorianPfaff
FlorianPfaff merged commit 7c8a33e into main Jul 17, 2026
26 checks passed
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