Skip to content

fix(diff): head each deferred diff with its module and target#29

Merged
rickliujh merged 1 commit into
mainfrom
feat/loom-diff-command
Jul 22, 2026
Merged

fix(diff): head each deferred diff with its module and target#29
rickliujh merged 1 commit into
mainfrom
feat/loom-diff-command

Conversation

@rickliujh

@rickliujh rickliujh commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Follow-up to the loom diff command (merged in #28).

Problem

Now that diffs print together at the end of a run instead of inline with the operation logs, they lost the surrounding context that told you which module produced a change and which repo it belonged to — leaving a wall of diffs with no attribution.

Fix

Head each deferred diff with its module and target:

  • Quick mode: the DiffCollector now carries the module name and a target label (rendered repo URL + branch, or the target dir) with each diff and prints a header before it — deduplicated across consecutive diffs from the same module and target.
  • Full mode: printTargetDiffs heads each target's git diff with the module (from the numbered clone dir), the origin remote URL, and the base branch — all read from the clone itself, so it works for bulk/child modules too.

In a terminal the module renders as an inverted chip and the repo/branch in muted gray, matching the log handler's style.

[demo] file:///…/upstream (main)
diff --git a/a.yaml b/a.yaml
...

Spec & tests

  • New spec rule DF4 ("diffs are headed with module and target") + header assertions added to the DF1/DF2 tests so the regression can't recur.
  • go test ./..., go vet ./..., gofmt, and spectrace all clean.

🤖 Generated with Claude Code

Now that diffs print together at the end instead of inline with the
operation logs, they lost the surrounding context that told you which
module produced a change and which repo it belonged to. Restore it:

- quick mode: DiffCollector carries the module name and a target label
  (rendered repo URL + branch, or the target dir) with each diff and
  prints a header before it, deduped across consecutive same-target diffs.
- full mode: printTargetDiffs heads each target's git diff with the module
  (from the numbered clone dir), the origin remote URL, and the base branch
  read from the clone itself.

Adds spec rule DF4 and header assertions to the DF1/DF2 tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rickliujh
rickliujh force-pushed the feat/loom-diff-command branch from d23ddb6 to f23edc6 Compare July 22, 2026 22:41
@rickliujh rickliujh changed the title feat: loom diff command (consolidates run --diff) fix(diff): head each deferred diff with its module and target Jul 22, 2026
@rickliujh
rickliujh merged commit 3ddfdb3 into main Jul 22, 2026
2 checks passed
rickliujh added a commit that referenced this pull request Jul 23, 2026
* origin/main:
  feat: diff module breadcrumb (#32)
  fix(diff): report the error before the diff on a failed run (#31)
  fix(diff): head each deferred diff with its module and target (#29)
  feat: loom diff command (#28)

# Conflicts:
#	pkg/module/executor.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant