Skip to content

SysML2 standard: facade packages with public imports for multi-file models - #73

Merged
Malcolmnixon merged 2 commits into
mainfrom
sysml2-facade-packages
Nov 22, 2026
Merged

Malcolmnixon merged 2 commits into
mainfrom
sysml2-facade-packages

Conversation

@Malcolmnixon

Copy link
Copy Markdown
Member

Summary

Replaces the package rules in sysml2-modeling.md (and the matching text in the sysml2tools-query skill) with a facade pattern for multi-file SysML2 models. This refines #64, #65, #70, and #71.

  • One unique top-level package per file. A package is never reopened across files.
  • System and subsystem packages are facades: they public import the packages they own, downward only, so {SystemName}::{AnyItem} resolves through chained re-exports.
  • Units private import exactly what they reference. Upward or sideways references import the specific item package, never a facade (that would form an import cycle).
  • Never name a package after a standard library package (Views shadows the library and leaves GeneralView unresolved).
  • A small cohesive namespace may be one file with one package.
  • New "Migrating split packages" section (rename packages, generate private imports from sysml2tools query dependencies with 0.3.0-beta.3, make system/subsystem files facades; existing {System}::X references keep working).
  • Skill: describes the facade layout and notes that query describe -e needs the declared qualified name, not a facade path.
  • .textlint.yaml: adds the proper names Sensmetry, Syside, and the rule-name word distinguishability.

The template branch counterpart is in a separate PR.

Evidence

Spec (normative)

  • Each file is its own root namespace, and top-level names share one flat global scope (KerML 1.0 §7.2.5.3, §10.2–10.3; SysML 2.0 §7.5.5). Folders do not create namespaces.
  • No package merging: duplicate top-level names give an unspecified resolution (KerML §8.2.3.5.4), and the OMG Pilot warns "Duplicate of other owned member name".
  • public import makes imported members visible members of the importing package (KerML §8.2.3.5.3; SysML §7.5.3).
  • Imports owned directly by a file's root namespace must be private (KerML §8.3.2.4.2 validateImportTopLevelVisibility), so facades must be packages.
  • Cyclic imports are legal (KerML §8.2.3.5.1) but stop the Pilot loading files one at a time.

Practice: the OMG libraries (ISQ re-exports 12 ISQ* packages; SI re-exports ISQ), Sensmetry smart-home-hub (DETECT_* prefix; Syside rule global-namespace-distinguishability), Airbus Apollo-11, and DE4SDV all use one top-level package per file, unique and often prefixed names, private import for dependencies, and facades with public import.

Experiments (OMG Pilot 2026-09.1 and SysML2Tools 0.3.0-beta.4 / main, same synthetic 2-subsystem model in eight layouts):

  • Split same-named packages: neither tool merges them. Pilot fails to load every file; SysML2Tools keeps the first Acme and ignores the rest, leaving unresolved references.
  • Unique packages with private imports only: valid, but Acme::Parser and import Acme::* do not resolve.
  • Facade with downward public imports: the only layout where Acme::Parser and import Acme::* both resolve. Strict lint is clean in SysML2Tools, and Pilot loads every file one at a time (when units do not back-reference the system).
  • Facade plus back-imports: SysML2Tools reports six Circular import detected warnings, and Pilot cannot load any file order.
  • A package named Views shadows the library, so GeneralView is unresolved.

Checks

pwsh ./fix.ps1 and pwsh ./lint.ps1 pass.

…odels

Refines #64, #65, #70, #71. Each file keeps one unique top-level package; the
system and subsystem packages become facades that public-import the packages
they own (downward only), units private-import what they reference, and a
migration section covers models that split one package across files.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings November 22, 2026 15:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Two moderate active documentation issues remain: direct system-owned units are not covered by the facade guidance, and the migration instructions can create redundant or conflicting imports.

2 open issues
What changed in this PR

Updates SysML2 modeling guidance and the query skill to standardize unique per-file packages with downward-facing facade packages and public imports for multi-file models.

Changes:

  • Replaces split-package guidance with unique package names, facade and import-direction rules, migration instructions, and updated quality checks.
  • Updates the sysml2tools-query skill with facade layout and qualified-name query behavior.
  • Adds SysML2 terminology and proper names to the text-lint dictionary.
File Description
src/​.github/​standards/​sysml2-modeling.md Defines facade package structure, import rules, migration steps, view guidance, and updated quality checks.
src/​.github/​skills/​sysml2tools-query/​SKILL.md Documents facade packages, declared qualified names, and multi-file query usage.
.textlint.yaml Adds distinguishability, Sensmetry, and Syside to the accepted vocabulary.

Review effort: Lite

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings November 22, 2026 15:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

An active documentation issue remains because the migration command omits the required model-file glob, preventing users from generating imports as instructed.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Low severity Dependency query omits required model files

src/​.github/​standards/​sysml2-modeling.md:153

This migration command omits the model-file glob even though the guidance above says every sysml2tools invocation must load all .sysml files. A user following step 2 will run query dependencies without the model and cannot generate the imports. Include the quoted full-model glob (or explicitly require passing the complete model file set) here.

2 resolved since last review

Review effort: Lite

@Malcolmnixon
Malcolmnixon merged commit c694c60 into main Nov 22, 2026
3 checks passed
@Malcolmnixon
Malcolmnixon deleted the sysml2-facade-packages branch November 22, 2026 16:05
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.

2 participants