Skip to content

Converge the two workflow YAML parsers in internal/config #504

Closed

Description

@scttfrdmn

Problem

Two files in internal/config/ now parse .github/workflows/*.yml with their own local structs:

The duplication was deliberate: the two branches were cut from origin/main independently so they could merge in either order without a conflict in a shared helper. That reason expires the moment both have landed.

What to do

One parser, one readWorkflow, one needsOf, one cutStep, used by both test files. Carry over the two comments that record measured facts, because both are the kind of thing that gets "simplified" back out:

  1. On must be a struct field tagged yaml:"on". gopkg.in/yaml.v2 implements YAML 1.1, where a bare on key parses as the boolean true — so unmarshalling into a map yields a true key and no "on" key at all.
  2. Step-scoped assertions must cut the step out first. Searching the whole file matched cosign verify-blob inside the release-notes echo block, so the mutation that deleted the executed verification still passed. That hole was found by mutation, not by reading, and a shared helper is where it should be fixed once.

Blocked on #500 and #501 both being merged.

Activity

  1. added this to the Future Work milestone on Sep 15, 2026
  2. added
    type: technical-debt
    priority: low
    area: tests
    area: ci-cd
    on Sep 15, 2026
  3. added
    effort: small
    on Sep 19, 2026
  4. scttfrdmn commented on Sep 19, 2026

    @scttfrdmn
    OwnerAuthor

    Milestoned for v0.17.0. Correcting the premise: it is four parsers now, not two. #531 added one
    yesterday, so the duplication this issue is about grew while it sat.

    Current state in internal/config:

    • Struct-based: release_gate_test.go (workflowFile, workflowJobDef), release_signing_test.go
      (signingWorkflow)
    • map[any]any-based: job_timeouts_test.go, pull_request_triggers_test.go, packaging_test.go
      (two yaml.Unmarshal sites)

    Six yaml.Unmarshal calls across five files, in two incompatible styles, all reading
    .github/workflows/. Converge on one readWorkflow, one needsOf, one cutStep, one job iterator.

    Both blockers are cleared: #500 and #501 are merged.

    Two measured facts have to survive as comments on the shared code, because each one was a real bug and
    neither is guessable from the API:

    • on is the boolean true. yaml.v2 reads YAML 1.1, so a bare on: key does not unmarshal as the
      string "on". In the struct form it needs a field tagged yaml:"on"; in the map form it needs the
      []any{true, "on"} lookup that pull_request_triggers_test.go's triggerSection does.
    • Step-scoped assertions must cut the step out first. Searching the whole file matched
      cosign verify-blob inside a release-notes echo, and a mutation deleting the executed verification
      still passed.

    Whatever the shared helper ends up looking like, verify it by mutation against the existing tests: each
    of the five callers should still fail for the reason it was written to fail, which for two of them means
    re-running the mutations above rather than trusting a green suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: ci-cdarea: testseffort: smallpriority: lowtype: technical-debt

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions