Code Investigate Test Failure

Table of Contents

When to use this skill

When a unit test is failing and you need to systematically find the root cause from test result XML and log output.

How to use this skill

The full operational procedure is in How do I investigate a test failure?. The skill exists to surface that recipe under a name an LLM session can invoke, and to add the framing decisions a recipe cannot make on its own.

  1. Ask which suite if the user hasn't specified — single suite like ores.accounts.tests, or rat for everything.
  2. Ask whether a specific test or all failures in the suite are in scope. A single failure usually means deep dive; a sweep means catalogue them, then prioritise.
  3. Run How do I investigate a test failure? end-to-end: enable logging → run suite → parse results → walk the investigation order (exception → test source → per-test log → suite log → re-run with trace → targeted debug logging).
  4. When you find the cause, decide:
    • Test bug → fix the test; commit on a feature branch.
    • Production bug → fix the code, and keep the test that surfaced it (or add a tighter one); open a task in the current sprint.
    • Flaky test → file a task with the seed (RNG Seed from the result XML) so it can be reproduced.
  5. Disable logging when you're done — keeps the rest of the test suite fast.

Recipes

Reference

Emacs 29.1 (Org mode 9.6.6)