fix(gtheory): harden NumPy scalar trust - #852
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review. 📝 WalkthroughWalkthroughG-theory numeric validation now uses exact trusted NumPy scalar types. Caller-defined subclasses are rejected before conversion or numerical callbacks. Regression tests cover spoofed metadata, hostile conversions, hashing, and equality behavior. Documentation and a changelog entry record the validation boundary. ChangesG-theory scalar validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This localized change hardens NumPy scalar validation at the public G-theory boundary without changing numerical behavior; no actionable merge-blocking risk remains beyond normal checks and review. Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
OpenCode cannot approve yet because required coverage evidence did not pass.
Review outcome
1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence
-
Problem: The required coverage-evidence job result was
failure, so OpenCode cannot establish approval sufficiency for this head. -
Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.
-
Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports
successwith required evidence or explicit no-source not-applicable evidence. -
Regression test: Keep the approval branch checking
needs.coverage-evidence.result == successbefore posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present. -
Result: REQUEST_CHANGES
-
Reason: coverage-evidence result was
failure, so required test/docstring evidence was not proven for current headf079ccf847409618287735477c0ad4d24beab672. -
Head SHA:
f079ccf847409618287735477c0ad4d24beab672 -
Workflow run: 31913763410
-
Workflow attempt: 1
Coverage evidence
Coverage evidence job did not run or did not publish coverage evidence.
Changed-File Evidence Map
flowchart LR
PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
Evidence --> S1["Docs (2 files)"]
S1 --> I1["operator or user guidance"]
I1 --> R1["Review risk: Docs (2 files)"]
R1 --> V1["docs review"]
Evidence --> S2["Changed file: gtheory.py"]
S2 --> I2["repository behavior"]
I2 --> R2["Review risk: Changed file: gtheory.py"]
R2 --> V2["required checks"]
Evidence --> S3["Test: test_gtheory_numpy_scalar_subclass_trust.py"]
S3 --> I3["regression suite"]
I3 --> R3["Review risk: Test: test_gtheory_numpy_scalar_subclass_trust.py"]
R3 --> V3["targeted test run"]
OpenCode Review Overview
Pull request overviewOpenCode cannot approve yet because required coverage evidence did not pass. Review outcome1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence
Coverage evidenceCoverage evidence job did not run or did not publish coverage evidence. Changed-File Evidence Mapflowchart LR
PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
Evidence --> S1["Docs (2 files)"]
S1 --> I1["operator or user guidance"]
I1 --> R1["Review risk: Docs (2 files)"]
R1 --> V1["docs review"]
Evidence --> S2["Changed file: gtheory.py"]
S2 --> I2["repository behavior"]
I2 --> R2["Review risk: Changed file: gtheory.py"]
R2 --> V2["required checks"]
Evidence --> S3["Test: test_gtheory_numpy_scalar_subclass_trust.py"]
S3 --> I3["regression suite"]
I3 --> R3["Review risk: Test: test_gtheory_numpy_scalar_subclass_trust.py"]
R3 --> V3["targeted test run"]
|
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Admin green-wave product SUCCESS
Scope
Fix #851 at the public G-theory numeric-control marshalling boundary without changing generalizability-theory mathematics.
Protected
maintreated a NumPy numeric scalar as trusted when it satisfiedisinstance(...)and its class__module__string started withnumpy. Caller-defined scalar subclasses can spoof that metadata and override__int__/__float__, so the existing predicate could authorize caller code before Rust numerical dispatch.Test-first lineage
2e4ea04b31b9883be74f01de9c7ccbc382925d41adds public-boundary regressions using caller-definednp.int64andnp.float64subclasses whose module metadata is spoofed tonumpy; rejected values must not execute conversion or representation callbacks and must not reach result-affecting Rust calls.d4b6a09bca142c9ccec20ef0f5c9bd096d49c8a5replaces module-name trust with exact package-supported NumPy integer/floating scalar type identities while preserving built-in Python controls and genuine NumPy scalar normalization.8c1484921ec47fc28e28b99d5ac7d7cfa31375e3records canonical release evidence.ddd66bf7a7b78c9c3014ece0584b897bd27bec2badds APA-traced doctoring and separates final NIST SSDF 1.1 from the SSDF 1.2 Initial Public Draft.f079ccf847409618287735477c0ad4d24beab672preserves the bounded G-theory validation, regression, changelog and doctoring slice.Scientific and architecture boundary
Exact current state
fb67ced09d8ee00542c05d56374537a9a7239751.f079ccf847409618287735477c0ad4d24beab672.No gate is weakened or bypassed. Any future source-head movement invalidates this evidence.
Fixes #851.
Summary by CodeRabbit
Bug Fixes
Documentation
Tests