Fix public Context Graph review follow-ups - #1853
Merged
Merged
Conversation
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
This is a deliberately narrow follow-up to #1848 — Fix public Context Graph subscription catch-up, which was merged into
testnet-canaryas7bbbd959727327ffb438e4e674b72251fd947445.It implements the first three actionable review follow-ups from that PR:
activeProjectId.includeSharedMemory: true.Review threads:
Original incident context
PR #1848 fixed a serious DKG V10 edge-node bug in which an explicitly public Context Graph entered the private join/bootstrap path and could not complete synchronization.
origin/testnet-canary/87f53014858abed8558fdc5c85a83efebdaeac020x00a9D0dcab936a418ffEbc734476C91D4027d359/balkan-places-to-visit12D3KooWDxBauQDeJjCmcvWiREFALfKsr5VfTzGUJbZJ6CUcc7aFaccessPolicy=public,subscribed=true,synced=false,callerInvolved=trueThe original failure sequence was:
runImmediatePostApprovalSync()used the private metadata refresh path with a private member proof.hasAuthoritativePrivateMetaDefinition()correctly requiredaccessPolicy=privateplus an approved-member delegation.data=0 sharedMemory=0.synced=false.The root cause was routing: discovery/UI forced an explicitly public graph into the private join path. The private proof code was failing closed correctly; it was being asked to validate the wrong kind of graph.
Original behavioral specification
The #1848 fix established these invariants, which this follow-up preserves:
accessPolicy=publicdefinition, validated ontology evidence, or identity-bound active on-chain registration./api/sync/catchup-status.synced=true; authoritative metadata, clean completion, and plane readiness are still required.Changes in this PR
Correct passive catalogue browsing
PanelLeftnow clearsactiveProjectIdbefore opening a passive public graph tab. The regression starts with an active private graph, browses a different passive public graph, and asserts that the old project target is removed while the public tab opens normally.Pin the public catch-up contract
The public subscription readiness test now records the request passed to
catchupRunner.run()and verifies the exact subscribed graph ID plusincludeSharedMemory: true. Existing assertions continue to cover durable/SWM backfill, readiness fields, job completion, and/api/sync/catchup-statusvisibility.Pin public-proof named-graph scoping
The public metadata proof parity matrix now moves a complete-looking definition into the data graph and verifies that both in-memory snapshot validation and the ASK query reject it. Authoritative public metadata must remain in the exact root
_metagraph.Security boundary
Regression evidence
The tests were exercised against intentional regressions before restoring/fixing production behavior:
activeProjectIdstill equal toprivate-active, then passed after the one-line fix.includeSharedMemory: falsemade the new catch-up request assertion fail.Verification
pnpm --dir packages/node-ui exec vitest run test/panel-left.test.ts --reporter=verbose— 12 passedpnpm --dir packages/cli exec vitest run test/context-graph-subscribe-readiness.test.ts— 17 passedpnpm --dir packages/agent exec vitest run test/context-graph-public-meta-proof.test.ts— 1 passedpnpm --dir packages/agent build— passedpnpm --dir packages/cli exec tsc --noEmit— passedpnpm --dir packages/node-ui build— passedpnpm --dir packages/cli test— 199 files passed, 2 skipped; 2,824 tests passed, 13 skippedpnpm --dir packages/node-ui test— 153 files passed; 2,178 tests passed, 38 skipped (run with localhost binding permitted; the sandbox-only attempt failed withlisten EPERM 127.0.0.1)pnpm --dir packages/agent test— 205 files passed, 2 skipped, 25 failed late after the shared Hardhat context file disappeared; all reported failures had the same unrelatedENOENT ... dkg-hardhat-ctx-9547.jsoninfrastructure error. The changed public-proof test and its isolated run passed.git diff --check— passedRemote query note
The separate curator response
ACCESS_DENIED: Context graph is not queryableis not changed here. Remote query access has its ownqueryAccesspolicy. As documented in #1848, the testnet chain did not contain a committed registration for the exact graph hash, so denial under the default policy is expected unless the curator explicitly enables per-graph query access.Deliberate non-goals
The later review suggestions to extract
hasConfirmedMetaState()or split modal validators are maintainability opportunities, not required for these three correctness/coverage fixes. They are intentionally excluded to keep this follow-up small and low-risk.