Support weak references for object interposers#36
Conversation
0d00f0d to
6eef7be
Compare
Co-authored-by: ezoushen <ezoushen@gmail.com>
6eef7be to
d9aea26
Compare
|
Codex review: needs maintainer review before merge. Reviewed June 11, 2026, 9:05 AM ET / 13:05 UTC. Summary Reproducibility: yes. from source inspection: current master stores object interposer targets strongly in Review metrics: 3 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep the strong-retaining default, then either land the weak-reference API with documented lifetime semantics after API approval or close the branch if core should not add that public surface. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: current master stores object interposer targets strongly in Is this the best way to solve the issue? Unclear as a product decision: the implementation is narrow and keeps existing strong behavior by default, but maintainers still need to accept or reject the new public API before merge. AGENTS.md: not found in the target repository. Codex review notes: model internal, reasoning high; reviewed against 2492331dd962. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Maintainer pass complete on June 11, 2026.
This remains intentionally unmerged because it adds the public |
|
Thank you, @ezoushen, for the contribution and the careful work on this. InterposeKit is old and no longer supported, and this repository is being archived. We will not merge or release this change, so I am closing the pull request. |
Summary
Support weakly referenced object interposers for the retain-cycle use case in the original proposal.
Interpose(.strong(object))andInterpose(.weak(object)).Interpose.objectto becomenilafter a weak target deallocates.InterposeError.objectDeallocatedwhen a later operation requires that target.The unsafe
unownedmode and validation bypass from the original draft are intentionally excluded.Regression Proof
On macOS 26.5 with Xcode 26.6, associating the existing strongly retaining interposer back to its target reproduced the retain cycle: the target remained alive after its autorelease pool exited.
The new regression tests verify:
InterposeError.objectDeallocated.Validation
swift build -vswift test(22 tests)swift test -c release(22 tests)$autoreview: clean