Strengthen badge publication checks
Dandaedre/agent-tasks/pipeline/head This commit looks good Details

This commit is contained in:
Dandaedre 2026-10-04 01:06:22 +02:00
parent b73ef8fc47
commit 6d30c15f05
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
1 changed files with 96 additions and 15 deletions

View File

@ -30,35 +30,66 @@ Retain only the three badges as Jenkins artifacts. Do not publish or retain
commit-addressed coverage directories, HTML, JSON, LCOV, or other detailed
reports unless the repository already has a separate requirement for them.
This task is complete only when all three badges are present in the README,
generated by CI, archived by Jenkins, and copied by a default-branch build to
the resolved asset mount below `coverage/<owner>/<project>/<default-branch>/`.
When the deployment contract uses `/mnt/assets`, verify the resulting files at
these exact filesystem paths rather than merely checking a similarly named
workspace or archive directory:
```text
/mnt/assets/coverage/<owner>/<project>/<default-branch>/version.svg
/mnt/assets/coverage/<owner>/<project>/<default-branch>/test.svg
/mnt/assets/coverage/<owner>/<project>/<default-branch>/coverage.svg
```
Do not report the task as successful when only scripts or pipeline definitions
were added. A configured operation, an archived artifact, a file in the Jenkins
workspace, and a file below the publication mount are four different states;
verify each required state explicitly.
## CI behavior
1. Use the project's established test and line-coverage tools. Pin tools that
1. Remove or recreate the workspace `coverage/` output directory at the start
of the build so files from an earlier run cannot satisfy later checks.
2. Use the project's established test and line-coverage tools. Pin tools that
CI installs itself, and keep tool configuration in the conventional tracked
project file.
2. Enforce an honest coverage floor supported by useful behavior tests. Do not
3. Enforce an honest coverage floor supported by useful behavior tests. Do not
exclude ordinary production code or distort code or tests to increase the
percentage.
3. Produce a temporary machine-readable coverage summary, extract and validate
4. Produce a temporary machine-readable coverage summary, extract and validate
a numeric percentage from 0 through 100, render `coverage/coverage.svg`, and
remove the summary.
4. Read the version from authoritative package or build metadata and render
5. Read the version from authoritative package or build metadata and render
`coverage/version.svg`. Do not duplicate the version in CI configuration.
5. Write a build-specific marker only after the test stage succeeds. In an
6. Write a build-specific marker only after the test stage succeeds. In an
always-run cleanup action, render `coverage/test.svg` as `passing` only when
that marker exists; otherwise render it as `failing`. Remove the marker
afterward so an old workspace cannot affect a later build.
6. If coverage did not complete, render a neutral `-%` badge during cleanup.
7. If coverage did not complete, render a neutral `-%` badge during cleanup.
Cleanup must run for both successful and failed builds so published status
cannot silently remain stale.
7. Archive exactly the three nonempty SVG files with fingerprinting on every
branch. Publish them only from the default branch. A missing or unwritable
publication mount is a CI failure.
8. Keep rendering and filesystem publication in small tracked scripts rather
8. Before archival or publication, enumerate the selected files and require
all three expected names to be regular, nonempty, non-symlink files that
parse as XML. Fail if any is absent or if an unexpected file is selected.
9. Archive exactly the three nonempty SVG files with fingerprinting on every
branch. Do not use `allowEmptyArchive`, broad `|| true`, exception swallowing,
or another fallback that converts missing badge output into CI success.
10. Publish all three badges only from the resolved default branch. Confirm the
branch condition actually runs in the Jenkins job type in use; a branch
predicate that silently skips the real default branch is a failure. A
missing or unwritable publication mount is a CI failure, not a reason to
print a warning and continue.
11. Keep rendering and filesystem publication in small tracked scripts rather
than large Jenkins shell blocks. Use the repository's existing scripting
language when suitable; otherwise use portable POSIX `sh`.
Update the Jenkins success and failure summaries to mention tests, coverage,
badge generation, and any other gates that the pipeline actually runs.
Success output must identify the resolved publication directory. Failure output
must identify the phase and missing or rejected path without hiding the
original build error.
## Renderer contract
@ -99,10 +130,18 @@ allow-listed set of badge names. It must:
traverse and read them even under a restrictive umask;
- copy each badge to a temporary file in its destination directory and rename
it atomically over the public file;
- after each rename, require the destination to be a regular, nonempty,
non-symlink file and compare it with the source so a partial or misdirected
copy cannot be reported as published;
- clean temporary files on ordinary failures and signals;
- quote paths and remain portable to the Jenkins worker's operating system;
- never recursively synchronize, prune, or delete the shared asset mount.
Exit nonzero with a message on standard error when validation, directory
creation, copying, permissions, renaming, or post-copy verification fails. The
message must name the operation and safe path involved. Never print a success
message before all selected badges have passed post-copy verification.
Do not automatically remove old commit-addressed directories. That is a
separate destructive migration requiring explicit authorization and exact path
verification.
@ -118,6 +157,12 @@ resolved values:
![test coverage](<asset-origin>/coverage/<owner>/<project>/<default-branch>/coverage.svg)
```
Editing the README is a required deliverable, not optional follow-up. After the
edit, search the rendered source and require each resolved badge URL exactly
once in an image reference. Check that no old owner, project, default branch,
filename, or asset origin remains in another badge block. A successful CI setup
without these README references does not complete this task.
Do not link them to a report that CI does not retain. Document the local
coverage command, enforced floor, version source, temporary summary, archived
files, publication path, and public URLs. Remove tracked generated badge files
@ -147,9 +192,45 @@ Before committing:
deleting the old target.
7. Verify rejection of missing badges, relative roots, unwritable
destinations, and regular-file branch destinations.
8. Validate Jenkins syntax as far as local tooling permits, inspect the final
diff, commit the change, and confirm the worktree is clean.
8. Verify the README contains each resolved public badge URL exactly once and
that all three image references render directly below the title.
9. On an actual default-branch Jenkins build, confirm the generation log names
all three workspace files, the archive contains exactly those files, and the
publication stage runs rather than being skipped. Inspect the resolved
destination below `/mnt/assets` when that is the configured mount and compare
all three published files with the generated sources.
10. Request each public URL without relying on a browser cache, require an SVG
response, parse it as XML, and confirm its displayed value matches the build
that published it. A pre-existing or stale public file is not evidence that
the current operation succeeded.
11. Validate Jenkins syntax as far as local tooling permits, inspect the final
diff, commit the change, and confirm the worktree is clean.
Report the measured coverage, enforced floor, checks run, commit ID, and any
checks unavailable locally. Do not claim the public badges are live until a
successful default-branch Jenkins build has published them.
## Failure reporting and handoff
Never silently downgrade a required check, and never describe the operation as
successful merely because the repository changes are committed. If any badge
is not added to the README, generated, archived, copied to the configured asset
mount, or served at its public URL, tell the calling agent or user that the
badge operation failed or remains incomplete and explain why.
The final report must give a separate status for each of these checkpoints:
1. README references;
2. CI generation;
3. Jenkins archival;
4. default-branch publication to the resolved mount; and
5. public URL retrieval and content validation.
For every failed, skipped, or unavailable checkpoint, report the failing phase,
the expected safe path or URL, the observed error or evidence, and the next
action needed. Distinguish a reproducible failure from a check that could not be
performed because Jenkins, the mount, credentials, network access, or the
default branch was unavailable. Do not invent results, treat unavailable as
passed, or hide an earlier failure behind successful cleanup or badge rendering.
Report the measured coverage, enforced floor, checks run, commit ID, and the
five checkpoint statuses above. Do not claim the public badges are live until a
successful default-branch Jenkins build has generated and archived the badges,
copied all three to the resolved publication directory, and their uncached
public responses have been validated.