Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Snapshot live code through its owner in the compiler adapter - #9450

Merged
youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:split/9439-provenance-20261029
Oct 31, 2026
Merged

youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:split/9439-provenance-20261029

Conversation

@youknowdot

@youknowdot youknowdot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Address the design review by removing the immutable construction-provenance/layout framework, external-bytecode rejection policy, and frozen-decoding rewiring. Merge main as of preparation (a20e9cdc284f70be0877dd41a8373f8d935479f3) without rewriting the original PR history.

The replacement is limited to _testinternalcapi's existing compiler adapter:

  • Snapshot live code through the owning PyCode's cached public bytecode and existing monitoring-wrapper resolution, constructing fresh execution storage without specialization caches.
  • Retain owners while recursively converting nested code constants; release each monitoring lock before visiting nested constants.
  • Preserve current filenames through the owner getter, and retain the adapter's existing BasicBag metadata conversion contract.

CPython basis and scope

CPython reconstructs and caches public bytecode using owner monitoring metadata to resolve wrappers. Its constructor validation does not introduce the removed provenance policy.

This is not a general live-code clone API or a claim of malformed-bytecode safety/concurrency equivalence. The existing adapter reconstructs constants rather than preserving identities as CPython's PyList_AsTuple does. Unsupported arbitrary co_consts, existing BorrowedConstant container leaks, and surrogate-bearing metadata limitations remain outside this change. No lossy string normalization is introduced. The earlier monitoring dependency claim should not be read as validated by this narrowed change.

Validation

  • Guarded cargo check -p rustpython-vm --lib and strict Clippy (-D warnings) passed with compiler,codegen,threading,host_env,stdio,doc,importlib, locked/offline and defaults disabled.
  • Both phases verified exact unchanged source/tool manifests, fresh VM artifacts, and terminated process groups.
  • Normal commit hooks passed. The first hook attempt made one layout-only Rust formatting change; exact replacement/non-whitespace-byte equivalence against the checked source was verified, and every other validated source file remained identical. Native checks were not rerun after that formatting-only change.
  • Runtime, C-API, Python tests, and full workspace tests were not run; no CLI binary was built. This is focused static validation only.

AI assistance

OpenAI Codex assisted with source research, implementation, review-response drafting, and guarded static validation. Commit messages include an Assisted-by trailer. Human runtime verification is not claimed.

Extract the independent code-source, clone, co_code and fallible decoding foundation from RustPython#9439. Interpreter-local monitoring dispatch remains in the dependent original PR.

Assisted-by: OpenAI Codex: model version unavailable
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@codspeed

codspeed Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:split/9439-provenance-20261029 (eaa75b1) with main (84d7afc)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Comment thread crates/compiler-core/src/bytecode.rs Outdated
pub struct CodeUnits {
// Construction provenance, never updated by runtime specialization. Keep
// original opcode identity: GET_ITER fixup does not apply to its specialized forms.
source: Box<[CodeUnit]>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

really? disagree to this approach

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.

Agreed—the immutable construction provenance and layout policy are broader than CPython requires. CPython reconstructs and caches public bytecode from execution state plus monitoring metadata; its marshal constructor validation does not introduce this provenance layer. I propose retaining that model and narrowing this change to fresh execution storage when copying live code, without carrying specialization caches or unresolved monitoring wrappers. External-bytecode rejection and frozen decoding should be considered separately rather than bundled into this change. This is a proposed direction, not an implemented revision.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

pls do it

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.

Implemented in e065e68. The provenance/layout framework, external-bytecode rejection policy, and frozen-decoding rewiring are removed. The replacement is confined to the existing _testinternalcapi compiler adapter: snapshot through the owning PyCode.get_code, then recursively snapshot nested code constants after releasing the owner lock; current filenames come from the owner getter.

The PR title/body now describe this narrower scope and the pinned CPython basis. Focused VM check and strict Clippy passed, and normal commit hooks passed (the final hook change was formatting-only, verified against the checked source). No runtime/C-API or full workspace tests were run locally; new-head CI is pending. This does not claim general live-code cloning, malformed-bytecode safety, constant-identity preservation, or a complete fix for the broader monitoring consumer paths.

Merge main and remove the construction provenance, external-bytecode policy, and frozen decode framework. Snapshot live code in the internal compiler adapter through its owning PyCode, recursively preserving access to monitoring metadata and current filenames.

AI assistance: OpenAI Codex performed source research, implementation, review response drafting, and guarded static validation. Runtime and C-API tests were not run.

Assisted-by: OpenAI Codex: model version unavailable
@youknowdot youknowdot changed the title Preserve immutable bytecode provenance when cloning code Snapshot live code through its owner in the compiler adapter Oct 30, 2026
@youknowone
youknowone marked this pull request as ready for review October 31, 2026 05:32
@chatgpt-codex-connector

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 ⚠️ Failed 2026-10-31T05:32:26.756591Z
We couldn’t complete this review. Comment @codex review to try again.
e065e68 Draft marked ready
ℹ️ 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.

@youknowone
youknowone merged commit ddd8fbf into RustPython:main Oct 31, 2026
28 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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.

3 participants