Skip to content

reports: rules-map explanations, runtime dashboard panel, annotated health report, RU executive report - #52

Merged
PhysShell merged 11 commits into
mainfrom
claude/reports-rules-map
Jul 18, 2026
Merged

reports: rules-map explanations, runtime dashboard panel, annotated health report, RU executive report#52
PhysShell merged 11 commits into
mainfrom
claude/reports-rules-map

Conversation

@PhysShell

@PhysShell PhysShell commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Доводка отчётов до «удобного вида» — гибридная карта правил + два отчёта под разные аудитории.

rules-map (report/rules_map.py + report/rules/*.tsv + report/rules_own.json): third-party правила несут официальные EN-титулы, выкачанные из док-индексов анализаторов (Meziantou 211, Roslynator ~260, WpfAnalyzers 83, INPC 25, IDISP 26 + AsyncFixer/Infer#); OWN*/OWN-TIMER/XAML107 — рукописные RU (что это / почему течёт / как чинить). CodeQL-слаги и компиляторные CS деградируют в производные титулы + ссылки. Гейт: ≥97% титулованности на реальных 72k находок.

Дашборд (A): rule_meta в hover топ-правил и в тултипах таблицы («что такое OWN001» — на месте); новая панель Runtime-confirmed retention из runtime-sts.json — reachable-инстансы по типам, цвет = вид корня, hover называет владельца; сабтайтл несёт сценарий + reachability-гейт.

Annotate pass (report/annotate_cli.py): пост-обработка health-report.md — джойн строк списка с findings.json по path:line, RULE + титул (+RU) в строке, легенда-приложение со ссылками. Генератор-независимый.

Executive-отчёт (B, RU) (report/exec_cli.py): таблица подтверждённых утечек «тип / экземпляров / чем удержан / владелец», сортировка по силе доказательства (static-event → timer → static-field, сноска на generic-держатели), «почему течёт и как чинить» из rules_own, карта боли, следующие шаги. На реальных данных наверху: KDTKTS 107 / GB 79 / GTD 76 у GBProperty.PropertyChanged — плюс два ранее не описанных статических издателя (PrintProperty, GoodsCustomsCostType.PropertyChanged).

Тесты: 4 новых bare-script suites (13+5+9+8), включены в ci.yml (+ -O прогон) и AGENTS.md-свип. Регенерированные artifacts/exec-report.md, health-report.annotated.md, viz/sts-dashboard.html — локально (artifacts/* gitignored).

🤖 Generated with Claude Code

https://claude.ai/code/session_01MigRSeRnzZH6fo3TP9fRET

Summary by CodeRabbit

  • New Features

    • Added tools to enrich health reports with rule IDs, explanations, documentation links, and a rule legend.
    • Added Russian executive memory reports combining runtime retention findings with health-report details.
    • Enhanced dashboards with rule descriptions, tooltips, and an optional runtime-confirmed retention panel.
    • Added metadata for built-in audit rules and improved handling of recognized and unknown rules.
  • Tests

    • Expanded regression coverage for reporting, visualization, rule mapping, and runtime-confirmed dashboard data.

PhysShell and others added 9 commits July 18, 2026 19:04
Third-party titles harvested from each analyzer's docs index into readable
report/rules/*.tsv (Meziantou 211, Roslynator ~260, WpfAnalyzers 83, INPC 25,
IDISP 26, AsyncFixer/Infer# extras); OWN*/XAML*/OWN-TIMER hand-written in
Russian (what it is, why it leaks, how to fix) in rules_own.json. rules_map.py
merges them and degrades gracefully: CodeQL slugs get derived titles + query-help
links, compiler CS and MSTEST get doc links, unknowns echo the id. 13/13 incl
a >=97% title-coverage gate over the real 72k STS findings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MigRSeRnzZH6fo3TP9fRET
…untime panel

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MigRSeRnzZH6fo3TP9fRET
rule_meta rides with the interned rule list (harvested title, doc link, RU for
OWN rules): the top-rules hover and the findings table's rule cell now answer
'what is OWN001' in place. New filter-independent 'Runtime-confirmed retention'
panel renders the collector artifact (runtime-sts.json): reachable instances
per suspect coloured by pinning root kind, hover names holder.member, subtitle
carries the scenario + the reachability gate. Hidden when no runtime run
exists. New tests wired into CI and the AGENTS.md sweep.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MigRSeRnzZH6fo3TP9fRET
Joins finding lines back to findings.json by path:line, appends the rule id +
rules-map title (RU included for OWN rules) and a legend appendix with doc
links. A post-pass on purpose — generator-agnostic. 5/5.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MigRSeRnzZH6fo3TP9fRET
Confirmed retention from the collector artifact as a management-readable table
(тип / экземпляров / чем удержан / владелец), why-it-leaks + how-to-fix pulled
from rules_own.json per root kind, the pain table carried over from the health
report, and fixed next steps. 9/9 (one test assertion fixed: the headline check
sliced past the headline).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MigRSeRnzZH6fo3TP9fRET
Confirmed table sorts by root-kind proof strength (static-event, timer, then
bare static fields) before count, so the product-owned leaks top the page and
the measuring scenario's own list-holders sink with a footnote. New suites
(rules_map/annotate/exec/dashboard) wired into ci.yml and the AGENTS.md sweep;
history snapshot from the artifacts rebuild.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MigRSeRnzZH6fo3TP9fRET
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@PhysShell, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 18 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c7f0b1ab-ab18-4cbc-9091-5d043eacffe5

📥 Commits

Reviewing files that changed from the base of the PR and between 25c2810 and 7cde936.

📒 Files selected for processing (8)
  • report/annotate_cli.py
  • report/exec_cli.py
  • report/tests/test_annotate.py
  • report/tests/test_exec.py
  • viz/build_dashboard.py
  • viz/fixtures/runtime-sts.json
  • viz/history.jsonl
  • viz/tests/test_dashboard_rules.py
📝 Walkthrough

Walkthrough

The change adds rule metadata resolution, report annotation and executive-report CLIs, runtime-confirmed dashboard rendering, new fixtures, and regression tests wired into CI and the documented Linux-safe sweep.

Changes

Report and dashboard enrichment

Layer / File(s) Summary
Rule metadata catalog
report/rules_map.py, report/rules_own.json
Loads analyzer and custom rule metadata, localized explanations, help links, and fallback descriptions.
Report annotation and executive output
report/annotate_cli.py, report/exec_cli.py
Annotates health-report findings with rule details and generates a Russian executive report from runtime and health artifacts.
Dashboard metadata and runtime rendering
viz/build_dashboard.py, viz/fixtures/runtime-sts.json, viz/history.jsonl
Adds rule tooltips and metadata to dashboard output and renders retained runtime object types in an optional panel.
Regression and CI coverage
report/tests/*, viz/tests/test_dashboard_rules.py, .github/workflows/ci.yml, AGENTS.md
Adds report/dashboard smoke tests and runs them in CI and the documented regression sweep.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Runtime as runtime-sts.json
  participant Builder as viz/build_dashboard.py
  participant HTML as sts-dashboard.html
  participant Browser as Dashboard browser
  Runtime->>Builder: retained runtime records
  Builder->>Builder: build rule metadata and runtime payload
  Builder->>HTML: serialize dashboard data
  HTML->>Browser: render rule details and runtime panel
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is specific and accurately reflects the PR’s main additions across reporting, dashboard, and annotation features.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/reports-rules-map

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
report/tests/test_rules_map.py (1)

55-62: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider failing or warning when the coverage fixture is missing.

Currently, if sts_audit/findings.json is missing (e.g., due to a path change or artifact download failure in CI), the coverage gate is silently skipped and the test will still pass. Consider adding a check to fail or explicitly log a warning so the absence of this critical gate is noticed.

♻️ Proposed fix
 if os.path.exists(findings_path):
     with open(findings_path, encoding="utf-8") as fh:
         findings = json.load(fh)["findings"]
     total = len(findings)
     titled = sum(1 for f in findings if describe(f.get("rule", ""), rules)["title"] != f.get("rule", ""))
     check("coverage", titled / max(total, 1) >= 0.97,
           "titled %d of %d (%.1f%%)" % (titled, total, 100.0 * titled / max(total, 1)))
+else:
+    print(f"Skipping coverage gate: {findings_path} not found")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@report/tests/test_rules_map.py` around lines 55 - 62, Update the coverage
check around findings_path so a missing sts_audit/findings.json is not silently
ignored: explicitly fail the test or emit the repository’s established warning
through check. Preserve the existing titled-coverage calculation when the
fixture exists.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@report/annotate_cli.py`:
- Line 82: Update the default output-path construction around args.out and
args.report so non-.md report names receive an appended “.annotated.md” suffix
instead of remaining unchanged; preserve the existing replacement behavior for
.md inputs and explicit args.out values.

In `@report/exec_cli.py`:
- Around line 57-75: Normalize retained counts against each record’s expected
allowance in report/exec_cli.py lines 57-75 around retained, best_root, and
total_instances: keep only records with positive count minus expected, and use
that excess for confirmed-leak totals and displayed counts. Apply the same
count-minus-expected normalization before adding runtime chart entries in
viz/build_dashboard.py lines 274-281.

---

Nitpick comments:
In `@report/tests/test_rules_map.py`:
- Around line 55-62: Update the coverage check around findings_path so a missing
sts_audit/findings.json is not silently ignored: explicitly fail the test or
emit the repository’s established warning through check. Preserve the existing
titled-coverage calculation when the fixture exists.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e6186d57-811a-4fc2-90ae-376c9301f589

📥 Commits

Reviewing files that changed from the base of the PR and between e2bce2d and 25c2810.

⛔ Files ignored due to path filters (6)
  • report/rules/extra.tsv is excluded by !**/*.tsv
  • report/rules/idisposable.tsv is excluded by !**/*.tsv
  • report/rules/meziantou.tsv is excluded by !**/*.tsv
  • report/rules/propertychanged.tsv is excluded by !**/*.tsv
  • report/rules/roslynator.tsv is excluded by !**/*.tsv
  • report/rules/wpfanalyzers.tsv is excluded by !**/*.tsv
📒 Files selected for processing (13)
  • .github/workflows/ci.yml
  • AGENTS.md
  • report/annotate_cli.py
  • report/exec_cli.py
  • report/rules_map.py
  • report/rules_own.json
  • report/tests/test_annotate.py
  • report/tests/test_exec.py
  • report/tests/test_rules_map.py
  • viz/build_dashboard.py
  • viz/fixtures/runtime-sts.json
  • viz/history.jsonl
  • viz/tests/test_dashboard_rules.py

Comment thread report/annotate_cli.py Outdated
Comment thread report/exec_cli.py Outdated
Comment on lines +57 to +75
retained = [r for r in runtime.get("retained", []) if r.get("count")]
heap = runtime.get("heapStats") or {}
catalog = load_rules_map()

kind_rank = {"static-event": 0, "timer": 1, "static-field": 2}

def best_root(rec):
roots = rec.get("roots") or []
return min(roots, key=lambda r: kind_rank.get(r.get("kind"), 9)) if roots else {}

# the most PROVEN retention first: an event/timer root names a real product owner,
# a bare static list may be the measuring scenario's own bookkeeping.
retained.sort(key=lambda r: (kind_rank.get(best_root(r).get("kind"), 9), -r["count"]))

total_instances = sum(r["count"] for r in retained)
out = ["# %s" % title, ""]
out += ["**Главное:** куча подтверждает утечку по **%d** типам — суммарно **%d** экземпляров, "
"которые обязаны были собраться сборщиком мусора, но удерживаются живыми."
% (len(retained), total_instances)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Honor expected retention consistently across runtime reports.

Both consumers classify every nonzero retained count as a confirmed leak, ignoring the artifact’s expected allowance.

  • report/exec_cli.py#L57-L75: include only positive excess and base confirmed-leak totals on count - expected.
  • viz/build_dashboard.py#L274-L281: apply the same normalization before adding runtime chart entries.
📍 Affects 2 files
  • report/exec_cli.py#L57-L75 (this comment)
  • viz/build_dashboard.py#L274-L281
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@report/exec_cli.py` around lines 57 - 75, Normalize retained counts against
each record’s expected allowance in report/exec_cli.py lines 57-75 around
retained, best_root, and total_instances: keep only records with positive count
minus expected, and use that excess for confirmed-leak totals and displayed
counts. Apply the same count-minus-expected normalization before adding runtime
chart entries in viz/build_dashboard.py lines 274-281.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 25c28105df

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread report/exec_cli.py Outdated
title: str = "STS — сводка аудита памяти") -> None:
with open(runtime_path, encoding="utf-8") as fh:
runtime = json.load(fh)
retained = [r for r in runtime.get("retained", []) if r.get("count")]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Subtract expected survivors before reporting leaks

When a runtime artifact includes an allowed survivor (the runtime contract/default config uses expected, defaulting to 1 for normal live instances), this filter treats count == expected as a confirmed leak and the executive headline/table says those objects should have collected. That turns clean singleton/control entries into reported leaks and inflates totals; filter and sum on count - expected using the same runtime threshold semantics instead of raw truthy count.

Useful? React with 👍 / 👎.

Comment thread viz/build_dashboard.py Outdated
Comment on lines +275 to +276
if not rec.get("count"):
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Subtract expected survivors in the runtime panel

For runtime.json entries with an expected survivor, this check still displays any nonzero count as “runtime-confirmed retention.” A scenario that legitimately keeps one singleton alive (count: 1, expected: 1) will be plotted as a leak in the dashboard, contradicting the existing correlate logic that only confirms excess retention; skip records whose count - expected is not positive/above the configured threshold.

Useful? React with 👍 / 👎.

FAIL.append("%s %s" % (name, detail))


build_dashboard.main(["viz/fixtures"])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the dashboard test from mutating history

Running the newly added regression sweep executes this call, and build_dashboard.main() writes viz/history.jsonl via _update_history(). From a clean checkout the fixture digest is not the last committed history entry, so the test passes but leaves a tracked file modified and can add synthetic fixture points to the real trend; redirect build_dashboard.HISTORY to a temp file or disable the history write for this test.

Useful? React with 👍 / 👎.

PhysShell and others added 2 commits July 18, 2026 19:29
The multi-tool health report prints clusters as '**[...]** — codeql, roslyn',
not '(tool)'; the annotator now matches both and appends every agreeing rule
('cs/local-not-disposed' + IDISP001). 6/6.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MigRSeRnzZH6fo3TP9fRET
…te history

Both runtime consumers now report only EXCESS retention (count minus the
contract's expected allowance, default 1) — an allowed singleton no longer
plots as a leak; fixture + asserts pin it. annotate_cli never defaults its
output onto the input for non-.md names. The dashboard test redirects HISTORY
to a temp file; the fixture point it had leaked into viz/history.jsonl is
scrubbed and the real multi-tool run (72,569) recorded.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MigRSeRnzZH6fo3TP9fRET
@PhysShell
PhysShell merged commit d43f575 into main Jul 18, 2026
3 checks passed
@PhysShell
PhysShell deleted the claude/reports-rules-map branch July 18, 2026 15:03
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