ADR 0002: Storage Enforces Channel Binding Policy
Status
Accepted.
Context
Following ADR 0001, archives are bound to channels rather than to finger
positions. The question then arises: where does that binding live, and what
happens when a second archive is bound to a channel that already has one?
Decision
IntentResolver is the single authoritative store of channel-to-archive
bindings. The rules are:
- Only one archive may be bound to a channel at a time.
- Binding a second archive to an already-bound channel silently replaces the
previous binding. The caller is responsible for any required teardown of
the displaced archive.
- Unbinding a channel sets its binding to
0 (the sentinel “no archive” id).
- Bindings survive
GestureEngine::Flush() calls; they are not cleared on
gesture boundaries.
The storage API (BindArchive, UnbindArchive, BoundArchive) is defined in
core/include/IntentResolver.h.
Consequences
- A simple array indexed by channel ordinal is sufficient — no hash map or
dynamic allocation is needed at the resolver level.
- The policy “one archive per channel” is trivially enforced: the array slot
is overwritten.
- Applications that need soft “layers” (e.g. a temporary modal binding) must
save and restore the previous archive id themselves.