feat(relay): centralize binding authority#52
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a centralized binding-authority module that classifies messenger binding state into a small set of outcomes (active, paused, revoked, moved, missing, state-unavailable) and migrates all relay delivery edges (Telegram/Discord/Slack adapters, broker process, in-process runtime, lifecycle, requester-file delivery) to fail closed when state is unreadable instead of silently treating load errors as an empty store. It also introduces stable destination keys for timer/progress bookkeeping so deferred work cleans up correctly even if a route's binding mutates.
Changes:
- Adds
extensions/relay/core/binding-authority.tswith shared resolver/key/diagnostic helpers andloadBindingAuthoritySnapshotonTunnelStateStorethat distinguishes missing vs corrupt state. - Migrates Telegram/Discord/Slack runtimes, broker
process.js/tunnel-runtime.ts, requester-file delivery, lifecycle, and extension-runtime status/send paths to authority snapshots and stable destination keys. - Adds new test suites (
binding-authority,state-store-hot-paths, broker corrupt-state, runtime corrupt-state suppression, requester-file authority-denied) and marks the OpenSpec tasks complete.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| extensions/relay/core/binding-authority.ts | New shared authority resolver, outcome types, destination keys, diagnostics |
| extensions/relay/core/index.ts | Re-exports binding-authority module |
| extensions/relay/core/requester-file-delivery.ts | Adds optional authoritySnapshot and authority-denied failure code before reading/uploading |
| extensions/relay/state/tunnel-store.ts | Adds loadBindingAuthoritySnapshot, fail-closed semantics, sync-helper warnings |
| extensions/relay/runtime/extension-runtime.ts | Status/send-file/lifecycle paths use snapshots and outcomes |
| extensions/relay/adapters/telegram/runtime.ts | Telegram delivery, activity/progress timers, session listings, register/auth flows migrated to authority + destination keys |
| extensions/relay/adapters/discord/runtime.ts | Discord active-binding, typing refresh, active-selection paths use snapshots |
| extensions/relay/adapters/slack/runtime.ts | Slack active-binding, find-binding, progress keying use snapshots and shared keys |
| extensions/relay/broker/tunnel-runtime.ts | Passes authority snapshot into requester-file delivery |
| extensions/relay/broker/process.js | New loadStateSnapshot, snapshot-based binding resolution, userId-aware activity/progress keys |
| docs/adapters.md | Updates binding-authority guidance |
| openspec/changes/.../tasks.md | Marks all tasks complete |
| tests/* and tests/relay/* | Adds authority matrix, hot-path guard, corrupt-state, requester-file, broker corrupt-state tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
centralize-binding-authority-resolutionOpenSpec tasks completeValidation