Skip to content

Add diff command to compare scan snapshots#17

Merged
maksimov merged 7 commits intomasterfrom
feature/diff-command-only
Apr 18, 2026
Merged

Add diff command to compare scan snapshots#17
maksimov merged 7 commits intomasterfrom
feature/diff-command-only

Conversation

@maksimov
Copy link
Copy Markdown
Collaborator

Summary

  • New gpuaudit diff <before.json> <after.json> subcommand that compares two scan snapshots
  • Reports new, removed, and changed GPU instances with cost deltas
  • Table and JSON output formats
  • Updated README with K8s scanning docs and current output format
  • Bug fix: misleading idle duration in K8s GPU node recommendations
  • Bug fix: box alignment in diff table output

Changes

  • internal/diff/diff.go — Compare function with instance matching and delta computation
  • internal/diff/diff_test.go — 6 test cases covering additions, removals, changes, and edge cases
  • internal/output/diff.go — Table and JSON formatters for diff results
  • cmd/gpuaudit/main.go — New diff cobra subcommand
  • internal/analysis/rules.go — Fix idle duration display
  • README.md — Updated docs

Test plan

  • All tests pass (go test ./...)
  • go vet clean
  • Manual test: gpuaudit diff before.json after.json with two scan snapshots

🤖 Generated with Claude Code

Compares two scan results by instance ID. Detects added, removed,
and changed instances across 6 fields (instance type, pricing model,
cost, state, GPU allocation, waste severity). Computes cost deltas.
gpuaudit diff old.json new.json [--format table|json]

Closes #5
The recommendation said "No GPU pods scheduled for X days" but X was
the node's total uptime, not the idle duration. We don't know when
the node became idle — only that it currently has zero GPU pods.
Changed wording to "Node up X days with 0 GPU pods scheduled."
@maksimov maksimov mentioned this pull request Apr 18, 2026
5 tasks
@maksimov maksimov merged commit 45b2457 into master Apr 18, 2026
2 checks passed
@maksimov maksimov deleted the feature/diff-command-only branch April 18, 2026 17:27
maksimov added a commit that referenced this pull request Apr 21, 2026
Add diff command to compare scan snapshots
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