지금까지 세션 스크래치패드에만 있던 것을
.claude/audit/handtrace-round7-reference-impl/로 옮긴다. 다음 세션이
발견 52건을 판정하려면 이게 있어야 한다.
구성:
- spikes/core.luau — 반응형 코어(state-epoch §2~§5, 전파 모델,
gate 4·8번, Blocker, H-23 스냅샷)
- spikes/dispatch.luau — Length/Offset 부기(getOffsetAt 접두합 캐시,
recompute, setLength/setOffsetSource, 배치 게이팅)
- spikes/chain.luau — Dispatch 체인(하강 diff, retractFrom)
- spikes/*.luau — 시나리오 29개(런타임 18 + 타입 11)
- RUN-runtime.txt / RUN-typecheck.txt — 2026-08-25 실행 결과 스냅샷
- README.md — 원문 대조표 + 스파이크→발견 대조표
⚠️ README가 가장 중요하다: 이 참조 구현은 base/의 확정 의사코드를 손으로
옮긴 **전사물**이라 그 자체가 틀렸을 수 있다. 그래서 "재실행은 검증이
아니다"를 못박고, (a) 어느 파일이 어느 절을 옮긴 것인지 대조표와
(b) 문서와 **의도적으로** 다른 곳 3개(H-72 때문에 임시로 둔 PeekDiffers,
H-102의 A/B 대조를 위한 위치 박스, 생명주기 게이팅 부재=H-97)를 같이
싣는다. 그 셋 외의 모든 차이는 전사 오류 후보다.
부수로 round7 문서 머리에 이 폴더 포인터와 같은 경고를 달았고,
.claude/README.md의 audit/ 행에도 등재했다.
Co-authored-by: qwreey <me@qwreey.moe>
47 lines
2.2 KiB
Text
47 lines
2.2 KiB
Text
--!nocheck
|
|
local q = require("./core")
|
|
|
|
print("=== (a) blocker:Off() 순회 중 한 핸들이 error ===")
|
|
local A = q.Source(1)
|
|
local B = q.Source(1)
|
|
local b = q.Blocker()
|
|
local g1 = q.Gate(A, function(emit) return b:Policy(emit) end, "g1")
|
|
local g2 = q.Gate(B, function(emit) return b:Policy(emit) end, "g2")
|
|
local seen1, seen2 = {}, {}
|
|
local o1 = q.Observer(g1, function() error("g1 하류에서 실패") end, "o1")
|
|
local o2 = q.Observer(g2, function() table.insert(seen2, g2:Get()) end, "o2")
|
|
b:On()
|
|
A:Set(2); B:Set(2)
|
|
print("보류 중 — g1.withheld 비었나:", next(g1.withheld) == nil, "| g2.withheld 비었나:", next(g2.withheld) == nil)
|
|
local ok, err = pcall(function() b:Off() end)
|
|
print("Off()가 던졌는가:", not ok, "|", err)
|
|
print("blocker.IsBlocked:", b.IsBlocked, "(이미 false — Off는 상태부터 바꾼다)")
|
|
print("g2가 아직 붙들고 있나(비었으면 flush됨):", next(g2.withheld) == nil, "| o2 발화:", o2.fires)
|
|
print("→ g2는 IsBlocked=false 인데도 밀린 통지를 못 내보냄. b:Off()를 다시 불러도:")
|
|
B.subs[g2] = B.subs[g2] -- no-op
|
|
local ok2 = pcall(function() b:Off() end)
|
|
print(" 두 번째 Off도 같은 자리에서 던짐:", not ok2, "| o2 발화:", o2.fires)
|
|
|
|
print()
|
|
print("=== (b) flush 도중 error → 떼어낸 배치가 소멸 ===")
|
|
local S = q.Source(1)
|
|
local bl = q.Blocker()
|
|
local g = q.Gate(S, function(emit) return bl:Policy(emit) end, "g")
|
|
local boom = true
|
|
local seen = {}
|
|
local o = q.Observer(g, function()
|
|
if boom then error("하류 실패") end
|
|
table.insert(seen, g:Get())
|
|
end, "o")
|
|
bl:On()
|
|
S:Set(2)
|
|
print("보류됨. withheld 비었나:", next(g.withheld) == nil)
|
|
pcall(function() bl:Off() end)
|
|
print("flush 진입 후 withheld 비었나(스왑됨):", next(g.withheld) == nil, "| flush 횟수:", g.flushes)
|
|
print("gate.emitEpochMap은 이미 Sync됨 → 같은 리비전은 이제 규칙 3으로 삼켜진다")
|
|
boom = false
|
|
-- 같은 리비전이 다른 경로로 다시 도착하는 상황을 재현
|
|
g:_receive(S)
|
|
print("같은 리비전 재도착 후 o 발화:", o.fires, "| 관측:", table.concat(seen, ","))
|
|
print("→ 배치는 사라졌고 재도착도 삼켜져, 그 변경에 대한 통지가 영영 안 나감")
|
|
print(" (값은 살아있다: g:Get() =", g:Get(), ")")
|