Skip to content

docs: WPF audit coverage matrix + net472 string-canonicalization design note - #15

Merged
PhysShell merged 6 commits into
mainfrom
claude/sts-runtime-analysis-2mo4z9
Jun 26, 2026
Merged

PhysShell merged 6 commits into
mainfrom
claude/sts-runtime-analysis-2mo4z9

Conversation

@PhysShell

@PhysShell PhysShell commented Jun 26, 2026 •

Copy link
Copy Markdown
Owner

Что это

Два design-дока, чтобы ничего из требований не потерялось перед стройкой реальных .NET-кусков. Кода нет — только фиксация scope.

docs/wpf-audit-coverage.md — карта покрытия WPF-пака

Каждый смелл × техника детекта (static-C# / static-XAML / runtime-heap / runtime-trace) × статус (have / small-rule / gap) × маппинг на Avalonia-оракул. Покрывает весь список: event leaks, timers, binding, PropertyChanged hell, virtualization, Freezable, data duplication.

Главное, что заземляет:

  • Сильная земля: event leaks, timers, fat-setter, data-duplication, virtualization-через-heap.
  • Два недостроенных слоя: XAML-анализатор (binding-path, virtualization-off, nested ScrollViewer, heavy DataTemplate, ElementName/RelativeSource) и runtime-trace коллектор (binding-errors, notification storms).
  • Чисто-WPF хвост: Freezable, DevExpress, CommandManager/DPD — только на STS.
  • Принцип: suspect statically, confirm at runtime (философия фазы 5, перенесённая на перф — напр. virtualization: XAML-подозрение + heap-подтверждение по числу живых контейнеров).

docs/string-canonicalization.md — net472 string-dedup

Дублированный System.String как доминирующий случай оси data-duplication, в нашей рамке анализатор → точечный мутатор:

  • Фаза A (анализатор): ClrMD heap-отчёт (count / total / wasted bytes / retention) + Roslyn birth-sites → кладётся в фазу 5.
  • Фаза B (мутатор): AdaptiveStringCanonicalizer (не String.Intern) + Cecil/Profiling-API+ReJIT/Harmony — только approved hot sites, только новые строки.
  • Отвергнуто явно: переписывание всего heap по ссылкам (ломает ReferenceEquals/lock(string)/identity-кэши/unsafe — ровно поэтому GC-string-dedup не въехал в dotnet/runtime). Зафиксировано, чтобы не пере-обсуждать.
  • Staged PoC (5 шагов) + net472-специфика (Profiling API, ReJIT, Cecil, ClrMD). Анализатор framework-агностичен → тестируется на Avalonia-оракуле здесь.

Плюс кросс-линк обоих из own-net-auditor.md §4.

🤖 Generated with Claude Code


Generated by Claude Code

Summary by CodeRabbit

  • Documentation
    • Added a new design note on string deduplication for long-running .NET desktop apps, outlining measurement, detection, and gated opt-in improvement paths.
    • Added a WPF audit coverage matrix mapping detectable checks to the techniques used, plus an Avalonia-based testing oracle and remaining gaps.
    • Expanded the WPF audit guide to include a coverage map reference and new string-canonicalization guidance.

claude added 4 commits June 26, 2026 07:09
A standalone, self-contained HTML view over the new engines, separate from
viz/build_dashboard.py so neither refactors the other. Computes straight from the
stand artifacts via the engine modules:
  - graph.json -> coupling map (Instability vs Abstractness on the main sequence, or
    Ce/Ca bars when no is_abstract flag) + architecture findings by rule + a per-namespace
    Ca/Ce/I/A/D table.
  - drift.json -> drift risk buckets + a risk-tagged "what moved" table.
  - findings.json + runtime.json -> runtime correlation donut (confirmed / static-only /
    blind spot) + a confirmed-and-unpredicted-leaks table with confidence.

Every section is optional and renders a muted empty-state when its artifact is absent,
so it smokes in CI (no stand data) and lights up on the stand. XSS-safe (esc() before any
innerHTML, <>& escaped in the embedded JSON), Plotly vendored for a fully offline file.
Verified headless: 4 charts mount, drift/runtime tables populate, zero console errors;
empty-state renders cleanly. Wired into the CI dashboard smoke.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LLHz4cevQyXHKZnjzCqhoa
… claim/unicode (Codex+CodeRabbit)

- _safe_json now distinguishes a MISSING artifact (-> None, empty-state) from a present-
  but-malformed one (-> raise); the graph block lets Graph's schema ValueError propagate
  instead of swallowing it, so a stale/corrupt graph.json fails loudly rather than
  rendering as "not collected yet".
- runtime correlation accepts a list-shaped findings.json (top-level list) as well as the
  usual {"findings": [...]} dict, so the section isn't silently empty.
- _plotly_tag keeps the CDN fallback (parity with build_dashboard.py + the gitignored
  4.5MB vendor blob; fail-loud would break the CI smoke) but now WARNS on fallback, and the
  docstrings no longer overclaim "self-contained/offline" — Plotly is inlined only when
  vendored, else CDN.
- Ruff RUF001: replace ambiguous unicode in HTML copy with entities/ASCII
  (3&ndash;5, static &times; heap, null-cell '-').

Re-verified headless: 4 charts, drift/runtime tables populate, zero console errors;
malformed/stale graph now raises; empty-state and list-findings paths both build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LLHz4cevQyXHKZnjzCqhoa
…CodeRabbit)

