Skip to content

ci: pre-build SP1 core runner binary so clippy doesn't break on cache hits#140

Merged
prajwolrg merged 1 commit into
mainfrom
ci-exclude-sp1-from-clippy
Jun 7, 2026
Merged

ci: pre-build SP1 core runner binary so clippy doesn't break on cache hits#140
prajwolrg merged 1 commit into
mainfrom
ci-exclude-sp1-from-clippy

Conversation

@prajwolrg
Copy link
Copy Markdown
Collaborator

@prajwolrg prajwolrg commented Jun 7, 2026

Description

The clippy lint job runs cargo clippy --all-features, which pulls the SP1 prover path (sp1-sdksp1-core-executor-runner) into the lint graph. That crate's build.rs runs a nested cargo build and embeds the result via include_bytes!(env!("SP1_CORE_RUNNER_BINARY")). Because cargo clippy runs every build script in the graph, the native build executes even for a lint — and it breaks intermittently on a Swatinem/rust-cache hit: the helper binary is written under the registry source dir (which the cache does not preserve), while the build-script output recording its path is cached, so cargo skips the rebuild and include_bytes! fails with "couldn't read …". This surfaced as a non-deterministic clippy failure (Lint check) on the SP1 6.2 bump (#102).

The crate's build.rs honors a SP1_CORE_RUNNER_OVERRIDE_BINARY env var (source-only — not in its README/docs, but a deliberate "override mode" branch in build.rs): when set it skips the nested build and points the runtime at an external binary. This PR pre-builds the helper into $RUNNER_TEMP and sets that var. It is cache-stable and keeps the heavy native build out of the lint, rather than forcing a rebuild each run. The same step replaces the existing cargo clean workaround in prover.yml so both workflows use one consistent approach.

The helper version is read from Cargo.lock rather than the sp1-sdk requirement: sp1-sdk = "6.2.0" is a caret that floats up to 6.2.2 in the lock, and the prebuilt helper must match the linked runner crate.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Notes to Reviewers

  • lint.yml's clippy command is unchanged, so coverage stays complete and within the required Check that lints passed gate — only the SP1 helper pre-build is added.
  • The pre-build step does not install the SP1 (RISC-V) toolchain: sp1-core-executor-runner-binary is a host crate, so cargo install builds it with the standard toolchain. If a runner ever shows it needs sp1up, that is the one thing to revisit.

Related Issues

Jira: STR-3722 (surfaced while working on the manifest-MMR reorg branch; this is an unrelated CI fix split out so it can land on main independently).

@prajwolrg prajwolrg force-pushed the ci-exclude-sp1-from-clippy branch from 39d8056 to ac7ac74 Compare June 7, 2026 04:14
@prajwolrg
Copy link
Copy Markdown
Collaborator Author

@codex review

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@prajwolrg prajwolrg marked this pull request as ready for review June 7, 2026 04:21
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac7ac747bf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/lint.yml Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 7, 2026

Commit: 92cfba9
SP1 Execution Results

program cycles gas
asm-stf 136,367,055 141,452,326
moho 5,223,555 5,525,314

The clippy job runs `--all-features`, which pulls `sp1-core-executor-runner`
into the lint graph. Its build.rs runs a nested `cargo build` and embeds the
result via `include_bytes!(env!("SP1_CORE_RUNNER_BINARY"))`. Since clippy runs
build scripts, that native build executes even for a lint, and it breaks on a
`Swatinem/rust-cache` hit: the helper binary lives under the registry source
dir (not preserved by the cache), while the build-script output recording its
path is cached, so cargo skips the rebuild and `include_bytes!` can't read it.

The crate's build.rs honors a `SP1_CORE_RUNNER_OVERRIDE_BINARY` env var
(source-only; not in its README/docs): when set it skips the nested build and
points the runtime at an external binary instead. A `prebuild-sp1-runner`
composite action pre-builds the helper into `$RUNNER_TEMP` and returns its
path as an output; lint.yml and prover.yml set it as the override env only on
the steps that compile the crate. Returning a path rather than writing
`$GITHUB_ENV` keeps the override scoped to those steps instead of the whole
job. This is cache-stable and keeps the heavy build out of the lint, unlike
the previous `cargo clean` workaround it replaces in prover.yml.

The helper version is read from Cargo.lock, not the `sp1-sdk` requirement,
which is a caret that floats up to a later patch in the lock.
@prajwolrg prajwolrg force-pushed the ci-exclude-sp1-from-clippy branch from ce40d6b to 7c9c43f Compare June 7, 2026 04:54
@prajwolrg prajwolrg merged commit 35fd61e into main Jun 7, 2026
23 of 24 checks passed
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.

1 participant