You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[wildcard] Kill syntactic alias/loan/freeze tracking: replace path-sensitive value-flow (freeze.rs + closures.rs) with Linear Region Capabilities (cap[R]) and Isolated Sub-Graphs[wildcard] #304
Replace path-sensitive, per-binding syntactic alias/loan/freeze analysis across freeze.rs and closures.rs with Linear Region Capabilities (Cap[R]) and Type-Colored Sub-Graphs. Within a task holding a region token r : Cap[R], arbitrary Go aliasing is 100% legal without false positives (HYB-E3001/E3004). Cross-task transfer moves the single non-copyable capability r, rendering all caller-local bindings statically inert. This eliminates the entire whack-a-mole game of statement-walk alias tracking (st.aliases, st.may_share, call_local_roots, closure re-assign bypasses).
Which assumption it breaks
Attacks Solicitation #2 ("Replace the borrow-checker machinery. Capability tokens, linear-type encodings inside Go's type system, runtime-enforced ownership — anything that deletes the alias/loan/freeze analysis rather than extending it."). Kills the sacred cow that Hybrid can soundly deduce exclusive ownership of arbitrary Go GC reference graphs (map, []T, *T) via AST statement-walk heuristics. As proved by the relentless stream of P0 soundness bugs in the repo (#14, #27, #38, #48, #54, #60, #137, #301), syntactic path-sensitive alias tracking cannot converge because aliasing in Go is a property of heap subgraphs, not local variable names.
Why this is a breakthrough, not an increment
Instead of incrementally patching freeze.rs and closures.rs for every new expression, control flow join, loop back-edge, or closure re-assignment, this completely deletes ~1,200+ LOC of brittle AST dataflow machinery. It trades syntactic whack-a-mole for a simple 1-bit linear capability check (Cap[R]), enabling arbitrary idiomatic Go aliasing inside a region while providing absolute compile-time safety across task boundaries.
How we would know it works (or doesn't)
Milestone 1 (Acceptance & Encoding): Encode the 24+ existing corpus test cases (including shadowing, multi-value assigns, closures, and loop back-edges) under Region-Brand typing (In[R, T]).
Falsification Criteria: Falsified on ergonomics if >20% of idiomatic .hy accept-corpus programs require explicit manual region wiring that cannot be inferred via anonymous per-allocation region brands (Cap[$alloc_id]). Falsified on complexity if region-typing rules require >250 LOC (compared to the ~1,200+ LOC currently spread across freeze.rs and closures.rs).
Cost honesty (optional but powerful)
Ergonomic Cost: Developers passing mutable GC graphs across task boundaries must use regions or anonymous per-allocation branding.
Guarantee Shift: Rows A1–A6 in GUARANTEES.md (lexical borrow/freeze of unannotated Go maps/slices) are replaced by Region-Brand Isolation. Intra-task code becomes more permissive, while inter-task move becomes a linear check on Cap[R].
Track terms
I understand no prototype is required and failure-with-knowledge is a valid, paid outcome
I understand all outcomes (including declines and failures) are published in MOONSHOT.md
Cap[R] is sound only if every mutable access, including through aliases and closure captures, requires a live capability for the referenced region. Go maps, slices, and pointers are copyable handles; moving a token does not revoke stale handles. The design needs a complete rule for deriving region labels and proving every dereference is capability-gated.
Cross-region edges are the harder boundary: an object in R can point into S. Moving only Cap[R] does not isolate the reachable graph. A sound transfer must require a closed region, transfer the union/closure of reachable capabilities, or conservatively reject shared edges. Interfaces, reflection, unsafe, and opaque Go calls make that closure difficult to infer.
Falsification sketch:
In typed IR, make heap references carry a region set and require a Cap[R] proof for every read/write. Treat unknown or external operations as opaque; they cannot cross task boundaries unless inside managed.
Re-encode the 24 corpus cases plus three adversarial cases: copied alias after transfer, an R-to-S mutable edge, and a closure holding a stale alias. Positive cases must compile; every access without the needed capability must reject.
Measure rule size and manual annotations. If soundness still needs binding-level alias/closure dataflow, or more than 20% of idiomatic accept-corpus programs need manual region wiring, then region capabilities may simplify tracking but do not eliminate it.
Acceptance should explicitly require that transferring Cap[R] makes every sender-side alias to R unusable. Without that invariant, the token labels ownership but does not enforce isolation. Not prototype-tested; this is a design/falsification contribution, not a claim that current code is vulnerable.
Thanks for the rigorous stress test, @nikolas-sapa ! You've hit on the exact core challenge: cross-region edges where an object in $R$ points into $S$.To clarify how Cap[R] handles this without collapsing into full path-sensitive tracking:Graph Closure on Transfer: Moving a region capability Cap[R] must enforce a transitively closed transfer rule for any embedded references pointing to sub-regions, or require explicit nested capability tokens (Cap[R]). If a graph has escaping edges into an unowned region, the transfer safely rejects at compile-time rather than relying on runtime aliasing.Opaque Boundaries: As noted in your falsification sketch, external or unsafe Go calls treat pointers as opaque, meaning they must cross boundaries wrapped in explicit managed blocks or local region scopes.The ROI Tradeoff: The goal isn't zero annotation, but shifting the cognitive load from path-by-path statement walking (freeze.rs / closures.rs) to structural region layout.Excited to see how the feasibility spike (#336) measures the annotation overhead across the 26 corpus cases!
Issue #304 correctly identifies the architectural tension at the heart of Hybrid's current design: path-sensitive AST statement walking (freeze.rs + closures.rs, ~1,200 LOC) attempts to deduce exclusive ownership across complex control flow, loop back-edges, and multi-binding rebinds via syntactic heuristics. Because heap aliasing in Go is a property of runtime object graphs rather than lexical identifier names, syntactic tracking has historically required repeated edge-case expansions.
Proposing a shift from lexical alias/freeze inference to an explicit or branded Linear Region Capability (Cap[R]) is a legitimate paradigm alternative. It re-anchors the safety invariant from "the compiler proved every lexical name pointing here is dead" to "this task holds the sole capability token required to dereference this region".
To qualify for rigorous falsification rather than speculative advocacy, the proposal must resolve four structural gaps in its type theory when applied to Go semantics:
A. Transitive Closedness of Heap Subgraphs (The Cross-Region Pointer Hole)
In Go, references are not isolated flat cells; structs, slices, and maps form arbitrary directed pointer graphs.
Suppose object $x$ resides in region $R_1$, but contains a field x.ptr pointing to object $y$ residing in region $R_2$.
If Task A holds $\text{Cap}[R_1]$ and Task B holds $\text{Cap}[R_2]$, Task A can dereference x.ptr and perform concurrent unsynchronized mutations against $y$ simultaneously with Task B.
Invariant Requirement: A transfer of $\text{Cap}[R]$ across a task boundary is sound if and only if$R$ is transitively closed under heap reachability: $$\forall o \in R, \quad \text{Reachable}(o) \subseteq R \cup \text{Immutable}$$
Without deep static pointer escape analysis (which the proposal seeks to eliminate) or hierarchical region nesting ($R_{inner} \prec R_{outer}$), arbitrary Go struct composition breaks region isolation immediately.
B. Interprocedural Region Polymorphism vs. "Zero-Annotation" Go
The proposal claims that $>80%$ of regions can be inferred via anonymous per-allocation brands (Cap[$alloc_id]). However:
In idiomatic Go, functions are compiled modularly (e.g., func Process(m map[string]int)).
If Process requires access to region $R$, its type signature must either:
Carry phantom region parameters (func Process[R](m In[R, map[string]int], cap Cap[R])), which completely breaks compatibility with idiomatic Go, interface dynamic dispatch, and the standard library; or
Treat function calls as opaque boundaries where all argument capabilities must be explicitly bundled and passed, forcing whole-program global inference.
Without explicit region polymorphism in function signatures, anonymous allocation brands cannot cross non-inlined call boundaries without collapsing into a single, conservative global ambient region.
C. Ineliminability of Local Loan Windows (A2 / A3 Rules)
The proposal claims to delete ~1,200 LOC of AST dataflow machinery. However, cross-task transfer (move) is only one half of Hybrid's concurrency invariants.
Rule A3 (HYB-E3102, map-slot loans p := &m[k]): A non-lexical window during which map mutations or deletions must be prohibited locally within the same task.
Rule A2 (HYB-E3101, boundary handle borrows vs mutations): Prohibiting mutating handle calls while a borrow handle view is live.
Region capabilities operate at the granularity of entire memory regions, whereas map-slot loans and handle borrows are fine-grained, intra-task, non-lexical path slices. As confirmed by the feasibility spike (Add region capability feasibility spike for bounty #304 #336, Case 37), region capabilities cannot model map-slot invalidation without reintroducing local statement-by-statement lifetime tracking.
D. Sub-Slice Aliasing & Interior Pointers
Go slices (reflect.SliceHeader) share backing storage across slicing operations (sub := s[1:5]). Both s and sub inhabit the same underlying allocation region $R$. Under a linear region model:
Slices sharing a backing array cannot be partitioned across concurrent tasks without fine-grained disjointness proofs (e.g., fractional permissions or interval capabilities).
If disjoint slicing cannot be proven, the model either rejects safe parallel slice workloads (e.g., divide-and-conquer parallel merges) or requires manual copy() allocations.
Under MOONSHOT.md, an idea does not need a full compiler implementation, but its learning must be falsifiable against clear empirical gates. Before progressing to M2, the proposal should formalize:
Gate F-1 (Transitive Closure Rule): Specify the exact structural typing rule for composite struct fields pointing to other heap allocations without requiring whole-program escape analysis.
Gate F-2 (Boundary Contract): Define how unannotated Go standard library calls and interface method dispatch interact with Cap[R] without triggering false-positive lockouts.
Gate F-3 (Corpus Overhead Census): Explicitly test the 50 corpus cases against the >20% manual wiring tripwire. If intra-task borrowing (A2/A3) must remain in hy-check, revise the claim from "completely deletes AST machinery" to "replaces cross-task sendability verification while retaining local loan windows".
Wildcard triage (within the 48h acknowledgment window): accepted — ledger W-001, lead slot in the 2026-11-01 review window (💎 Bounty label confirmed). Reason: the most evidence-grounded answer to Solicitation #2 received — it names the exact failure chain (#14 → #27 → #38 → #48 → #54 → #60 → #137 → #301) as its falsification basis, and the claim that aliasing is a property of heap subgraphs rather than local variable names is precisely the right shape of attack: not patching freeze.rs/closures.rs, but deleting their job. What M1 review will press on: (1) the migration path — the checked subset is ~50 corpus programs deep into statement-walk semantics; the entry needs an incremental-adoption story that does not fork the language; (2) interaction with the existing A2/A6/A7 loan rules and managed blocks; (3) the false-positive elimination claim (E3001/E3004 → zero inside a region) needs a worked example against corpus 15's chunk_of shape. Feasibility spike PR #336 is attached to this entry's slot and will be reviewed with it. Credit also to rickymulya #175 (duplicate → folded into this family with the O(N) token-balance and syntactic scoped-split formulations added to the slot's reading list).
— Entered in the MOONSHOT.md ledger; review opens in the 2026-11-01 window (Discussion thread linked from the ledger). M1 acceptance ($250) is decided in that review; M2 ($250) on the published learning — success or failure alike.
Activity
t3ratech commentedon Oct 16, 2026
/attempt
nikolas-sapa commentedon Oct 16, 2026
AI-assisted design stress test for this proposal.
Cap[R]is sound only if every mutable access, including through aliases and closure captures, requires a live capability for the referenced region. Go maps, slices, and pointers are copyable handles; moving a token does not revoke stale handles. The design needs a complete rule for deriving region labels and proving every dereference is capability-gated.Cross-region edges are the harder boundary: an object in R can point into S. Moving only
Cap[R]does not isolate the reachable graph. A sound transfer must require a closed region, transfer the union/closure of reachable capabilities, or conservatively reject shared edges. Interfaces, reflection,unsafe, and opaque Go calls make that closure difficult to infer.Falsification sketch:
Cap[R]proof for every read/write. Treat unknown or external operations as opaque; they cannot cross task boundaries unless insidemanaged.Acceptance should explicitly require that transferring
Cap[R]makes every sender-side alias to R unusable. Without that invariant, the token labels ownership but does not enforce isolation. Not prototype-tested; this is a design/falsification contribution, not a claim that current code is vulnerable.ajithnair1808-max commentedon Oct 16, 2026
Thanks for the rigorous stress test, @nikolas-sapa ! You've hit on the exact core challenge: cross-region edges where an object in$R$ points into $S$ .To clarify how Cap[R] handles this without collapsing into full path-sensitive tracking:Graph Closure on Transfer: Moving a region capability Cap[R] must enforce a transitively closed transfer rule for any embedded references pointing to sub-regions, or require explicit nested capability tokens (Cap[R
]). If a graph has escaping edges into an unowned region, the transfer safely rejects at compile-time rather than relying on runtime aliasing.Opaque Boundaries: As noted in your falsification sketch, external or unsafe Go calls treat pointers as opaque, meaning they must cross boundaries wrapped in explicit managed blocks or local region scopes.The ROI Tradeoff: The goal isn't zero annotation, but shifting the cognitive load from path-by-path statement walking (freeze.rs / closures.rs) to structural region layout.Excited to see how the feasibility spike (#336) measures the annotation overhead across the 26 corpus cases!1932819331hy-debug commentedon Oct 16, 2026
Architectural & Soundness Review: Linear Region Capabilities (
Cap[R]) vs. AST Flow TrackingEvaluation Context: Wildcard Track (Track 3,
MOONSHOT.md), attacking Solicitation #2 ("Replace the borrow-checker machinery").1. Conceptual Assessment & Merits
Issue #304 correctly identifies the architectural tension at the heart of Hybrid's current design: path-sensitive AST statement walking (
freeze.rs+closures.rs, ~1,200 LOC) attempts to deduce exclusive ownership across complex control flow, loop back-edges, and multi-binding rebinds via syntactic heuristics. Because heap aliasing in Go is a property of runtime object graphs rather than lexical identifier names, syntactic tracking has historically required repeated edge-case expansions.Proposing a shift from lexical alias/freeze inference to an explicit or branded Linear Region Capability (
Cap[R]) is a legitimate paradigm alternative. It re-anchors the safety invariant from "the compiler proved every lexical name pointing here is dead" to "this task holds the sole capability token required to dereference this region".2. Theoretical & Semantic Boundary Vulnerabilities
To qualify for rigorous falsification rather than speculative advocacy, the proposal must resolve four structural gaps in its type theory when applied to Go semantics:
A. Transitive Closedness of Heap Subgraphs (The Cross-Region Pointer Hole)
In Go, references are not isolated flat cells; structs, slices, and maps form arbitrary directed pointer graphs.
x.ptrpointing to objectx.ptrand perform concurrent unsynchronized mutations againstWithout deep static pointer escape analysis (which the proposal seeks to eliminate) or hierarchical region nesting (
B. Interprocedural Region Polymorphism vs. "Zero-Annotation" Go
The proposal claims that$>80%$ of regions can be inferred via anonymous per-allocation brands (
Cap[$alloc_id]). However:func Process(m map[string]int)).Processrequires access to regionfunc Process[R](m In[R, map[string]int], cap Cap[R])), which completely breaks compatibility with idiomatic Go, interface dynamic dispatch, and the standard library; orWithout explicit region polymorphism in function signatures, anonymous allocation brands cannot cross non-inlined call boundaries without collapsing into a single, conservative global ambient region.
C. Ineliminability of Local Loan Windows (A2 / A3 Rules)
The proposal claims to delete ~1,200 LOC of AST dataflow machinery. However, cross-task transfer (
move) is only one half of Hybrid's concurrency invariants.HYB-E3102, map-slot loansp := &m[k]): A non-lexical window during which map mutations or deletions must be prohibited locally within the same task.HYB-E3101, boundary handle borrows vs mutations): Prohibiting mutating handle calls while a borrow handle view is live.Region capabilities operate at the granularity of entire memory regions, whereas map-slot loans and handle borrows are fine-grained, intra-task, non-lexical path slices. As confirmed by the feasibility spike (Add region capability feasibility spike for bounty #304 #336, Case 37), region capabilities cannot model map-slot invalidation without reintroducing local statement-by-statement lifetime tracking.
D. Sub-Slice Aliasing & Interior Pointers
Go slices ($R$ . Under a linear region model:
reflect.SliceHeader) share backing storage across slicing operations (sub := s[1:5]). Bothsandsubinhabit the same underlying allocation regioncopy()allocations.3. Falsification Criteria & Gate Requirements (For M1 Acceptance)
Under
MOONSHOT.md, an idea does not need a full compiler implementation, but its learning must be falsifiable against clear empirical gates. Before progressing to M2, the proposal should formalize:Cap[R]without triggering false-positive lockouts.>20% manual wiringtripwire. If intra-task borrowing (A2/A3) must remain inhy-check, revise the claim from "completely deletes AST machinery" to "replaces cross-task sendability verification while retaining local loan windows".limitlessprojects commentedon Oct 17, 2026
Wildcard triage (within the 48h acknowledgment window): accepted — ledger W-001, lead slot in the 2026-11-01 review window (💎 Bounty label confirmed). Reason: the most evidence-grounded answer to Solicitation #2 received — it names the exact failure chain (#14 → #27 → #38 → #48 → #54 → #60 → #137 → #301) as its falsification basis, and the claim that aliasing is a property of heap subgraphs rather than local variable names is precisely the right shape of attack: not patching
freeze.rs/closures.rs, but deleting their job. What M1 review will press on: (1) the migration path — the checked subset is ~50 corpus programs deep into statement-walk semantics; the entry needs an incremental-adoption story that does not fork the language; (2) interaction with the existing A2/A6/A7 loan rules andmanagedblocks; (3) the false-positive elimination claim (E3001/E3004 → zero inside a region) needs a worked example against corpus 15'schunk_ofshape. Feasibility spike PR #336 is attached to this entry's slot and will be reviewed with it. Credit also to rickymulya #175 (duplicate → folded into this family with the O(N) token-balance and syntactic scoped-split formulations added to the slot's reading list).— Entered in the MOONSHOT.md ledger; review opens in the 2026-11-01 window (Discussion thread linked from the ledger). M1 acceptance ($250) is decided in that review; M2 ($250) on the published learning — success or failure alike.