Skip to content

feat(calm-hub-ui): POC of a new Diff View between architectures#2429

Draft
aamanrebello wants to merge 9 commits into
finos:mainfrom
aamanrebello:diffs
Draft

feat(calm-hub-ui): POC of a new Diff View between architectures#2429
aamanrebello wants to merge 9 commits into
finos:mainfrom
aamanrebello:diffs

Conversation

@aamanrebello
Copy link
Copy Markdown
Contributor

@aamanrebello aamanrebello commented May 6, 2026

First step towards addressing #2289.

Description

CALM Hub UI Diff Feature Plan

Aim

Build a battle-ready CALM architecture diff experience in calm-hub-ui that can compare two architecture JSON files and identify:

  • nodes added, removed, modified, unchanged
  • relationships/edges added, removed, modified, unchanged
  • renamed nodes and renamed edges
  • structural renames where the unique-id changed but the node/relationship is otherwise unchanged

Done so far

  • Created diff types in src/model/diff.ts
  • Implemented core comparison logic in src/service/diff-service.ts
    • node add/remove detection
    • node modification detection
    • node rename detection
    • relationship add/remove detection
    • relationship modification detection
    • relationship rename detection
  • Added test fixtures in src/fixtures/diff-test-architectures.json
  • Added src/service/diff-service.test.ts
  • Verified the diff-service tests pass
  • Add tests for harder edge cases to stress the diff logic
    • edge/relationship rename detection
    • ambiguous rename matching when multiple candidates exist
    • relationship modifications beyond destination changes
    • metadata/interface changes on nodes or relationships
    • duplicate unique-id handling or invalid shapes
  • Polish and UX:
    • color-code added/removed/modified/renamed elements
  • Integrate with UI:
    • add a /diff route in src/App.tsx
    • create a Diff.tsx container page
    • add DiffGraphPanel.tsx for side-by-side architecture graphs
    • add DiffPanel.tsx for diff summary and details
    • extend parseCALMData() and node/edge rendering to support diff status styling
  • Add unit tests for UI:
    • Ensure coverage is comprehensive on both logic and UX.

What is left

  • Polish and UX:
    • optionally add a toggle to hide unchanged items
    • add a JSON diff/detail view for property-level changes
  • Integrate with main CalmHub
  • Apply to timelines

Screenshots:

image image

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🎨 Code style/formatting changes
  • ♻️ Refactoring (no functional changes)
  • ⚡ Performance improvements
  • ✅ Test additions or updates
  • 🔧 Chore (maintenance, dependencies, CI, etc.)

Affected Components

  • CLI (cli/)
  • Schema (calm/)
  • CALM AI (calm-ai/)
  • CALM Hub (calm-hub/)
  • CALM Hub UI (calm-hub-ui/)
  • CALM Server (calm-server/)
  • CALM Widgets (calm-widgets/)
  • Documentation (docs/)
  • Shared (shared/)
  • VS Code Extension (calm-plugins/vscode/)
  • Dependencies
  • CI/CD

Commit Message Format ✅

Testing

  • I have tested my changes locally
  • I have added/updated unit tests
  • All existing tests pass

Checklist

  • My commits follow the conventional commit format
  • I have updated documentation if necessary
  • I have added tests for my changes (if applicable)
  • My changes follow the project's coding standards

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 6, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@github-actions github-actions Bot added the calm-hub-ui Affects `calm-hub-ui` label May 6, 2026
@aamanrebello aamanrebello changed the title deat(calm-hub-ui): POC of Diff View feat(calm-hub-ui): POC of Diff View May 6, 2026
@aamanrebello aamanrebello changed the title feat(calm-hub-ui): POC of Diff View feat(calm-hub-ui): POC of a new Diff View between architectures May 6, 2026
@aamanrebello
Copy link
Copy Markdown
Contributor Author

/easycla

@aamanrebello aamanrebello marked this pull request as ready for review May 8, 2026 13:22
@aamanrebello aamanrebello requested a review from a team as a code owner May 8, 2026 13:22
@aamanrebello
Copy link
Copy Markdown
Contributor Author

Video evidence:

video1066756758.mp4

rocketstack-matt added a commit to rocketstack-matt/architecture-as-code that referenced this pull request May 9, 2026
Wires up the architecture diff page from PR finos#2429 against the new
calm-models/diff layer. The diff function and its data types are
imported from @finos/calm-models/diff so the same comparison logic
backs the calm diff CLI, the shared runDiff runner, and this UI.

UI-only types (DiffGraphProps, DiffPanelProps, DiffNodeData, etc.) live
in src/diff/model/diff-ui-types.ts so they don't leak into the shared
package; everything else (DiffResult, NodeChange, RenameMapping, etc.)
comes from @finos/calm-models/diff. Tests, fixtures, components, and
the calmHelpers extension are ported from finos#2429 with updated import
paths.
@rocketstack-matt
Copy link
Copy Markdown
Member

For consideration alongside this PR — I've raised #2442 as an alternative implementation that pushes the diff detection logic out of calm-hub-ui and into @finos/calm-models/diff, with a thin runDiff runner in @finos/calm-shared and a new calm diff CLI command.

The architectural intent matches @markscott-ms's comment on #2289 — same diff function backing the UI, the CLI (with --exit-code for "is this really a patch bump?" gating), and any future hub backend, rather than UI-only.

The UI in #2442 uses your components from this PR with import paths rewired to the shared module — same screen, same behaviour. Test fixtures and unit tests are largely ported from your work.

The two PRs are mutually exclusive and only one should land. Posting it so reviewers can compare the two approaches end-to-end and pick the one they prefer; happy to close #2442 if folks would rather keep the diff UI-only at this stage.

@aamanrebello
Copy link
Copy Markdown
Contributor Author

For consideration alongside this PR — I've raised #2442 as an alternative implementation that pushes the diff detection logic out of calm-hub-ui and into @finos/calm-models/diff, with a thin runDiff runner in @finos/calm-shared and a new calm diff CLI command.

The architectural intent matches @markscott-ms's comment on #2289 — same diff function backing the UI, the CLI (with --exit-code for "is this really a patch bump?" gating), and any future hub backend, rather than UI-only.

The UI in #2442 uses your components from this PR with import paths rewired to the shared module — same screen, same behaviour. Test fixtures and unit tests are largely ported from your work.

The two PRs are mutually exclusive and only one should land. Posting it so reviewers can compare the two approaches end-to-end and pick the one they prefer; happy to close #2442 if folks would rather keep the diff UI-only at this stage.

Have approved your PR and moved this one to draft. I think it makes sense to have diff logic in calm-models, and the test cases have been devised by making Copilot (with different models) repeatedly think of missing edge cases so they are pretty solid. I am confident the diff logic should be reliable.

@aamanrebello aamanrebello marked this pull request as draft May 11, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

calm-hub-ui Affects `calm-hub-ui`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants