mps-cli-py (binary-persistency): fix stream misalignment in cross-module model references#61
Merged
Prithvi686 merged 3 commits intoApr 27, 2026
Conversation
… details of the issue and applied fix explained below: - Our binary persistence parser was calling read_string() after reading a MODELID_REGULAR model id but Java's ModelInputStream.readModelReference() calls readModuleReference() there instead but this was missed earlier which caused stream misalignment issues. - This issue wasn't caught earlier since In standard MPS plugin directories this code path is never reached because cross-model references use MODELREF_INDEX but the vemb repo's language plugins specifically migration scripts etc.. most likely use full inline MODELID_REGULAR references which exposed this issue. - Replaced read_string() with _read_module_ref() in _read_other_model_ref() in nodes.py. Affected: 15 .mpb files (migration.mpb, editor.mpb etc..) Result: From 2624 models to 2625 models parsed now and from 11,176,926 nodes to 11,179,666 nodes successfully parsed now without any issues.
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.
15 .mpb files in a big repository (migration.mpb, editor.mpb etc..) were failing to parse with read_bytes(18576): EOF warnings.
Root cause is that -
In _read_other_model_ref() in nodes.py, after reading a MODELID_REGULAR model id, the parser called read_string() but Java's ModelInputStream.readModelReference() calls readModuleReference() there instead.
This was never caught before because standard MPS plugin directories I guess uses MODELREF_INDEX for cross-model refs but the vemb repo's language plugins use full inline MODELID_REGULAR references hitting this path for the first time.
Fix:
Replace read_string() with _read_module_ref() in _read_other_model_ref() in nodes.py.
Result
zero parse warnings
Models read now: From 2624 to 2625
Nodes read now: From 11,176,926 to 11,179,666