지금까지 세션 스크래치패드에만 있던 것을
.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>
26 lines
1.3 KiB
Text
26 lines
1.3 KiB
Text
--!nocheck
|
|
local q = require("./core")
|
|
local A = q.Source(1)
|
|
local B = q.State(function(self, prev, a) return a:Get() end, {A}, "B")
|
|
local C = q.State(function(self, prev, a) return a:Get() end, {A}, "C")
|
|
-- B 아래에 터지는 Observer, C 아래에 멀쩡한 Observer
|
|
local bad = q.Observer(B, function() error("사용자 콜백 실패") end, "O_bad")
|
|
local goodSeen = {}
|
|
local good = q.Observer(C, function() table.insert(goodSeen, C:Get()) end, "O_good")
|
|
|
|
print("-- A:Set(2) (전파 중 O_bad가 error) --")
|
|
local ok, err = pcall(function() A:Set(2) end)
|
|
print("Set이 던졌는가:", not ok, "|", err)
|
|
print("O_bad 발화:", bad.fires, "| O_good 발화:", good.fires, "| 관측:", table.concat(goodSeen, ","))
|
|
print("C의 값은 자가치유되는가: C:Get() =", C:Get(), "(정상)")
|
|
print("하지만 O_good은 이 변경에 대해 영원히 안 울었다:", good.fires)
|
|
|
|
print("-- 이후 A:Set(3)은 정상인가 --")
|
|
local ok2 = pcall(function() A:Set(3) end)
|
|
print("두 번째 Set도 같은 자리에서 던짐:", not ok2, "| O_good 발화:", good.fires)
|
|
|
|
print("-- O_bad를 제거하고(구독 해제 없이 새 파동) --")
|
|
B.subs[bad] = nil
|
|
A:Set(4)
|
|
print("O_good 발화:", good.fires, "| 관측:", table.concat(goodSeen, ","))
|
|
print("→ 2와 3에 대한 통지는 영영 오지 않았다. 마지막 값만 보임")
|