- build_arch_dashboard: a present-but-malformed drift.json (e.g. {}) or a
  findings.json with a non-list "findings" / a non-object runtime.json now raise
  instead of silently rendering as a missing-artifact empty-state; only an absent
  file maps to empty-state. Consistent with the _safe_json fix.
- Both dashboards: SRI-pin the Plotly CDN fallback with
  integrity="sha384-cCVCZkAj…" + crossorigin="anonymous" so the remote bundle
  can't be swapped silently. The hash is of plotly-2.35.2.min.js, verified
  byte-identical to the vendored viz/plotly.min.js.

Verified: bad drift/findings shapes raise; the SRI fallback tag is well-formed;
both dashboards still build (CI smoke); demo stays headless-clean (4 charts, 0
console errors).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LLHz4cevQyXHKZnjzCqhoa
…gn note

Capture two things so nothing on the wishlist is lost:

- docs/wpf-audit-coverage.md: every WPF smell (event leaks, timers, binding,
  PropertyChanged hell, virtualization, Freezable, data duplication) mapped by
  detection technique (static-C# / static-XAML / runtime-heap / runtime-trace),
  status (have / small-rule / gap), and Avalonia-oracle mappability. Names the
  two unbuilt surfaces — a XAML analyzer and a runtime-trace collector — and the
  WPF-only tail (Freezable, DevExpress, CommandManager/DPD). Governing principle:
  suspect statically, confirm at runtime (phase-5 philosophy applied to perf).

- docs/string-canonicalization.md: the net472 CLR string-dedup branch, framed in
  the project's analyzer-then-mutator terms. Phase A analyzer (ClrMD heap dup-string
  report: count/total/wasted bytes/retention + Roslyn birth sites) folds into
  phase 5. Phase B mutator (AdaptiveStringCanonicalizer + Cecil/Profiling-API+ReJIT/
  Harmony) is opt-in, approved-sites-only, new-strings-only. Whole-heap reference
  rewrite explicitly rejected (breaks ReferenceEquals/lock(string)/identity caches/
  unsafe — why dotnet/runtime's GC string dedup never shipped). Staged PoC plan +
  net472 specifics; analyzer is framework-agnostic so it's testable on the oracle.

- own-net-auditor.md §4: cross-link both docs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LLHz4cevQyXHKZnjzCqhoa
@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 073382cd-5467-408c-8836-cbac91944c16

📥 Commits

Reviewing files that changed from the base of the PR and between c8fa143 and 1f21b3a.

📒 Files selected for processing (1)
  • docs/wpf-audit-coverage.md
✅ Files skipped from review due to trivial changes (1)
  • docs/wpf-audit-coverage.md

📝 Walkthrough

Walkthrough

The PR adds a WPF audit coverage matrix, links it from the main auditor note, and adds a string-canonicalization design note covering analyzer, mutator, and test-scope details.

Changes

Audit docs

Layer / File(s) Summary
WPF audit coverage matrix
docs/own-net-auditor.md, docs/wpf-audit-coverage.md
The main WPF auditor note points to the new coverage matrix and string-canonicalization note, and the coverage page defines detection techniques, gaps, and Avalonia oracle mapping.
String canonicalization design note
docs/string-canonicalization.md
The new design note lays out the analyzer phase, gated mutator phase, rejected whole-heap rewrite, PoC sequence, net472-specific implementation details, and Avalonia oracle test scope.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A bunny found some docs to munch,
With maps and strings and plans in bunch.
It twitched its nose, then gave a cheer,
“These notes are tidy, clear, and near!”
🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two new docs added in the PR and matches the main scope of the changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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/sts-runtime-analysis-2mo4z9

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: 1

🤖 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 `@docs/wpf-audit-coverage.md`:
- Around line 76-80: The coverage summary in the oracle/oracle-candidate
description is overstating current Avalonia coverage by listing heavy templates
and binding errors as already exercised. Update the wording in the WPF audit
coverage doc to either present those items as planned or partial coverage, or
restrict the “currently exercises” claim to the framework-agnostic core that is
actually covered today. Use the existing summary block and the terms “XAML
analyzer” and “runtime-trace collector” to keep the documented gaps aligned with
the claim.
🪄 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: 1606cc55-4dad-4811-a224-18859fb81a9b

📥 Commits

Reviewing files that changed from the base of the PR and between 46160ef and c8fa143.

📒 Files selected for processing (3)
  • docs/own-net-auditor.md
  • docs/string-canonicalization.md
  • docs/wpf-audit-coverage.md

Comment thread docs/wpf-audit-coverage.md Resolved
The summary listed heavy templates and binding errors as current oracle coverage,
but the same doc marks the XAML analyzer and runtime-trace collector as unbuilt
gaps. Reword into three honest buckets: today (framework-agnostic core), once the
two gap surfaces exist (planned), and never (WPF/vendor-only tail).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LLHz4cevQyXHKZnjzCqhoa
@PhysShell
PhysShell merged commit 18b10b5 into main Jun 26, 2026
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.

2 participants