Skip to main content

Summary

FM-05 (gate removal) and FM-06 (contract breaking changes) require comparing the current version of a unit against its previous version. The CI workflow needs both versions to detect regressions. Rather than building a versioned artifact store, git show {base-ref}:{path} retrieves the previous version directly from the branch the PR targets.

The Approach

The stratt ci command accepts --base-ref (defaults to HEAD~1, set to origin/${{ github.base_ref }} by the workflow). For each changed file, gitShow(baseRef, relativePath) returns the file contents at that ref — or null for new files (no previous version, so no breaking change to detect). The result is parsed, validated, and assembled into a Map<string, Unit> keyed by unit ID.

Why This Works

Git is already the source of truth for file history. No external storage, no artifact registry, no cache invalidation. The fetch-depth: 0 checkout ensures the base ref is available. New files gracefully skip comparison — the pipeline’s check functions already handle missing previous versions (no-op).

Business Impact

This eliminates an entire class of CI infrastructure (artifact storage for previous versions) while being more correct — git history is immutable and authoritative. The pattern generalises to any system that needs “before and after” comparison at CI time.