Skip to content

fix(compile): register #8128's optnone knob as a build-cache input - #8158

Merged
proggeramlug merged 1 commit into
mainfrom
fix/8128-optnone-knob-build-cache
Aug 15, 2026
Merged

fix(compile): register #8128's optnone knob as a build-cache input#8158
proggeramlug merged 1 commit into
mainfrom
fix/8128-optnone-knob-build-cache

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

cargo-test — a required context — is red on main right now.

these codegen env vars key neither the build cache nor an exclusion (#6394's rule):
  ["PERRY_LL_RS4GC_OPTNONE_INSTRS"]

Reproduced on main @ 8b1b4b909, so this is not any open PR's doing. It surfaced while I was triaging #8084's red cargo-test, which turns out to be inheriting this.

Cause

#8128 added the knob. Its description says it was "registered as a build-cache key per #6394" — it was not.

Why BUILD_CACHE_ENV_VARS and not an exclusion

The knob stamps optnone+noinline on any function past its instruction threshold, so flipping it skips the middle-end for that function and changes emitted code. An exclusion asserts the opposite — that a variable cannot change emitted code — so the exclusion list would be the wrong home and would re-break the invariant #6394 exists to hold. Without the entry, changing the threshold leaves the build-level no-op check reporting a match and handing back the previous build's executable.

Verification

  • Failing on main before the change, passing after.
  • cargo test -p perry --bin perry green.
  • The test that caught it is the discriminating one: it enumerates codegen env vars and requires each to key the cache or carry a written exclusion, so it goes red again if a future knob skips registration.

Note this class is invisible to cargo test -p perry --libperry has no lib target, so the test only runs under --bin perry.

Summary by CodeRabbit

  • Bug Fixes
    • Build results now refresh correctly when the garbage-collection optimization setting changes, preventing stale cached builds.

`cargo-test` is red on main. `codegen_env_vars_are_build_cache_inputs`
reports `PERRY_LL_RS4GC_OPTNONE_INSTRS` keying neither the build cache
nor an exclusion.

#8128 introduced the knob and its description says it was "registered as
a build-cache key per #6394" — it was not. The knob stamps
`optnone`+`noinline` on any function past the threshold, so flipping it
skips the middle-end for that function and changes emitted code. It
belongs in BUILD_CACHE_ENV_VARS, not the exclusion list: an exclusion
asserts the variable cannot change emitted code, which is the opposite
of what this one does.

Without it, changing the threshold leaves the build-level no-op check
reporting a match and hands back the previous build's executable.

Verified failing on main at 8b1b4b9 before the change and passing
after; `-p perry --bin perry` green.
@proggeramlug
proggeramlug merged commit ef989f4 into main Aug 15, 2026
8 of 54 checks passed
@proggeramlug
proggeramlug deleted the fix/8128-optnone-knob-build-cache branch August 15, 2026 12:23
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2b3093c2-9cd8-418e-a3b1-985b9bafc372

📥 Commits

Reviewing files that changed from the base of the PR and between 8b1b4b9 and 2cf1a10.

📒 Files selected for processing (1)
  • crates/perry/src/commands/compile/build_cache.rs

📝 Walkthrough

Walkthrough

The build cache input list now includes PERRY_LL_RS4GC_OPTNONE_INSTRS. Changes to this environment variable invalidate build-level cache hits.

Changes

Build cache invalidation

Layer / File(s) Summary
Track RS4GC threshold changes
crates/perry/src/commands/compile/build_cache.rs
The build cache tracks PERRY_LL_RS4GC_OPTNONE_INSTRS changes. This invalidates cached builds when the RS4GC optnone/noinline instruction threshold changes.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related PRs

  • PerryTS/perry#6855: Updates build-cache invalidation for code-generation environment variables.

Suggested reviewers: jdalton

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/8128-optnone-knob-build-cache

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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