Repository navigation
fix(concerto-core): fix logic error in skipValidationAndResolution guard - #1158
Conversation
The condition `!options?.disableMetamodelValidation === false` was incorrectly evaluating to `true` when `disableMetamodelValidation` is `true`, causing an error to be thrown in a configuration that should be allowed. Fixed to `options?.disableMetamodelValidation === false` to correctly mirror the `disableMetamodelResolution` check. Signed-off-by: Copilot <copilot@github.com> Co-authored-by: jamieshorten <842103+jamieshorten@users.noreply.github.com>
jamieshorten
left a comment
There was a problem hiding this comment.
@copilot why are there so many changes to the types? Please try remove those changes.
Remove inadvertently staged changes to types/ files and package-lock.json that were unrelated to the skipValidationAndResolution logic fix. Signed-off-by: Copilot <copilot@github.com> Co-authored-by: jamieshorten <842103+jamieshorten@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes a logic bug in DecoratorManager.decorateModels where operator precedence caused skipValidationAndResolution to incorrectly throw when disableMetamodelValidation: true was provided, and adds a regression test to cover the scenario.
Changes:
- Correct the
skipValidationAndResolutionguard to checkoptions?.disableMetamodelValidation === false(mirroring thedisableMetamodelResolutioncheck). - Add a regression test ensuring
skipValidationAndResolution: true+disableMetamodelValidation: truedoes not throw. - Update
package-lock.json(currently still included in the PR diff).
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/concerto-core/lib/decoratormanager.js | Fixes the guard condition for skipValidationAndResolution to remove the precedence/negation bug. |
| packages/concerto-core/test/decoratormanager.js | Adds a regression test covering the previously failing options combination. |
| package-lock.json | Removes "peer": true fields (appears unrelated to the described fix and should likely be reverted). |
diana-lease
left a comment
There was a problem hiding this comment.
Can you add tests when skipValidationAndResolution is true and either disableModelResoltion or disableModelValidation are false? I only see one where both are false.
|
@copilot see Diana's comment:
|
…solution Add two additional tests covering the case where skipValidationAndResolution is true and either disableMetamodelResolution or disableMetamodelValidation is individually set to false (each should throw). Signed-off-by: Copilot <copilot@github.com> Co-authored-by: jamieshorten <842103+jamieshorten@users.noreply.github.com>
Added in a7fa948 — there are now two additional targeted tests:
|
…ard (#1158) * Initial plan * fix(concerto-core): fix logic error in skipValidationAndResolution guard The condition `!options?.disableMetamodelValidation === false` was incorrectly evaluating to `true` when `disableMetamodelValidation` is `true`, causing an error to be thrown in a configuration that should be allowed. Fixed to `options?.disableMetamodelValidation === false` to correctly mirror the `disableMetamodelResolution` check. Signed-off-by: Copilot <copilot@github.com> Co-authored-by: jamieshorten <842103+jamieshorten@users.noreply.github.com> * fix(concerto-core): revert unrelated type and package-lock changes Remove inadvertently staged changes to types/ files and package-lock.json that were unrelated to the skipValidationAndResolution logic fix. Signed-off-by: Copilot <copilot@github.com> Co-authored-by: jamieshorten <842103+jamieshorten@users.noreply.github.com> * test(concerto-core): add targeted throw tests for skipValidationAndResolution Add two additional tests covering the case where skipValidationAndResolution is true and either disableMetamodelResolution or disableMetamodelValidation is individually set to false (each should throw). Signed-off-by: Copilot <copilot@github.com> Co-authored-by: jamieshorten <842103+jamieshorten@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jamieshorten <842103+jamieshorten@users.noreply.github.com>
Due to operator precedence,
!options?.disableMetamodelValidation === falsenegates the value before comparing, so passingdisableMetamodelValidation: truewithskipValidationAndResolution: truewould incorrectly throw. The condition should mirror the adjacentdisableMetamodelResolutioncheck.Changes
!options?.disableMetamodelValidation === false→options?.disableMetamodelValidation === falseindecoratormanager.jsskipValidationAndResolution: true+disableMetamodelValidation: truemust not throwskipValidationAndResolution: true+disableMetamodelResolution: falsealone must throwskipValidationAndResolution: true+disableMetamodelValidation: falsealone must throwtypes/files andpackage-lock.jsonthat were unrelated to the fixFlags
Screenshots or Video
N/A
Related Issues
Author Checklist
--signoffoption of git commit.mainfromfork:branchname🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.