hermetic-test-suites
Skill1 starsChanged 15 days agoMITView on GitHub
Make test suites deterministic across local, CI, clean checkout, repeated, and randomized runs. Use when tests depend on environment variables, repository files, external services, background work, process-global caches, execution order, or leftover state.
In this repository43 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/adopt-skill-stack.mdcCursor rule
- adopt-skill-stackSkill
- api-and-interface-designSkill
- astrobyte-architectSkill
- astrobyte-git-identitySkill
- astrobyte-modeSkill
- astrobyte-project-startupSkill
- astrobyte-pr-workflowsSkill
- astrobyte-recallSkill
- astrobyte-reviewSkill
- astrobyte-show-workSkill
- astrobyte-tddSkill
- astrobyte-verify-projectSkill
- blast-radiusSkill
- browser-testing-with-devtoolsSkill
- ci-cd-and-automationSkill
- codebase-designSkill
- continual-improvement-checkSkill
- deprecation-and-migrationSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- frontend-designSkill
- frontend-ui-engineeringSkill
- git-workflow-and-versioningSkill
- grillingSkill
- handoffSkill
- observability-and-instrumentationSkill
- performance-optimizationSkill
- pr-feedback-loopSkill
- prototypeSkill
- researchSkill
- security-and-hardeningSkill
- setup-astrobyte-skillsSkill
- shipping-and-launchSkill
- source-driven-developmentSkill
- technical-writingSkill
- to-questionnaireSkill
- typescript-best-practicesSkill
- unslopSkill
- update-skill-stackSkill
- writing-for-agentsSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 9 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Run the failing tests in the developer checkout and a clean checkout from the same commit.
- Distinctive: line 19
default config paths and repository-local data
- Distinctive: line 26
Treat a passing dirty checkout as suspect until the same test passes without its leftover state.
- Distinctive: line 34
use framework-native dependency overrides and restore the previous mapping
- Distinctive: line 36
run workers inline for behavior tests.
- Distinctive: line 39
Keep production defaults at the composition root.
- Distinctive: line 45
Update stale assertions only after isolation is in place.
- Distinctive: line 49
Verify in this order:
- Distinctive: line 57
no unhandled-thread, unraisable, or delayed background exception
≈ “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
Hermetic test suites
Establish the mismatch
Run the failing tests in the developer checkout and a clean checkout from the same commit. Record exact node IDs, environment differences, generated files, warnings, and background failures. Keep stale assertions separate from isolation failures.
The baseline is complete when every observed difference has evidence rather than an assumed CI explanation.
Inventory ambient inputs
Trace each test through the real runtime boundary and account for:
- environment variables and credential discovery
- default config paths and repository-local data
- network clients, cloud SDKs, clocks, randomness, and host services
- process-global caches, singletons, mutable factories, and dependency maps
- background threads, tasks, subprocesses, and delayed exceptions
- writes outside per-test temporary storage
- state left by earlier tests
Treat a passing dirty checkout as suspect until the same test passes without its leftover state.
Build explicit seams
Move nondeterminism to injectable boundaries:
- pass config values or explicit fixture paths
- construct services with injected clients, formatters, clocks, launchers, and storage
- use framework-native dependency overrides and restore the previous mapping
- clear every relevant cache before and after tests
- run workers inline for behavior tests; use a recording launcher when only scheduling matters
- store reusable payloads under the test data tree and load them through fakes
Keep production defaults at the composition root. Core behavior should run without credentials, network access, repository config, or mutable class state.
Patch third-party constructors only at their import boundary when constructor wiring is the behavior under test. Prefer dependency injection for application code.
Repair expectations
Update stale assertions only after isolation is in place. Assert domain results, persisted status transitions, constructor contracts, and scheduled work at their owning seams. Give each API test unique identifiers and use clients as context managers so lifespan cleanup runs.
Prove hermeticity
Verify in this order:
- previously failing node IDs in isolation
- the full suite from a clean checkout with generated directories absent
- the full suite with provider, credential, tracing, and app-config variables removed
- two consecutive full runs
- at least three deterministic shuffled orders
- unchanged repository status and no repository-local writes
- no unhandled-thread, unraisable, or delayed background exception
Make thread and unraisable warnings test errors. A network-blocking plugin is optional evidence, not a substitute for injected dependencies.
The suite is trustworthy when every verification mode agrees and no run depends on state that another run created.
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.

