Skip to content

Archmotif metrics bridge#162

Merged
mshogin merged 5 commits into
mainfrom
archmotif-metrics-bridge
Jun 13, 2026
Merged

Archmotif metrics bridge#162
mshogin merged 5 commits into
mainfrom
archmotif-metrics-bridge

Conversation

@mshogin

@mshogin mshogin commented Jun 13, 2026

Copy link
Copy Markdown
Owner

No description provided.

mshogin added 5 commits June 12, 2026 15:21
Adapter so archlint reuses archmotif's metric engine (Newman modularity Q,
motif redundancy, anomaly detectors) directly from an in-memory graph — no
GraphML, no reflection, no subprocess.

- internal/archmotifbridge: MetricsProvider interface + Report.
- ArchmotifProvider: model.Graph -> archmotifimport.Builder (tiered:
  packages -> types -> functions -> methods -> fields, parents resolved from
  contains edges; import/calls/uses/embeds -> DependencyKind) -> Build() ->
  archmotifmetrics.ComputeMetrics. Defensive: skips nodes/edges with missing
  parents/endpoints and reports counts in Notes.
- FallbackProvider: built-in Newman modularity over package import graph via
  label-propagation communities (variant A seed) — archlint stays
  self-sufficient if archmotif is unavailable.
- Compute(g): tries archmotif, falls back on error; Report.Source labels which.
- go.mod: require github.com/kgatilin/archmotif + replace => mshogin fork
  (pseudo-version of the pushed bridge commit).
- Tests: fixture two-community graph (archmotif Q + fallback Q=0.30) and a REAL
  graph (analyze archlint internal/model -> archmotif metrics, source=archmotif).
archlint baseline writes a deterministic .archlint-baseline.json (sorted, strict
qname keys) capturing current SCC cycles, layer back-edges and dead-code. The
delta gate compares live patterns against it to block only NEW regressions, not
pre-existing (legacy) violations. Registers SCC cycles and layer violations as
closed-world ERROR classes alongside dead-code; adds shared gate analysis helpers.
Delta splits current violations into New/Existing by strict fingerprint, generic
over any severity-class Kind. New ERROR-class patterns are regressions; existing
ones are legacy and audited, not blocked.
EffectiveLevel routes ERROR-class patterns through the delta: NEW vs baseline
blocks (exit 1), existing or no-baseline degrades to audit (telemetry, no block).
Wires baseline loading and dead-code into scan; magnitude/WARNING violations keep
the count threshold. E2E covers the baseline-then-regress flow.
…-gated ERROR detectors, delta gate

- property graph model: implements/usesType/returns/references edges, qname identity
- ERROR detectors via soundness gate (firing implies real defect, self-checked):
  SCC cycles, dead-code (open-world, triple-lock), ISP (two syntactic guards), layering-A
- DIP demoted to WARNING (semantic discriminator not graph-provable; ERROR-core covered by SCC)
- delta gate: deterministic baseline snapshot + NEW-pattern detection, block only new regressions
- two-axis soundness catalog: pattern/magnitude x cost-of-false-fire; closed/open-world gradient
- lint hygiene: errcheck/staticcheck across legacy files
@mshogin mshogin merged commit 52193bb into main Jun 13, 2026
0 of 3 checks passed
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.

1 participant