fix(holon-viz): emit valid SysML v2 syntax; add real-parser validation (ufo_types::sysml) - #197
Open
elasticdotventures wants to merge 2 commits into
Open
fix(holon-viz): emit valid SysML v2 syntax; add real-parser validation (ufo_types::sysml)#197elasticdotventures wants to merge 2 commits into
elasticdotventures wants to merge 2 commits into
Conversation
…eal parser validation into ufo-types Ran SysmlV2Emitter's own output through the real sysml-v2-parser crate (docs/sysml-v2-parser-spike.md, an existing unmerged spike) and confirmed two bugs make it non-parseable: - The closing '}' was on the same line as a trailing '//' comment, so the comment swallowed it -- the block was never syntactically closed. - The emitter used SysML v1's 'block def' keyword. SysML v2 renamed this construct to 'part def'; 'block' is not a SysML v2 keyword at all. Fixed both. Added ufo_types::sysml -- a shared Constraint/Satisfies-based SysML v2 syntax validator wired to sysml-v2-parser (pinned to =0.54.0 per the spike's crate-health findings; not wasm32-compatible, so this must stay out of holon-viz's runtime dependency graph -- added to holon-viz only as a dev-dependency, used in a new round-trip test that feeds the emitter's own output through the real parser instead of just asserting on substrings. This is the concrete round-trip-closed signal the existing spike (PR #187) called out as the next step.
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.
What
Follow-up from the SysML v2 epic's retrospective + issue #195. The
unmerged spike PR #187 (
sysml-v2-parserround-trip investigation) alreadyfound that
holon-viz'sSysmlV2Emitterdoesn't produce parseable SysMLv2 at all — this PR fixes both bugs it found and lands a reusable real-parser
validator, rather than leaving the finding as a spike writeup nobody acted
on.
Bugs fixed in
SysmlV2Emitter}on the same line as a trailing// id: ..., kind: ...comment —//runs to end of line, so the brace was never actually theresyntactically.
block defis SysML v1, not v2. SysML v1 called this constructBlock; SysML v2 renamed it topart def.blockis not a SysML v2keyword —
parse()/parse_for_editor()reject it outright.Both confirmed against the real grammar, not asserted from reading the
spec.
New:
ufo_types::sysmlA shared
SysmlV2Syntaxconstraint +validate_sysml_v2()function (andSatisfies<SysmlV2Syntax>impls forstr/String), wired to thesysml-v2-parsercrate (pinned=0.54.0, matching the spike's ownrecommendation given its pre-1.0/high-churn release cadence). This gives
every crate that generates SysML v2 text (today:
holon-viz,sysml-derive— see the follow-up PR wiring this into #196) one shared,real-grammar oracle instead of each hand-rolling its own heuristic (the
"no
<>characters" check I originally used to validate #196 was exactlythis kind of heuristic).
Important dependency-graph note:
sysml-v2-parserpulls instacker,which is not
wasm32-compatible.ufo-typesitself is never compiled towasm in this repo, so it's a normal dependency there.
holon-viz, however,is compiled to wasm (
holon-viz-wasm) — soufo-typesis added thereonly as a dev-dependency, used in a new test
(
tests/sysml_v2_roundtrip.rs) that feedsSysmlV2Emitter's own outputthrough the real parser. This must not become a runtime dependency of
holon-viz.Verification
cargo test -p ufo-types: 17/17 pass (4 new, including one that assertsblock defis rejected and one that asserts the comment/brace bug isrejected — both against the real parser).
cargo test -p holon-viz: all pass, including the 3 new round-triptests (previously these exact same inputs failed to parse — this is the
concrete "did we close the round-trip" signal PR spike: sysml-v2-parser round-trip against holon-viz emitter #187's writeup asked
for).
"block def"to expect"part def"instead (one count changed from 2to 3, since nodes and containment edges now correctly share one
keyword instead of an artificial v1/v2-mixed split).
cargo check --workspace --all-features: clean.