Skip to content

fix(package-coverage-check): [#2762] follow the CLI output contract - #2810

Merged
josecelano merged 8 commits into
torrust:developfrom
josecelano-bot:2762-package-coverage-check-contract
Nov 11, 2026
Merged

josecelano merged 8 commits into
torrust:developfrom
josecelano-bot:2762-package-coverage-check-contract

Conversation

@josecelano-bot

@josecelano-bot josecelano-bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2762. Part of EPIC #2758.

package-coverage-check now follows the stdout-result-data contract for matrix, compare and summary: every failure is one NDJSON record with a kind on stderr and empty stdout; usage errors and the TTY refusal exit 2, runtime failures exit 1; summary prints one JSON object with the Markdown in a markdown field, and generate_coverage_pr.yaml extracts it with jq -r .markdown. The matrix and compare result schemas are unchanged.

Tests: red tests first (commit 1), then the fix; CLI tests in tests/cli.rs and a unit test of the failure-to-exit-code mapping. The TTY refusal needs a pseudo-terminal, so it is verified manually. Evidence (real binary, before and after) is in manual-verification-evidence.md next to the spec. actionlint was not available locally; the workflow change is a jq pipe plus shell: bash (so a failing summary fails the step) and ran in the pull-request run https://github.com/torrust/torrust-tracker/actions/runs/42867272734, where the summary step passed under pipefail; the rendered step summary could not be read.

🤖 Generated with Claude Code

josecelano-bot and others added 3 commits November 10, 2026 16:49
…tract

NDJSON errors on stderr, usage and TTY refusal exit 2, and summary prints one
JSON object with the Markdown in a markdown field. The coverage workflow
extracts the field with jq.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

@da2ce7 da2ce7 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.

Reviewed at 304b7c2cda2b0fd55e48f9e701e75122d6eac0b3. Recomputed from the bytes at this head, against the merge base c2b5d96ef; git merge-tree against develop c2b5d96ef merges cleanly, and the merged tree is the head's own tree.

Process: a contract deviation fixed under fix-bug (the spec's Bug-Fix Process names it), with write-unit-test, implement-workflow for the workflow line, create-issue progress tracking, commit-changes and open-pull-request.

The change against its claim: main.rs mirrors the ci-gate reference (Failure kinds, exit 2 for usage and TTY, 1 for runtime, one NDJSON record, empty stdout) and summary wraps the unchanged report in markdown; the five CLI tests are byte-identical between the test commit and the head, and each one's assertions fail on the base binary's output (traced: exit 1, plain-text stderr, multi-line Markdown). On success, jq -r .markdown reproduces the former step-summary bytes exactly (recomputed). On failure it does not: the step has no shell:, so it runs without pipefail, and a failing summary now leaves the step green with an empty summary (F1). The evidence overstates three observations (F2, F3) and lacks the green and recheck records the skill asks for (F4).

Consistency: no new links, no dictionary words, no moves; the EPIC row and the spec's status/related-pr are updated at archive time in this repository, so their absence is not a finding.

Hygiene: three Conventional subjects with the [#2762] form; author equals committer; each commit carries one attribution footer and the description ends with one attribution line, which no rule in the tree governs; git diff --check is clean; the PR-branch commit-id check prints nothing; the only closing keyword is Closes #2762 in the description.

Findings: F1 Major; F2 to F6 Minor; F7 and F8 Nit.

Checked, no finding: argument parsing per subcommand; From<String> routing every subcommand error to runtime_error; child cargo/git stderr captured, not inherited; the V2 matrix, compare and summary outputs against lib.rs serialization; dependencies and lockfile unchanged; rustfmt layout at max_width = 130.

Checks

On the loop's compute node at this head, against the merge base c2b5d96ef (receipt server-gates-kranich-616): the repository's pre-commit gate exit 0 (73 s), clippy-allow-reasons against the base exit 0, and the tree left clean; linter markdown, linter cspell, linter lychee (offline links) exit 0; frontmatter-validator --all showed no new error against the base. F1 checked on the bytes: .github/workflows/generate_coverage_pr.yaml sets no shell: and no defaults.run.shell anywhere, and the new step ends | jq -r .markdown >> "$GITHUB_STEP_SUMMARY", while at the base the same step called summary without a pipe. GitHub checks at this head at posting time: "Package Coverage Regression: queued/pending; Package Coverage (package-coverage-check): completed/success; Docker E2E: completed/skipped; Test (Docker) (release): queued/pending; Docs Lint: completed/success; Discover Package Coverage: completed/success; Generate Coverage Report: in_progress/pending; Build on windows-latest (stable): completed/success; Build on macos-latest (stable): queued/pending; Build on ubuntu-latest (nightly): completed/success; Build on ubuntu-latest (stable): completed/success; Build on windows-latest (nightly): completed/success; Build on macos-latest (nightly): completed/success; Shipped Features: completed/success; Unit (stable): in_progress/pending; Unit (nightly): in_progress/pending; Layer Boundary Bans: completed/success; Workspace Packaging: completed/success; Documented Clippy Allows: completed/success". At posting, develop is 3fe63d04b.

josecelano-bot and others added 2 commits November 10, 2026 17:35
…ary step and correct the evidence

Review round 1 of PR 2810: set shell: bash on the summary step so a failing
summary fails the step, rerun the TTY check with single quotes, record the red
and green test output and the build each recheck ran on, and correct the
progress records.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The coverage workflow can silently pass when report generation fails because pipefail is not enabled, and the TTY verification does not capture the binary’s actual exit status.

2 open issues
What changed in this PR

This PR updates package-coverage-check to follow the global CLI output contract for issue #2762, part of EPIC #2758, and adapts the coverage workflow to consume its JSON summary.

Changes:

  • Adds structured JSON errors, distinct usage/runtime exit codes, and TTY refusal.
  • Wraps summary Markdown in JSON and extracts it in the coverage workflow.
  • Adds CLI regression tests and records implementation and verification evidence.
File Description
docs/​issues/​open/​2762-2758-package-coverage-check-contract/​manual-verification-evidence.md Records regression results and manual verification.
docs/​issues/​open/​2762-2758-package-coverage-check-contract/​ISSUE.md Updates task status and acceptance evidence.
contrib/​dev-tools/​checks/​package-coverage-check/​tests/​cli.rs Tests error records, exit codes, and JSON summaries.
contrib/​dev-tools/​checks/​package-coverage-check/​src/​main.rs Implements structured failures, TTY refusal, and JSON summaries.
.github/​workflows/​generate_coverage_pr.yaml Extracts Markdown from the JSON summary using jq.

Review effort: Balanced

@da2ce7 da2ce7 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.

Reviewed at ced4198a8ee2bbbb1d84ba7fa9cefde32ffc2aa6. Recomputed from the bytes at this head, against the previous round's head 304b7c2cd and the merge base c2b5d96ef; git merge-tree against develop 4a46f98b2 merges cleanly, and the merged tree differs from develop only in this PR's six paths, which develop has not touched.

What moved: 7831de126 and ced4198a8 fast-forward 304b7c2cd (5 files, +221/-16); the other 2449 paths are byte-identical, so the previous round's conclusions on them stand.

Previous findings:

  • F1 fixed: the step sets shell: bash; run with its exact block, a failing summary now fails the step (exit 1, was 0) and success appends the same bytes.
  • F2 fixed: the TTY command is single-quoted.
  • F3 partly fixed: M3 and T4 name what ran, but T4, AC5 and V3 now cite a hosted-run note the PR does not carry (re-raised).
  • F4 fixed: R1 per test, the mutation run, and G1, whose counts (16, 3, 5, 1, no doc-tests) match the tree.
  • F5, F6, F7 fixed.
  • F8 still open (re-raised).

The new commits: the audit validator's logic, run offline on the captured threads, passes (8 rows, 0 failures), but the audit has no rows for the second review's two findings (F9); the open-pull-request commit-id check now prints three PR-branch ids (F10); the audit's stamps postdate its commit (F11).

Hygiene: Conventional subjects with [#2762]; author equals committer; one attribution footer each, which no rule in the tree governs; git diff --check clean; no renames.

Findings: F3, F9 and F10 Minor; F8 and F11 Nit. None blocks; the verdict waits for the audit to cover every answered thread.

Checked, no finding: R1's failure lines against the tests and the base binary; the mutation's left/right against the assertion in main.rs; the pty reasoning against the dev-dependencies; the audit's review ids, reply threads and severities against the captured comments; no links added besides thread URLs.

Checks

On the loop's compute node at this head, against the merge base c2b5d96ef (receipt server-gates-kranich-623): the repository's pre-commit gate exit 0 (86 s), clippy-allow-reasons against the base exit 0, and the tree left clean; linter markdown, linter cspell, linter lychee (offline links) exit 0; frontmatter-validator --all showed no new error against the base; the repository's audit validator on pr-2810-review exit 0 (8 rows, 1 log entry). Package tests: cargo test -p package-coverage-check exit 0 (25 passed). F1 confirmed fixed on the bytes: the summary step now sets shell: bash. This round is a COMMENT with no ACK until the audit record covers the answered threads of the second review (F9). GitHub checks at this head at posting time: "Package Coverage Regression: queued/pending; Package Coverage (package-coverage-check): completed/success; Docker E2E: completed/skipped; Workspace Packaging: queued/pending; Layer Boundary Bans: queued/pending; Shipped Features: completed/success; Unit (stable): queued/pending; Unit (nightly): in_progress/pending; Documented Clippy Allows: completed/success; Docs Lint: completed/success; Discover Package Coverage: completed/success; Generate Coverage Report: in_progress/pending; Build on ubuntu-latest (stable): completed/success; Build on macos-latest (nightly): completed/success; Build on windows-latest (nightly): completed/success; Build on windows-latest (stable): completed/success; Build on macos-latest (stable): completed/success; Build on ubuntu-latest (nightly): completed/success; Test (Docker) (release): in_progress/pending". At posting, develop is 4a46f98b2.

Record the hosted run of the summary step, take the stamps from the commit
times, cite PR-branch commits by subject and add the audit rows for the second
Copilot review and for round 2.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
da2ce7
da2ce7 previously approved these changes Nov 10, 2026

@da2ce7 da2ce7 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.

Reviewed at cbfb590e7cfe123fe52c8f509ad4987affe1fc06. Recomputed from the bytes at this head, against the previous round's head ced4198a8 and the merge base c2b5d96ef; git merge-tree against develop 4a46f98b2 merges cleanly, and the merged tree differs from develop only in this PR's six paths, with the PR's own stat.

What moved: cbfb590e7 fast-forwards ced4198a8 (three docs files, +119/-13); the other 2451 paths, code and workflow included, are byte-identical, so earlier conclusions on them stand.

Previous findings (F1, F2 and F4 to F7 stay fixed):

  • F3 partly fixed: T4, V3 and the new H1 state only what ran, but AC5 stays checked though the hosted summary was not read, and the description records no run (re-raised).
  • F8 partly fixed: 16:54 and 17:35 match their commits; the new 18:15 stamps postdate theirs (re-raised).
  • F9 fixed: 15 rows for the 15 threads.
  • F10 fixed in the tree: the open-pull-request commit-id check prints nothing (replies: F14).
  • F11 partly fixed: the 17:37 entry matches its commit; line 4 and the new entry do not (re-raised).

The new commit: the audit validator's logic, run offline on the captured comments, passes (15 rows, 0 failures); reviewer IDs, severities, re-raise links and thread states match the capture. H1's job, step and shell match the workflow; the run is not checkable offline. New: reply order (F12), a log entry rewritten in place (F13), ids in replies (F14).

Hygiene: Conventional subject with [#2762]; the body matches the diff apart from the new stamps; author equals committer; one attribution footer, which no rule in the tree governs; git diff --check clean; no renames, no closing keyword.

Findings: F3 and F14 Minor; F8, F11, F12 and F13 Nit. None blocks: each is a record slip the author can repair after merge.

Checked, no finding: the fix commits' Rust source differs only in the tests/cli.rs comment; every cited subject is on the branch; each reply URL sits on its own thread.

Checks

On the loop's compute node at this head, against the merge base c2b5d96ef (receipt server-gates-kranich-633): the repository's pre-commit gate exit 0, clippy-allow-reasons against the base exit 0, and the tree left clean; cargo test -p package-coverage-check exit 0 (25 tests); the repository's audit validator on pr-2810-review exit 0 (15 rows, 2 log entries, no failures). GitHub checks at this head at posting time: "". At posting, develop is 4a46f98b2.

@da2ce7

da2ce7 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

ACK cbfb590 — docs-only round-2 commit over byte-identical code and workflow, with the audit covering all 15 threads and passing the validator's logic offline

Correct the stamps and the audit log, state what the hosted run showed and
what could not be read, and add the audit rows for round 3.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
da2ce7
da2ce7 previously approved these changes Nov 10, 2026

@da2ce7 da2ce7 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.

Reviewed at d734459f45871474fa95367a5169ca5eb077011a. Recomputed from the bytes at this head, against the previous round's head cbfb590e7 and the merge base c2b5d96ef; git merge-tree against develop 4a46f98b2 merges cleanly, and the merged tree differs from develop only in this PR's six paths, with the PR's own stat.

What moved: d734459f4 fast-forwards cbfb590e7 (three docs files, +95/-8); the other 2451 paths, code and workflow included, are byte-identical, so earlier conclusions on them stand.

Previous findings (F1, F2, F4 to F7, F9 and F10 stay fixed):

  • F3 fixed: the AC5 row and H1 say what was observed and what AC5 rests on; the description records the run.
  • F8 fixed: 18:10 matches its commit; the new 18:36 stamps precede theirs (18:36:39Z).
  • F11 fixed: line 4 says 18:36; a correction names the 18:15 entry.
  • F12 partly fixed: the correction records the round-2 reply times; the new entry repeats the claim (re-raised).
  • F13 fixed: the 17:55 entry is restored byte for byte; a correction names the rewrite.
  • F14 fixed: no reply cites a PR-branch id; the edits fall at 18:34:19Z to 18:34:32Z.

The new commit: the audit validator's logic, run offline on the captured comments, passes (21 rows, 4 log entries, 0 failures); IDs, severities, re-raise links and thread states match the capture. The correction's reply times match it; the open-pull-request commit-id check prints nothing. H1's claim that the summary was unreadable is not checkable offline.

Hygiene: Conventional subject with [#2762]; the body matches the diff; author equals committer; one attribution footer, which no rule in the tree governs; git diff --check clean; no renames.

Findings: F12 (re-raised) and F15, both Nit; neither blocks, each a record slip the author can repair after merge.

Checked, no finding: the ISSUE.md round-2 stamp is corrected in place, as earlier stamps were, and the issue template's log has no append-only rule; the new URLs resolve to the right threads.

Checks

On the loop's compute node at this head, against the merge base c2b5d96ef (receipt server-gates-kranich-635): the repository's pre-commit gate exit 0 (97 s), clippy-allow-reasons against the base exit 0, and the tree left clean; the repository's audit validator on pr-2810-review exit 0 (21 rows, 4 log entries, no failures). Code and workflow are byte-identical to the previous round's head, where the package tests passed. GitHub checks at this head at posting time: "". At posting, develop is 4a46f98b2.

@da2ce7

da2ce7 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

ACK d734459 — docs-only round-3 commit over byte-identical code and workflow, with the audit covering all 21 threads and passing the validator's logic offline

@josecelano

Copy link
Copy Markdown
Member

ACK d734459

Add the review retrospective beside the audit, fix the two round-4 audit nits
and record the round-4 rows and corrections.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

@da2ce7 da2ce7 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.

Reviewed at 218d335cf91933338cf4e518614760239a8c80df. Recomputed from the bytes at this head, against the previous round's head d734459f4 and the merge base c2b5d96ef; git merge-tree against develop 4a46f98b2 merges cleanly, and the merged tree differs from develop only in this PR's seven paths, with the PR's own stat.

What moved: 218d335cf fast-forwards d734459f4 (four docs files, one new, +144/-5); the other 2451 paths, code and workflow included, are byte-identical, so earlier conclusions on them stand.

Previous findings (F1 to F11, F13 and F14 stay fixed):

  • F12 fixed: the 21:33 entry records the round-3 reply times, says the round-3 entry was wrong, and postdates the round-4 replies it cites.
  • F15 fixed: the paragraph reads rounds 1 to 4 in order; the round-3 entry says "above".

The new commit: the audit validator's logic, run offline on the captured comments, passes (23 rows, 5 log entries, 0 failures); IDs, severities, the F22 re-raise of F19 and thread states match the capture. The open-pull-request commit-id check prints nothing; no reply cites a PR-branch id. The retrospective follows its template; its counts, per-finding rows and claims about the code, the one-line workflow fix and the ci-gate header hold, except two (F17, F18).

Hygiene: Conventional subject with [#2762]; the body matches the diff; author equals committer; one attribution footer, which no rule in the tree governs; git diff --check clean; no renames.

Findings: F16 and F18 (Minor), F17 (Nit); none blocks, each a record slip the author can repair after merge.

Checked, no finding: the in-place "below" to "above" edit departs from the template's append-only log rule, but the previous round asked for it and the correction names it; the new stamps (21:33) precede their commit (21:34:53Z).

Checks

On the loop's compute node at this head, against the merge base c2b5d96ef (receipt server-gates-kranich-661): the repository's pre-commit gate exit 0 (88 s), clippy-allow-reasons against the base exit 0, and the tree left clean; the repository's audit validator on pr-2810-review exit 0 (23 rows, 5 log entries, no failures). Code and workflow are byte-identical to the previous round's head. GitHub checks at this head at posting time: "". At posting, develop is 4a46f98b2.

@da2ce7

da2ce7 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

ACK 218d335 — docs-only round-4 commit over byte-identical code and workflow, with the audit covering all 23 threads and passing the validator's logic offline

@josecelano

Copy link
Copy Markdown
Member

ACK 218d335

@josecelano
josecelano merged commit c7d9be2 into torrust:develop Nov 11, 2026
22 checks passed
josecelano added a commit that referenced this pull request Nov 11, 2026
017b4c4 docs(issues): [#2762] address PR 2820 review round 1 (josecelano-bot)
8a84228 docs(issues): [#2762] take the close-out stamps from the commit time (josecelano-bot)
bfa08f1 docs(issues): [#2762] close out the package-coverage-check issue (josecelano-bot)

Pull request description:

  Related to #2762 (PR #2810 is merged and the issue is already closed). Part of EPIC #2758.

  Archives the spec to `docs/issues/closed/`, sets row 3 of the EPIC to DONE, and fixes the findings of da2ce7's last review of #2810 that were deferred to this PR: the reply URLs of audit rows F22 and F23 (new replies were posted on those threads), the audit rows F24 to F26 for that review, and the retrospective's commit count and validator description. No code or workflow changes.

  Validation: `linter all` exits 0 on the branch; the pre-commit and pre-push hooks passed; the closed-state check `gh issue view 2762` printed CLOSED before the move; the old spec path has no live references (two historical command records in the PR 2771 audit stay).

  🤖 Generated with [Claude Code](https://claude.com/claude-code)

ACKs for top commit:
  da2ce7:
    ACK 017b4c4 — previous findings F1, F2 and F4 to F7 recomputed as fixed and the new review audit checked against the captured threads and the validator's logic offline at this head
  josecelano:
    ACK 017b4c4

Tree-SHA512: 47c0c9f95cfcafe0ef57fb7ef2434e84c5ae4f3c952f492e5f9fb410d955cc8ff68072861f56a09da2126696c101fb97b3184416392cc737cf7ac83bb9fd7c6f

This branch was previously deployed

1 inactive deployment
coverage — 218d335c Deployed Nov 11, 2026 by josecelano-bot via Generate Coverage Report #3039
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.

package-coverage-check: NDJSON errors, usage exit 2, TTY refusal and a JSON summary

4 participants