Skip to content

fix: key compilation caches on namespace and extern switches - #14929

Merged
TheHypnoo merged 3 commits into
PerryTS:mainfrom
wsafight:fix/compile-env-cache-switches
Nov 18, 2026
Merged

TheHypnoo merged 3 commits into
PerryTS:mainfrom
wsafight:fix/compile-env-cache-switches

Conversation

@wsafight

@wsafight wsafight commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

cargo-test fails the compiler environment audit because PERRY_FACTS_NATIVE_EXTERN and PERRY_NS_PAIRS are read by compilation but omitted from the cache-key inputs. Both switches change the facts or lowering; changing either must invalidate the object and completed-build caches.

Changes

  • crates/perry/src/commands/compile/compile_env.rs: register both switches in the sorted shared cache-input list.
  • docs/src/cli/cache-dir.md: document invalidation when either switch changes, including =0.
  • changelog.d/14929-compile-env-cache-switches.md: record the cache correctness fix.

Related issue

Refs #12582 and CI investigation in #14919. #14898 documents the inherited failure but does not modify these cache inputs.

The independent e2e-scoped failure is fixed by #14928. This cache fix does not include that script change.

Test plan

  • A temporary Cargo harness imports the actual compile_env.rs and its existing compile_env/tests.rs through symlinks, with CARGO_MANIFEST_DIR set to the real workspace crate. On unchanged main it reports 52 passed, 1 failed, naming exactly the two missing switches. With the fix it reports 53 passed, 0 failed (cargo test --offline). The harness is outside the repository and changes no production/test source.
  • rustfmt --check --edition 2021 crates/perry/src/commands/compile/compile_env.rs.
  • python3 scripts/check_test_registration.py.
  • git diff --check.
  • CARGO_HOME=<task-cache> CARGO_TARGET_DIR=<task-target> cargo test --locked --offline --profile perry-dev -p perry --bin perry commands::compile::compile_env::tests -- --test-threads=1 — the actual CLI test binary also reports 53 passed, 0 failed, 1587 filtered out, on macOS arm64 with the pinned toolchain. No runtime symbol shim is used.
  • Upstream cargo-test CI job passes on this PR.
  • Full script-tier lint (SKIP_COMPILE_GATES=1, BASE_SHA=upstream/main, offline task caches) initially reports 18/142 failing commands, with 2 CI-only arms skipped. A clean same-base 2ea9a8be checkout has the same 17 failures except the one-second parity fixture; a separate unchanged parity-runner rerun passes all 52 tests on this branch. No gate, timeout or baseline is weakened. No full-lint pass is claimed.

Checklist

  • No workspace version bump or CHANGELOG.md edit.
  • No cache audit exclusions or gate weakening; both switches affect emitted code.

Summary by CodeRabbit

  • Bug Fixes

    • Changing namespace-lowering or native-extern settings now triggers a rebuild rather than reusing cached results built with different settings.
  • Documentation

    • Clarified that compiler switches, including switches set to 0, affect cache reuse.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The compilation environment cache inputs now include PERRY_FACTS_NATIVE_EXTERN and PERRY_NS_PAIRS. The changelog and cache-directory documentation describe how changing these switches affects cached results.

Changes: Compiler environment cache keys

Layer / File(s) Summary
Add switches to cache inputs
crates/perry/src/commands/compile/compile_env.rs, docs/src/cli/cache-dir.md, changelog.d/14929-compile-env-cache-switches.md
COMPILE_ENV_VARS now includes PERRY_FACTS_NATIVE_EXTERN and PERRY_NS_PAIRS. The cache documentation and changelog state that changing a switch, including setting it to 0, triggers a rebuild instead of reusing cached results.

Estimated code review effort: 2 (Simple) | ~7 minutes

Change: Bug fix

Merge Risk: Minimal · up to 67920

This fix makes changes to PERRY_FACTS_NATIVE_EXTERN and PERRY_NS_PAIRS invalidate cached objects and completed builds, so stale outputs are no longer reused. The change is small and reversible, and I found no remaining merge-blocking risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: compilation caches now key on the namespace and native-extern switches. It matches the summary, the cache-key list change, and the stated objective. The title is short…
Description check Passed The description follows the template's sections: Summary, Changes, Related issue, Test plan, and Checklist. The Summary states the cause and the fix. Changes lists the three touched files. The Related…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: compilation caches now key on the namespace and native-extern switches. It matches the summary, the cache-key list change, and the stated objective. The title is short and specific. The 'fix:' prefix follows the repository convention.

Full details: Description check

Explanation

The description follows the template's sections: Summary, Changes, Related issue, Test plan, and Checklist. The Summary states the cause and the fix. Changes lists the three touched files. The Related issue section gives references. The Test plan lists commands run and their results, with the lint gate reported as not passing. The Type of change, Platforms, and Tested on sections are not filled in. The description does not mark a type of change or platform. It states the platform only in the test plan text (macOS arm64). The Checklist items are ticked. One Test plan item is unchecked and explained.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ad784550-7a84-4081-b0b0-14ab7984225e
Commits

Reviewing files that changed from the base of the PR and between d6da0c0 and 67920f0.

Files selected for processing: 1

  • docs/src/cli/cache-dir.md
Files skipped from review as they are similar to previous changes: 1

  • docs/src/cli/cache-dir.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@wsafight
wsafight marked this pull request as ready for review November 17, 2026 16:18
@TheHypnoo TheHypnoo added area:tooling-ci CLI driver, scripts, CI, release effort:S Hours: one local fix impact:high Common programs break, platform or CI blocked status:verify-fixed Looks fixed on main; verify and close type:bug Confirmed defect or regression labels Nov 18, 2026
@TheHypnoo
TheHypnoo merged commit 5e3eb7d into PerryTS:main Nov 18, 2026
125 of 133 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tooling-ci CLI driver, scripts, CI, release effort:S Hours: one local fix impact:high Common programs break, platform or CI blocked status:verify-fixed Looks fixed on main; verify and close type:bug Confirmed defect or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants