feat(channels): add Channels.match() API and switch default to target mode

- Add Channels.match(name, ch) for dual-mode event filtering
  Returns true if ch matches any active channel for the logical name.
  In dual mode, matches both legacy and target channels.
- Switch default channelMode from 'current' to 'target'
  RT channels now resolve to 4210-4213 instead of legacy 100-103.
- Config default also updated so fresh installs start in target mode.
- Rollback to 'current' mode still supported via setMode().
This commit is contained in:
MayaTheShy
2026-03-26 16:25:47 -04:00
parent ce673f177d
commit 611bc1236c

View File

@@ -52,15 +52,15 @@ Channels.registry = {
}
--- Channel mode controls which channel number is returned by get().
-- "current" — use legacy channel numbers (default, safe)
-- "target" — use new channel numbers (post-migration)
-- "current" — use legacy channel numbers (for rollback)
-- "target" — use new channel numbers (default, post-migration)
-- "dual" — listeners open both; senders use target
Channels.mode = 'current'
Channels.mode = 'target'
--- Load channel mode from persistent config if available.
-- Called automatically on require; can be called again to reload.
function Channels.loadConfig()
local cfg = Config.load('platform', { channelMode = 'current' })
local cfg = Config.load('platform', { channelMode = 'target' })
if cfg.channelMode then
Channels.mode = cfg.channelMode
end