You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Build AST nodes for nested bodies, directed usages, timeslices, multi-redefinition (#137): corpus strict errors 48 → 8 - #138
Closes the AST coverage gaps that blocked strict-by-default lint (#137). Each construct below previously built no AST node, so references into it could never resolve:
Action, calc, constraint and case bodies (definitions and usages) and transition effects: nested usages, nested actions and parameters.
perform, exhibit, include and assert constraint usages.
Multiple redefinitions (:>> a :>> b): all targets are recorded and resolved.
Anonymous owner scopes.
The new nodes are kept out of diagrams through IsExcludedFromDiagrams, so gallery images are byte-identical.
Results:
Metric
Before
After
OMG corpus strict errors (ratchet cap)
48
8
OMG corpus files failing strict
18
4
OMG corpus default-mode errors
0
0
Stdlib warnings
13
12 (0 errors)
stdlib.json.gz
729,610 B
881,745 B
The remaining 8 are all explained:
3, in training/17.Control/Camera.sysml: a genuine collision in the corpus, where a root-level package Camera sits alongside examples/CameraExample/Camera.sysml's root-level part def Camera. Each file resolves cleanly on its own, and a test covers this.
5, #service def, #cloud and #cause: semantic-metadata keyword usages, not modeled yet. A follow-up issue will track them.
Since #129 began, strict errors on the OMG corpus have gone 161 → 8 and failing files 60 → 4.
Type of Change
Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Breaking change (fix or feature that would cause existing functionality to not work as expected)
Before submitting this pull request, ensure you have completed the following:
Build and Test
Code builds successfully and all tests pass: pwsh ./build.ps1. Passed: 6357 tests.
Code produces zero warnings
Code Quality
New code has appropriate XML documentation comments
Static analyzer warnings have been addressed
Quality Checks
All linters pass: pwsh ./lint.ps1. Passed.
Testing
Added unit tests for new functionality: one per construct, the Camera single-file test, and the ratchet cap lowered to 8.
Updated existing tests if behavior changed
All tests follow the AAA (Arrange, Act, Assert) pattern
Test coverage is maintained or improved
Documentation
Updated README.md (if applicable). N/A.
Updated docs/ documentation (if applicable): AstBuilder and SysmlNode design and verification docs, and the export format notes in the user guide.
Added code examples for new features (if applicable). N/A.
Updated requirements.yaml (if applicable): the reqstream files.
Additional Notes
Export and query: output now includes the new declaration kinds, two new fields, and $anon<n>/$perform<n> name segments. No golden files changed.
OMG corpus renders (not committed): 12 of 275 differ because references now resolve. New = binding connectors and :>/:>> labels appear.
Performance:lint on the spec's Annex A SimpleVehicleModel takes 9s on both main and this branch, with peak memory 209 MB on main and 222 MB here.
Separately, render --auto on that model does not finish within 15 minutes, on main as well as this branch. Profiling puts the time in the Rendering library's orthogonal edge router. This is unrelated to this PR and is being investigated separately.
…tions and anonymous owners (closes#137)
Build the AST members the OMG corpus references but the AST lacked, so that corpus strict unresolved-reference errors drop from 48 (18 files) to 8 (4 files), each explained (3 from a genuine name collision between two corpus files, 5 from user-defined keyword/semantic-metadata members left unmodeled).
- AstBuilder: bare/default reference usages (ref, with direction/typing/multiplicity; return = out), timeslice/snapshot/individual usages, bodies of action/calc/constraint/state/case usages and definitions, perform/exhibit/include/assert constraint usages, a named transition effect, all redefinition targets (AdditionalRedefinedFeatureNames) and redefinition/subsetting capture for every usage kind, a synthetic $anon scope for an anonymous usage with a body.
- NameResolver/ReferenceResolver: implicit-specialization rows (perform, exhibit, include, assert constraint, timeslice, snapshot, transition), reference subsetting as a lookup general type, self-exclusion for general-type references, every redefinition target resolved and inherited, anonymous owner scope.
- SysmlNode.IsExcludedFromDiagrams/DiagramChildren: the new members stay out of every diagram strategy, the auto-view target and the dynamic-view pre-check; gallery images are byte-identical.
- stdlib.json.gz regenerated (0.73 MB to 0.88 MB; stdlib warnings 13 to 12), corpus ratchet lowered to 8 with an expected-errors table, tests, requirements, design, verification and user guide updated.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The broad cross-component changes affect parsing, resolution, serialization, and all layout strategies, while the full test/build matrix and rendering regressions remain unverified.
No open issues 🎉
What changed in this PR
This pull request expands SysML AST coverage for nested behavior bodies, directed usages, semantic usages, multiple redefinitions, and anonymous scopes, improving name resolution and reducing strict OMG corpus diagnostics from 48 to 8 while preserving diagram output.
Changes:
Builds and resolves previously unmodeled AST members, usages, effects, and redefinition targets.
Excludes resolution-only nodes from diagram rendering and layout strategies.
Adds semantic, layout, serialization, corpus, documentation, and requirements coverage for the new behavior.
…es resolve deterministically (refs #137)
The symbol table keeps the first registration of a qualified name, so which of two
same-named root declarations won depended on the caller's file order (directory
enumeration differs between Windows and Linux): the corpus Camera collision gave 8
strict errors on Windows and 5 on Linux. WorkspaceLoader now orders files by the
ordinal, '/'-normalized full path before registration and resolution.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved moderate and critical issues remain in anonymous constraint scoping and general-type resolution, including incorrect member ownership and leakage of lookup-only references into the public type calculation.
For an anonymous constraint { ... } usage, name is null, so the body members collected here are built while _namespaceStack is still the enclosing scope. A parameter such as in x : T; is therefore registered as an enclosing member (or can collide with one) instead of under a private synthetic owner. Please use the same synthetic-scope treatment as BuildUsageNode for nameless bodies.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
A moderate issue remains because anonymous constraint-body members are built without a local scope, causing them to be registered in the enclosing namespace where they can incorrectly shadow or resolve as siblings.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Give anonymous constraint bodies a synthetic scope
When an anonymous constraint usage has a body, this path now builds its local parameters and usages without creating a scope: name is null, so _namespaceStack is never extended and those children receive qualified names in the enclosing namespace (for example P::p::x). They are then registered and can shadow or resolve as siblings of the constraint even though they belong to the anonymous body's local scope. Please either give anonymous constraint bodies the same synthetic owner scope as other anonymous usages or avoid registering their body members.
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
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.
Pull Request
Description
Closes the AST coverage gaps that blocked strict-by-default
lint(#137). Each construct below previously built no AST node, so references into it could never resolve:in x : T;), with direction, typing and multiplicity. These are designed so [Feature]: Action Flow View: parameters, swimlanes, flows, nested actions, control structures #103 can render action parameters later.perform,exhibit,includeandassert constraintusages.:>> a :>> b): all targets are recorded and resolved.The new nodes are kept out of diagrams through
IsExcludedFromDiagrams, so gallery images are byte-identical.Results:
stdlib.json.gzThe remaining 8 are all explained:
training/17.Control/Camera.sysml: a genuine collision in the corpus, where a root-levelpackage Camerasits alongsideexamples/CameraExample/Camera.sysml's root-levelpart def Camera. Each file resolves cleanly on its own, and a test covers this.#service def,#cloudand#cause: semantic-metadata keyword usages, not modeled yet. A follow-up issue will track them.Since #129 began, strict errors on the OMG corpus have gone 161 → 8 and failing files 60 → 4.
Type of Change
Related Issues
Closes #137
Pre-Submission Checklist
Before submitting this pull request, ensure you have completed the following:
Build and Test
pwsh ./build.ps1. Passed: 6357 tests.Code Quality
Quality Checks
pwsh ./lint.ps1. Passed.Testing
Documentation
Additional Notes
$anon<n>/$perform<n>name segments. No golden files changed.=binding connectors and:>/:>>labels appear.linton the spec's Annex A SimpleVehicleModel takes 9s on bothmainand this branch, with peak memory 209 MB onmainand 222 MB here.render --autoon that model does not finish within 15 minutes, onmainas well as this branch. Profiling puts the time in the Rendering library's orthogonal edge router. This is unrelated to this PR and is being investigated separately.