experiment: graph explorer API (neighborhood, shortest path, reindex) - #976
Draft
SHAcollision wants to merge 1 commit into
Draft
experiment: graph explorer API (neighborhood, shortest path, reindex)#976SHAcollision wants to merge 1 commit into
SHAcollision wants to merge 1 commit into
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.
experiment: backend half of the graph explorer. Use together with the pubky-app branch
experiment/graph-viz(frontend PR: pubky/pubky-app#2138).What it adds
GET /v0/graph/{kind}/{id}withkindinuser|post|tag: a typed node-link neighborhood around a center entity, painted in one request. Params:depth(1..2, user centers only),limit(1..50, default 30),kinds(csv filter). Node ids are kind-prefixed (user:{pubky},post:{author}:{post_id},tag:{label}); FOLLOWS/TAGGED edges carryindexed_atso the client can time-travel.GET /v0/graph/path/{from}/{to}: undirected shortest FOLLOWS path, max 6 hops, nodes path-ordered. Distinct 404s for unknown users vs no path.nexusd db reindex: rebuilds the whole Redis index from the Neo4j graph (flush, recreate the RediSearch post-content FT index, resync). Needed once after restoring a graph backup, and reusable as an operational tool.Design notes
BoundedLimit, aGraphDepthnewtype in theWotDepthstyle,GraphKindswith its own CSVDeserialize,Path<PubkyId>extraction. Invalid input is a 400, not a silent clamp.user_projection,post_fields,not_deletedonUSER_DELETED_SENTINEL) keep the projections in one place.MockDb::sync_redisanddb reindexnow share onerebuild(); this fixes a real gap where a reindex skipped the FT index and post search came back empty. The flush isFLUSHALL ASYNCso production-sized indexes do not outlive the client timeout.Tests
14 integration tests (
nexus-webapi/tests/graph/) over the mock dataset: shapes for all three center kinds, depth/limit/kinds behavior, edge-endpoint closure, path ordering, and the full 4xx surface. Serde unit tests for the new deserializers. Full suite green: 625 passed.We probably will not merge this as-is; it exists so the team can explore the feature end to end.