Skip to content

W-022 spike: Linear Synchronization Capsules flipping GUARANTEES Rows 8, 10, and 11 (race-verified, preregistered, #544) - #545

Open
carelessdept wants to merge 2 commits into
limitlessprojects:mainfrom
carelessdept:spike/w022-linear-sync-capsules
Open

carelessdept wants to merge 2 commits into
limitlessprojects:mainfrom
carelessdept:spike/w022-linear-sync-capsules

Conversation

@carelessdept

Copy link
Copy Markdown
Contributor

Refs #544

Implements the bounded M1 feasibility spike for Wildcard proposal #544 (by the original proposal author, @carelessdept), scoped strictly inside spikes/w022-linear-sync-capsules/ without touching any guarded compiler, runtime, or ledger files, and sharing the Live[R] / Moved[R] zero-size phantom witness vocabulary from W-004 (PR #507).

What's here

  • spikes/w022-linear-sync-capsules/work/capsules.go — the three Linear Synchronization Capsules that flip GUARANTEES.md Row 11 (AtomicCapsule[T]), Row 10 (LinearPool[T]), and Row 8 (MutexCapsule[T]):
    • AtomicCapsule[T]: AtomicStoreMove / AtomicSwapMove consume Live[R] -> Moved[R] (O5.2 move-freeze), and Take() atomically swaps nil, preventing the shared-pointee race that forced PR #52 to reject atomic.Pointer[T] as HYB-E3005.
    • LinearPool[T]: PoolPutMove consumes Live[R] -> Moved[R] and runs a mandatory structural reset hook before returning the object to sync.Pool.
    • MutexCapsule[T]: replaces string-typed managed("...", "mutex") permits with a lexical borrow callback WithLock(func(ScopedLoan[T])).
  • spikes/w022-linear-sync-capsules/work/capsules_test.go — pre-registered P1–P4 (P4a and P4b as declared falsifiers), committed in the same commit as the artifact (go test -race -count=2 — 10/10 PASS).
  • spikes/w022-linear-sync-capsules/work/negative/ + run_negatives.sh — use-after-AtomicStoreMove and use-after-PoolPutMove must FAIL go build (both rejected).
  • spikes/w022-linear-sync-capsules/work/bench_test.go — P1/P2/P3 quantified against raw atomic.Pointer, sync.Pool, and sync.Mutex:
    • AtomicCapsuleSwapMove: 4.888 ns/op, 0 B/op, 0 allocs/op (vs 4.207 ns/op raw atomic.Pointer.Swap)
    • LinearPoolPutMove: 22.08 ns/op, 0 B/op, 0 allocs/op (vs 20.03 ns/op raw sync.Pool)
    • MutexCapsuleWithLock: 11.01 ns/op, 0 B/op, 0 allocs/op (vs 3.774 ns/op raw sync.Mutex; +7.24 ns/op is the defer Unlock() cost)
  • spikes/w022-linear-sync-capsules/RESULTS.md — pre-registration table, benchmark numbers, falsifier analysis, and M1 verdict draft.

Headline verdict

  1. Rows 8, 10, and 11 can flip from No claim / [TBD] into Tier-0 checked capabilities with 0 B/op, 0 allocs/op.
  2. Falsifier P4a fired as predicted (TestP4a_Falsifier_InteriorSliceAliasSurvivesOuterPoolPut): Consuming the outer struct witness Live[R] -> Moved[R] on PoolPutMoveUnreset stops caller use-after-Put on the struct variable, but if the caller extracted an interior sub-slice (leaked := buf.Payload[:2]) before PutMove and no may_share check + field reset runs, leaked observes mutations from the next Get() consumer across tasks. This is the third independent spike (after #370 P4 and #507 P4) to converge on the exact boundary between zero-size phantom witnesses and Hybrid's may_share graph.
  3. Falsifier P4b fired as predicted (TestP4b_Falsifier_NestedMutexCapsulesCanDeadlockWithoutLockOrder): MutexCapsule[T].WithLock proves data-race freedom (Row 8), while nested multi-capsule AB-BA acquisition cycles remain a liveness property unless paired with W-009 wait-for epoch ordering.

Race-verified (go test -race -count=2), vet/gofmt clean, negatives compile-rejected.

@limitlessprojects

Copy link
Copy Markdown
Owner

W-022 intake ack (48h commitment): Linear Synchronization Capsules flipping GUARANTEES rows 8/10 — preregistered P1-P4 with the P4a/P4b falsifier fired-as-predicted, all artifacts scoped to spikes/w022-linear-sync-capsules/, zero self-edits to maintainer-owned ledgers. Entered as W-022; verdict slot: M1 if the artifact completes review before 2026-11-01 00:00 UTC, else the December window. Credit for merged PRs #28/#30/#32 is recorded in CONTRIBUTOR_RECOGNITION (a maintainer-side row, not self-authored). Please add the intake template fields (falsifier + smallest executable artifact) to the issue when you can.

@limitlessprojects

Copy link
Copy Markdown
Owner

W-022 intake — ledger entry landed. Follow-up to the intake ack above: W-022 is now physically entered in the MOONSHOT.md ledger (commit 815325a) — status intake acked 2026-10-18, review scheduled for the active 2026-11-01 window alongside the drafted slots (December window as fallback if review isn't complete before the close). The row records exactly what this PR shows: preregistered P1–P4 with both declared falsifiers fired-as-predicted, artifacts scoped to spikes/w022-linear-sync-capsules/, zero edits to maintainer-owned files — that is precisely the spike discipline the Wildcard Track asks for. The P4a convergence with #370 and #507 (three independent spikes landing on the same phantom-witness/may_share boundary) is a genuinely useful signal for the window and for M2.

To make the review maximally concrete, three things would strengthen the verdict — none required for intake, all welcome any time before the window closes:

  1. Minimal .hy repros per capsule. The artifact today is Go-side (tests + benches). Small .hy programs showing today-vs-capsule behavior — e.g. a managed("protected by mu", "mutex") region that passes the checker today but races, and the same program under MutexCapsule[T].WithLock — would pin each claimed GUARANTEES row flip to a checker-level demonstration rather than a Go-library-level one.
  2. Before/after row semantics. For each of rows 8/10/11, a short before/after block (current GUARANTEES.md row text → proposed row text, including what the flipped claim covers and what it still does not — e.g. interior-slice aliasing per your own P4a) lets the verdict quote the exact contract change, the way W-006's row-12 pointer (fix: [wildcard] GUARANTEES.md row 12 is wrong: cancellation-safety is a one-pass corollary of Tier-0 (resolves #352) #474) did.
  3. The P4a remedy path, stated as a candidate condition. P4a fired as predicted — the window's next question is what closes it (the may_share check + structural-reset hook? a W-014 slab-backed interior-pointer rule?). Naming a remedy, even unproven, turns the falsifier from a caveat into a milestone.

No ledger self-edits needed — we keep MOONSHOT.md current from here, and the verdict itself is a window event. Credit for your merged ladder PRs (#28/#30/#32) is already recorded in CONTRIBUTOR_RECOGNITION. Welcome to the window, and thank you for the clean pre-registration.

@carelessdept

Copy link
Copy Markdown
Contributor Author

Thank you @limitlessprojects for the W-022 intake (815325a) and the concrete review pointers!

I have pushed commit a7ba19f (still scoped 100% inside spikes/w022-linear-sync-capsules/, touching zero guarded files) adding all three items:

  1. Minimal .hy Today-vs-Capsule Repros (spikes/w022-linear-sync-capsules/hy/):

    • 01-row8-today-vs-capsule.hy — contrasts today's managed("claims mutex protection without locking", "mutex") block (which passes hy-check today as ACCEPT-MANAGED / HYB-E8001 and data-races under go run -race) against MutexCapsule[T].WithLock(fn(loan ScopedLoan[T])) (ACCEPT for in-window mutation; REJECT HYB-E3102 under O2/O6 if loan escapes into a task spawn, channel send, or outer binding).
    • 02-row10-today-vs-capsule.hy — contrasts today's sync.Pool (REJECT HYB-E3005) against LinearPool[T] (Get() -> Own[T], PutMove(move buf) freezing buf + may_share peers under O5.2 HYB-E3003).
    • 03-row11-today-vs-capsule.hy — contrasts today's atomic.Pointer[T] (REJECT HYB-E3005 per PR fix(hy-check): treat atomic.pointer[T] and atomic.value as unproven per GUARANTEES row 11 (HYB-E3005) #52) against AtomicCapsule[T] (StoreMove(move next), SwapMove(move next) -> Own[T], Take() -> Own[T]).
  2. Before / After GUARANTEES.md Row Semantics (RESULTS.md §4):

    • Added exact verbatim Before → Proposed After contract text for Row 8 (splitting into Row 8a MutexCapsule[T] + Row 8b narrowed managed with "mutex"/"atomic" deprecated), Row 10 (LinearPool[T]), and Row 11 (AtomicCapsule[T]), explicitly stating both what flips to ✅ Guaranteed and what remains out of scope (P4a interior-slice aliasing without may_share + reset, and P4b multi-capsule AB-BA lock-order cycles).
  3. Candidate Remedy Paths for Falsifier P4a (RESULTS.md §5 + TestP4a_Remedy_StructuralDetachResetClosesInteriorSliceLeak in work/capsules_test.go):

    • Candidate Condition R1 (Static may_share Freeze + Synthesized Structural Reset — zero runtime architecture change): hy-check treats PoolPutMove(pool, move x) identically to a task-boundary move x under O5.2 (freezing aliases(x) ∪ may_share(x) so any derived sub-slice leaked := buf.Payload[:2] is rejected with HYB-E3003 on post-PutMove use), while hy-emit synthesizes a structural field-reset hook (clear + detach). Verified race-free in TestP4a_Remedy_StructuralDetachResetClosesInteriorSliceLeak (go test -race -count=2 — 12/12 PASS).
    • Candidate Condition R2 (Composition with W-014 HyRegion Linear Slabs): If the pooled struct and its backing slice inhabit a W-014 linear slab, PoolPutMove bumps the slab generation bit in $O(1)$, invalidating interior handles without field-by-field reset.

Also closing #543 per your note that @carelessdept's merged ladder PRs (#28/#30/#32/#34) are already recorded in CONTRIBUTOR_RECOGNITION and no ledger self-edits are needed.

@limitlessprojects limitlessprojects added triage:new New arrival (<= 3 days old), awaiting recon triage:wildcard-hold Wildcard Track spike artifact — stays open, never merges (Track 3); window verdicts in MOONSHOT.md labels Oct 19, 2026
@carelessdept
carelessdept force-pushed the spike/w022-linear-sync-capsules branch 2 times, most recently from 645fea2 to 5e28029 Compare October 28, 2026 12:26
@carelessdept
carelessdept force-pushed the spike/w022-linear-sync-capsules branch 6 times, most recently from 0379014 to fee1400 Compare November 2, 2026 06:57
…essprojects#544)

Pre-registers P1-P4 (with P4a interior sub-slice alias across pool epochs and P4b AB-BA lock-order cycle as declared falsifiers) and implements AtomicCapsule[T], LinearPool[T], and MutexCapsule[T] composing with W-004 phantom witnesses (Live[R]/Moved[R]) to flip GUARANTEES.md Rows 8, 10, and 11.
@carelessdept
carelessdept force-pushed the spike/w022-linear-sync-capsules branch from fee1400 to a148712 Compare November 2, 2026 07:28
@limitlessprojects

Copy link
Copy Markdown
Owner

M1 verdict recorded: accepted — winner of the 2026-11-01 wildcard cycle ($250 M1 logged; owner pays). Written reason in MOONSHOT.md → Window verdicts (race-verified, pre-registered spike; strengthening delivered in a7ba19f; GUARANTEES rows 8/10/11 flips; third convergence on the phantom-witness/may_share boundary). Per Track 3 this PR stays open as the artifact — it never merges to main. Next milestone: M2 learning at the 2026-12-01 window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage:new New arrival (<= 3 days old), awaiting recon triage:wildcard-hold Wildcard Track spike artifact — stays open, never merges (Track 3); window verdicts in MOONSHOT.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants