Skip to content

refactor(picklescan): simplify native reports and source analysis - #1871

Merged
mldangelo-oai merged 51 commits into
mainfrom
mdangelo/codex/modelaudit-04-picklescan
Oct 4, 2026
Merged

mldangelo-oai merged 51 commits into
mainfrom
mdangelo/codex/modelaudit-04-picklescan

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

The standalone scanner repeats report construction, integer-option validation, and source-analysis wrappers. Consolidate those paths, reuse the existing Rust detail conversion and PyO3 map conversion, and remove private branches whose callers always select the same behavior.

Public exports, option defaults and errors, scan bounds, fail-closed verdicts, finding order, and the zero-Python-dependency wheel boundary remain unchanged. The six affected assignment-alias test setups now call the same lower-level composition directly; their assertions are retained. This is PR 4 of the six-part simplification series; PRs 1–3 have landed. Net reduction: 214 maintained lines (216 production lines removed, two test lines added).

Validation:

Current-main integration (2a5185a): preserves the upstream SafeTensors FDICT fix and deterministic initial/retried cache interruption fixture. Focused cache/routing checks and five neighboring compression cases pass on this branch; real benign/malicious CLI scans preserve scanner selection, JSON findings, SHA-256 metadata, and exit codes 0/1. Ruff checks pass. Changed-file mypy passes; full local mypy retains the previously documented optional TensorFlow baseline error. Hosted CI validates the published head.

  • Before the latest base integration, the committed prefix passed 1,948 affected result, CLI, streaming, acquisition and SARIF/SBOM tests, with three Windows-only and two opt-in integration skips. Every file and mode matches the independently reconstructed PR4 prefix; this PR’s six-file standalone change is preserved.

  • Rust formatting, check, Clippy with warnings denied, and 187 Rust tests passed.

  • All 19 standalone test modules ran: 3,334 passed, three failed and one skipped. One failure came from the validation harness disabling bytecode creation; its exact case passed on parent and candidate with that setting removed. Both remaining Click 8.5 failures reproduce on the unchanged parent: a LazyFile/_LazyFile path expectation and a fragmented startup-hook verdict. No assertions were weakened.

  • Rebuilt native extension and isolated wheel match this checkout. Clean, malicious and truncated wheel scans passed without Python runtime dependencies.

  • 49 original/candidate option, report and stream-callback comparisons match. Only durations and originally nondeterministic opcode-counter mapping order are normalized.

  • On the actual PR4 prefix, root adapter tests passed 98 cases with the rebuilt candidate and 98 with the published 0.1.10 floor; one remote-model acquisition test was deselected in each run. Published Python files match release tag modelaudit-picklescan-v0.1.10 exactly.

  • Full repository Ruff formatting/lint passed; installed mypy 2.3.1 passed all 28 standalone source/test files. The full repository check reports only the existing unreachable TensorFlow import in tests/scanners/test_weight_distribution_scanner.py. Upstream-required mypy 2.4 could not be installed through this devbox's package index; its pin is preserved.

No package version or dependency constraint is changed. Rust 1.83 and other supported platform/Python combinations await the hosted CI matrix.

Latest integration: merged main 86c40e4 after #1870 landed. The original six-file picklescan patch is byte-identical against main; only two upstream dependency-test guards were added to the branch. All 22 dependency-lock tests, full Ruff lint/format checks, and focused mypy passed. Two fresh native reviews and an independent verifier found no blockers. Hosted CI is being refreshed for f279969. A Windows run exposed a pre-existing filesystem-sensitive cache test: unrelated changes above its temporary directory can make the cache return early. Paired parent/candidate experiments reproduced the failure; one existing fixture helper now scopes identity checks to the actual test tree. Both hit/miss and source-revalidation assertions remain unchanged. All seven importer-neighbor tests and eight fresh-process normal/churn probes pass. No production code changed for this CI fix.

PRs 1: tooling, 2: tests, and 3: raw evidence have landed. Remaining merge order: 4: picklescan → 5: scanning/results → 6: acquisition/cache/progress. PR4 targets main; PRs 5–6 target the preceding branch.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-03T22:19:02.169926Z fe005ab New commits
🔒 Security Review ✅ Completed 2026-10-03T22:20:07.409351Z fe005ab New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The refactoring preserves the reviewed behavior and introduces no unresolved issues.

Review effort: Balanced
Findings: None

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: c8818615a5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: c8818615a5

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@mldangelo-oai

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 19a2f80030

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The refactoring preserves prior behavior and no unresolved correctness issues were identified.

Review effort: Balanced
Findings: None

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 19a2f80030

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@mldangelo-oai

Copy link
Copy Markdown
Contributor Author

@codex review

Please review the current head after integration with main 2a5185a. The new changes preserve the upstream SafeTensors FDICT fix and deterministic cache cleanup regressions. Existing review-thread replies document validated fixes, parent comparisons, and the explicit raw local evidence policy in AGENTS.md. Please verify current source and avoid repeating already addressed or intentional behavior.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The refactoring preserves the reviewed behavior and introduces no unresolved correctness issues.

Review effort: Balanced
Findings: None

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: bdf327f664

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bdf327f664

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}
Ok(dict.into_any().unbind())
}
DetailValue::Dict(values) => Ok(detail_dict_to_py(py, values)?.into_any()),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Unbind the dictionary before returning it

Building the PyO3 extension fails here because detail_dict_to_py(...).into_any() returns a Bound<'_, PyAny>, while to_py_object must return Py<PyAny>; unlike the adjacent list branch, this expression never calls .unbind(). Add .unbind() after .into_any() so the independently published native package can compile.

AGENTS.md reference: packages/modelaudit-picklescan/AGENTS.md:L7-L10

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

detail_dict_to_py already returns PyResult<Py<PyDict>> and calls dict.unbind() in report.rs:203–209. The caller therefore invokes into_any() on an owned Py<PyDict>, yielding the required owned Py<PyAny>; the adjacent list starts as Bound and needs its own unbind. Verified the exact reviewed head with cargo check --locked --offline --manifest-path packages/modelaudit-picklescan/Cargo.toml --features extension-module,abi3: it passes. No additional unbind is needed.

Base automatically changed from mdangelo/codex/modelaudit-03-raw-evidence to main October 4, 2026 08:47
@mldangelo-oai
mldangelo-oai merged commit 180b26c into main Oct 4, 2026
35 checks passed
@mldangelo-oai
mldangelo-oai deleted the mdangelo/codex/modelaudit-04-picklescan branch October 4, 2026 10:11
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.

2 participants