fix(ios): replace Python stamp callback with native jobs - #133
Merged
Conversation
Contributor
Greptile SummaryThe PR replaces the Python callback-based stamp cancellation bridge with callback-free, job-owned Swift state and a start/poll/cancel/release C ABI.
Confidence Score: 5/5The PR appears safe to merge, with the new callback-free stamp lifecycle consistently guarded across Swift, Python, teardown, exports, and Release artifact verification. Native jobs retain their work safely, serialize cancellation against result publication, fail closed at the Python boundary, and are cancelled and detached during teardown; no concrete blocking failure remains. Important Files Changed
Sequence DiagramsequenceDiagram
participant LXMF
participant Python as rns_bridge.py
participant ABI as Native C ABI
participant Registry as Swift Job Registry
participant Workers as PoW Workers
LXMF->>Python: external_generator(workblock, cost, token)
Python->>ABI: stamp_job_start(...)
ABI->>Registry: register job
Registry->>Workers: start proof-of-work
loop Until terminal
Python->>Python: check cancellation token
opt Cancelled
Python->>ABI: stamp_job_cancel(jobID)
ABI->>Registry: cancel job
end
Python->>ABI: stamp_job_poll(jobID, output)
ABI-->>Python: running / stamp / cancelled / failed
end
Python->>ABI: stamp_job_release(jobID)
Python-->>LXMF: stamp or None
Reviews (1): Last reviewed commit: "fix(ios): avoid pointer capture in stamp..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ctypes.CFUNCTYPEcancellation trampoline with job-owned native Swift stateRoot cause
The previous Swift-to-Python cancellation callback used a libffi closure backed by dynamically generated executable memory. Physical arm64e devices could reject that page under iOS code-signing enforcement, producing
CODESIGNING 2 Invalid Pagecrashes while stamping.Verification
Risk and rollback
The change is isolated to the iOS external stamper bridge and native stamp-job lifecycle. The synchronous callback-free native generator remains available. Rollback is the three commits in this PR, but would restore the unsafe reverse callback and is not recommended.
Environment limitation
The exact reported iOS 27 beta device was unavailable. Validation used the closest installed iOS 26.4 Simulator and a physical arm64e iPhone on iOS 26.