magus v0.3.0 is out. See what's new
¶ View markdown source · ✎ Suggest an edit
6 min read

InsightService

InsightService serves the assembled lenses to the console dashboard. One read-only unary RPC: the four git lenses come from a server-cached scan (~10s TTL) and volatility from a fresh file read, so the client polls rather than subscribes.

Package magus.insight.v1, defined in proto/magus/insight/v1/insight.proto. Part of the daemon API.

Methods

GetInsight

GetInsight returns every lens in one message.

POST /magus.insight.v1.InsightService/GetInsight - unary.

Takes GetInsightRequest, returns GetInsightResponse.

Messages

AffinityOutput

AffinityOutput reports projects that change together (temporal coupling).

Field Type # Description
definition string 1
commits int32 2
since string 3
pairs repeated CoChange 4

CoChange

CoChange is a pair of projects that changed in the same commit, how often, and whether the coupling is hidden - no dependency edge connects them, which is the candidate architectural smell the lens exists to surface. a/b are the stable project paths; a_name/b_name are the declared display names, carried alongside rather than resolved into the path so a reader can label the pair without a second lookup.

Field Type # Description
a string 1
a_name string 2
b string 3
b_name string 4
count int32 5
hidden bool 6

FileHotspot

FileHotspot is one file's hotspot score: edit frequency weighted by complexity. score is commits x complexity, sent rather than derived so a reader ranks by the same number the CLI printed even if the weighting changes.

Field Type # Description
path string 1
commits int32 2
complexity int32 3
score int32 4
authors int32 5
last_commit Timestamp 6

GetInsightRequest

No fields.

GetInsightResponse

Field Type # Description
insight Insight 1

HotspotOutput

HotspotOutput ranks where churn meets complexity - the canonical "fix this first" view. nodes is the project-level heatmap; files is the per-file ranking, populated only when the scan ran at file granularity.

Field Type # Description
definition string 1
commits int32 2
since string 3
nodes repeated ProjectNode 4
files repeated FileHotspot 5

Insight

Insight bundles the five lenses. volatility is absent (not an empty report) when the workspace has no run-outcome history to score - the distinction matters to a reader, which renders "no runs recorded yet" rather than "no volatile targets".

Field Type # Description
hotspots HotspotOutput 1
affinity AffinityOutput 2
ownership OwnershipOutput 3
trend TrendOutput 4
volatility VolatilityReport 5

Ownership

Ownership is one project's authorship. bus_factor_1 and stale are the two risk flags the server decides (single author; no commits in the recent half of the window) - they ride the wire rather than being recomputed by a reader so the console and the CLI cannot disagree about what counts as abandoned.

Field Type # Description
path string 1
name string 2
commits int32 3
authors int32 4
primary string 5 the author with the most commits
primary_share int32 6 that author's share, in percent
bus_factor_1 bool 7
stale bool 8
last_commit Timestamp 9

OwnershipOutput

OwnershipOutput reports author concentration per project - the knowledge-risk view.

Field Type # Description
definition string 1
commits int32 2
since string 3
projects repeated Ownership 4

ProjectNode

ProjectNode is one project in the heatmap. It mirrors types.Node, the dependency-graph node the hotspots lens reuses, which is why it carries graph shape (children, spell_name, exclusive) alongside the churn fields - the same message serves a reader that wants to draw the dependency edges under the heat. It is NOT magus.graph.v1.Node: that one is a knowledge-graph node (id/kind/relation), this one is a project in the build graph. churn, authors and last_commit are the heatmap overlay and are absent on a plain dependency graph; blast_radius and duration_ms come from the graph itself.

Field Type # Description
path string 1 the stable machine key
name string 2 the declared display name, empty when the project never set one
spell_name string 3
children repeated string 4
dir string 5
exclusive bool 6
blast_radius int32 7
duration_ms int64 8
churn int32 9 recent commits touching the project
authors int32 10 distinct authors behind them
last_commit Timestamp 11

Trend

Trend is one project's churn across the window's two halves. delta is recent - earlier, sent explicitly because it is the sort key and a reader should not have to know the sign convention (positive is rising).

Field Type # Description
path string 1
name string 2
recent int32 3
earlier int32 4
delta int32 5

TrendOutput

TrendOutput ranks projects by whether their activity is rising or cooling: the window is split at its midpoint and the halves compared.

Field Type # Description
definition string 1
commits int32 2
since string 3
projects repeated Trend 4

VolatilityReport

VolatilityReport is the run-outcome lens: the one lens that does not read git. It is computed from the shared runtime-history file, so it is present even in a workspace with no VCS history, and absent in one that has never recorded a run.

Field Type # Description
threshold double 1 The configured Wilson lower bound at or above which a target is treated as volatile. Sent so a reader renders the same threshold line the server scored against.
targets repeated VolatilityTarget 2

VolatilityTarget

VolatilityTarget is one (project, target) pair's recorded flakiness: the Wilson lower-bound score against the report's threshold, plus the tallies it was computed from. pass/fail/ volatile_count count the retained window and samples is how many outcomes that window holds, so a reader can tell a genuinely stable target from one with two runs on record.

Field Type # Description
project string 1
target string 2
score double 3
volatile bool 4 score >= the report's threshold
pass int32 5
fail int32 6
volatile_count int32 7
samples int32 8
last_pass Timestamp 9 the most recent passing run, unset when never
apiprotoconnectgrpcinsightservice
Last updated (e4f13c3d)
Glossary

Workspace

The magus root directory that owns a set of projects and shared config; the unit magus operates over. See workspace.

Project

A directory magus recognizes as a unit of work (it has a magusfile); the unit of caching, scheduling, and dependency tracking. See workspace.

Target

A named operation (build, test, ...) you invoke with magus run <target>; it may compose a spell's tool-native operations and depend on other targets. See targets.

Spell

A language/runtime adapter (e.g. go, md) that maps generic targets onto a toolchain's real commands. See spells.

Cache

The content-addressed store magus consults before running a target, so unchanged work is skipped. See cache.

Service

A long-running or shared process magus manages across runs, distinct from a one-shot target. See services.

Daemon

The background magus host that owns shared state such as services and the warm knowledge graph. See daemon.

CI

An ordinary magusfile-defined target you compose yourself with magus\needs - magus does not hardcode its stages. Magus.RunCI treats it specially only in that it strips the rw charm, it is the anchor magus affected ci keys off, and a selected scope with no project declaring it is a load error rather than a silent no-op. See targets.

Volatility

A target that fails once and passes on rerun is volatile, as opposed to a regression that started failing and stays failing. magus keeps per-target pass/fail history and a Wilson-score volatility rate to tell them apart and auto-retry the noise. See volatility.

Insight

The reports magus derives over the graph and history (hotspots, affinity, ownership, trend). See insight.

Hotspot

An insight lens: edit frequency times complexity, the prime refactoring targets. The project view heat-colors the dependency graph by churn; --files ranks individual files. See insight.

Affinity

An insight lens: projects that change together (temporal coupling). A pair that co-changes without either declaring a dependency on the other is a candidate architectural smell. See insight.

Ownership

An insight lens: author concentration - the primary author and their share, the distinct-author count (the bus factor), and abandonment. See insight.

Trend

An insight lens: the recent half of the window against the earlier half. A positive delta is a rising hotspot; a negative one is cooling. See insight.

Conventions

This page uses none of the site's convention markers. The full set is on the conventions page.