Skip to content

feat(calm-models): compare items catalogues in the pattern differ - #3112

Open
YoofiTT96 wants to merge 8 commits into
finos:mainfrom
YoofiTT96:feat/2859-diff-items
Open

YoofiTT96 wants to merge 8 commits into
finos:mainfrom
YoofiTT96:feat/2859-diff-items

Conversation

@YoofiTT96

Copy link
Copy Markdown
Member

Description

A catalogue member was invisible to calm diff. Adding or removing one reported no change at all, and hasChanges stayed false, so calm diff --exit-code passed. An unchanged member appeared in no bucket, so CALM Hub painted it with no diff status.

Part of #2859.

PR sequence

Five stacked PRs, each reviewable alone, in this order:

PR Scope
1 #3059 prefixItems alternatives — the pre-existing gaps that had to be fixed first
2 #3060 items in pattern validation
3 #3103 items in generation
4 #3110 items in the pattern diagram
5 this items in the pattern differ

GitHub will not let a cross-fork PR target a branch in my fork, so all five sit on main and each diff carries the ones below it. The commit to review here is the last one.

The decision worth knowing

A catalogue is a choice block, and expandAlternatives already flattens those, so the catalogue is read as one more declaration source and its members flow into the existing partition. They land in the buckets that already exist — added, removed, modified, same. No new buckets, no change to NodeChange, nothing for hasChanges, the CLI report or the Hub to learn.

An items schema that declares a node directly is not read, which matches validation (#3060) and the pattern renderer (#3110).

Out of scope

The differ cannot tell a guaranteed node from one alternative among several, so moving a node between those sites reports as no change. Filed as #3111 — it reproduces on main with no items involved, and a fix needs three levels of obligation rather than two.

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.)

A pattern that uses no items diffs exactly as before.

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

calm-models, which the template has no box for. It is the base of the build order, so the change is deliberately self-contained.

Commit Message Format ✅

feat(calm-models): compare items catalogues in the pattern differ

Note: commitlint warns on the calm-models scope, which is missing from its scope-enum while cli/.releaserc.json carries ten release rules for it. The warning is a gap in the lint config, not the commit.

Testing

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

Eight new tests covering a member added, removed, changed and unchanged, a pattern gaining and losing a catalogue, the reduced instance, and an items schema that declares a node directly being ignored.

Mutation-tested: removing the catalogue source fails seven of the eight, and relaxing the choice filter fails the eighth.

calm-models passes 217 tests, every TypeScript workspace builds, and the full root npm test is green apart from the long-standing calmguard-docs peer-dependency test, which resolves over the network and times out.

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

@github-actions github-actions Bot added cli Affects `cli` code shared calm-hub-ui Affects `calm-hub-ui` labels Sep 14, 2026
A catalogue member was invisible to calm diff. Adding or removing one
reported no change at all, and hasChanges stayed false, so
calm diff --exit-code passed. An unchanged member appeared in no bucket,
so the Hub painted it with no diff status.

The catalogue is a choice block, so it is read as one more declaration
source and expandAlternatives flattens it into the existing partition.
Members land in the buckets that already exist. No new buckets, no change
to NodeChange or hasChanges.

An items schema that declares a node directly is not read, matching
validation and the pattern renderer.

The allOf traversal was written for prefixItems only, so it becomes
findField, which takes what the caller is after.

Reporting a change in obligation is out of scope and filed as finos#3111. It
reproduces on main with no items involved.
Comment thread calm-models/src/diff/pattern-diff.ts
@markscott-ms

Copy link
Copy Markdown
Contributor

@YoofiTT96 previous PR is now merged.

@YoofiTT96
YoofiTT96 marked this pull request as ready for review September 18, 2026 11:11
@YoofiTT96
YoofiTT96 requested a review from a team as a code owner September 18, 2026 11:11
Comment thread calm-models/src/diff/fixtures/diff-test-patterns.json

This branch has not been deployed

No deployments
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` cli Affects `cli` code shared

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants