dsh-ci-test-reliability
Skill4 starsChanged 13 days agoMITView on GitHub
Design, review, and diagnose DeepSeek Harness tests and fixtures that can fail nondeterministically under concurrent gate execution, shared host resources, clocks, process-global state, subprocesses, network listeners, or asynchronous teardown. Use when adding or changing tests with those risks, investigating flaky tests, or reviewing test isolation; use dsh-pre-push-checks separately to select outgoing commands.
- Reads credentials
9 other projects use a version of this, 7 of them edited.
Adopted by
Most recently taken up by
- Hejunlong27/AIAuditOxedited, first seen Nov 29, 2026
- TeFuirnever/azhou-ai-hubtheir own version, first seen Nov 22, 2026
- qufei1993/skills-hubtheir own version, first seen Nov 1, 2026
- ZeroOnehub/aipm-workbenchedited, first seen Nov 1, 2026
- See-Sol-Lab/DeepSeekGUIedited, first seen Oct 18, 2026
- Yao920127/claude-code-harnessedited, first seen Oct 11, 2026
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 7
- deepseek-ai/deepseek-harness★ 289k91% same
- See-Sol-Lab/DeepSeekGUI★ 27491% same
- SuperJJ007/papermachine★ 5991% same
- Hejunlong27/AIAuditOx★ 691% same
- ZeroOnehub/aipm-workbench★ 291% same
- SparkElf/deepseek-harness-plus★ 191% same
- Yao920127/claude-code-harness★ 191% same
Wrote their own version · 2
- qufei1993/skills-hub★ 1.9ksame name
- TeFuirnever/azhou-ai-hub★ 3same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository32 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .agents/notes/AGENTS.mdAGENTS.md
- .agents/notes/archived/AGENTS.mdAGENTS.md
- .agents/notes/implemented/AGENTS.mdAGENTS.md
- benchmarks/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- packages/AGENTS.mdAGENTS.md
- scripts/AGENTS.mdAGENTS.md
- snapshots/AGENTS.mdAGENTS.md
- vendor/AGENTS.mdAGENTS.md
- website/AGENTS.mdAGENTS.md
- agent-experienceSkill
- cordis-styling-nitpickingSkill
- dsh-archive-agent-notesSkill
- dsh-client-ui-uxSkill
- dsh-code-reviewSkill
- dsh-create-upgrade-guideSkill
- dsh-cua-macos-signingSkill
- dsh-doc-writingSkill
- dsh-error-handlingSkill
- dsh-find-simplificationsSkill
- dsh-merging-stacked-prsSkill
- dsh-official-plugin-artworkSkill
- dsh-pr-descriptionSkill
- dsh-pre-push-checksSkill
- dsh-prose-standardSkill
- dsh-responsive-uiSkill
- dsh-session-projectionSkill
- dsh-speed-up-perfSkill
- dsh-translate-docsSkill
- dsh-trim-cot-leakageSkill
- record-browser-gifSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. 19 are common, 0 are distinctive, and 4 are very specific to this project.
19
Common
Most of the 7 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Common: line 12
Use the testing policy to select unit, coverage, expected-output, snapshot, browser, or real-API evidence.
- Common: line 13
Use the defensive patterns for lifecycle, subprocess, cancellation, and teardown behavior.
- Common: line 14
Read the active Vitest config and the gate runner when their worker or gate topology affects the test.
- Common: line 16
Use dsh-pre-push-checks after the test design is sound to select outgoing validation.
- Common: line 29
Do not serialize an entire suite merely because one fixture lacks isolation.
- Common: line 33
Use the resource owner's allocator instead of checking availability and claiming it later.
- Very specific: line 36
Create private per-test temporary roots with mkdtemp.
- Common: line 38
Use exclusive creation where a path must not already exist.
- Common: line 39
Keep stable recorded identifiers separate from ephemeral transport addresses.
- Very specific: line 45
Treat process.env, cwd, fake timers, locale and timezone, module mocks, registries, console hooks, globalThis, and global fetch …
- Common: line 47
Prefer an injected dependency or instance-local adapter.
- Very specific: line 52
use try/finally around the smallest mutation scope.
- Very specific: line 53
keep an afterEach fallback when failure before the local finally is plausible.
- Common: line 65
Prefer an observation that holds on every platform.
- Common: line 79
Wait for an explicit readiness event, handshake, state transition, owned promise, or externally observable condition.
- Common: line 80
Use deferred promises or barriers to place a race at a deterministic point and prove the relevant operations overlap.
- Common: line 81
Use a timeout only to bound a wait, never as the condition that makes the assertion correct.
- Common: line 82
Do not assert scheduler-dependent ordering unless that ordering is the product behavior under test.
- Common: line 83
When time itself is the subject, inject or fake the clock and always restore real timers.
- Common: line 98
Verify external state, events, files, logs, exits, or disposal instead of trusting the component's self-report.
- Common: line 104
Do not present these as root-cause fixes for deterministic local tests:
- Common: line 124
Run the smallest focused regression for the affected behavior.
- Common: line 131
Before a push, use dsh-pre-push-checks.
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Reliable DSH tests under concurrency
Build tests that remain correct when the repository's gates and test processes run concurrently on one host, not only when run alone on a quiet workstation. This skill owns isolation and reliability decisions; it does not replace the repository's test-tier policy or select every command for a push.
Read the owning rules
- Use the testing policy to select unit, coverage, expected-output, snapshot, browser, or real-API evidence.
- Use the defensive patterns for lifecycle, subprocess, cancellation, and teardown behavior.
- Read the active Vitest config and the gate runner when their worker or gate topology affects the test.
- For recorded-session scenarios, also follow the snapshot instructions.
- Use dsh-pre-push-checks after the test design is sound to select outgoing validation.
Model the execution topology
Assume these layers can overlap unless the active configuration proves otherwise:
- Tests in one Vitest file.
- Separate Vitest files or worker processes.
- Independent Vitest or repository-gate processes in one aggregate.
- Other gate runs and test processes on the same host.
Process isolation does not isolate host ports, predictable filesystem paths, external services, databases, sockets, or inherited child processes. For every acquired resource, identify its owner, atomic allocation mechanism, observable readiness signal, registered cleanup, and quiescent completion signal.
Do not serialize an entire suite merely because one fixture lacks isolation. Narrow the exclusive scope or change the resource allocation first. A sequential Vitest block cannot protect a host resource from another file, process, or gate run.
Allocate resources atomically
Use the resource owner's allocator instead of checking availability and claiming it later.
- Network fixtures bind loopback with
listen(0)and read the assigned address only after the server reports that it is listening. Never scan for a free port and bind it later. - Create private per-test temporary roots with
mkdtemp; do not acquire predictable shared paths. - Give shared databases, sockets, sessions, and output locations unique per-test namespaces.
- Use exclusive creation where a path must not already exist.
- Keep stable recorded identifiers separate from ephemeral transport addresses. Translate inside the fixture instead of forcing the live resource to use the recorded value.
Literal paths and URLs used only as parser inputs or expected values are not acquired resources. Do not rewrite them merely because they look fixed.
Contain process-global state
Treat process.env, cwd, fake timers, locale and timezone, module mocks, registries, console hooks, globalThis, and global fetch interception as exclusive mutable resources.
Prefer an injected dependency or instance-local adapter. When mutation is required:
- capture whether the original value was absent or present;
- restore that exact state;
- register restoration immediately;
- use
try/finallyaround the smallest mutation scope; - keep an
afterEachfallback when failure before the localfinallyis plausible; - intercept the narrowest exact request or call that the fixture owns.
Respect platform-owned semantics
The same suite runs on Windows and on POSIX hosts, and a value the operating system owns does not always come back the way a test wrote it.
- Writing a value back is safe only when the assertion tolerates the write-back failing. Restoring a file's
mtimeto prove that a fingerprint invalidates anyway holds everywhere; restoring it to prove that a record stays valid assumes a lossless round trip, which NTFS's 100-nanosecond ticks do not give a fractional millisecond. When the assertion depends on the restoration, take the expected value from a fresh read rather than from the remembered one. - Windows matches environment variable names case-insensitively, so a fixture seeding
http_proxyandHTTP_PROXYas separate keys holds one entry there. - Windows releases file handles asynchronously, so a rename or removal that completes at once on a POSIX host needs a bounded retry sized to the observed contention.
- Windows has no POSIX permission or signal semantics. A case that depends on them takes an explicit platform skip naming the reason, rather than an assertion weakened everywhere.
Prefer an observation that holds on every platform. When a case genuinely cannot, exclude it on that platform explicitly.
Budget timeouts against the invocation
A describe or case timeout overrides Vitest's --testTimeout instead of yielding to it, so a value below the invocation's budget lowers what that invocation granted — and the same literal reads as a widening on a host whose default is smaller. A suite bound by process creation takes the invocation's budget; a tighter value carries the reason it is tighter.
Raise the hook budget with the test budget. Setup and teardown pay the same contention, so lifting only the case budget moves a contended failure into afterEach.
Where a timeout is the subject, keep the outer wait far larger than the timeout under test. A case proving that a 20 ms deadline fires must not race the harness's own wait, or load decides which deadline reports first.
Synchronize on state
A fixed sleep is not evidence that setup completed or cleanup settled.
- Wait for an explicit readiness event, handshake, state transition, owned promise, or externally observable condition.
- Use deferred promises or barriers to place a race at a deterministic point and prove the relevant operations overlap.
- Use a timeout only to bound a wait, never as the condition that makes the assertion correct.
- Do not assert scheduler-dependent ordering unless that ordering is the product behavior under test.
- When time itself is the subject, inject or fake the clock and always restore real timers.
Dispose to quiescence
Register cleanup immediately after acquisition so assertion failures also release the resource. Cleanup stops new callbacks or requests, detaches listeners, restores global hooks, terminates owned work, and awaits child exit, server close, worker termination, or the equivalent completion signal.
Calling abort(), close(), or kill() without awaiting the owned completion signal is incomplete teardown. When late completion is possible, prove that disposal prevents it from mutating another test.
Prove the intended regression
- Observe an ordinary regression fail before the fix when practical.
- For a new static or corpus guard, temporarily introduce the rejected case and observe the intended failure.
- For a race, use barriers to prove overlap; repeated execution alone is not a race test.
- For ports, sockets, shared paths, subprocesses, or other host resources, run independent test processes concurrently when cross-process isolation is part of the fix.
- Where a fixture spawns with its own deadline, assert that no signal or timeout ended the child before asserting its exit status, so a killed child reports as a timeout instead of as a status mismatch.
- Verify external state, events, files, logs, exits, or disposal instead of trusting the component's self-report.
Stress runs supplement a deterministic regression; they do not replace one.
Reject flake-masking fixes
Do not present these as root-cause fixes for deterministic local tests:
- increasing a timeout without identifying the awaited state;
- adding retries;
- making all files serial;
- swallowing an error or unhandled rejection;
- weakening an assertion;
- normalizing away unstable behavior;
- adding a sleep before cleanup or assertion.
Retries remain valid for documented transient external-provider tests under the real-API policy. Keep that exception at the external boundary.
Restoring a budget is not masking. Raising a suite to the budget it already had, or sizing a bounded retry to the contention actually measured on the host, names the awaited work and returns what the invocation granted; neither invents headroom around an unexamined wait.
Diagnose existing flakes
For an existing probabilistic failure, read the flake diagnosis workflow. A diagnosis-only request remains read-only: report the cause and evidence unless the user also asks for a fix.
Validate and report
Run the smallest focused regression for the affected behavior. Add topology-specific evidence only when the change owns that risk:
- global mutation needs restoration evidence;
- lifecycle or subprocess work needs quiescent teardown evidence;
- ports, sockets, or shared paths need concurrent independent-process evidence;
- a new guard needs a negative control.
Before a push, use dsh-pre-push-checks. Report exact commands and observed results; do not describe retries, skipped tests, or unrun checks as passing.
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.

