Skip to content

feat(calm-hub-ui): render items catalogues in pattern diagrams - #3110

Merged
markscott-ms merged 7 commits into
finos:mainfrom
YoofiTT96:feat/2859-visualisation-items
Sep 18, 2026
Merged

markscott-ms merged 7 commits into
finos:mainfrom
YoofiTT96:feat/2859-visualisation-items

Conversation

@YoofiTT96

Copy link
Copy Markdown
Member

Description

A pattern may declare nodes and relationships under items as well as prefixItems. The renderer read only prefixItems, so a catalogue node never appeared on the diagram and a decision naming one drew no box at all. The pattern in #2859 rendered two nodes and one edge, with the catalogue and the decision missing entirely.

Now the catalogue draws as a decision box carrying the author's prompt and each answer, with the catalogue nodes inside it.

Part of #2859.

PR sequence

Four 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 this items in the pattern diagram

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

The decision worth knowing

items is read as one more choice block, nothing else. Its members get a decision group exactly as prefixItems alternatives do, so the existing parenting and the existing options lookup handle them with no further change. That keeps this PR to the reading side of the transformer and leaves the parent-resolution model alone.

A decision is read from prefixItems only. #3060 rejects a decision declared in items, so the renderer does not tolerate what validation refuses.

Gotcha

This makes items visible; it does not change how decision boxes relate to containers. A catalogue node that also sits in a deployed-in container still parents to the decision box, leaving the container drawn empty beside it. That shape was unreachable before, because the catalogue rendered nothing at all, so this PR makes an existing limitation newly visible. #2933 owns the fix and has been updated with the current behaviour.

Tidying

The allOf lookup and the oneOf/anyOf read were each written out four times. Both are now one function, which is most of the line count in the diff.

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

Additive. A pattern that uses no items renders 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

Commit Message Format ✅

feat(calm-hub-ui): render items catalogues in pattern diagrams

Testing

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

Seven new tests in patternTransformer.test.ts, covering a catalogue node rendering, its grouping into one box, the prompt attaching, an anyOf catalogue's label, a prefixItems decision staying separate from the catalogue box, a relationship under items, and a plain items: { $ref } correctly ignored.

Mutation-tested: stop reading the catalogue and five of the seven fail while the rest stay green.

calm-hub-ui passes 118 files and 1450 tests. Lint and build are clean, and the full root npm test is green.

Rendering is not viewport-dependent — the transformer returns the same nodes and edges at any width — so no mobile-specific case applies here.

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

A pattern may declare nodes and relationships under items as well as
prefixItems. The renderer read only prefixItems, so a catalogue node
never appeared and a decision naming one rendered no box at all.

items is read as one more choice block. Its members get a decision group
like prefixItems alternatives do, so the existing parenting and the
existing options lookup handle them with no further change. The catalogue
box carries the decision's prompt and choices.

A decision is read from prefixItems only. Declaring one in items is
rejected by validation, so the renderer does not tolerate it.

Drawer's isPatternData accepts nodes.items, or a pattern that declares
only a catalogue is misrouted as an architecture and never reaches the
transformer.

The allOf lookup and the oneOf/anyOf read were each written out four
times. Both are now one function.
Comment thread calm-hub-ui/src/visualizer/components/drawer/Drawer.tsx Outdated
@YoofiTT96
YoofiTT96 marked this pull request as ready for review September 18, 2026 06:03
@YoofiTT96
YoofiTT96 requested a review from a team as a code owner September 18, 2026 06:03
Most of them restated the line below. The ones that carry a reason nobody
can read from the code stay: why useDropzone takes no accept filter, why a
dropped file must not borrow the viewport key, and why the default layout
is withheld alongside it.

Those three were paragraphs guarding one or two lines each. Same facts,
fewer words, and the viewport-key note is now one point per line rather
than four run together.
@markscott-ms
markscott-ms merged commit 2f196c1 into finos:main Sep 18, 2026
14 checks passed
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.

2 participants