Repository navigation
fix(hy-check): reject moving may-share peers of non-owned bindings (#75) - #83
Closed
milkingndb-oss wants to merge 1 commit into
Closed
milkingndb-oss wants to merge 1 commit into
milkingndb-oss wants to merge 1 commit into
Conversation
…imitlessprojects#75) check_non_owned_move derived non_owned_origin from the binding's own origin or its aliases-chain root only; the may-share graph (limitlessprojects#27/limitlessprojects#35) was not consulted, and define-time origin inheritance fires for reference-alias shapes only. A shallow struct/array copy of a param (h2 := h / a2 := a) recorded a share edge but no origin, so the move passed with 0 diagnostics while the caller kept a live binding to the same storage - go run hit 'fatal error: concurrent map writes'. When both origin lookups miss, scan st.share_group(name) (and each peer's alias root) for a non-owned origin and reject with a may-share-peer-flavored HYB-E3004. Peers are scanned in sorted order for deterministic diagnostics; the own-origin path keeps its original message byte-for-byte. Gates: cargo test --workspace all green (6 new tests in hy-check/tests/param_share_move.rs: struct/array/map/pure-local, spawn+send forms); corpus harness 29/29 (corpus 29 struct peer, 30 array peer, both REJECT A1b); tripwire not fired (6.9%/10.3%); hyb check on the issue's repros now E3004 (struct+array) with the map twin regression intact; emit-go refuses the repro (exit 1); all 10 examples still OK (0 diagnostics).
This was referenced Oct 14, 2026
Owner
|
Your fix is on |
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
Fixes #75 (soundness P0).
check_non_owned_move(freeze.rs) derivednon_owned_originfrom the binding's own origin or itsaliases-chain root only. The may-share graph (#27/#35 — undirected: shallow struct/array copies, re-slices, projections, composite captures) was not consulted, andrecord_alias's define-time origin inheritance only fires for reference-alias shapes (Map/Slice/Pointer). So a local share peer of a parameter moved at a concurrency boundary escaped O5.1:m2 := m(map param) — correctly rejectedHYB-E3004(alias + inherited origin).h2 := h(struct param carrying a map) — share edge but no origin:task worker(move h2, done)passed with OK (0 diagnostics) while the emitted Go raced (fatal error: concurrent map writesreproduced ongo run, per the issue's report).a2 := a([2]map[string]intparam) — same gap for fixed arrays (not reference aliases); alsoOK (0)pre-fix, same runtime fatal.The O5.1 rationale the checker already applies to the parameter itself ("the caller retains the argument across intra-task calls") is storage-identity identical for its share peers: the moved local is not exclusively owned by the sending frame, and freezing it cannot reach the caller's live binding (O5.2 freeze-reach).
Fix
In
check_non_owned_move, when the binding's own origin and its alias-root origin are bothNone, scanst.share_group(name)— and each peer's alias root — for anon_owned_origin, and reject with a may-share-peer-flavoredHYB-E3004(... not a may-share peer of parameter ...). Peers are scanned in sorted order for deterministic diagnostics. The own-origin path keeps its original message byte-for-byte (map-twin regression control pins the spelling).Tests / gates
hy-check/tests/param_share_move.rs(6 new): struct peer of param (spawn + send forms) -> E3004; array peer of param -> E3004; map twin regression -> E3004 (non-share spelling preserved); pure-local peer stays free of E3004 (O5.2 E3003 still fires on post-move peer use); pure-local full-accept control (peer never used post-move -> clean Accept).29-struct-param-share-move-reject.hy,30-array-param-share-move-reject.hy, bothREJECT A1b) + VERDICTS.md rows; distribution line recomputed (the old line undercounted after row 27 landed: 8+2+16=26 against 27 registered files — nowACCEPT 8 . ACCEPT-MANAGED 2 . REJECT 19 -- 29 programs). Numbering skips 28 to leave the slot for open PR fix(hy-check): edge call results to may-share arguments on define (#73) #74's generic-call corpus file.parse_all.rs27->29.cargo test --workspace: all green.tools/corpus_harness.py: 29/29 verdict agreement; tripwire not fired (verdict-level 6.9%, as-written 10.3%).HYB-E3004(issue's repro + array twin); map twin unchanged;hyb build --emit-gorefuses the repro (exit 1).OK (0 diagnostics).Compatibility
Independent of open PR #74 (this PR does not edge call results; #74 does not scan the share group at move time). Merge seam if both land:
parse_all.rscount and the VERDICTS.md distribution line will need a trivial rebase bump (27+2 new files here, 1 there -> 30).AI-assisted fix (MiMo agent via opencode); reporter of record on #75: @milkingndb-oss.