feat(control): dig-node control-panel surface — WS status, cache-LRU, token pairing#16
Merged
Merged
Conversation
… token pairing Coordinated 9778 browser-surface release for the extension control-panel epic: - #239 WebSocket status/liveness channel `GET /ws/status` (status snapshot on connect + 5s heartbeat + WS ping; 20s half-open timeout; CSWSH Origin allowlist; shared status_fields with /health). - #279 cache-LRU management over the OPEN cache.* family: per-entry `lru_rank` on cache.listCached (0 = next evicted), and a new `cache.stats` (cap/used, entry_count, total_bytes, session evicted_count/bytes, content-cache hits/misses). - #280 control-token pairing so an MV3 extension can drive control.* mutations without reading the token file: OPEN pairing.request/poll + MASTER-gated control.pairing.list/approve/revoke, a scoped + revocable paired-token store, and a `dig-node pair` CLI approve step (compare-codes consent). Unpaired callers stay -32030; a paired token cannot administer pairings. All additive-only (§5.1). SPEC.md updated (§4.5 WS, §7.2 auth, §7.10 cache, §7.11 pairing). Version bumped 0.11.1 -> 0.12.0 (feat -> minor). Closes #239 Closes #279 Closes #280 Refs #278
eaaa87b to
e745e72
Compare
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.
TLDR
One coordinated 9778 browser-surface release for the extension control-panel epic (#278): the WebSocket live-status channel (#239), the full OPEN cache-LRU management surface (#279), and control-token PAIRING so the MV3 extension can drive
control.*mutations (#280). Additive-only; released-first so the extension consumes it next.What changed
GET /ws/statusWebSocket (prior-lane work, completed here): status snapshot on connect, then aheartbeat(refreshed snapshot +ts) every ~5s plus a transport ping; 20s half-open timeout closes a dead socket;Originvalidated against the same local allowlist CORS reflects (CSWSH defense); sharesstatus_fieldswith/healthso the two can't drift.cache.*):cache.listCachedentries gainlru_rank(0 = least-recently-used = next evicted; strict0..norder). Newcache.stats→{ cap_bytes, used_bytes, entry_count, total_bytes, evicted_count, evicted_bytes, content_cache:{hits,misses} }(session counters).cache.setCapBytesreserved-cap floor (64 MiB),getConfig/removeCached/clearunchanged.pairing.request/pairing.poll(an MV3 extension can't read the token file) + MASTER-gatedcontrol.pairing.list/approve/revoke; a scoped, revocable paired-token store (<config_dir>/paired-tokens.json, owner-only, atomic); the auth gate accepts the master token OR a valid paired token, except pairing-admin methods (master only). Newdig-node pairCLI (compare-codes consent). Unpaired callers stay-32030.How verified (this session)
cargo test -p dig-node-service -p dig-node-core— all green, incl. the WS integration tests (snapshot/heartbeat/clean-close/origin), the new cachelru_rank+cache.statstests, the 6 pairing unit tests, the end-to-endpairing_flow_grants_then_revokes_a_scoped_control_tokenHTTP test (unpaired→-32030, request→approve→poll→authorized mutation→paired-token-can't-admin→revoke→-32030), and the openrpc drift guard (cache.statscatalogued + resolved).cargo fmt --all -- --checkclean;cargo clippy --all-targets --all-features -- -D warningsclean;cargo build --lockedOK.dig-node pair --helplists list/approve/revoke;dig-node pair list --json(no node) emits a cleanIO_ERRORenvelope.Bump rationale
feat→ minor: 0.11.1 → 0.12.0. New additive endpoints/fields/methods; no removed or repurposed API, no wire/format break (§5.1 additive-only — older readers ignore the new fields).Blast radius (gitnexus + survey)
server.rs::rpc(new OPENpairing.*branch before the control gate; gate extended for paired tokens),control.rs::dispatch_control(+control.pairing.*),dig_node_core::handle_rpc(+cache.stats,lru_rank).AppState/ControlCtxgain a sharedPendingPairings.pairing.rs(state + store + open/admin dispatch) andpair.rs(CLI client). Catalogue: 5 new methods inmeta::methods()(drift guard green).control.status, DIG Browser cache FFI) unaffected.SYSTEM.md deltas for the orchestrator (do NOT edit superproject here)
The "dig-node control interface" contract gains, on the 9778 browser surface:
GET /ws/status(OPEN; snapshot + heartbeat; open socket = liveness).cache.listCachedper-entrylru_rank; newcache.stats.pairing.request/pairing.poll+ gatedcontrol.pairing.list/approve/revoke; the gate now accepts a paired token (scoped, revocable;<config_dir>/paired-tokens.json) beside the master token, except for pairing-admin methods. This changes the prior "an MV3 extension CANNOT drive control.* mutations" statement — it now can, after consented pairing.Refs #278. Closes #239, #279, #280.