Hoc test execution

From openreachtech/hora-skills-ort-core · View interactive version

Hoc test execution is an AI agent skill from the GitHub repository openreachtech/hora-skills-ort-core. Run a project's test cases and drive them to green without weakening them — no test skipped, deleted or loosened to make the suite pass. Use this skill whenever tests are run, whenever a test still fails after an implementation was believed finished, and before claiming an implementation is complete

How to use this skill

Skill file

Test Execution

A skill for running the test cases and resolving what they report.

The failure this skill exists to prevent is not "the tests fail". It is what usually happens next:

changing the test until it stops failing. A suite that was changed until it passed reports nothing,

and the next defect ships behind a green run.

Core principle: a failing test is a result, not an obstacle

The test is a statement about required behavior. When it fails, exactly one of two things is true:

the behavior is wrong, or the statement is wrong. **Deciding which one — with evidence — is the

work.** Everything else is just routine detail.

implementation encodes what was required; the implementation is the newer, less-reviewed

thing.

expectation is wrong. Not because the implementation disagrees with it — the implementation

disagreeing with it is the failure.

The loop

run the whole suite
      │
      ▼
any failure? ──no──▶ report the run's own summary ──▶ done
      │yes
      ▼
take ONE failure
      │
      ▼
read its actual output (message, diff, stack, the assertion that failed)
      │
      ▼
classify it  ──────▶  see references/failure-triage.md
      │
      ▼
fix the thing the classification names — never the test unless the class is "test defect"
      │
      ▼
re-run that one test ──fails──▶ back to reading the output (do NOT try a second change on top)
      │passes
      ▼
re-run the whole suite ──▶ back to the top

change did what, and routinely leaves two of them wrong.

breaks two other tests is a worse state than the one it started from, and only the full run

shows it.

then change one thing.

Before running anything

  1. Discover how this project runs its tests. Read package.json scripts and the test

configuration. Use the project's own command; do not invent one.

runner invoked directly — <the project's test script> -- <path or pattern>. The script is

not a convenience wrapper; it carries what the runner needs, and a runner started beside it

starts without it.

without the flag its project's script exports, reported a file under node_modules as

unloadable and offered three fixes — add a compiler, widen a configuration key, raise the

platform version. All three are work on the project; none was the cause. The symptoms are

an environment problem's, so triage sends the reader hunting a setup that was never broken.

Confirm the command was the project's own before classifying any failure.

  1. Discover whether the project has more than one suite and whether order matters. Many

projects separate tests that touch no persistent state from tests that write to a store, and

require them to run in a defined order. Running them the wrong way produces failures that

have nothing to do with the code.

  1. Discover what the suite needs to be present — an environment file, a database, a

migration applied, a seed set loaded. A missing prerequisite produces failures that look like

defects.

  1. Run the suite once before changing anything, to establish which failures were already

there. A pre-existing failure attributed to the current change wastes the whole session.

  1. Size the run to the machine, not to its listed specifications. Most runners execute test

files in parallel workers — one per core by default — and each worker is a full process using

its own memory. That default assumes an idle machine; a real one is running an editor, a browser,

a local database, and sometimes a full E2E stack, all using memory before the suite starts.

Before a full run, account for what else is resident and how much memory and CPU are **actually

free — not how much is installed. When the machine is constrained, dial the parallelism

down (the runner's max-workers lever, halved and re-run) or run serially** (the runner's

in-band / single- worker mode) rather than letting the operating system kill a worker — or

another process — under the load. A serial run that finishes beats a parallel one that dies

halfway. The concrete flags and the way to weigh workers against available memory belong to the

project's test-running convention; the principle here is to **look at the machine before choosing

the parallelism**, not after it dies.

Read the actual output

stack frame in the project's own code. All four.

to check; the output says what happened.

and read it.

isolation, print the actual value, or run with the project's verbose option. Guessing costs

more than one extra run.

Changing a test is a specification decision

A test expectation may be changed only in these two cases, and the report must say which.

| Case | What must be true |

| :-- | :-- |

| The test contradicts a written acceptance criterion | Quote the criterion id and its text in the report. The test was wrong; the implementation may be right |

| The specification itself changed | The requirement document records the change. Until it does, the test stands |

In every other case the test stands and the implementation changes. "The implementation is

obviously right and the test is out of date" is not one of the two cases — it is the

rationalization this rule exists to stop.

Prohibited ways to make a test pass

These are never acceptable, including "temporarily". See

prohibited-fixes.md for what to do instead in each case.

from an expected object, widening a matcher until it stops discriminating.

have.

path is no longer exercised.

Reusing a recorded pass is not one of these — why, when it is allowed, and what a reused pass

must be reported with belong to /hoc-test-cache.

Breaking the letter of these rules breaks their spirit too. A suite whose failures were silenced

is worse than no suite, because it is believed.

Rationalization table

Every one of these appears when a suite will not go green. Each one means: stop and triage.

| Rationalization | Reality |

| :-- | :-- |

| "The test is out of date" | Then a written criterion says so. Quote it, or the test stands |

| "The implementation is obviously correct" | Obvious is what the test is there to check. Read the criterion |

| "It's flaky, just re-run it" | Flaky means order-dependent or racing. That is a defect, in the test or the code. Diagnose it |

| "I'll skip it and come back" | Nobody comes back. A skipped test is a deleted test with extra steps |

| "It only fails on CI" | Then the difference between the environments is the finding. Find it |

| "The assertion is too strict" | The assertion is the specification. Strictness is the feature |

| "I'll widen the timeout, the machine is slow" | Timeouts hide races. Find what is not being waited for |

| "Just this one test, the rest pass" | The rest passing is what makes the one failure informative |

| "It's a pre-existing failure, not mine" | Say so in the report, with the run that proves it. Do not silence it |

| "Nobody will notice" | The next defect behind this test will slip by too. That is the cost |

Red flags — stop and triage

All of these mean: revert the edit, read the output, classify the failure.

Reporting the run

Build the report from the run's own output, not from memory.

  1. The command that was run, exactly as executed, and which suite it covers.
  2. The run's own summary line — the suite and test counts as the runner printed them.

Paste it; do not paraphrase it.

  1. Per failure resolved: the test, the classification, what was actually wrong, what was

changed, and — when a test expectation was changed — the acceptance criterion id that

justified it.

  1. Failures still open, with their classification and what is needed. Never omit these.
  2. Pre-existing failures, separated from the ones this work caused.

State that the suite passes only when the run's summary is in the report. **A claim of green without

the output is an unverified claim**, and the whole point of running the tests was to stop making

unverified claims.

Detail files

each class means, what to inspect, and how to confirm the classification before acting.

and the correct handling of the situation that tempts it.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.