Repository navigation
Add Lean specification coverage masks, mapping docs, and CI checks - #8940
Draft
Amaury Chamayou (achamayou) wants to merge 1 commit into
Draft
Amaury Chamayou (achamayou) wants to merge 1 commit into
Amaury Chamayou (achamayou) wants to merge 1 commit into
Conversation
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
Contributor
There was a problem hiding this comment.
🟡 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The four Lean specification coverage masks and their scope mapping previously lived only on the
coverage-paperbranch, where 74 of 111 anchor-checked line ranges drifted out of date asmainevolved.This PR brings the masks, their scope documentation, and
scripts/lean_coverage_report.pyontomain, refreshes them against currentmain, and enforces mask validity inscripts/ci-checks.shso future changes to mapped C++ files keep the masks accurate automatically.Key changes:
lean/{consensus,consistency,disaster-recovery,kv}/coverage_mask.json): re-anchored all four masks against currentmainand 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 incft.handstore.h,MaterialisedReadOnlyreads and signature-table/role access control inkv, and the splitTxHistory/chunker blocks around the modeled rollback check inStore::commit), while keeping modeled additions such as Request recovery decision restart only after commit #8888'sJOININGrestart/guard logic and Fix off-by-one heartbeat check for retired-committed primaries #8894's heartbeat fix in scope.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 frommain).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.