refactor(flow): expose shared checkout report builders

Merged
TH
12d ago
+308-30

Closes #348

Summary

Extract pure typed builders for the version-one checkout report and wire the existing CLI writer to them, so library consumers get the same wire contract without duplicating it.

  • createFlowCheckoutReport(result) — full coverage report (--report)
  • createFlowPartialReport(result) — omission-only report (--partial-report)
  • Both are exported from the package root, together with FlowCheckoutReport / FlowPartialReport types

Behavior preserved

  • Schema version, field set, JSON key order, and deterministic omission ordering are unchanged — the CLI serializes the exact same JSON as before
  • Omission arrays are copied and sorted (object, component, diagnostic, source transport); input is never mutated
  • Unknown inventory stays unavailable: the full builder omits inventory / inventoryResolutions / absentObjects rather than inventing them; indexedOnly is normalized to a boolean
  • An empty skipped list alone does not imply a complete snapshot; no completeness status is introduced
  • No new CLI command or MCP surface, no dependency changes

Testing

  • New packages/adt-flow/tests/checkout-report.test.ts covers: full wire contract, unknown-vs-verified-empty inventory, base/index-only retention, partial-report shape, deterministic ordering independent of input order (and input immutability)
  • Full adt-flow suite: 96/96 passing, including CLI report output
  • Package build, typecheck, lint and format checks pass

Included drive-by fix

Widening the affected scope surfaced two latent typecheck errors that main's CI never typechecked (these packages were not affected on main, so the errors never ran): a bare resolve() in packages/adt-atc/src/resolvers/abapgit.ts (the module already imports resolve as resolvePath) and a missing parse import in packages/adt-mcp/src/lib/http/multi-system.ts. Both fixed mechanically; no behavior change.

Summary by Sourcery

Expose shared checkout report builders so library consumers and the CLI produce the same version-one report contract.

New Features:

  • Expose typed, pure builders for full and partial version-one checkout reports from the adt-flow package root.

Bug Fixes:

  • Fix latent typecheck errors in ATC path resolution and MCP multi-system HTTP imports.

Enhancements:

  • Reuse the shared report builders in the existing CLI writer while preserving the current wire contract and storage behavior.
  • Ensure report omission ordering is deterministic, inputs remain unchanged, unavailable inventory stays absent, and index-only status is represented accurately.

Documentation:

  • Document the public checkout report builders and their coverage semantics in the adt-flow README.

Tests:

  • Add coverage for report shapes, inventory availability, index-only and base modes, deterministic ordering, and input immutability.

Chores:

  • Add OpenSpec requirements and implementation documentation for the shared checkout report builders.