Skip to content

No Go fixture with a toolchain directive, so version selection is untested #75

Closed

Description

Problem

Both scan lanes select a Go toolchain from the project's go.mod, and go.mod carries two version directives:

go 1.23.0
toolchain go1.25.3

actions/setup-go v6 onwards prefers toolchain where present and falls back to go. Getting that precedence wrong is not a soft failure: setup-go exports GOTOOLCHAIN=local, so Go refuses to fetch the toolchain the module asks for and stops with

go: go.mod requires go >= 1.25.3 (running go 1.23.0; GOTOOLCHAIN=local)

lfreleng-actions/test-go-project, the fixture both lanes' Go legs scan, declares only:

module github.com/lfreleng-actions/test-go-project

go 1.25

No toolchain directive. So no self-test in this repository exercises toolchain selection at all, in either lane, in either scan mode.

Why this is not hypothetical

The CLM lane shipped with exactly this defect from PR #38 until #76. It passed build-metadata-action's go_go_version — documented as the go directive — as setup-go's go-version, which beats go-version-file outright, so the file was never read and toolchain never applied. Every Go self-test passed throughout, because the fixture has nothing to get wrong.

That is the same shape as #74: a silent-by-construction failure mode with no fixture able to surface it. The difference is that this one fails loudly in production while passing in CI — the fixture is what makes it invisible, not the failure itself.

Proposal

Give the estate a Go fixture whose go.mod carries a toolchain directive newer than its go directive, so the two resolve to observably different versions.

Two placements, both defensible:

  1. Add the directive to lfreleng-actions/test-go-project. Cheapest, and makes every consumer's Go path more representative. But that fixture is shared with go-workflows and others, so the change needs their sign-off — it would raise the minimum Go those jobs install.
  2. Add a sibling fixture (test-go-toolchain-project, or a branch of the existing one) used only where toolchain selection is under test. No blast radius, one more repository to keep current.

Then assert the resolved version, not merely that the job completed: a run that installs the go directive's version and succeeds anyway proves nothing, since most modules build fine on either.

Acceptance

  • A fixture exists whose go and toolchain directives resolve to different versions
  • Both lanes' Go legs scan it
  • The check fails if the go directive's version is installed instead of the toolchain one
  • Ideally also covered with GOTOOLCHAIN=local preset, which flips setup-go back to the go directive

Related

Raised while fixing the toolchain precedence in #76.

