feat(adt-flow): add incremental transport checkout

Merged
TH
1mo ago
+5589-421

Summary

Adds the Git-independent @abapify/adt-flow core and delivery surfaces for exact transport base/head trees. Existing SAP objects appear as modifications, moves, or deletions instead of pseudo-creations.

This PR includes the stacked foundation slice (format tree materialization) plus the transport checkout core and CLI/MCP delivery surfaces.

Scope

  • introduces public @abapify/adt-flow
  • adds typed root flow configuration and adt flow checkout tr <TR[,TR...]> [--base]
  • binds the shared service to authenticated ADT manifest, immutable source, object, and package metadata operations
  • materializes base-before-earliest-scope or head-newest-in-scope selections
  • stores deterministic .adt/tr and .adt/objects descriptors with hashes and version identities
  • reconciles create, update, package move, delete, and no-op without invoking Git
  • exposes confined flow_checkout_tr MCP parity over the same service
  • adopts format-recognizable files when descriptors do not exist
  • rejects inexact manifests, divergence, traversal, duplicate ownership, unowned collisions, and portable case collisions before writes
  • explicitly defers historical commit replication and metadata reconstruction

Incremental evidence

  • exact repeated head: zero SAP calls and zero writes
  • indexed base: one metadata-only manifest, zero object/package/source calls
  • deleted .adt: same source tree with expected extra source read
  • first-observed deletion: existing format files are removed without a prior descriptor
  • package reassignment: old-path removals plus new-path writes, reported only as moves
  • local Git fixture: one modification, one 100% rename pair, one deletion pair, and a transport descriptor

Verification

  • adt-flow behavioral/contracts: 18 passed
  • focused MCP delivery tests: 2 passed
  • affected Nx test/build/lint matrix: passed
  • frozen Bun install: passed
  • strict OpenSpec validation and diff checks: passed
  • full MCP suite baseline audit: the same three unrelated failures reproduce on committed HEAD before this slice
  • public-content and commit-metadata audit: passed

Test plan

  • pnpm nx run-many -t test,build,lint --projects=adt-flow,adt-mcp,adt-plugin,adt-plugin-abapgit,adt-config
  • adt flow checkout tr <TR> against a sandbox transport (head and --base)
  • MCP flow_checkout_tr returns the same structured result as the CLI
  • Re-run checkout with warm .adt descriptors confirms zero SAP calls / zero writes

Made with Cursor


Summary by cubic

Adds incremental transport checkout to materialize exact base/head source trees from immutable SAP source versions. Hardens repository safety and format materialization, enforces descriptor and ownership invariants, and exposes CLI/MCP flows for review-ready changes without Git.

  • New Features

    • CLI/MCP: validate flow config (flowConfigSchema in CLI; MCP loads flow from server/workspace config via @abapify/adt-config), re-resolve workspaceRoot, and return structured error codes.
  • Bug Fixes

    • Validation/Determinism: enforce descriptor identity and tombstone invariants; validate transport IDs and ownership; validate owned file paths with safeRelativePath; preserve toJSON semantics in stableJson/digests (now passes the JSON key); fix base/head fast path and owned-file unions; fail fast if base/head boundary versions are missing.
    • Repository/Workspace/MCP: resolve chained symlinks; validate physical roots before reads/walks/writes/removals; harden path-collision and traversal checks; skip symlinks in walks; exclusive temp-file writes and symlink-aware snapshots; revalidate workspaceRoot at execution time and reject symlink roots; track created directories and clean up on rollback; flow_checkout_tr preserves error codes/messages and reports configuration_invalid/format_unsupported.
    • Repository/abapGit: honor explicit historical sources (including empty maps) with an explicit source guard and supportsExplicitSources; propagate source-read errors for BDEF/SRVD and reject unsupported source components in SRVD; accept explicit sources for TABL/TABL-DS and decode XML entities; normalize FUGR top-include mapping and exclude only exact LTOP/SAPL keys; restrict filename parser to abapGit extensions and classify non-XML files as source; discover .abdl/.asrvd sources; preserve package.json export conditions and disable tsdown overwrites.
    • Code health: reduce complexity in @abapify/adt-flow service and helpers; extract TABL serializer helpers; cleanup README/tests/tsconfig; no behavior changes.

Summary by CodeRabbit

  • New Features
    • Added transport checkout for materializing ADT source trees at base or head boundaries.
    • Added equivalent CLI and MCP access with structured results and workspace confinement.
    • Added configurable format selection, filtering, concurrency, and source-size limits.
    • Added deterministic abapGit materialization, descriptors, caching, and rollback-capable reconciliation.
  • Bug Fixes
    • Added safeguards for unsafe paths, collisions, local divergence, ambiguous history, and unsupported formats.
  • Documentation
    • Added usage, configuration, and materialization guidance.
  • Tests
    • Added comprehensive checkout, validation, confinement, and reconciliation coverage.