8000 feat(graph): sources, sensors, people and agents as Source nodes linked to what they brought in by adeelahmad · Pull Request #627 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(graph): sources, sensors, people and agents as Source nodes linked to what they brought in - #627

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-pf8kii
Oct 18, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-pf8kii

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: the timeline said who brought each asset in (its activity's actor: Work Gmail, a sensor, a person, an automation), but the graph knew nothing of it. Nothing answered "where does Lens learn about St Mary's School?"

After: whoever brought an asset in is a Source node in the graph with an ADDED relationship to the asset, part of the hierarchy, so (Source)-[:ADDED]->(Recording)-[:MENTIONS]->(Entity) works in Cypher, the explorer lists an asset's source among its parents, and GET /graph/schema describes the label. On the canvas, sources are cloud-shaped nodes linked to what their assets mention (a Brought in edge per source and entity, weighted by mentions), in the Sources group of the filters; a source with nothing visible to link to is hidden, as an entity is. The Timeline page gets a Graph button that opens the canvas on the sources alone (/graph?show=actors). Ids are a:<actor>: a:source/12, a:account/1, a:app; properties name, actor, type (Service, Person, Application), kind (source, sensor, person, hook, agent), recordings, namespaces.

How: events_content.added_by(db, rows) is now the one place that says who added an asset (the timeline's asset.added activities use it too); graph_model.build adds a Source node per actor over the recordings in scope and ADDED links, and graph.build (the canvas) folds the same through the mentions into source–entity edges. Nothing is stored: the nodes come from each asset's own record, so there is no migration.

Motivation and Context

Step 5 of the activity stream design (thread above): actors in the graph, and a Graph tab on the feed. Follows #570 and #622.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests.
  • My change requires documentation updates, and I have updated docs/ accordingly.
  • Users need more than the title to understand it, so I wrote it as a fragment in changelog.d/ (graph-actors.md).

Done questions (AGENTS.md)

  • Goal: the graph shows where Lens learns about each entity, for people on the canvas and agents in Cypher; merged on green CI.
  • Agents: GET /api/v1/graph/related (a Source among an asset's parents), POST /api/v1/graph/query (the Source label and ADDED type, listed by /graph/schema) and the MCP graph tools, unchanged.
  • Zero setup: built from each asset's own record; nothing to configure.
  • Fewest clicks: one click on the Timeline page's Graph button opens the canvas on the sources; the Sources group and the Brought in edge are in the filters like any other.
  • Configurable: n/a, no new setting; the existing graph limits (max nodes, min edge weight) apply.
  • Light: one query over the recordings in scope and the lookups the timeline already does for actors; no model call.
  • Private and secure: only recordings the caller can read are walked, as before; an actor's name is what the timeline already shows for it. No new surface for the threat model.
  • Cost: no model call; nothing in the ledger to log.
  • User decides: n/a, nothing acts; existing defaults unchanged (the canvas opens as before unless asked for show=actors).
  • Upgrades: nothing stored; no migration.
  • Honest: docs/timeline.md's status table lists actors in the graph as built and For you as planned; the README's built line names it.
  • Tested and documented: test_graph.py::test_sources_are_actors_in_the_graph (schema, explorer parents, Cypher, canvas), jest graph-explorer.test.ts (API node to canvas node, hidden until linked); docs graph.md, timeline.md, requirements.md, changelog.d; make openapi regenerated the client.
  • Open standards: the actors are the stream's Activity Streams 2.0 actors; Cypher as before; no new dependency.
  • Reported: result goes back in the thread; refine later: an actor's own page from the canvas, a source's ADDED links filtered by time.
  • Reuse: events_content.actors and the asset.added actor rules, graph_model.Graph, the canvas's node groups, shapes and edge kinds; no new machinery.

Local CI (ci/local-ci.sh) on this head: FastAPI embedded and server, Next.js, pre-commit, PR title and upgrade all pass.


Generated by Claude Code

…ed to what they brought in

Whoever brought an asset in (the actor of its asset.added activity: a storage source, a sensor, a person, an
automation, a routine, an import hook, or Lens) is a Source node in the property graph with an ADDED relationship to
the asset, part of the hierarchy, so the explorer, Cypher and the MCP graph tools answer where Lens learns about each
entity. The canvas draws sources linked to what their assets mention (Brought in), and the Timeline page's Graph
button opens it on the sources alone (/graph?show=actors). events_content.added_by is the one place that says who
added an asset; the timeline's activities use it too.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ln25ykE6uBDqx21WBU94SX
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

0