Source Inventory And Engine Health
Purpose
Source inventory is the shared scan of workspace files that engine-health uses to report architecture, cleanup, validation, and generated-content signals. It classifies source, authored JSON, generated inputs, generated outputs, and test fixtures so budgets can focus on the right files.
Engine-health is the author-facing report for drift and maintenance risk: large files, JSON shape, lint allowances, coupling hotspots, duplicate schema definitions, architecture guardrails, protocol registry drift, validation coverage, compatibility windows, placeholder modules, stale TODO markers, and refactor slices.
Scan Scopes And Classifications
The default scan focuses on source-like files. engine-health can scan authored content or the full workspace with include and exclude filters. JSON shape metrics are classified as source, authored, generated input, generated output, generated, or all. Generated classifications are derived from the shared generated-artifact descriptors.
Steps
- Run
cargo run -p xtask -- engine-health --root . --format markdownfor a readable report. - Use
--format jsonwhen feeding the result into tooling. - Use
--scan-scope authoredwhen debugging authored content budgets. - Use
--fail-on-thresholdswhen the report must gate a change. - Select a quality-gate profile when you need profile-specific cleanup thresholds.
Expected Outputs
Markdown output should summarize the signal groups with enough file paths to act on them. JSON output should expose stable arrays such as json_shape_metrics, module_coupling_hotspots, protocol_registry_drift, and stale_todo_markers. Threshold mode should fail only when observed counts exceed the configured budget.
Common Mistakes
Do not treat generated-output JSON budget failures the same as authored-source failures; the repair path may be a generator change. Do not lower thresholds to hide a real cleanup budget breach. Do not add new validation-sensitive catalogs without tests or fixtures that engine-health can discover.
Recovery Paths
For protocol drift, repair the registry and generated protocol outputs together. For JSON shape failures, split authored source or adjust generated ownership. For coupling hotspots, move shared behavior behind a domain API. For stale TODO or placeholder signals, either finish the work or convert the note into tracked planning outside runtime code.