Auto-diagnose test gaps from file changes and track test outcomes

Overview

Fix-test keeps a project's tests in step with its source. It turns file-system events into a prioritized, partly auto-executable maintenance plan, and it records what actually ran so the next plan can reason about staleness and coverage gaps.

Two modules cooperate:

Fix-test is not a test generator — it decides what test work a change implies and whether it can run unattended. It is reached as the /fix-test skill; there is no dedicated attune CLI subcommand. This page documents the Python API you call directly when wiring test maintenance into a hook, a CI step, or a custom tool.

Concepts

From a file event to a plan

TestMaintenanceWorkflow is the coordinator. Construct it with a project root, then drive it one of two ways:

  1. Event handlerson_file_created, on_file_modified, and on_file_deleted each take a single file_path and return a dict describing the test work that change implies. These are the integration point for a file-watcher or a git hook.
  2. run(context) — generates a whole-project TestMaintenancePlan in one of four modes (analyze, execute, auto, report).

Both paths lean on the same building blocks:

Type What it represents
TestPlanItem One unit of test work: file_path, the action (TestAction), the priority (TestPriority), a reason, an optional test_file_path, an estimated_effort string, an auto_executable flag, and a free-form metadata dict.
TestMaintenancePlan The assembled plan: generated_at, the list of items, a summary dict, and options. Filter it with get_items_by_action, get_items_by_priority, or get_auto_executable_items.
TestAction What to do with a test — one of CREATE, UPDATE, REVIEW, DELETE, SKIP, MANUAL.
TestPriority How urgent — one of CRITICAL, HIGH, MEDIUM, LOW, DEFERRED.

The two modules fit together

Async vs sync — the one thing to get right

The workflow's event and run surface is asynchronous; everything else is a plain function call:

Two functions named get_files_needing_tests

Mind the namespace: there is a module-level test_runner.get_files_needing_tests(stale_only=False, failed_only=False) that reads telemetry records, and a TestMaintenanceWorkflow.get_files_needing_tests(limit=20) method that reads the project index. They are different functions with different signatures and return types — import or call the one you mean.

Notes & tips