Archmotif metrics bridge#162
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.