frostney / frostney/GocciaScript
Normalize coverage path keys for entry-vs-import files
Nobody has claimed this yet.
- Dominant language
- Pascal
- Stars
- 20
- Forks
- 3
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 45
Description
Problem
Coverage reports key files inconsistently: the entry file is keyed by the CLI-spelled (often relative) path, while imported modules are keyed by absolute path (Template.DebugInfo.SourceFile). A file that is both an entry point and an import in the same run receives two separate report records whose hits are never merged — verified during stack #1083's coverage work (layer #1081), where a shared module produced './shared.js' with 4 statement hits plus its absolute-path twin with 5.
Why it was deferred
Normalizing changes the emitted report paths for every consumer (LCOV/Codecov and the JSON format), so it needs a deliberate decision on the canonical form (absolute vs repo-relative) rather than a drive-by fix. See the deferral note in PR #1081.
Sequencing
This now blocks #1041 (coverage scope patterns + thresholds): include/exclude patterns match against exactly these path keys, so implementing scope before normalization would bake the inconsistency into user-facing configuration. Recommend deciding and landing this first.
Where
- Entry-file registration:
source/app/Goccia.CLI.SourcePipelineResult.pas(registers the CLI spelling) - Import registration: bytecode template debug info (absolute)
- Reporters:
source/units/Goccia.Coverage.Report.pas(LCOV + JSON emitters would carry the chosen canonical form)
Acceptance
- One record per physical file regardless of entry/import role, with hits merged
- A documented canonical path form, applied consistently in LCOV and JSON output
- A regression test covering the entry+import dual-role case
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read source/app/Goccia.CLI.SourcePipelineResult.pas and source/units/Goccia.Coverage.Report.pas, then trace how bytecode template debug info registers imported files. Decide and document the canonical path form before implementing it consistently in LCOV and JSON. Add a regression test for a file used as both an entry point and an import, verifying one record with merged hits.
Written by the indexing model from the issue text.
Assessment
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100