--quality-delta: architecture and coupling changes between two trees (the measurements #477's consumers asked for)

Aperta
#845 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
30/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp

Direzione di ricerca

Start with runQualityDelta in src/verbs_quality.h, then read ModuleMetric in src/arch.h and the availability states in src/langfacts.h. First decide which architectural rows and thresholds consumers can justify; the issue asks for measured examples and a fixture pair with a known verdict. Done means a mutation controlled regression test is added to test/regression.sh alongside the command documentation and changelog entry; claim the work in a comment first.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement help wanted

Split out of #477, where it was the other half of a --dump-graph discussion and did not belong. This issue is for what --quality-delta would have to report so that a tool measuring package-level architecture can read a change rather than recompute one, and for the question we cannot answer ourselves: which of these is worth gating on, and at what threshold.

What --quality-delta does today

It reports only what a change made worse against a baseline (git HEAD by default, or an explicit BASE..HEAD), across these kinds:

complexity · verbosity (LOC) · nesting · params · duplication · dead-code · api-surface · error-masking · short-horizon-churn · new-clone-of-reused-helper · defect-shape format-arity · ceiling · tangle

It exits 2 when pre-existing code got worse; rows on new symbols never gate (except the three noted). An ack ledger suppresses a finding with a recorded reason, and a stale ack is reported rather than silently dropped.

What it has no notion of is architecture. Nothing in that list moves when a new import creates a cycle, or when a package's fan-in doubles.

What is already computed, just not diffed

--arch computes per-directory Ca, Ce, instability, abstractness, distance and zone, uncapped. --deps lists cycles. #477's consumers measured those against an ast-based ground truth on pypa/pip and rollup/rollup: 81% of directories exact on Ca, 85% on Ce on pip, 26 of 26 sampled directories exact on both on rollup, every real SCC detected plus a deliberately introduced one, byte-identical re-runs throughout. So the inputs are trustworthy at that accuracy; what is missing is the delta between two trees.

Proposed rows

  1. new-cycle — an import cycle present at HEAD and absent at the baseline. The clearest signal of the set: a cycle is a yes/no fact, not a number with a noise band.
  2. coupling-change — Ca, Ce, instability, abstractness, distance per directory, baseline vs HEAD.
  3. lcom4 — wanted, but not in a first step: ours needs fixing before it can be diffed. Listed here so the issue records the intent rather than looking like an omission.

Report-only to begin with. None of these gates (no exit 2) until there is evidence about what a real change does to them.

The part we cannot answer from here

Instability and distance are noisy: a single new import moves them, and a refactor that splits one file moves a whole directory's numbers without changing anything a reviewer would call a regression. Publishing a gate on a noisy metric is how a gate becomes something people learn to ignore.

So, concretely, for anyone who would consume these:

  • Which rows would you gate on, and which do you want report-only forever?
  • At what threshold — absolute (Ca +3), relative (instability +0.15), or "only when a cycle appears"?
  • Over what population — every directory, or only directories the diff touches? (The second is much quieter and much easier to defend.)
  • Would a new-cycle row alone be enough for a first version, with coupling numbers available from --arch on each side?

Measured answers beat opinions here. If you have two commits where you know what the architectural verdict should be, that pair is worth more to this issue than a threshold proposal.

Per-language availability: "not available", never zero

Not every language has file-level edges in this build. LangFacts::fileEdges (src/langfacts.h:101-106) is a three-state column — Resolved, Unmeasured, NotApplicable — and Go, Java and Swift are Unmeasured today (src/arch.h:665).

A coupling row for those languages must say not available, not 0. --arch already sets the precedent: an unread FROM-side file makes a rule's verdict unknown rather than pass, and the verb prints <arch unqualified=N> with a per-rule verdict="unknown" row. Any row added here follows that, because a zero that means "not read" is the kind of silent surface this project treats as a defect.

Scope notes

  • Field read/write sites and language-specific type taxonomy are out — #477's consumers compute those themselves and asked us not to.
  • The absolute-levels use case is not this issue: that is --dump-graph in #477. This issue is only the change between two trees.
  • Whatever lands needs a gate written before it, with a mutation control: a delta row that cannot distinguish a real change from a re-run is worse than no row. A fixture pair of commits with a known verdict is the gate.

Files this would touch

src/verbs_quality.h (runQualityDelta), src/arch.h (ModuleMetric, and kZoneDistanceThreshold if a zone change becomes a row), src/langfacts.h for the availability read, plus a new test/*check.sh listed in test/regression.sh in the same commit (manifestcheck enforces it), a docs/COMMANDS.md entry, and a changelog.d/ fragment.

Claim it in a comment first. Partial answers to the threshold questions above are useful on their own — they do not need to come with code.

Lingua principale
C++
Stelle
2.6k
Fork
182
Merge medio
21h 12m
PR unite (30g)
262

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di redhat-et/ripwire

Tutte le issue di redhat-et/ripwire

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.