quad/quad-base/src/Dispatch/Handler.luau
qwreey-agent-selene 590b0fe6a1
feat: M3 단위 1 — Handler 계약 타입(quad-types 소유) + Quad.Dispatch 필드(H-25)
- quad-types: `Handler`(isHandlable/priority/process→retractor 3종) /
  `Dispatch`(getHandler/process/retractFrom/addHandler/listHandlers/drive +
  HANDLER_PRIORITY_* 밴드) export type 신설, `Quad`에 `Dispatch` 필드
  (H-25 — 닫힌 레코드라 없으면 quad.Dispatch 접근이 analyze 타입에러)
- quad-base/src/Dispatch/Handler.luau: 타입 전용 잎(§6 계획) — quad-types
  재export만, Dispatch 되참조 없음(단방향 의존)
- H-165 예고대로 pesde shim 재생성 필요했음 — `pesde install` 재실행으로 해소

Co-authored-by: qwreey <me@qwreey.moe>
Claude-Session: https://claude.ai/code/session_01LF78pXeFGD1ZSVD3ifteYG
2026-08-31 15:13:08 +09:00

30 lines
1.5 KiB
Text

--[[
Handler — the handler contract, types only. `.claude/base/dispatch-core-plan.md`
"핸들러 계약" section, as-is:
isHandlable(inst, key, value) -> boolean -- pure, fast predicate (no side
-- effects; validation happens
-- *after* selection, inside process)
priority: number -- open numeric space; use the
-- HANDLER_PRIORITY_* band constants
-- (`Dispatch/init.luau`) ± offsets
process(inst, key, value, index) -> retractor
-- does the work and returns the 1-arg closure that undoes exactly what
-- this call did. Returning nil is a contract violation (Dispatch errors
-- immediately); return `Void` when there is nothing to undo (`H-162`).
-- The retractor's argument is either nil (plain retract) or a new value
-- this same handler is about to process — nothing else can arrive
-- (descending diff, "Dispatch 체인" section).
This file is a leaf on purpose: concrete handlers and `Dispatch/init.luau`
both depend on it, never the other way around ("Dispatch는 프리미티브가
아니다" — the dependency is one-way). The type itself is owned by
`quad-types` (so `Quad.Dispatch.addHandler` and backends share it) and only
re-exported here.
]]
local QuadTypes = require("../../roblox_packages/quad_types")
export type Handler = QuadTypes.Handler
return {}