Skip to content

Reject masked shared random parameters - #4964

Closed
FlorianPfaff wants to merge 2 commits into
mainfrom
agent/reject-masked-shared-random-parameters
Closed

Reject masked shared random parameters#4964
FlorianPfaff wants to merge 2 commits into
mainfrom
agent/reject-masked-shared-random-parameters

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Summary

  • reject genuinely masked distribution parameters before shared NumPy/Autograd random wrappers coerce them with asarray
  • cover uniform bounds, normal location/scale, multivariate-normal mean/covariance, and choice probabilities
  • preserve ordinary NumPy inputs and fully unmasked MaskedArray values

Root cause

The shared validators converted inputs with asarray before checking NumPy mask semantics. For a masked scalar or partially masked array, that conversion exposes the hidden data payload and discards the mask. Missing configuration values could therefore become real sampling parameters.

Examples include a masked normal scale being silently used as its hidden standard deviation and a masked choice probability being normalized and sampled from.

Impact

NumPy and Autograd backend samplers now fail early instead of drawing reproducible-looking samples from missing data. The earlier masked-input fix for NumPy randint and multinomial did not cover these shared distribution samplers.

Validation

  • reproduced mask loss for scalar and partially masked arrays through NumPy asarray
  • isolated exact-module regression: eight masked cases rejected and the fully unmasked compatibility path passed
  • Python syntax compilation passed for the modified source and regression module
  • branch comparison: 2 commits ahead, 0 behind main
  • final diff is limited to 8 validator lines and one focused test file

@github-actions

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 28.77s
✅ JSON prettier 7 0 0 0 1.27s
✅ JSON v8r 7 0 0 4.52s
✅ MARKDOWN markdownlint 68 0 0 0 1.97s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.69s
✅ PYTHON black 1809 55 0 0 99.08s
✅ PYTHON isort 1809 87 0 0 2.83s
✅ REPOSITORY betterleaks yes no no 2.03s
✅ REPOSITORY checkov yes no no 59.07s
✅ REPOSITORY gitleaks yes no no 17.1s
✅ REPOSITORY git_diff yes no no 0.3s
✅ REPOSITORY secretlint yes no no 89.56s
✅ REPOSITORY syft yes no no 6.2s
✅ REPOSITORY trivy-sbom yes no no 7.03s
✅ REPOSITORY trufflehog yes no no 32.86s
✅ YAML prettier 11 0 0 0 0.76s
✅ YAML v8r 11 0 0 13.45s
✅ YAML yamllint 11 0 0 0.72s

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

Copy link
Copy Markdown
Owner Author

Closing as low value. This expands masked-array rejection across shared random-distribution parameters, but masked arrays are not a supported cross-backend sampling contract in PyRecEst. Adding piecemeal validation here would increase inconsistency rather than establish coherent missing-data behavior.

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