Repository navigation
Conversation
Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
…ix top-dir template Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
🔴 5% (3 lines)
Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
🔴 5% (3 lines)🔴 5% (3 lines) and compact snapshots
There was a problem hiding this comment.
Pull request overview
Adds an optional “lost covered lines” regression report to the action by persisting per-file covered line numbers in artifacts, diffing base vs PR head line mappings via git diff, and surfacing results in the existing markdown tables (plus compacted Jest snapshots).
Changes:
- Introduces
track_lost_linesinput, covered-lines artifact (coverage-lines.json), and lost-lines computation (git diffparsing + line mapping). - Extends Cobertura/Clover parsing to capture
covered_lines, and updates markdown template/context to render a “Lost Lines” column and details block. - Adds a Jest snapshot serializer to compact large
number[]arrays and regenerates snapshots/tests accordingly.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/with-base-coverage.hbs | Adds “Lost Lines” column and a details section to the base-coverage report template. |
| src/utils.ts | Adds trackLostLines input + covered-lines JSON read/write helpers and constants. |
| src/reports/cobertura/parser/index.ts | Collects per-file covered line numbers from Cobertura line hits. |
| src/reports/clover/parser/index.ts | Collects per-file covered line numbers from Clover <line> elements. |
| src/lost-lines.ts | New module: git diff execution/parsing, line mapping, and lost-lines report computation. |
| src/interfaces.ts | Adds covered_lines and new Lost Lines report interfaces + handlebars context fields. |
| src/functions.ts | Wires the feature into action flow, artifact upload, markdown generation, and formatting. |
| jest.config.js | Registers a custom snapshot serializer. |
| action.yml | Adds the track_lost_lines action input. |
| tests/utils.test.ts | Adds tests for covered-lines map + JSON round-trip and input parsing. |
| tests/run.test.ts | Adds run-path tests for track_lost_lines behavior and mocks lost-lines module. |
| tests/number-array-serializer.js | New serializer intended to render number[] with 20 items per line. |
| tests/lost-lines.test.ts | Adds unit tests for diff parsing, mapping, and lost-lines computations. |
| tests/functions.test.ts | Updates/extends markdown tests for lost-lines display and helper formatting. |
| tests/snapshots/utils.test.ts.snap | Regenerates snapshots to include covered_lines (and compact formatting). |
| Plans/lost-lines-feature.md | Documents the intended design/plan for the lost-lines feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…n baseRef not in history Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
… changes Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
…build dist Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
…ld dist Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
… Number.parseInt Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
…ch check to hasMergeBase Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
…erge-base resolution Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
…ote-tracking refs Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
…es from remote-tracking refs Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
…ront guard and first logGitDebugInfo Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
…ent, rebuild dist Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
… directly (#6) This change eliminates the intermediate coverage-lines.json file and uses the Coverage object directly for better performance and simpler code. Changes: - Removed writeCoveredLinesFile, readCoveredLinesFile, and COVERED_LINES_FILENAME from utils.ts - Removed coveredLinesToRangesTuples, rangeTuplesToLines, and isValidRangeTuples helper functions - Removed CoveredLinesFile interface - Updated computePrLostLinesReport to accept baseCoverage instead of artifactPath - Updated computePrLostLinesReport to use buildCoveredLinesMap(baseCoverage) directly - Removed coverage-lines.json upload sections for both PR head branch and push/schedule events - Updated tests to remove mock references to deleted functions - Removed 8 test cases for deleted file I/O functions - Updated 4 test cases to use buildCoveredLinesMap instead of readCoveredLinesFile - Removed 2 test cases for writeCoveredLinesFile (no longer needed) - Built dist folder with updated code 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
…omments, code tidying, rebuild dist Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
…st, rebuild dist Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com>
Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com> Agent-Logs-Url: https://github.com/Zadjil-AR/code-coverage-report-action/sessions/66641b2d-c10d-4472-81f0-d50685e44ddc
|
… when trackLostLines enabled Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com> Agent-Logs-Url: https://github.com/Zadjil-AR/code-coverage-report-action/sessions/863537ef-0399-4367-9c19-70fbe4289540
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 22 out of 26 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com> Agent-Logs-Url: https://github.com/Zadjil-AR/code-coverage-report-action/sessions/c40547b2-89e0-423b-8347-c801522888f8
…nator fix, test improvements Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com> Agent-Logs-Url: https://github.com/Zadjil-AR/code-coverage-report-action/sessions/d593ab6e-3cd9-4c7f-abca-b42b2c4856b5
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 22 out of 26 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code Coverage Report
Minimum allowed coverage is |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 22 out of 26 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const num = Number.parseInt( | ||
| (line as { '@_number'?: string })['@_number'] ?? '0', | ||
| 10 | ||
| ); | ||
| if (hits > 0) { | ||
| lines_covered += 1; | ||
| if (covered_lines !== undefined && num > 0) { | ||
| covered_lines.push(num); |
There was a problem hiding this comment.
countLines() parses the line @_number for every entry even when trackLostLines is false. This adds per-line work even with the feature flag disabled; consider only parsing @_number (and only for hits > 0) when trackLostLines is enabled.
| const num = Number.parseInt( | |
| (line as { '@_number'?: string })['@_number'] ?? '0', | |
| 10 | |
| ); | |
| if (hits > 0) { | |
| lines_covered += 1; | |
| if (covered_lines !== undefined && num > 0) { | |
| covered_lines.push(num); | |
| if (hits > 0) { | |
| lines_covered += 1; | |
| if (covered_lines !== undefined) { | |
| const num = Number.parseInt( | |
| (line as { '@_number'?: string })['@_number'] ?? '0', | |
| 10 | |
| ); | |
| if (num > 0) { | |
| covered_lines.push(num); | |
| } |
| lost_coverage: lostEntry | ||
| ? formatLostCoverage(lostEntry.lostCount, lostEntry.lostPercentage) | ||
| : undefined |
There was a problem hiding this comment.
buildLostLinesByFile() now adds zero-loss entries to support correct directory denominators, but here the per-file row renders lost_coverage for any lostEntry (including lostCount=0). This will show misleading values like "🔴 -0% (0 lines)" for files with no lost lines. Only set lost_coverage when lostEntry.lostCount > 0 (or when lostPercentage > 0).
| lost_coverage: lostEntry | |
| ? formatLostCoverage(lostEntry.lostCount, lostEntry.lostPercentage) | |
| : undefined | |
| lost_coverage: | |
| lostEntry && | |
| (lostEntry.lostCount > 0 || lostEntry.lostPercentage > 0) | |
| ? formatLostCoverage( | |
| lostEntry.lostCount, | |
| lostEntry.lostPercentage | |
| ) | |
| : undefined |
| const lostLinesMergeBaseSearchSteps = Math.max( | ||
| 1, | ||
| Number.parseInt( | ||
| core.getInput('lost_lines_merge_base_search_steps') || '10', | ||
| 10 | ||
| ) || 10 | ||
| ); | ||
|
|
||
| const lostLinesMergeBaseMaxDepth = Math.max( | ||
| lostLinesMergeBaseSearchSteps, | ||
| Number.parseInt( | ||
| core.getInput('lost_lines_merge_base_max_depth') || '512', | ||
| 10 | ||
| ) || 512 | ||
| ); |
There was a problem hiding this comment.
Update the logic so that the default value is used when: 1) the setting is not supplied. 2) the setting supplied is not a number. 3) the setting supplied is less than 1.
| lost_coverage: lostEntry | ||
| ? formatLostCoverage(lostEntry.lostCount, lostEntry.lostPercentage) | ||
| : undefined |
There was a problem hiding this comment.
The output should show a empty space if there are no lines lost for the entry. It should not show a zero value. See the comment #5 (comment)
| const num = Number.parseInt( | ||
| (line as { '@_number'?: string })['@_number'] ?? '0', | ||
| 10 | ||
| ); | ||
| if (hits > 0) { | ||
| lines_covered += 1; | ||
| if (covered_lines !== undefined && num > 0) { | ||
| covered_lines.push(num); | ||
| } | ||
| } |
There was a problem hiding this comment.
Create a brand new description for the PR to add the final changes that came to resolve the feature #4. Ignore all the intermediate changes and revisions. ONLY consider the final set of code in relation to the code in the main branch. Do not assume reader has access to the issue. Structure the description with what it is trying to achieve, how the feature is used by others, any implications of the change and key aspects of the code change.
There was a problem hiding this comment.
Increase the test coverage on utils.ts
…r, dist rebuild, new PR description Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com> Agent-Logs-Url: https://github.com/Zadjil-AR/code-coverage-report-action/sessions/029893c8-2ecb-41e7-9bb0-224fbfcbc443
Linter suggested change
Co-authored-by: Zadjil-AR <64791169+Zadjil-AR@users.noreply.github.com> Agent-Logs-Url: https://github.com/Zadjil-AR/code-coverage-report-action/sessions/fd5fdb1d-6d0a-4132-afbe-349c92f06edf
|



src/utils.ts: use default value when setting is not supplied, not a number, or less than 1 (for bothlostLinesMergeBaseSearchStepsandlostLinesMergeBaseMaxDepth)src/functions.ts: only showlost_coveragewhenlostCount > 0(not for zero-loss files frombuildLostLinesByFile)src/functions.ts: correct prettier formatting onformatLostCoveragecall (indentation)src/reports/cobertura/parser/index.ts: only parse@_numberwhencovered_lines !== undefinedAND inside thehits > 0blockPlans/lost-lines-feature.md: fresh PR description covering the final state of changes vs maindist/index.js__tests__/utils.test.tscovering default-value logic forlostLinesMergeBaseSearchStepsandlostLinesMergeBaseMaxDepthOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.