13 Context Graph

Context Graph

Before you change a datamodel, a topic or a leg, you want to know what else depends on it: which routes read it, which projects build them, which solution they belong to. Nobody can keep that map up to date by hand. The context graph is that map, built from what the projects' builds report: solutions, integration projects, their legs (the routes), the topics they read and write, and the datamodels they use, as nodes, with how they depend on each other as relations. It answers "what does this connect to?" and "what would a change reach?" before anything is changed.

  • In the menu: Build → Context graph (/integration-assets/integration-context)
  • For: architects, developers and business roles who want to see what connects to what; anyone who may read the tenant's context opens it, and within it the domains their roles cover
  • Reads: klok.dev's database, filled by every integration project's build on main with the build's documentation payload

What You See

  • The search box searches node names, keys and documents when you press Enter: a datamodel (InvoiceV1), a system, a route id, a topic.
  • A chip per kind of node filters the list: System, Solution, Datamodel, Topic, Integration project, Leg, Repository and File; most carry how many nodes of that kind there are. The line under them says when a build last reported and from which repository.
  • The nodes found, at most 50, the best matches first, with their kind and key.
  • The selected node, on the right: its description and facts (key, domain, source, when it was last seen, and what the build said about it, such as a datamodel's version and artifact or a leg's base class), its Relations, its Documentation, and Impact of a change for a datamodel, topic, system or leg. The documents of a project whose documentation only its members or admins read (Documentation → Visibility) are left out, here and in the search, for whoever may not read it on docs.klok.dev.

The relations are named from the node's side: a datamodel is Implemented by the legs that use it and Used by its solution and topics; a leg Consumes from a topic, Implements datamodels, Depends on the sub routes it calls, and is a Leg of its project and its solution.

Walkthrough: Follow What A Datamodel Connects To

  1. Type PersonnelEmploymentBatchV1 and press Enter. The list shows everything that carries the name: the datamodel, its two topics (PersonnelEmploymentBatchV1 and its purpose _heroma), the legs that publish it, a project that builds them and the solution, KLK010 Personnel scheduling.

  2. Choose the datamodel. Its facts say which release the builds use and where its schema lives; under Relations are the three legs that implement it and the solution and topics that use it.

  3. Choose a relation, here KLK010E1_KonvojEmploymentStore. The leg opens with its description from the build and its relations: the topic it consumes from, the datamodels it implements, the sub route it depends on, and its project and solution. Its Documentation holds the route's page from the build.

Walkthrough: See What A Change Would Reach

  1. Select the datamodel, topic, system or leg you are about to change, and choose Impact of a change.

  2. Read the figures: how many nodes the analysis started from, how many it reached and over how many relations. It searches for the node's name and walks two steps from every datamodel, topic, system and leg the search finds, so it names where it started. For PersonnelEmploymentBatchV1 it reaches all five of KLK010's projects.

  3. Use the list by kind to decide who to talk to and what to test before the change is designed. A node's name opens it.

The impact here is a walk of the graph, without AI. Walking from the node itself, rather than from what a search for its name finds, is frontend-klok-dev#116. For a written report with severities, start an Impact analysis under Kloker → Tasks, which reads the same graph.

Where The Graph Comes From

The job klok_docs_publish runs ./gradlew publishKlokDocs publishKlokContext on every build on main: the first task scans the code and publishes the documentation payload, the second posts the same payload to klok.dev, where the build's routes, topics, datamodels, solutions and documents become nodes and relations. A project that publishes with klok docs send instead adds nothing here.

What the graph does not hold yet:

  • Datamodel builds publish their payload on the broker, but the graph reads only what is posted to it, so a datamodel's own release does not reach the graph; its node comes from the projects that use it. Reading the topic instead is frontend-klok-dev#53.
  • Systems come into the graph with Sync workspace, which rebuilds the tenant's nodes from klok.dev's own copies of its datamodels, projects, solutions, systems and domains, not from the builds. Only a Tenant Admin and platform staff see the button. What it adds and what the builds report can disagree (frontend-klok-dev#93).

What Happens In Git

In klok.dev Where it lands Who By hand
Search, a relation, Impact of a change Nothing: read from klok.dev's database Anyone who may read the tenant's context —
A build on main The project's nodes, relations and documents in klok.dev's database; the REST API changelog when the build carries an OpenAPI document The pipeline, after a person merged ./gradlew publishKlokDocs publishKlokContext with the tenant's ingest token (KLOK_INTEGRATION_CONTEXT_TOKEN)
Sync workspace The tenant's nodes rebuilt from klok.dev's own copies; nothing in Git A Tenant Admin or platform staff —

The graph is a copy of what the builds reported, never the only copy: the next build on main updates it. See What klok.dev Does In Git for every page.

Who Does What

Automation Kloker You
Every build on main scans the code and posts its payload; klok.dev turns it into nodes and relations; Impact of a change walks the graph two steps out Reads the same graph when it answers questions in Ask Kloker and when it writes an impact analysis under Kloker → Tasks Judge what a change means for the nodes it reaches, and decide how it is made

See You, The Automation And Kloker.

How It Connects

The graph is filled by the builds of the Integration Projects, and it is what other pages read: Solutions compares each solution document with the legs in it, Logs finds a failed route's source code and documentation through its leg, Broker shows the routes declared to publish and read each topic, and Kloker answers from it. How The Build Pages Fit Together places it in the Build workflow.

Read More