Skip to content

Commit 7ef49d0

Browse files
committed
feat(metrics): add adoption and public API baselines with compact schema-aware storage
1 parent f9be591 commit 7ef49d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+19590
-416
lines changed

CHANGELOG.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,35 @@
22

33
## [2.0.0b5]
44

5+
### Contracts, metrics, and review surfaces
6+
7+
- Bump canonical report schema to `2.5` for `metrics.families.coverage_adoption`
8+
and `metrics.families.api_surface`.
9+
- Bump clone baseline schema to `2.1` and standalone metrics-baseline schema to
10+
`1.2` for compact `api_surface` wire payloads (`local_name` on disk,
11+
reconstructed full qualnames in runtime) while keeping read-compatibility for
12+
earlier `2.0` / `1.1` baseline files in the current b5 line.
13+
- Add shared public/private visibility classification for public-symbol-aware
14+
metrics, without changing clone/fingerprint semantics.
15+
- Add canonical type/docstring adoption coverage:
16+
parameter coverage, return coverage, public docstring coverage, and explicit
17+
`Any` counts.
18+
- Add opt-in public API surface inventory and baseline diff:
19+
public symbol snapshots, added symbols, and breaking changes against a
20+
trusted metrics baseline.
21+
- Add new gates:
22+
`--min-typing-coverage`, `--min-docstring-coverage`,
23+
`--fail-on-typing-regression`, `--fail-on-docstring-regression`,
24+
`--fail-on-api-break`.
25+
- Surface adoption and API metrics compactly in MCP summaries/detail, the HTML
26+
Overview tab, and canonical report payloads without adding a new HTML tab.
27+
- Extend the normal CLI `Metrics` block with adoption coverage and public API
28+
facts, while keeping the quiet compact metrics line unchanged.
29+
- Make unified clone baselines preserve embedded metrics and optional
30+
`api_surface` payloads safely across saves.
31+
532
### MCP, HTML, and docs
633

7-
- Bump canonical report schema to `2.4` for `meta.analysis_profile`.
834
- Surface the effective runtime analysis profile (`min_loc`, `min_stmt`, block, and segment thresholds) in canonical
935
report metadata, MCP summary/triage projections, and the HTML Executive Summary subtitle.
1036
- Clarify MCP interpretation with compact `health_scope`, `focus`, and `new_by_source_kind` fields in summary/triage

README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ Live sample report:
4343
- **Clone detection** — function (CFG fingerprint), block (statement windows), and segment (report-only) clones
4444
- **Structural findings** — duplicated branch families, clone guard/exit divergence and clone-cohort drift (report-only)
4545
- **Quality metrics** — cyclomatic complexity, coupling (`CBO`), cohesion (`LCOM4`), dependency cycles, dead code,
46-
health score, and report-only `Overloaded Modules` profiling
46+
health score, type/docstring adoption coverage, public API surface diff, and report-only `Overloaded Modules`
47+
profiling
4748
- **Baseline governance** — separates accepted **legacy** debt from **new regressions** and lets CI fail **only** on
4849
what changed
4950
- **Reports** — interactive HTML, deterministic JSON/TXT plus Markdown and SARIF projections from one canonical report
@@ -141,8 +142,18 @@ codeclone . --fail-cycles --fail-dead-code
141142

142143
# Regression detection vs baseline
143144
codeclone . --fail-on-new-metrics
145+
146+
# Adoption and API governance
147+
codeclone . --min-typing-coverage 80 --min-docstring-coverage 60
148+
codeclone . --fail-on-typing-regression --fail-on-docstring-regression
149+
codeclone . --api-surface --update-metrics-baseline
150+
codeclone . --fail-on-api-break
144151
```
145152

153+
In normal full-mode CLI output, CodeClone now surfaces adoption coverage
154+
(`params`, `returns`, `docstrings`, `Any`) in the main `Metrics` block, and it
155+
adds a `Public API` line when `--api-surface` facts are collected.
156+
146157
### Pre-commit
147158

148159
```yaml
@@ -277,11 +288,11 @@ class Middleware: # codeclone: ignore[dead-code]
277288
Dynamic/runtime false positives are resolved via explicit inline suppressions, not via broad heuristics.
278289

279290
<details>
280-
<summary>Canonical JSON report shape (v2.4)</summary>
291+
<summary>Canonical JSON report shape (v2.5)</summary>
281292

282293
```json
283294
{
284-
"report_schema_version": "2.4",
295+
"report_schema_version": "2.5",
285296
"meta": {
286297
"codeclone_version": "2.0.0b5",
287298
"project_name": "...",
@@ -348,8 +359,16 @@ Dynamic/runtime false positives are resolved via explicit inline suppressions, n
348359
}
349360
},
350361
"metrics": {
351-
"summary": {},
352-
"families": {}
362+
"summary": {
363+
"...": "...",
364+
"coverage_adoption": { "...": "..." },
365+
"api_surface": { "...": "..." }
366+
},
367+
"families": {
368+
"...": "...",
369+
"coverage_adoption": { "...": "..." },
370+
"api_surface": { "...": "..." }
371+
}
353372
},
354373
"derived": {
355374
"suggestions": [],

0 commit comments

Comments
 (0)