Activity

  1. ModeSevenIndustrialSolutions commented on Sep 1, 2026

    @ModeSevenIndustrialSolutions
    MemberAuthor

    The fixture half of this is now up as lfreleng-actions/test-go-project#81, and the consuming assertion as #82.

    What each part does

    test-go-project#81 adds one directive:

     go 1.25
     
    +toolchain go1.25.0

    Option 1 from this issue — extending the existing fixture rather than adding a sibling. The concern raised here was that it "would raise the minimum Go those jobs install". It does not: the pin sits below the go directive's resolution, not above it.

    Path Resolves to
    toolchain directive (correct) exactly 1.25.0
    go directive (the regression) latest 1.25.x — 1.25.14 today

    The go directive is untouched, so build-metadata-action's go_go_version_matrix is unchanged and no consumer's version matrix moves. Go 1.25 has 15 published patches, so the gap is permanent and widens with each release — the check cannot decay into a false pass.

    security-workflows#82 publishes the resolved version from both lanes and compares each against the fixture's go.mod, reading the directive at runtime rather than hardcoding a version.

    On the acceptance criteria

    • A fixture exists whose go and toolchain directives resolve to different versions
    • Both lanes' Go legs scan it — the Sonar lane had no version to report (go-test-action exposes none), so Feat: Expose lane outputs and assert on them #82 records the toolchain that reached PATH after its test step
    • The check fails if the go directive's version is installed instead of the toolchain one, naming which lane drifted
    • GOTOOLCHAIN=local preset — not covered, see below

    The one criterion left open

    The final box asked for coverage with GOTOOLCHAIN=local preset, which flips setup-go back to the go directive. That is deliberately not implemented, because on reflection it tests upstream behaviour rather than ours: setup-go documents the fallback, and asserting it here would pin us to an implementation detail we do not control and would have to update when it changes. If a lane ever sets GOTOOLCHAIN itself the calculus changes — neither does today.

    Happy to add it if you disagree; it is a matrix entry, not a redesign.

    A correction worth flagging

    This issue's framing — and D21 as merged — described the defect as failing the scan outright. That was wrong, and #82 corrects it. Checked against Go 1.24.3: a module declaring go 1.23.0 with toolchain go1.25.3 runs go mod tidy to completion under GOTOOLCHAIN=local, exit 0, silently ignoring the toolchain. The error I had quoted comes from the go directive being unsatisfied, which that code path could never cause.

    So the real consequence was a silent downgrade rather than an outage — which is a stronger argument for this issue existing, not a weaker one. An outage would have been noticed without a fixture.

    Also worth correcting: the defect was CLM-only. The Sonar lane always read go.mod through go-test-action. The new assertion still guards both, since either can regress into it.

    Merging #81 first means a dispatch of testing.yaml from #82 exercises the real assertion rather than the skip branch.

  2. ModeSevenIndustrialSolutions commented on Sep 3, 2026

    @ModeSevenIndustrialSolutions
    MemberAuthor

    Ready to close. Both halves landed:

    The fixture — test-go-project gained the directive in test-go-project#81:

     go 1.25
    +
    +toolchain go1.25.0

    The assertion — #82, released in v0.6.0. It covers both lanes, not just the CLM one this issue was raised against: go-test-action reports no version, so the Sonar lane records the toolchain that reached PATH and publishes it the same way.

    Because the check reads the directive from go.mod at runtime rather than comparing against a hardcoded version, it armed itself the moment the fixture merged — no follow-up change was needed here.

    Against the acceptance criteria

    • A fixture whose go and toolchain directives resolve to different versions — 1.25.0 versus the latest 1.25.x, permanently distinct and widening with each patch release
    • Both lanes' Go legs scan it
    • Fails if the go directive's version is installed instead, naming which lane drifted
    • Coverage with GOTOOLCHAIN=local preset

    On the last box: I left it deliberately. It asserts setup-go's own documented fallback rather than anything this repository controls, so it would pin us to an upstream implementation detail and need updating when that changes. If a lane ever sets GOTOOLCHAIN itself the calculus flips — neither does today. Happy to add it as a matrix entry if you disagree.

    Worth a dispatch before the next release

    testing.yaml has not run since the fixture merged, so assert-go-toolchain has never executed its real comparison — until now it took the warn-and-skip branch, by design. The first dispatch is what confirms the whole chain end to end.

    Also worth noting the correction this work produced: D21 originally described the defect as failing the scan outright, which was wrong. Verified against Go 1.24.3, it is a silent downgrade — the scan builds on the older Go and reports success. That makes this fixture more necessary rather than less, since an outage would have been noticed without one.

    Related: #74 remains open for the equivalent submodule gap.

  3. ModeSevenIndustrialSolutions commented on Sep 14, 2026

    @ModeSevenIndustrialSolutions
    MemberAuthor

    Both halves of this now exist; closing

    The issue asks for a Go fixture carrying a toolchain directive, so the lane's version selection is actually exercised rather than assumed.

    The fixture has one. lfreleng-actions/test-go-project at main:

    $ git show origin/main:go.mod | grep -E '^go |^toolchain'
    go 1.25
    toolchain go1.25.0

    Two directives that disagree in kind is the whole point: toolchain outranks go, and a lane passing a version as setup-go's go-version would suppress the file and silently select the wrong one.

    The assertion exists. testing.yaml carries assert-go-toolchain, gated on both lanes' Go legs plus the fixture ref, so it compares what each lane resolved against what the file declares rather than trusting either in isolation.

    That closes the gap D21 was written about — the defect it records was a silent downgrade, exit 0 with nothing said, which is precisely the failure a fixture without a toolchain directive cannot catch.

    One caveat worth recording rather than leaving implicit: testing.yaml is workflow_dispatch-only and needs org credentials, so the assertion runs when someone dispatches it, not on every PR. The coverage exists; it is not continuous.

  4. added a commit that references this issue on Oct 22, 2026
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions