Skip to content

feat(sysml2): accept visibility modifiers, quoted names, alias and recursive import — official corpus 1 -> 16 of 310 - #489

Merged
avrabe merged 1 commit into
mainfrom
feat/sysml2-visibility
Oct 14, 2026
Merged

avrabe merged 1 commit into
mainfrom
feat/sysml2-visibility

Conversation

@avrabe

@avrabe avrabe commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

REQ-SYSML2-VISIBILITY-001 (v0.46.0). No tracking issue.

What it does

public/private/protected were lexed as keywords that no grammar rule consumed, so the SysML v2 spec's own Annex A model failed at line 3. Now accepted:

  • visibility on any member, at file level and in every namespace body. A dangling or duplicated prefix is an error;
  • KerML unrestricted names such as 'Application Layer' (with \' escapes). An unclosed one is one error token ending at the line break;
  • alias Name for QualifiedName (; | body);
  • recursive import Pkg::**.

Measured

  • Official corpus: 1 → 16 of 310. The OFFICIAL_PARSING ratchet is raised to match.
  • The old "258 of 309" estimate counted files whose first error was one of these constructs. Most of those files fail again on something further down, so the real gain is 15.
  • Conformance: Package, Part_Definition and Port examples now parse. The other four record their real next first error.

Acceptance amended, deliberately

"Annex A parses" is not met. It now stops at 35:17, perform action providePower;, which is behaviour syntax. That is split into REQ-SYSML2-ANNEX-A-001 (backlog, no release), with the measured histogram of remaining first errors.

Oracles

  • parse_private_import / parse_public_import were vacuous: a comment in them conceded the keyword "may cause a parse error", and they passed anyway. They now require a clean parse.
  • In-diff mutants: 8 MISSED before the tests. After: 29 tested, 22 caught, 2 unviable, 5 timeouts (non-advancing parser stalls), 0 missed.
  • Note: CI's PR mutation gate covers only spar-analysis, so these numbers come from a local run.
  • Workspace: 3243 passed, 0 failed. fmt and clippy are clean. rivet validates.

Not claimed

Any semantic effect of visibility. Lowering ignores it, so a private member is still exported.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BnBWxgVEUPdsBTLNKtrA6Z

…cursive import — official corpus 1 -> 16 of 310

REQ-SYSML2-VISIBILITY-001. Visibility is KerML core and sits on almost every
member of every real model, so the specification's own Annex A vehicle model
failed at line 3. `public`/`private`/`protected` were lexed as keywords that no
grammar rule consumed; `alias` likewise.

- Visibility prefixes any member, at file level and in every namespace body
  (every definition body goes through `namespace_body`). A prefix with no
  member after it, or a second prefix, is an error, not silently accepted.
- A KerML unrestricted name `'Application Layer'` (with `\'` escapes) lexes
  as IDENT, so every name position takes it. An unclosed one ends at the line
  break as ONE error token instead of swallowing the rest of the file.
- `alias Name for QualifiedName (; | body)`; ALIAS_DECL is ignorable in
  lowering (no AADL equivalent, nothing lost).
- Recursive import `Pkg::**` — Annex A's next blocker (line 17) once line 3
  parsed.

MEASURED: official corpus 1 -> 16 of 310, OFFICIAL_PARSING raised (two-sided
ratchet). Three named conformance files flip to Parses; the other four move
past the constructs they were recorded against, and the table now records
their real first errors. The old estimate that these constructs "account for
258 of the 309 failures" counted files whose FIRST error was one of them —
most carry further unsupported constructs behind it, so the real gain is 15.

ACCEPTANCE AMENDED, deliberately: "Annex A parses" is not met. It now stops
at 35:17, `perform action providePower;` — behaviour syntax, a different
grammar area — and is split out as REQ-SYSML2-ANNEX-A-001 (backlog, no
release), with the measured long tail of remaining first errors.

ORACLE: `parse_private_import` / `parse_public_import` were VACUOUS — they
asserted only that a PACKAGE node existed, with a comment conceding
visibility "may cause a parse error". They now require a clean parse. New
cases cover every level, dangling and duplicate visibility, alias with and
without `for`, `::**`, the quoted-name lexer edges, and the first test of
lowering's unsupported-construct diagnostic in both directions. In-diff
mutants: 8 MISSED before the tests; after, 29 tested, 22 caught, 2 unviable,
5 timeouts (non-advancing parser/lexer stalls), 0 missed.

NOT CLAIMED: any semantic effect of visibility — lowering ignores it, so a
private member reaches AADL like a public one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BnBWxgVEUPdsBTLNKtrA6Z
@github-actions

Copy link
Copy Markdown

Rivet verification gate

✅ 20/20 passed

count
Passed 20
Failed 0
Skipped (no steps) 0

Filter: (and (= type "feature") (or (has-tag "v093") (has-tag "v0100")))

Failed artifacts

(none)

Updated automatically by tools/post_verification_comment.py. Source of truth: artifacts/verification.yaml.

@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.16312% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/spar-sysml2/src/lib.rs 96.29% 2 Missing ⚠️
crates/spar-sysml2/src/lower.rs 87.50% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@avrabe
avrabe merged commit 35b4e0a into main Oct 14, 2026
21 checks passed
@avrabe
avrabe deleted the feat/sysml2-visibility branch October 14, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant