Repository navigation
Coverage claims verify measured source identities - #875
Merged
Merged
Conversation
Imported line numbers describe the measured source. Keep unverified coverage as historical file associations so changed files cannot inherit execution or nonexecution claims from older runs. Signed-off-by: zlareb1 <[email protected]>
Matching source markers do not establish compiler-span or test freshness. Verify their identities before exact execution claims and require a run at the current watermark before ruling out execution. Signed-off-by: zlareb1 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Clamping incomplete spans can turn an unresolved symbol into measured execution. Keep its file association historical until the line bounds and source revision are verified. Signed-off-by: zlareb1 <[email protected]>
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.
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
Coverage claims verify source, symbol-span, and test identities before applying imported line ranges. Unverified measurements remain historical file associations; a current nonexecution claim requires a measurement at the repository watermark.
Why
An imported run's line numbers can overlap different code after a file changes, or miss the same symbol after its lines move. Applying those ranges to current symbol spans can falsely report both coverage and nonexecution.
A run's commit must match the source file, selected symbol spans, and measured test indexing commits, with a known repository watermark. Unchanged indexed files keep their parsing commit when the head advances, so moving the repository head alone does not discard valid evidence. Different or missing identities remain unverified because the serving read does not fetch historical file objects. Every selected symbol definition needs complete, ordered line bounds. A current negative additionally requires a measurement at the repository watermark, because later tests can execute unchanged source.
Scope and risk
The coverage claim separates verified execution from historical file associations, including deleted or changed tests and lagging compiler spans. Per-file measurement identities prevent mixed runs from borrowing the first file's commit. The reads use existing tenant-scoped point queries. Stored coverage rows are retained.
The conservative identity check can leave unchanged files unverified when coverage was measured at a different commit from their last parse. Symbols with missing or lagging revision metadata also stay unverified. Other strong evidence can still establish coverage; partial or unverified measurements cannot establish nonexecution.
Compatibility, rollout and rollback
measureddictionary addsfreshness,commits,index_commit,files,unverified_paths,unmeasured_paths, andrun_current;commitis empty for mixed commits. Per-file details also include selectedsymbol_commits. Its execution fields include verified source and span identities only. Historical test rows use methodcoverage_historyand existing tierfile_reference.Tests
The regression tests fail before the fix for stale overlapping ranges, shifted symbols, missing identities, and mixed-run reporting. Current nonexecution remains a passing control. Focused coverage, imports, conventions, documentation, and package-contract tests pass: 429 tests. The added regressions cover stale or missing symbol spans, deleted or edited tests, historical negatives, file-only symbol associations, missing or inverted line extents, partial symbol definitions, and execution without a specific attributed test. An unresolved end bound remains unverified; the span-helper regression excludes that path instead of fabricating a one-line extent. The helper passes strict type checking;
make lintpasses.make format-check,make lint, andmake typecheckpass on the reviewed head. Full CI passes on that head: 47 successful checks, two skipped checks, and all five workflows successful. Local test execution stays focused. Reproduce the source-identity regressions with.venv/bin/python -m pytest tests/unit/test_code_coverage_freshness.py -q.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated: Codex wrote the implementation and tests. The diagnosis, source identity check, and focused regression results were checked against the code.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist