Skip to content

ci: pin explicit toolchain input on both Rust setup steps - #486

Open
atanishka308 wants to merge 4 commits into
lacs-project:mainfrom
atanishka308:fix-ci-rust-toolchain-input
Open

atanishka308 wants to merge 4 commits into
lacs-project:mainfrom
atanishka308:fix-ci-rust-toolchain-input

Conversation

@atanishka308

@atanishka308 atanishka308 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Summary

dtolnay/rust-toolchain is given components but no toolchain input in two places in .github/workflows/ci.yml: the rust job and the postgres-contract job. The trailing # stable (branch) comment documents intent but has no effect on the action itself — it's just a YAML comment. dtolnay/rust-toolchain currently resolves a default toolchain successfully — CI is green today. But under a SHA pin, the point is to remove dependence on anything that could resolve or drift later; leaving toolchain: implicit means the pinned step still silently depends on the action's own default-resolution behavior, which is exactly what the pin is meant to eliminate. Naming it explicitly is what every other input in this file already does.
Fixed both spots:

  • rust job's "Set up Rust" step — added toolchain: stable alongside the existing components: rustfmt, clippy
  • postgres-contract job's "Set up Rust" step — added a new with: block containing toolchain: stable (it previously had no with: at all)

Related Issue

No tracked GitHub issue for this specific CI bug. It was discovered as a failing "Set up Rust" step on PR #445's CI checks (which addresses issue #218, syslog enterprise_number config) — an unrelated change that just happened to trigger this broken toolchain input. This fix is independent of #445's content and not itself tied to #218.

Validation

  • Tests added or updated
  • Documentation updated if behavior changed
  • Security impact considered
  • Trust boundary preserved (daemon remains the only privileged executor)
  • CI passes

Notes for Reviewers

No tests added — this is a CI configuration fix, and the failure only reproduces inside the GitHub Actions runner environment; it can't be validated locally. The real verification is this PR's own rust and postgres-contract jobs actually getting past their "Set up Rust" steps.

No documentation change needed (internal CI config only) and no security/trust-boundary impact (workflow setup step, not application code) — checked those boxes to reflect that they were considered, not left unchecked by oversight.

@vladimirrott vladimirrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is right and I want it. Under a SHA pin the action cannot read stable off the ref it was called by, so leaving the toolchain implicit makes the pinned step depend on something the pin was supposed to remove. Naming it is what the rest of this file does for every other input.

The reasoning in the PR body is not right, though, and I would rather correct it here than let it into the log.

Without an explicit toolchain: key, the action fails while parsing/installing rustup, before any repository command runs, breaking CI for every PR.

CI is green on this pull request, including rust and postgres-contract, the two jobs the diff touches. It was green on #463, which I merged an hour ago on the unmodified steps. Nothing is broken today: dtolnay/rust-toolchain resolves a default and the runners get a usable stable toolchain. What your change buys is that the step stops depending on that resolution, which is worth having on its own and does not need a failure to justify it.

One mechanical thing before I merge. The diff also changes the pin comment spacing on both lines:

-        uses: dtolnay/rust-toolchain@4cda84d5...  # stable (branch)
+        uses: dtolnay/rust-toolchain@4cda84d5... # stable (branch)

Every pinned action in that file uses two spaces:

$ grep -cE 'uses: .*@[0-9a-f]{40}  # ' .github/workflows/ci.yml
16
$ grep -cE 'uses: .*@[0-9a-f]{40} # ' .github/workflows/ci.yml
0

Your diff makes two of eighteen differ, and it is almost certainly an editor rather than a decision. Put the second space back and rewrite the summary to say what the change actually does, and I will merge it. If you would rather not spend another round trip on whitespace, say so and I will fix both at merge and write the CHANGELOG line myself.

Nothing else to raise. Two lines, both in the right place, and you found something real by reading a pin rather than by waiting for it to bite.

You are already carrying #440 and #218, so I am not putting anything else on you. Get #445 over the line first; the rust failure there is on your side of the diff and I will look at it properly this week.

@atanishka308

Copy link
Copy Markdown
Contributor Author

Fixed the description above — the original justification was wrong, and you were right to correct it: dtolnay/rust-toolchain resolves fine on its own, nothing is broken today. The actual reason to name toolchain: explicitly is that a SHA pin is supposed to remove dependence on anything that could resolve differently later, and leaving it implicit undercuts that.

On the spacing: I checked the current file directly (Select-String against both lines) and both already have two spaces before # stable (branch), matching the rest of the file's pinned actions. Not sure if that was already fixed in an earlier commit or if the diff you saw was against a slightly different snapshot — happy to double check anything specific if it's still showing differently on your end.

@vladimirrott vladimirrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 8fac9371. Thanks for rewriting the summary. The new wording says what the change does: it names toolchain: stable so the pinned step stops depending on the action's own default.

On the spacing, I think you checked a different copy from the one on the branch. GitHub's diff for this PR still shows one space on both lines:

$ gh api repos/lacs-project/sysknife/pulls/486/files --jq '.[].patch' | grep -n 'rust-toolchain@' | cat -A | cut -c1-140
5:-        uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4  # stable (branch)$
6:+        uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable (branch)$
16:-        uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4  # stable (branch)$
17:+        uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable (branch)$

The only non-merge commit on the branch is 636c14f from yesterday, so the fix may be sitting in your working copy unpushed. git log origin/fix-ci-rust-toolchain-input -1 -p -- .github/workflows/ci.yml will show what GitHub has.

It is whitespace, and I don't want it to cost you another round, so I'm approving as is and will put the second space back when I merge. The "Related Issue" section still describes a failing "Set up Rust" step. Trim that if you like, but it doesn't hold anything up.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants