Skip to content

Add Lean specification coverage masks, mapping docs, and CI checks - #8940

Draft
Amaury Chamayou (achamayou) wants to merge 1 commit into
microsoft:mainfrom
achamayou:achamayou-miniature-tribble
Draft

Amaury Chamayou (achamayou) wants to merge 1 commit into
microsoft:mainfrom
achamayou:achamayou-miniature-tribble

Conversation

@achamayou

Copy link
Copy Markdown
Member

The four Lean specification coverage masks and their scope mapping previously lived only on the coverage-paper branch, where 74 of 111 anchor-checked line ranges drifted out of date as main evolved.
This PR brings the masks, their scope documentation, and scripts/lean_coverage_report.py onto main, refreshes them against current main, and enforces mask validity in scripts/ci-checks.sh so future changes to mapped C++ files keep the masks accurate automatically.

Key changes:

  • Updated coverage masks (lean/{consensus,consistency,disaster-recovery,kv}/coverage_mask.json): re-anchored all four masks against current main and updated exclusions for unmodeled additions from Forbid live signature-table access in CCF 8.0 #8490 and Fence local writes against step-down with a role lock #8921 (KV local-write role-lock permit helpers in cft.h and store.h, MaterialisedReadOnly reads and signature-table/role access control in kv, and the split TxHistory/chunker blocks around the modeled rollback check in Store::commit), while keeping modeled additions such as Request recovery decision restart only after commit #8888's JOINING restart/guard logic and Fix off-by-one heartbeat check for retired-committed primaries #8894's heartbeat fix in scope.
  • Scope and mask documentation (lean/COVERAGE_MAPPING.md): documents the disjoint file partition across the four specifications, what each mask includes and excludes, the mask JSON schema, and how to validate masks or compute live Total and Trace-validated coverage tables on demand (omitting volatile per-run snapshot tables and uncovered-line inventories from main).
  • Automated CI validation (scripts/lean_coverage_report.py --check-masks, scripts/lean-coverage-masks-checks.sh, scripts/ci-checks.sh): validates mapped file existence, start/end anchors, lexical {/} brace balance, non-overlap, cross-spec disjointness, and the report script's unit tests on every PR.

Port the four anchor-validated Lean coverage masks, the specification-to-C++
coverage mapping documentation, and scripts/lean_coverage_report.py (with unit
tests) to main, re-anchored and updated for recent main changes including
microsoft#8490, microsoft#8785, microsoft#8791, microsoft#8888, microsoft#8894, microsoft#8905, and microsoft#8921.

Add --check-masks to scripts/lean_coverage_report.py and wire
scripts/lean-coverage-masks-checks.sh into scripts/ci-checks.sh so CI
validates mask anchors, brace balance, and cross-spec disjointness on every PR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 679d732f8eac4c0aa07824aa725ebde6
@achamayou
Amaury Chamayou (achamayou) requested a review from a team as a code owner December 4, 2026 12:11
Copilot AI balanced review requested due to automatic review settings December 4, 2026 12:11
@achamayou
Amaury Chamayou (achamayou) marked this pull request as draft December 4, 2026 12:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved issues allow missing end anchors and revision-mismatched masks, reject valid C++ digit separators, and inflate coverage when trace data omits baseline coordinates.

4 open issues
What changed in this PR

Brings Lean specification coverage tracking onto main, with refreshed masks and CI validation to detect drift as C++ sources change.

Changes:

  • Adds four coverage masks and documents their scope.
  • Adds reporting for total and trace-validated coverage.
  • Integrates mask validation and report tests into CI.

Custom instructions used

Repository guidance supplied in the review context; no additional instruction files loaded.

File Description
scripts/​tests/​lean_coverage_report_test.py Tests parsing, validation, and coverage calculations.
scripts/​lean-coverage-masks-checks.sh Runs mask validation and report tests.
scripts/​lean_coverage_report.py Validates masks and generates coverage reports.
scripts/​ci-checks.sh Registers the Lean coverage check.
lean/​kv/​coverage_mask.json Defines modeled KV regions and exclusions.
lean/​disaster-recovery/​coverage_mask.json Defines recovery protocol coverage scope.
lean/​COVERAGE_MAPPING.md Documents mappings, exclusions, and report usage.
lean/​consistency/​coverage_mask.json Selects consistency-related endpoint and RPC code.
lean/​consensus/​coverage_mask.json Defines consensus coverage scope.
.github/​skills/​formatting-and-linting/​SKILL.md Documents the new validation check.

Review effort: Balanced

Comment on lines +730 to +731
if ch == "'":
in_char = True
mask_path, rel_path, source_lines, start, entry.get("start_anchor")
)
end_anchor = entry.get("end_anchor")
if end_anchor and end_anchor not in source_lines[end - 1]:
Comment on lines +1343 to +1347
tl, tml, tbr, tmbr, tbr_ok = _summarize_detailed(
tv_detail, included
)
tv_lines += tl
tv_missed_lines += tml
Comment on lines +2027 to +2028
source = fetch_ci_coverage_report(args.repo, args.branch, args.run_id)
coverage_files = extract_file_coverage(source.text)

This branch has not been deployed

No deployments
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