test(core): isolate fixtures from inherited scan roots - #917
Merged
Conversation
Core fixed-count scanner fixtures and materialized parser tests still used the production env-aware entry points. Valid inherited client roots could add files or redirect a fixture away from its TempDir, producing 27 failures in a hostile default-parallel core run. Route pure fixtures through the existing explicit-home strategy, clear only unrelated sibling scan roots from env-specific scanner tests, and use a panic-safe guard for the new environment isolation. Shadow the test parser helper with the no-env strategy while preserving its pricing and cache paths. Dedicated positive environment tests continue to exercise production root resolution. The hostile core suite now passes with 1219 tests passing and one ignored; strict workspace Clippy and all-feature tests also pass. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
junhoyeo
approved these changes
Jul 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This applies the same fixture-isolation principle as #647 to
tokscale-core. Production scanning, parser behavior, cache formats, parser versions, and public APIs are unchanged.Reproduction
With valid hostile roots supplied through
HOME, XDG variables,TOKSCALE_CONFIG_DIR,TOKSCALE_EXTRA_DIRS, client-specific home variables, andTOKSCALE_HEADLESS_DIR, the pre-change default-parallel core suite reported:A focused fixed-count fixture demonstrated the contamination directly:
After this change, the same hostile environment passes with the default parallel runner:
The remaining core integration test binaries also pass under that environment.
Verification
cargo fmt --all -- --checkcargo clippy --locked --workspace --all-features -- -D warningscargo test --locked --workspace --all-featurescargo build --locked --release -p tokscale-clicargo test -p tokscale-corewith the default parallel runnergit diff --checkPlatform boundary
The local environment does not have a Windows Rust target or Windows runner, so the changed
#[cfg(test)]modules were not cross-compiled or executed on Windows. The repository's Windows native checks compile release binaries only and do not compile Rust test modules; those checks therefore provide production compile coverage, not Windows test-code or runtime coverage.Summary by cubic
Isolated
tokscale-coretest fixtures from inherited environment scan roots so env vars can’t alter test inputs. Tests now use explicit-home scanning with a panic-safe env guard; production scanning, parser behavior, caches, and public APIs are unchanged.TOKSCALE_EXTRA_DIRS,TOKSCALE_HEADLESS_DIR) while preserving positive environment coverage.EnvGuardto restore env vars on unwind and shadow the parser test helper to the no-env path to keep pricing/cache behavior. Hostile env run now passes: 1219 passed, 0 failed, 1 ignored.Written for commit ee97d53. Summary will update on new commits.