The target page's code graph card links to the drawn graph, and a
finding whose location the graph has links to its impact: the entry
points that reach it, the call chains, callers and callees.
The explorer and the impact page follow the current dashboard: German
first through i18n, the target page's header, and graph colours taken
from the theme tokens, so the drawing follows the light and dark theme
and recolours on a switch.
A large graph stays usable: above 1,200 nodes it opens as one node per
group (communities of 10 or more, smaller ones pooled by folder), and a
click opens a group with its members and the groups linked to them.
The grouping runs in Rust (pages/graph_view.rs); graph-viz.js only
draws. A large drawing stops its layout after stabilising. The agent's
truncation of very large graphs is now shown.
/graph leads to the targets list; the file and search queries are
encoded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a scan has built a code graph with declarations in it, the target
page shows a card with:
- the number of code units (functions, types, PLC blocks);
- the number of entry points;
- the languages;
- one line on why it matters: triage takes into account whether an
entry point reaches a finding.
The build run counts its file nodes and entry points once, while it is
built. The new GET /api/v1/graph/{id}/summary then reads only the latest
build and loads no nodes. A build stored before this change has no counts
and shows no card until the next scan.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A PLC target now gets a code graph. Before this, PLC targets skipped the
graph phase entirely.
Nodes:
- A PROGRAM is a module and an entry point.
- A FUNCTION_BLOCK is a class.
- A FUNCTION is a function.
Edges:
- A variable whose type is a function block is a type reference to it.
- A call through an instance is a call to its type.
- Calls by name are calls.
- Standard blocks such as TON have no node, so their edges are dropped.
How it fits together:
- The PLC module reads each tree once, and both the findings and the
graph come from that read.
- The engine gets a public assemble step for nodes parsed outside the
graph crate, and FileGraph is public with line-based adders.
- One build function takes a tree or a PLC project's POUs. The scan
uses it, and so does the explorer's manual rebuild, which would
otherwise replace a PLC target's graph with file nodes only.
POU spans:
- A POU records the line of its END_ keyword.
- A PLCopen POU spans its <pou> element in the XML. Its statements keep
their synthetic lines, so finding lines and fingerprints don't change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Customer code is mostly C firmware and C#/ASP.NET, which the graph didn't
parse, so their graphs were nearly empty.
- C: functions, structs, unions, enums (including typedef'd ones and those
inside #if blocks), calls by name and #includes. main and interrupt
handlers are entry points, in the avr-gcc ISR(), CodeVision, SDCC, IAR and
GCC attribute spellings.
- C#: classes, structs, interfaces, records, enums, methods and
constructors, base types (Implements for IName), calls and constructions.
Entry points are Main and what a web framework calls: controller actions,
[Http*]/[Route]/[WebMethod] methods, Razor page handlers, Web Forms
pages and controls, IHttpHandler.ProcessRequest.
- Overloads and #ifdef/#else alternatives share one qualified name: they
give one node (an entry point if any of them is), and the calls of every
body count. Before, the graph kept the last and orphaned the others.
- tree-sitter-c 0.23.4; tree-sitter-c-sharp pinned to 0.23.1, as 0.23.5 is
built for grammar ABI 15 and our tree-sitter 0.24 reads up to 14.
- Edge resolution goes through an index by last name segment instead of
scanning every node per edge. When several nodes match it prefers the
edge's own file (C static functions), then the first by name, so a
rebuild links the same way. #include "uart.h" now links to the header.
- Community detection kept its totals up to date only by re-summing all
nodes for every node (quadratic per pass), and ran twice per build. It
now costs O(nodes + edges) per pass and runs once, in the build. The
FreeRTOS kernel (6,500 nodes) builds in 1.2 s instead of 6.9 s.
- compliance-graph joins CI's clippy and test steps. Its tests never ran
in CI before. The Rust parser's tests move below its last impl (clippy).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
First part of t72, Prüfwerk metering (LB §2 Abs. 4–5, §7). This PR records what a scan is metered by. Nothing is counted or enforced yet; counters, the 6-per-day limit and the Prüftag cap come in the next PR.
## What changes
- **Included vs extra targets.** Each target stores `billing: included | extra`.
- The oldest active targets by `created_at` are included, up to the plan's `limits.included_targets` from the registry entitlement. The rest are extra.
- The split is refreshed before each scan and when a target is created. Archiving an included target moves the oldest extra one up.
- A plan without that key includes every target, which is every plan until the registry sends the limits. So this PR changes nothing for existing tenants.
- **Run attribution.** Each run records an `attribution`:
- `request`: the customer started it (dashboard or API).
- `support`: staff started it.
- `change`: something the customer changed, i.e. new commits, other uploads, or a live URL.
- `rescan`: only the Prüfwerk build changed.
For scheduled and webhook scans it's set where change detection decides, so our rescan after an update is no longer counted as a customer change. `uploads_changed` / `content_changed` don't depend on `UPLOAD_CHANGE_SKIP`.
- **`chargeable`.** Says whether the run counts once it completes:
- a request always counts;
- a change counts only on an extra target;
- rescans and support scans never count.
`scan.completed` now carries `attribution` and `counted` as properties.
- **Dashboard.** The targets list shows a "Zusätzliches Prüfobjekt" badge on an extra target.
## Tests
- **Core:** the included/extra split, attribution, and the contract table of what counts.
- **Agent:** `content_changed`/`uploads_changed`, the `included_targets` limit, reading a stored target's billing, and a Mongo integration test (`tests/target_billing.rs`): the oldest are included, and an extra target moves up on archive.
Not built locally, per the CI-only rule; CI is the compiler here.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #927
vuln-watch flags PyJWT 2.13.0 in compliance-agent (CVE-2026-102268, critical, fixed in 2.14.0). semgrep 1.177.0 pins pyjwt~=2.13.0; 1.179.0 is the first release that allows >=2.15.0. Tested in debian:bookworm-slim: semgrep 1.179.0 + ruff 0.16.8 install, PyJWT 2.15.1, mobsfscan still installs with --no-deps (its semgrep==1.172.0 mismatch already existed), a sample rule still finds its match. All four image builds now use `--pull`.
Note: a semgrep minor bump can shift findings; watch the nightly baseline run after merge. Prod stays on its pinned digest until it is promoted.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #580