WIP: Resume native cleanup contexts after child proofs #144

Draft
erikinkinen wants to merge 5 commits from feature/cleanup-context-continuations into feature/native-cstd-memory-provider
Owner

Resume eligible native context checks after their actual child proofs finish, with bounded retained state and the original callback path for unsupported readers.

Paused frames are measured as one current object graph. Shared data is counted once, nested replacements are measured afresh, and unsupported storage falls back without invoking its custom protocols. The per-State extent caches have been removed.

  • Preserve source ownership, reader/body coupling, failure cleanup and the original material allowance.
  • Cover nested mutation, shared storage, quota pressure and unsupported protocols.
  • Pass all six original native frame checks within their 60-second deadlines.
  • Pass CI for the final head.

The frame deadline remains unresolved. This does not establish source/type closure or guest acceptance.

Resume eligible native context checks after their actual child proofs finish, with bounded retained state and the original callback path for unsupported readers. Paused frames are measured as one current object graph. Shared data is counted once, nested replacements are measured afresh, and unsupported storage falls back without invoking its custom protocols. The per-State extent caches have been removed. - [x] Preserve source ownership, reader/body coupling, failure cleanup and the original material allowance. - [x] Cover nested mutation, shared storage, quota pressure and unsupported protocols. - [ ] Pass all six original native frame checks within their 60-second deadlines. - [ ] Pass CI for the final head. The frame deadline remains unresolved. This does not establish source/type closure or guest acceptance.
feat: Resume native cleanup contexts after child proofs
Some checks failed
CI / rust (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / markdown (push) Successful in 3s
CI / rust (push) Failing after 19m41s
1483943cf0
Keep a native interpreter's checked state across missing child proofs, then
resume both call sites with the same FIFO, widening and source checks. Unknown
callbacks and unsupported memory layouts retain the original schedule.

Reserve bounded continuation bookkeeping before allocation and retire it with
its interpreter. Weak byte extents and mixed identity buckets reduce repeated
accounting without supplying memory, source or preservation authority.
erikinkinen added this to the Alpha 1 milestone 2026-11-14 23:10:17 +01:00
Author
Owner

Keep custom decoder callbacks on the original interpretation schedule. Eligibility now checks the defining implementation and its actual bound receiver, including the live profiler binding. It also avoids entering custom attribute readers and preserves the original body-map coupling when paused work resumes.

Regression tests compare callback visits and complete results with the original schedule. The six native frame deadlines remain unresolved, so this stays WIP.

Keep custom decoder callbacks on the original interpretation schedule. Eligibility now checks the defining implementation and its actual bound receiver, including the live profiler binding. It also avoids entering custom attribute readers and preserves the original body-map coupling when paused work resumes. Regression tests compare callback visits and complete results with the original schedule. The six native frame deadlines remain unresolved, so this stays WIP.
fixup! feat: Resume native cleanup contexts after child proofs
Some checks failed
CI / rust (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / markdown (push) Successful in 3s
CI / rust (push) Failing after 20m7s
81d03b3f1c
Keep stateful and rebound decoder methods on the original interpretation schedule. Bind eligible query functions to their original implementations and actual receivers, including maintained profiler wrappers, and recheck paused contexts before reuse. Inspect the owned image namespace without entering custom attribute readers. Preserve callback-free source validation and the original interpreter/body-map coupling; reserve guard material and refresh exact source bindings.
Author
Owner

Measure every held State again so a larger nested replacement cannot borrow its earlier byte count. Primitive leaf rows retain their actual immutable fields and replay shared nodes through the original seen set; quota pressure evicts optional backing before exact retry.

Whole-State shortcuts are removed, and shared objects keep their original per-traversal accounting. The analysis allowance stays unchanged. The native frame deadline remains open, and no speed gain is claimed.

Measure every held State again so a larger nested replacement cannot borrow its earlier byte count. Primitive leaf rows retain their actual immutable fields and replay shared nodes through the original seen set; quota pressure evicts optional backing before exact retry. Whole-State shortcuts are removed, and shared objects keep their original per-traversal accounting. The analysis allowance stays unchanged. The native frame deadline remains open, and no speed gain is claimed.
fixup! feat: Resume native cleanup contexts after child proofs
Some checks failed
CI / rust (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / markdown (push) Successful in 3s
CI / rust (push) Failing after 20m14s
7f0973e785
Recheck every held State instead of borrowing a whole-State extent across nested changes. Reuse only weak, charged primitive-leaf observations, comparing actual immutable field objects and replaying flat nodes through the original seen set so aliases remain exact. Evict optional backing before exact retry under quota pressure. Keep original callback/source-owner boundaries, clear retained data with the weak owner, and roll back interrupted row publication before releasing its charge. Proof dependencies, source bindings and native analysis limits remain unchanged.
Author
Owner

Count the complete paused frame once, including data shared between States. Each observation traverses current storage, so nested replacements cannot borrow earlier byte counts. The per-State caches and their unused backing machinery are removed.

The original material allowance, callback fallback and cleanup rules remain in force. The native frame deadline is still open; this accounting fix does not claim a speed gain.

Count the complete paused frame once, including data shared between States. Each observation traverses current storage, so nested replacements cannot borrow earlier byte counts. The per-State caches and their unused backing machinery are removed. The original material allowance, callback fallback and cleanup rules remain in force. The native frame deadline is still open; this accounting fix does not claim a speed gain.
fixup! feat: Resume native cleanup contexts after child proofs
Some checks failed
CI / rust (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / markdown (push) Successful in 3s
CI / rust (push) Failing after 10m39s
7af8d11f21
Use one exact traversal for the complete retained frame, so shared data is not multiplied by the number of States. Remove per-State and primitive-leaf memo tables, extra workspaces and their private APIs. Read known data namespaces without invoking substituted protocols and observe nested changes on every charge. Preserve quota publication, callback visits, source-owner checks and the original continuation limits; cover the shared-graph acceptance boundary on a live paused fixture.
Author
Owner

Retire the lifetime fixture with the same detach-and-close sequence as the execution owner. Python 3.13 keeps the closure alive while a closed generator is still held, including in the control without a material account. The weak-reference assertion stays in place with the account still live.

The production interpreter is unchanged. The native frame deadline remains open.

Retire the lifetime fixture with the same detach-and-close sequence as the execution owner. Python 3.13 keeps the closure alive while a closed generator is still held, including in the control without a material account. The weak-reference assertion stays in place with the account still live. The production interpreter is unchanged. The native frame deadline remains open.
fixup! feat: Resume native cleanup contexts after child proofs
Some checks failed
CI / rust (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / markdown (push) Successful in 3s
CI / rust (push) Failing after 19m50s
9f6c590572
Retire the lifetime fixture with the same detach-and-close sequence as the actual execution owner. CPython 3.13 retains the function closure while its closed generator is still held, even without a material account. Keep the weak-reference check with the account live and cover standalone fixture retirement.
Some checks failed
CI / rust (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / markdown (push) Successful in 3s
CI / rust (push) Failing after 19m50s
This pull request is marked as a work in progress.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'feature/cleanup-context-continuations:feature/cleanup-context-continuations'
git switch 'feature/cleanup-context-continuations'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'feature/native-cstd-memory-provider'
git merge --no-ff 'feature/cleanup-context-continuations'
git switch 'feature/cleanup-context-continuations'
git rebase 'feature/native-cstd-memory-provider'
git switch 'feature/native-cstd-memory-provider'
git merge --ff-only 'feature/cleanup-context-continuations'
git switch 'feature/cleanup-context-continuations'
git rebase 'feature/native-cstd-memory-provider'
git switch 'feature/native-cstd-memory-provider'
git merge --no-ff 'feature/cleanup-context-continuations'
git switch 'feature/native-cstd-memory-provider'
git merge --squash 'feature/cleanup-context-continuations'
git switch 'feature/native-cstd-memory-provider'
git merge --ff-only 'feature/cleanup-context-continuations'
git switch 'feature/native-cstd-memory-provider'
git merge 'feature/cleanup-context-continuations'
git push origin 'feature/native-cstd-memory-provider'
Sign in to join this conversation.
No description provided.