Skip to content

feat(app): /graph force-directed entity graph (PR ι-graph)#47

Open
Ayaan2907 wants to merge 4 commits into
feat/v0.1.2-pr-lambda-shellfrom
feat/v0.1.2-pr-iota-graph
Open

feat(app): /graph force-directed entity graph (PR ι-graph)#47
Ayaan2907 wants to merge 4 commits into
feat/v0.1.2-pr-lambda-shellfrom
feat/v0.1.2-pr-iota-graph

Conversation

@Ayaan2907

Copy link
Copy Markdown
Owner

PR ι-graph — graph screen

Stacked on feat/v0.1.2-pr-lambda-shell (#46). Base = the λ-shell branch so this diff is graph-only; retarget to staging after #46 merges.

Adds /graph — a force-directed canvas of the user's real entity graph. Second surface of the v0.1.2 queue (eng-review decision D=B: real-thin, not mocked — the edges already exist in the db).

What changed

  • graph.get tRPC (lib/trpc/routers/graph.ts) — userId-scoped { nodes, links } assembled from entityCompanies/entityEvents/entityTopics, mirroring entity.detail's filters (ownerUserId, deletedAt IS NULL, sourceDeleted = false). People→company (works_at), →event (attended), →topic (discussed).
  • GraphClientreact-force-graph-2d dynamically imported with ssr: false; nodes colored by kind; tap a node → floating card with → open linking to /{kind}/{id}; filter chips per kind; empty state.
  • /graph route — server-loaded, auth-gated; added to middleware PROTECTED_PATHS.

New dependency (approved)

react-force-graph-2d@1.29.1 (+ force-graph, react-kapsule, prop-types) — the canonical MIT force-graph React wrapper. It was assumed pre-installed by the plan but wasn't; added with lockfile integrity. User-approved before this PR.

Tests

typecheck ✓ · lint ✓ · 92 pass (16 files). graph.get: two-user isolation, node/link mapping, soft-delete + sourceDeleted exclusion, empty graph. GraphClient: node render, node→entity navigation, empty state.

Known follow-up (not blocking)

  • Desktop dedicated detail-pane (design.md §14.3) deferred — the floating card suffices for this PR.
  • Live browser dogfood (render/perf at node count) not run in CI.

Next in queue

ζ acts → η settings → κ onboarding → θ search (architecture locked).

Copilot AI review requested due to automatic review settings June 6, 2026 21:51
@vercel

vercel Bot commented Jun 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
wingmic-web Ready Ready Preview, Comment Jun 6, 2026 9:52pm

@railway-app

railway-app Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

🚅 Deployed to the wingmic-pr-47 environment in wingmic

Service Status Web Updated (UTC)
wingmic ✅ Success (View Logs) Jun 6, 2026 at 9:53 pm

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new authenticated /graph screen that visualizes a user-scoped entity graph (people connected to companies/events/topics) using a force-directed canvas, backed by a new graph.get tRPC procedure and covered by router + UI tests.

Changes:

  • Introduces graph.get tRPC procedure that assembles { nodes, links } from entities + entity{Companies,Events,Topics} (userId-scoped, soft-delete + sourceDeleted=false).
  • Implements /graph server route and GraphClient UI using react-force-graph-2d via dynamic import (ssr: false).
  • Adds the new dependency (react-force-graph-2d) plus Vitest coverage for router isolation/mapping and GraphClient behaviors.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
docs/superpowers/plans/2026-06-06-v0.1.2-pr-iota-graph.md Implementation plan for the graph screen and associated backend/UI work.
bun.lock Lockfile updates for the new graph visualization dependency chain.
apps/app/package.json Adds react-force-graph-2d dependency.
apps/app/middleware.ts Protects /graph behind auth and adds middleware matcher.
apps/app/lib/trpc/routers/graph.ts New graph.get procedure building force-graph {nodes, links} payload.
apps/app/lib/trpc/routers/graph.test.ts In-memory libSQL tests for graph isolation, filtering, and mapping.
apps/app/lib/trpc/routers/_app.ts Registers the new graph router on the root tRPC router.
apps/app/app/graph/page.tsx Server-loaded, auth-gated /graph page that calls graph.get.
apps/app/app/graph/GraphClient.tsx Client-side force-directed canvas + filters + selected-node card UI.
apps/app/app/graph/tests/GraphClient.test.tsx UI tests (mocking the graph lib) for rendering, navigation, and empty state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +59 to +61
const links = data.links.filter(
(l) => visibleIds.has(l.source) && visibleIds.has(l.target),
);
Comment on lines +211 to +213
<a
href={'/' + selected.kind + '/' + selected.id}
style={{
Comment on lines +29 to +34
const people = await db.query.entities.findMany({
where: and(
eq(schema.entities.ownerUserId, userId),
isNull(schema.entities.deletedAt),
),
});
Comment on lines +26 to +31
const KIND_COLOR: Record<NodeKind, string> = {
person: accent, // #FFC452
company: blue, // #7DD3FC
event: 'var(--text-55)',
topic: violet, // #A78BFA
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants