Skip to content

fix(cache): PERRY_SEGVIEW keys the build cache, PERRY_SEGVIEW_DIAG is a recorded diagnostic exclusion — fixes codegen_env_vars_are_build_cache_inputs on main - #9971

Closed
proggeramlug wants to merge 1 commit into
PerryTS:mainfrom
proggeramlug:fix/segview-env-vars-build-cache-inputs

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Small fix on origin/main for the one unit test that has been red in CI's cargo-test on main: commands::compile::build_cache::tests::codegen_env_vars_are_build_cache_inputs.

Why

The segment-view lowering (#9893, landed via the merge train) reads two environment variables in codegen that were registered neither as build-cache key inputs nor as exclusions. PERRY_SEGVIEW selects the lowering, so a compile with a different value could be served a stale cached object — the same class of silent staleness the build-cache inventory test exists to prevent.

What changes

  • PERRY_SEGVIEW is a build-cache input (crates/perry/src/commands/compile/build_cache.rs); it is read in crates/perry-codegen/src/collectors/segview.rs and gates the lowering.
  • PERRY_SEGVIEW_DIAG is an explicit diagnostic-only exclusion with its reason recorded; its read only toggles diagnostics and does not change emitted code.
  • A real cache test in crates/perry/tests/native_link_cache.rs: compiling the same program with PERRY_SEGVIEW=0 then =1 must miss both the build and the object cache. Sabotage (registration removed) fails with an erroneous manifest match.
  • Changelog fragment.

Verified locally

Scoped build-cache units 4 passed; the perry binary's unit tests 1,089 passed; the new cache test passes; rustfmt and diff-check clean. (perry has no library target, so the gates ran as --bin perry.)

https://claude.ai/code/session_011dhBmdn4vGgNibjo3oZqTo

Include PERRY_SEGVIEW in the build-cache environment fingerprint so
switching the lowering cannot reuse a binary built under the other mode.
Record PERRY_SEGVIEW_DIAG as diagnostics-only, and cover the real cache
miss with a qualifying Intl.Segmenter compile.

Claude-Session: https://claude.ai/code/session_011dhBmdn4vGgNibjo3oZqTo
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 38b4f87b-33c9-4d05-8f78-c8a3fc4465f6

📥 Commits

Reviewing files that changed from the base of the PR and between 8b7dc33 and 9929ed0.

📒 Files selected for processing (3)
  • changelog.d/9971-segview-build-cache-input.md
  • crates/perry/src/commands/compile/build_cache.rs
  • crates/perry/tests/native_link_cache.rs

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.

@proggeramlug

Copy link
Copy Markdown
Contributor Author

Landed on main via merge train #9978. Validated as a tree: 77 of 80 lint gates pass, and perry-runtime/codegen/hir/stdlib all green (5,980 tests, 0 failures).

The three non-passing gates are accounted for: public-baseline is pre-existing on main (verified on a pristine worktree; red since 2026-07-29), and the two API docs gates are an artifact of this session's CARGO_TARGET_DIR override — regen_api_docs.sh hardcodes $ROOT/target/release/perry. With the binary placed where the script expects, regeneration succeeds and the drift check is clean. Thanks!

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