nested-build-isolation
Skill2 starsChanged 10 days agoMITView on GitHub
Diagnose and safely isolate nested build, test, and coverage subprocesses (e.g., Cargo running inside cargo test, cargo llvm-cov, or cargo nextest) that fail due to inherited environment variables, target directory collisions, compiler flags, or generated .profraw litter. Use this skill when subprocess builds fail only under coverage/instrumentation, produce inaccurate coverage summaries, or inherit outer toolchain settings. Not for ordinary single-process test failures, unit test debugging without nested subprocesses, or non-nested build issues.
In this repository63 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .agents/skills/avoid-ai-writing/AGENTS.mdAGENTS.md
- .agents/skills/do-web-doc-resolver/AGENTS.mdAGENTS.md
- .agents/skills/skill-evaluator/AGENTS.mdAGENTS.md
- scripts/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms-full.txtllms.txt
- llms.txtllms.txt
- accessibility-auditorSkill
- agent-browserSkill
- agentic-abstentionSkill
- agents-mdSkill
- api-design-firstSkill
- architecture-diagramSkill
- avoid-ai-writingSkill
- cicd-pipelineSkill
- cloudflare-worker-apiSkill
- codacySkill
- codeberg-apiSkill
- code-review-assistantSkill
- css-render-performanceSkill
- database-devopsSkill
- debuggerSkill
- delegateSkill
- dependency-upgradesSkill
- dist-channel-selectionSkill
- docs-hookSkill
- document-rendering-and-locatorsSkill
- dogfoodSkill
- dora-reportSkill
- do-web-doc-resolverSkill
- durable-objectsSkill
- eu-ai-act-complianceSkill
- git-github-workflowSkill
- goap-agentSkill
- implementerSkill
- intent-classifierSkill
- iterative-refinementSkill
- jules-delegatorSkill
- learnSkill
- lifecycle-managementSkill
- local-context-sanitizationSkill
- memory-contextSkill
- migration-refactoringSkill
- privacy-firstSkill
- progressive-deliverySkill
- pwa-offline-syncSkill
- reader-ui-uxSkill
- readme-best-practicesSkill
- secrets-managementSkill
- secure-invite-and-accessSkill
- security-code-auditorSkill
- shell-script-qualitySkill
- skill-creatorSkill
- skill-evaluatorSkill
- static-analysisSkill
- testing-strategySkill
- test-runnerSkill
- triz-solverSkill
- turso-dbSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 31
When a test spawning a subprocess fails, determine if it fails only under an outer instrumentation or test runner session (such as cargo …
- Very specific: line 38
Do not scatter ad hoc environment unsets (env::remove_var or command env_remove) across individual tests.
- Very specific: line 58
Never Fix by Deleting or Skipping: Do not "fix" an instrumented-only test failure by deleting the test, adding #[ignore], or removing …
- Distinctive: line 60
Never Disable Sensors: Do not disable coverage or telemetry sensors to force a passing result.
- Distinctive: line 62
Unmeasured Is Not Passed: Treat skipped, quarantined, or unmeasured test runs as unmeasured—never fabricate coverage numbers.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Nested Build Isolation
Isolate nested build, test, and coverage subprocesses when invoked inside an outer build, coverage runner, or instrumentation session.
Source Attribution: Adapted from the
do-harnessnested-build-isolation skill for portable use across software repositories.
Quick Start Checklist
- Identify the outer runner (
cargo test,cargo llvm-cov,cargo nextest). - Inspect env vars passed to child processes (
CARGO_TARGET_DIR,RUSTFLAGS). - Centralize child process environment sanitization in a dedicated helper.
- Direct child process target and output files to isolated temporary dirs.
- Parse coverage metrics from structured reports (e.g. JSON report output).
- Verify tests pass both standalone and under outer instrumentation.
Core Principles
1. Identify Outer Environment Before Patching Tests
When a test spawning a subprocess fails, determine if it fails only under an
outer instrumentation or test runner session (such as cargo llvm-cov or
cargo nextest). Subprocesses inherit outer environment variables, compiler
flags, and target paths that cause unexpected build failures or collisions.
2. Centralize Child Process Environment Sanitization
Do not scatter ad hoc environment unsets (env::remove_var or command
env_remove) across individual tests. Create a centralized helper function to
sanitize child process environments consistently.
Key variables to strip or isolate for nested Rust/Cargo invocations:
CARGO_TARGET_DIR— Prevent target directory lock contention.RUSTFLAGS/CARGO_ENCODED_RUSTFLAGS— Strip outer instrumentation flags.LLVM_PROFILE_FILE— Avoid filename collisions in nested binaries.CARGO_MAKEFLAGS/CARGO_FLAGS— Avoid outer jobserver inheritance.
3. Stable Report Parsing Over Unstructured Stdout
Tool stdout summary text (e.g., human-readable progress tables) is subject to
formatting changes across tool versions and environment settings. Prefer
generating and parsing machine-readable coverage reports (such as cargo
llvm-cov --json or LCOV reports) to obtain deterministic measurements.
4. Non-Negotiable Quality Safeguards
- Never Fix by Deleting or Skipping: Do not "fix" an instrumented-only
test failure by deleting the test, adding
#[ignore], or removing assertions. - Never Disable Sensors: Do not disable coverage or telemetry sensors to force a passing result.
- Unmeasured Is Not Passed: Treat skipped, quarantined, or unmeasured test runs as unmeasured—never fabricate coverage numbers.
Rationalizations
| Rationalization | Reality |
| | |
| "The nested test fails under cargo llvm-cov, so I'll add #[ignore]." | Ignoring tests masks environment leaks and degrades test confidence. |
| "I can parse line coverage from stdout summary tables." | Stdout format varies across tool releases; JSON reports provide stable contracts. |
| "Unsetting RUSTFLAGS in one test function is sufficient." | Centralized sanitization helpers ensure consistent isolation across all tests. |
Red Flags
- Adding
#[ignore]or skipping tests under coverage/instrumentation - Removing sensors or disabling coverage checks to suppress build errors
- Parsing coverage percentages from stdout/stderr text rather than JSON
- Scattering ad hoc
env_removecalls across tests instead of a helper
Detailed References
- For Cargo environment variables, helper implementations, and report parsing examples, see references/cargo-isolation.md.
See Also
test-runner— Executing and debugging test suites.testing-strategy— High-level test architecture and coverage planning.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

