The formats shipped; nothing ran them - #107
Conversation
`check` gained SARIF and JUnit in #104, and the tool still runs when someone remembers to run it. This is the packaging half of #89: a composite action, a pre-commit hook, and an example workflow. `action.yml` installs a pinned release wheel, checks the packages, uploads the SARIF to code scanning, writes the counts to the job summary, and exits on the tool's own code. `version` is required and has no default: a floating tag would make a report's `tool_version` unpredictable, and that field is read as evidence about which catalog ran, so the install step also compares the tag against the version it actually installed. The action's `failures`, `warnings` and `not-run` outputs come from `ceqa_preflight.ci_summary`, which calls the same `summarize_counts` the console summary line calls. Counting in shell would have been shorter and would have been a second implementation of a published number, drifting from the first one with nothing to notice. It exits 2 on a directory holding no report, rather than publishing `failures=0` for a job that checked nothing. `.pre-commit-hooks.yaml` adds a `ceqa-preflight` hook, and a `pre-commit` command behind it. `pre-commit` hands a hook the staged paths, not the package they belong to, and the tempting fallback -- the working directory, or the files' common parent -- is how a hook becomes a check that cannot fail: checking the wrong directory reports on a package nobody is filing and passes while doing it. So resolution walks up from the staged files' common directory, no higher than where the hook was invoked, to the first directory holding a manifest, and takes the filing type from that manifest rather than defaulting one. When no package can be identified it exits 2 and asks for `--package`. `check`'s body moves into `_check_sources` so both commands run the same loop. No behaviour changes on the `check` path.
…agged The README and the example workflow both wrote `uses: ChelseaKR/ceqa-preflight@v0.1.0`. No tag exists on this repository, so that line documents an install that fails. Both now say so and point at the release-status section.
040963a to
5fd8fde
Compare
`test_every_flag_the_action_passes_still_exists_on_the_cli` scraped `--help` output. Rich wraps and colours that at the terminal's width, so on an 80-column runner `--filing-type` arrives split across two lines and the substring is absent. Green on a wide developer terminal, red on all three CI platforms -- a test measuring the runner rather than the code, which is the one failure mode a gate must not have. It now reads the option strings off the command objects `typer.main.get_command` returns, which is both width-independent and a stronger assertion: it sees the real parameter names rather than their rendering. Verified the replacement still fails for the reason it exists: renaming `--filing-type` to `--filing-kind` in all three of its declarations reddens it (and the SARIF/JSON agreement test), and restoring the file byte-for-byte turns both green.
|
Rebased onto The defect. Verified the replacement still fails for the reason it exists rather than merely passing: renaming The rebase. Four conflicts, all mechanical:
Still a draft, for the two reasons in the body: publishing One sequencing note, since both open pull requests here are drafts waiting on you: #105 and this branch overlap only in Prepared with AI assistance; reviewed before submission. |
Part of #89. The two report formats that issue asks for landed in #104; this is the packaging half — the part that makes them run without anyone remembering to. #89 stays open until you decide the two things in the last section.
What was missing
check --format sarifand--format junitexist. Nothing invokes them. The tool runs when a person runs it, which is the state the issue describes: "Today the tool runs when someone remembers."What changed
action.yml— a composite action. It installs a pinned release wheel, checks the packages in JSON, SARIF and JUnit, uploads the SARIF to code scanning, writes the counts to the job summary, and exits on the tool's own code (0clean,1findings,2a package it could not read).versionis required and has no default. A floating tag would make a report'stool_versionunpredictable, and that field is read as evidence about which catalog produced the findings. The install step also compares the tag against the version it actually installed, and refuses a release carrying more than one wheel rather than picking by sort order.ceqa_preflight.ci_summary— the module behind thefailures,warningsandnot-runoutputs. It calls the samesummarize_countsthe console summary line calls. Counting in shell would have been four lines shorter and would have been a second implementation of a published number, drifting from the first one with nothing in the repository to notice. Its other job is the failure mode: a report directory holding nothing exits2and says "no report produced", rather than publishingfailures=0for a job that checked nothing..pre-commit-hooks.yamland apre-commitcommand.pre-commithands a hook the staged paths, not the package they belong to. The tempting fallback — the working directory, or the files' bare common parent — is how a hook becomes a check that cannot fail: it reports on a package nobody is filing and passes while doing it. So resolution walks up from the staged files' common directory, no higher than where the hook was invoked, to the first directory holding apackage.yaml/package.yml/package.json, and takes the filing type from that manifest rather than defaulting one — a default would check an NOD package against the NOE rules and pass. When no package can be identified it exits2and asks forargs: [--package, ...].check's body moves into_check_sourcesso both commands run the same loop. Nothing on thecheckpath behaves differently.The one thing worth knowing before you read the diff
The action cannot run today. It installs the wheel from a GitHub Release, and this repository has cut no tag —
git ls-remote --tagsis empty, which is #85. Both the README and the example workflow now say so in terms and point at the release-status section, so theuses: ChelseaKR/ceqa-preflight@v0.1.0line reads as the shape of the reference rather than a version anyone can pin. A second commit on this branch does only that; without it the README would document an install that fails, which is the drift class this repository keeps finding in its own prose.How it was verified
make verifyclean —lock-check lint typecheck test security audit i18n, the audit reaching the network. 564 tests, 0 failures. README anddocs/I18N.mdgate figures updated to 564 / 40 / 211, and the one new console string is translated, somake i18nreports 211 messages at parity acrossenandes.action.yml,.pre-commit-hooks.yamland the example workflow are YAML that CI here cannot execute, so the tests assert the parts that rot silently: that every flag the action passes still exists oncheck, that the outputs it declares are exactly the keysci_summarywrites, thatversionstill has no default and the install step still compares versions, and that the example grantssecurity-events: write— which the caller must, because a composite action cannot widen the token it is handed.Four negative controls, each replacing a literal, each read back from disk and SHA-256-compared before running and restored from a
cp -pcopy compared again after:[]instead of raising525bfa6e…→00639597…not-run=0for a directory with no report, which is the whole point086a2a1e…→1216cad0…exit 0a48ed3e5…→be58d79c…warningsreads thefailurecount525bfa6e…→c66c99ae…The fourth is the one that says whether
ci_summaryis worth having. It is a one-word change with no syntax error and no type error, exactly the shape a shell reimplementation would have drifted into, and it reddens the test that compares the published counts againstsummarize_countson a real report.The first control is worth reading for what it printed rather than for the failure: with the refusal removed the command emitted
failures=0 warnings=0 not-run=0and exited0, so the action would have uploaded an empty SARIF, written a table of zeroes to the job summary, and gone green on a run that produced nothing.What needs your call
Publishing an Action is a distribution claim.
action.ymlat the repository root makesuses: ChelseaKR/ceqa-preflight@<tag>a public interface, and interfaces are harder to withdraw than to add. The issue's scope names the action explicitly and puts Marketplace publication out of scope, which is what I built, but the file at the root is the part you may want to sit with. It is inert until Cut the first tagged release #85 in any case.The pinned
codeql-action/upload-sarifSHA iscdf488f595d80d6e07e03d4674febd5ab45fa938(v4.37.9) — the same one.github/workflows/security.ymlalready pins. Dependabot updates this repository's own workflows; whether it also updates a consumer-facingaction.yml, and whether you want it to, is a policy question I did not settle.Not built, so #89 keeps them: nothing here publishes to the Marketplace, and nothing runs the
aicommands in CI — they need credentials and send text off-machine, which the issue puts out of scope and which I agree with.Prepared with AI assistance; reviewed before submission.