fix(shared): identify unique-ids in complex patterns#2290
Draft
markscott-ms wants to merge 4 commits intofinos:mainfrom
Draft
fix(shared): identify unique-ids in complex patterns#2290markscott-ms wants to merge 4 commits intofinos:mainfrom
markscott-ms wants to merge 4 commits intofinos:mainfrom
Conversation
Member
|
@markscott-ms although code is cheap now, design is expensive. I think confirming the question on the issue before implementation is a better approach than spamming in PRs. |
jpgough-ms
approved these changes
Apr 1, 2026
Contributor
Author
|
After discussion with @niamhg-ms I'm reviewing the change as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
fixes #2230 - @aidanm3341 you didn't include an example failure on your bug report, and CALM validate correctly identifies duplicate unique-ids, assuming a pattern does not use
oneOforanyOf, so this is an educated (AI-assisted) guess at what your problem is. Look at the test cases to see if I've caught your actual issue.This pull request updates the logic for checking uniqueness of
unique-idvalues in pattern schemas, particularly improving support for nodes and relationships defined insideoneOfandanyOfblocks. The main change is that duplicate IDs are now only flagged if they occur outside of, or across, different choice groups—duplicate IDs within the sameoneOforanyOfblock are allowed, since only one alternative will be instantiated. The test suite has been expanded to cover these scenarios.Enhancements to unique-id detection logic:
ids-are-unique.tsto recursively detect allunique-idvalues, including those nested withinoneOfandanyOfblocks, and to allow duplicates within the same choice group but not across different groups. Introduced a helper functiongetChoiceGroupto determine group membership by JSON pointer.Test coverage improvements:
ids-are-unique.spec.tsto verify correct handling of duplicate IDs inside and acrossanyOf/oneOfblocks, including:anyOf/oneOfType of Change
Affected Components
cli/)calm/)calm-ai/)calm-hub/)calm-hub-ui/)calm-server/)calm-widgets/)docs/)shared/)calm-plugins/vscode/)Commit Message Format ✅
Testing
Checklist