Repository navigation
Description
internal/config/package_install_coverage_test.go reaches ci.yml's packaging job with a
line-oriented text cut (jobSource, plus isJobHeader), and its own doc comment says why and what
to do about it:
A text cut and not a YAML descent, deliberately and with a caveat. #504 converged this package's four
workflow parsers into one, and the parsed form is the right way to reach a job's steps; the struct that
lands with it grows aStepsfield that is not on this tree yet, and adding a fifth parser here to
bridge the gap would be the thing #504 exists to stop. So this cuts the text, and whoever holds both
halves should replace it with asteps:walk.
#504 has now merged (#540, 4cdea39), so that condition is satisfied: workflow_test.go declares
Steps any with a yaml:"steps" tag, and readWorkflow, readWorkflows, readWorkflowTexts,
cutStep and needsOf are all in the package. The caveat is stale and the note is the only thing
holding the shape in place.
Why it is worth doing rather than leaving
The text cut works and is guarded — a floor on the cut's length, and a ceiling asserting the body holds
exactly one runs-on:, which is how a cut that overruns into the next job gets caught. That second
guard exists because text cutting has this failure mode; a steps: walk does not have it, so the
guard and the helper both go away.
It also carries a second, subtler cost. runsCommand matches a line prefix after stripping sudo ,
because the first version used a substring match and the mutation deleting rpm -e objectfs from
ci.yml passed — the job's own echo "::error::... survived rpm -e" diagnostics satisfied it.
Walking steps: and searching each step's run: string does not remove that hazard (an echo is still
inside a run:), so runsCommand should survive the conversion unchanged. Worth stating explicitly so
the conversion does not "simplify" it away.
Work
- Replace
jobSourcewith a descent through the converged parser tojobs.packaging.steps[].run. - Delete
jobSource,isJobHeader, and the two cut guards (the length floor and theruns-on:
ceiling) — they guard a failure mode the parsed form does not have. - Keep
runsCommandand its line-prefix rule, and keep its comment: the defect it was written for
is a property ofrun:bodies, not of how the job was located. - Re-verify by mutation, since the gate is only worth what a mutation says: delete
rpm -e objectfs
fromci.ymland confirmTestEveryPackagedFormatIsInstalledAndRemovedInCIfails by name, and
confirm the mutation still compiles.
No behaviour change and no user-facing effect. Filed so a comment that is now wrong does not quietly
become permanent.
Activity