fix(markdown-common): retain empty nodes arrays in AST to satisfy strict=true in concerto-v4#652
Merged
mttrbrts merged 1 commit intoaccordproject:mainfrom Apr 10, 2026
Conversation
…ict Concerto validation Signed-off-by: Aadityavardhan Singh <singhrashmi018@gmail.com>
5d1a87b to
6da1b6f
Compare
Coverage Report for CI Build 24067562976Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage decreased (-0.08%) to 72.194%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
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 #651
This PR fixes a critical AST validation crash that occurs when using Concerto v4 engine (specifically
4.0.0-beta.1and later) alongsidemarkdown-transform. I uncovered this bug 2-3 weeks ago and and the fix was easier than I anticipated!The Root Cause:
As described in the issue:
In
packages/markdown-common/lib/FromMarkdownIt.js(blockToCommonMark), the parser was explicitly deleting thenodesarray if a markdown element (like an empty clause, list, or blockquote) had no children. While Concerto v3 permitted this "lazy AST" where the array was simplyundefined, the new strict type-checking in Concerto v4 throws a fatalValidationException: Expected property 'nodes' to be an arraybecausenodesis defined as a mandatory array in the metamodel.The Fix:
Removed the aggressive deletion block (
delete node.nodes) inFromMarkdownIt.jsso that empty elements correctly retain an empty array ("nodes": []).Testing / Validation
ValidationExceptioncrash in strict parsing environments.Standalone Script Output Proof:
I made a script to directly test this:
By feeding an empty clause (
{{#clause testClause}}\n{{/clause}}) intoCiceroMarkTransformer, we can see the exact structural change to the AST:Before (Fails v4 Validation):
After (Passes v4 Validation):