fix(admin-dapp): adopt the current @enbox line, sync-driven refresh, and sync health - #272
Open
LiranCohen wants to merge 8 commits into
Open
fix(admin-dapp): adopt the current @enbox line, sync-driven refresh, and sync health#272LiranCohen wants to merge 8 commits into
LiranCohen wants to merge 8 commits into
Conversation
Move all nine @enbox packages from the stale early-June pins (agent 0.8.17 / dwn-sdk-js 0.4.10 line) to the current published versions: agent 0.8.34, api 0.6.73, auth 0.6.80, browser 0.3.65, common 0.1.5, crypto 0.1.8, dids 0.1.8, dwn-sdk-js 0.4.18, protocols 0.2.100. package.json and bun.lock move together, resolving the documented node_modules/lockfile divergence (CI installs with --frozen-lockfile). The typed-records rework in @enbox/api now requires defineProtocol to receive one runtime codec per reachable protocol type; supply plain JSON codecs for all ten mesh types through a loosely-typed alias (the JSON-imported definition is too wide for literal path inference and trips TS2589 otherwise). No behavior change: the typed handle is only used for configure/verify. Refs #268 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The dashboard refetched the full topology (5+N RecordsQuery) every ten seconds regardless of whether anything changed. The upgraded sync engine emits typed delivery:applied events once per freshly applied remote message, so refresh on those instead: filter descriptors to the mesh protocol, coalesce bursts through a 500ms trailing debounce (an approval applies member + node + approval records back-to-back), and refetch once. Kept: the manual Refresh button, the visibilitychange refresh, and a slow visibility-gated safety-net poll (60s) for anything the event stream misses. The subscription and any pending debounce are torn down on unmount/disconnect. Refs #268 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Compact sidebar surface over the sync engine's getRemoteSyncStatus, modeled on notesd's use-remote-sync-status + remote-sync-panel: one row per (tenant, remote) with the SDK's rolled-up state (precedence offline > quota-blocked > degraded > healthy), quota-blocked/failed message counts, last activity, next probe time, the last error, and a per-remote Retry bound to retryRemoteNow. Quota-blocked is spelled out as "Storage full — pushes deferred" — a full remote silently deferring pushes otherwise just looks like a node that never appears. The hook refreshes on every sync event (400ms trailing throttle) plus a slow visibility-gated 30s poll, and unsubscribes on unmount. Styling follows the dapp's light theme with teal/amber accents. Refs #268 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…shes
queryRecords assumed every matching record arrived in one reply; the
server's bounded record materialization (dwn-sdk-js 0.4.18) makes that
fragile. Walk the reply's pagination cursor with limit-100 pages, capped
at 20 pages so a runaway query can never loop forever (a truncation past
2000 records per path is warned about).
The one-shot sync("push") after each write survives at agent 0.8.34 and
is kept, but terminal push failures never surface through it — the
engine dead-letters them and resolves. After each push, report
mesh-protocol dead letters via console.warn (best-effort, never fails
the write); the sync health panel shows the same state as per-remote
failed counts.
Refs #268
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Ignore __TESTDATA__/ (PlatformAgentTestHarness LevelDB debris) and _peervis.mjs (local peer-visibility repro script) — both exist only as untracked files in local checkouts and were never meant to be committed. The README claimed the dapp also requests the key-delivery protocol (https://identity.foundation/protocols/key-delivery); it requests only the wireguard-mesh protocol, and role-audience keys travel through the mesh protocol's own sealed $encryption records. Refs #268 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
dwn-sdk-js 0.4.17 (#1446) tightened the $recordLimit protocol schema to additionalProperties:false with "max" as the only property. The shipped definition still carried strategy:"reject" at network/preAuthKey, which the 0.4.18 ProtocolsConfigure validator rejects — ensureProtocolsReady failed at dapp startup against the upgraded @enbox pins. Rejecting over limit is now the SDK's only behavior, so dropping the property changes nothing semantically. The Go-side protocol test now rejects any $recordLimit property other than max instead of only purgeOldest. Refs #268 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ensureProtocolsReady tests mock configure(), so schema-tightening dwn-sdk-js releases (like 0.4.17 removing $recordLimit.strategy) could ship green while the real ProtocolsConfigure validator rejects the definition at startup. Pin protocols/wireguard-mesh.json to the installed SDK by driving ProtocolsConfigure.create with the wallet-installed shape ($keyAgreement injected), plus a negative case proving the gate actually validates $recordLimit. Refs #268 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The topology effect listed busyAction in its deps, so every action start/finish tore down and re-created the sync-event subscription and cancelled any pending debounced refresh; delivery:applied events landing in that gap were dropped until the safety poll. Read busyAction through a ref so the subscription survives action churn. Refs #268 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Fixes #268
What changed
package.json+bun.lockcommitted together, ending the dev-vs-CI SDK divergence (bun install --frozen-lockfileverified). API breakage fixed: the typed-records rework requires runtime codecs per protocol type.protocols/wireguard-mesh.json, own commit since the Go daemon embeds it): dwn-sdk-js 0.4.17 removed$recordLimit.strategyfrom the schema — the old definition is now rejected at ProtocolsConfigure time, which would have left the upgraded dashboard unable to start. Removing it is semantically a no-op (reject-over-limit is the SDK's only behavior now). A new test drives the shipped JSON through the real installed SDK validator so future schema-gate changes failbun run testinstead of production.delivery:appliedsync events filtered to the mesh protocol (500ms debounce), with the manual Refresh button, visibilitychange refresh, and a 60s visibility-gated safety poll retained. The subscription survives UI action churn.sync("push")kept (verified to exist at 0.8.34); terminal dead-lettered pushes surfaced instead of silently swallowed;queryRecordsnow paginates (limit 100, hard page cap) instead of assuming single-page replies..gitignorefor local experiment debris, README key-delivery claim fixed.Approval-flow gate re-validation (for the record): #1479 (authorized role issuers) and #1480 (record-limited role rejection) are both ProtocolsConfigure-time checks — the mesh definition passes both (no
$rolepath carries$recordLimit; role issuance iswho: "author", of: "network"and the dapp's$rolewrites are owner-authored via delegated grant).Verification
bun install --frozen-lockfile— clean, no changesbun run test— 62/62 pass (+17 new: refresh scheduler, sync health, pagination, dead letters, real SDK protocol gate)bun run build— tsc + vite + PWA worker, zero errorsgo build ./... && go vet ./... && go test ./... -count=1 -race— all pass (the protocol JSON is embedded in the Go daemon)🤖 Generated with Claude Code