Skip to content

feat(python): classify executable source surfaces - #579

Draft
chrisknvidia wants to merge 28 commits into
NVIDIA:mainfrom
chrisknvidia:feat/christopherk/python-execution-surface-classification
Draft

chrisknvidia wants to merge 28 commits into
NVIDIA:mainfrom
chrisknvidia:feat/christopherk/python-execution-surface-classification

Conversation

@chrisknvidia

Copy link
Copy Markdown
Contributor

Summary

  • classify Python execution surfaces from raw bytes across .py, .pyw, PEP 263 encodings, extensionless shebangs, and ambiguous inputs
  • model platform-specific /usr/bin/env behavior for CPython, PyPy, and uv script launchers, failing closed when execution depends on platform, aliases, options, or invocation spelling
  • propagate classification through artifact inventory, nested/transitive analysis, static and behavioral analyzers, build context, inspection ledgers, and provider-cache boundaries
  • preserve exact decoded Python for analysis while keeping bounded provider views and preventing local-only, hidden, or nested content leakage

Review context

This is the Python decoding, shebang/platform-command parsing, and execution-surface split requested in the review of #497.

Stacked dependency: #578, which itself depends on #576 and #577. Until those land and this branch is rebased, GitHub's combined diff includes the dependency stack. The Python-only review range is:

git diff d856d88c289c5ef3389060ef69651c9981aae38f..266d42e050493dad869fe50be420ace97914ea82

That delta is 23 files (+5,211/-89). This PR remains draft until its dependencies land, it is rebased onto current main, hosted CI passes at the rebased head, and a current-head human review is complete.

Validation

  • regression-first classifier, cache, provider-boundary, ledger, analyzer-routing, and uv launcher coverage
  • integrated focused matrix: 1,339 passed, 1 skipped
  • independent overlap audits: clean; all 11 replayed patches range-diff identical and final A2 cap/identity behavior preserved
  • full configured suite: 6,060 passed, 14 skipped, 39 deselected, 4 expected xfails
  • Ruff and formatting clean; all 11 changed source files free of new mypy errors
  • wheel built and installed into a fresh environment
  • installed CLI JSON, Markdown, and SARIF scans produced the expected TM1 findings and partial-completeness reasons for ambiguous/decode-error inputs
  • real uv runtime covered -s, --script, --gui-script, macOS case aliases, global options, and option-like paths
  • installed provider-boundary probe preserved exact bounded Latin-1 content while excluding local-only, hidden, and nested source

No live LLM/provider call was run; the configured 39 provider/live integration tests remain deselected.

Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed exact draft head 266d42e050493dad869fe50be420ace97914ea82. I found no additional blocker in the focused Python execution-surface range (d856d88..266d42e): 1,118 affected tests passed with 1 skip, 732 current-main merged-tree regressions passed, and lint/format/diff checks are clean.

I am requesting changes because the current combined tree still contains the confirmed #576/#577 blockers: a three-row ledger cap drops a second distinct fatal fact, and a definitely true bound shell= value evades TM1 when a later argument is effectful. This PR also inherits draft #578 and explicitly requires the dependency stack to land, rebase onto current main, fresh exact-head CI, and current-head review.

Please propagate the dependency fixes and rebase. If the focused range remains semantically unchanged and CI stays green, I found it otherwise suitable for approval.

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