fix(concerto-linter): lint reserved system concept declarations#1237
Open
Rishabh060105 wants to merge 2 commits into
Open
Conversation
Signed-off-by: Rishabh Jain <rishabhj2005@email.com>
Contributor
Author
|
Hi @mttrbrts , I’ve implemented the linter follow-up for this. What changed:
A couple of related updates were needed as part of this:
This keeps |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a compatibility-aware default linter rule to catch user declarations that collide with reserved Concerto system concept names, surfacing actionable violations for legacy/v3 models and for v4 runs when the “dangerous” reserved-type-name opt-out is enabled.
Changes:
- Introduces a new default-ruleset rule
reserved-system-concept-declarations(with fixtures + tests) to flag declarations namedConcept,Asset,Transaction,Participant,Eventin legacy/v3, and in v4 when the dangerous flag is enabled. - Extends
lintModelto acceptdangerouslyAllowReservedSystemTypeNamesInUserModelsand injects that flag into the loaded Spectral ruleset. - Updates documentation and adjusts
no-reserved-keywordsbehavior/tests so capitalized system concept names are handled by the new targeted rule.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/concerto-linter/src/index.ts | Adds dangerous-mode option to lintModel and patches ruleset to pass the flag into the reserved-system rule. |
| packages/concerto-linter/test/unit/lintModel.test.ts | Unit tests for silent v4 behavior, dangerous-mode reporting, and custom-ruleset injection. |
| packages/concerto-linter/README.md | Documents compatibility-aware linting via dangerouslyAllowReservedSystemTypeNamesInUserModels. |
| packages/concerto-linter/default-ruleset/src/ruleset-main.ts | Registers the new reserved-system-concept-declarations rule in the default ruleset. |
| packages/concerto-linter/default-ruleset/src/reserved-system-concept-declarations.ts | Defines the new rule entry (given/severity/then). |
| packages/concerto-linter/default-ruleset/src/functions/find-reserved-system-concept-declarations.ts | Implements the rule function (legacy/v3 detection + dangerous-mode gating). |
| packages/concerto-linter/default-ruleset/src/no-reserved-keywords.ts | Adjusts reserved keyword regex to stop catching capitalized system concept names generically. |
| packages/concerto-linter/default-ruleset/test/rules/reserved-system-concept-declarations.test.ts | Adds rule-level tests for v3/legacy/v4 and dangerous-mode behavior. |
| packages/concerto-linter/default-ruleset/test/rules/no-reserved-keywords.test.ts | Adds regression coverage ensuring system concepts aren’t reported by the generic keyword rule. |
| packages/concerto-linter/default-ruleset/test/fixtures/reserved-system-concept-declarations-v4-valid.cto | Valid v4 fixture. |
| packages/concerto-linter/default-ruleset/test/fixtures/reserved-system-concept-declarations-v4-invalid.cto | Invalid v4 fixture (reserved declarations). |
| packages/concerto-linter/default-ruleset/test/fixtures/reserved-system-concept-declarations-v3-invalid.cto | Invalid v3 fixture (reserved declarations). |
| packages/concerto-linter/default-ruleset/test/fixtures/reserved-system-concept-declarations-legacy-invalid.cto | Invalid legacy fixture (missing namespace version). |
| packages/concerto-linter/default-ruleset/test/fixtures/no-reserved-keywords-system-concepts-valid.cto | Fixture ensuring the keyword rule doesn’t flag system concept names. |
| packages/concerto-linter/default-ruleset/README.md | Documents the new rule and its compatibility-dependent behavior. |
| packages/concerto-linter/default-ruleset/package.json | Adds semver dependency for parsing concerto version metadata. |
| package-lock.json | Lockfile update for the new semver dependency. |
mttrbrts
reviewed
May 25, 2026
Signed-off-by: Rishabh Jain <rishabhj2005@email.com>
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.
Closes #1216
Adds a default Concerto linter rule that reports declaration names colliding with reserved system concepts in the risky compatibility contexts called out in the issue. Normal v4 linting stays silent, while legacy/v3 models and dangerous-mode v4 runs now surface actionable errors earlier.
Changes
reserved-system-concept-declarationsdefault-ruleset rule forConcept,Asset,Transaction,Participant, andEvent, including support for legacy/v3 detection and dangerous-mode v4 linting.lintModelto acceptdangerouslyAllowReservedSystemTypeNamesInUserModels, inject that flag into the loaded ruleset, update docs, and add unit/integration coverage for the new behavior and theno-reserved-keywordsregression path.Flags
dangerouslyAllowReservedSystemTypeNamesInUserModelsis enabled.no-reserved-keywordsno longer catches capitalized system concept names generically, so those names are now handled by the new targeted rule instead.Screenshots or Video
N/A
Related Issues
Author Checklist
--signoffoption of git commit.mainfromRishabh060105:issue-1216-reserved-system-concept-lint