Skip to content

feat: make the repository a KerML 10.3 project interchange - #13

Merged
HuiJun merged 3 commits into
mainfrom
feature/project-interchange-manifests
Oct 27, 2026
Merged

HuiJun merged 3 commits into
mainfrom
feature/project-interchange-manifests

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A tagged commit of this repository is now a KerML 10.3 project on its own, so a package manager can install it from its git host as pkg:git/github.com/Open-MBEE/OpenSysML-Extensions-Library@X.Y.Z with nothing but the OMG format, and the release .kpar is derived from the tree's manifests instead of constants in a script.

  • .project.json (root, Table 12): name "OpenSysML Extensions Library", publisher "Open-MBEE", version 1.0.0 (proposed first tag v1.0.0; nothing is tagged here), description, license Apache-2.0, website, usage = the 9 OMG 20250201 archives the units depend on.
  • .meta.json (root, Table 13): index root namespace → libraries/<Unit>, metamodel, created, checksum SHA-256 per unit and for LICENSE; keys and entries sorted.
  • scripts/write-project-meta.py writes .meta.json; --check (run in CI and in the release job) fails when a checksum, the index, the canonical form, or .project.json's fields/semver/usage drift from the tree.
  • scripts/build-kpar.py no longer carries a project description: it runs the same check, then archives exactly the manifests plus every file .meta.json checksums at its repository path (libraries/...), deflate, 1980-01-01 dates, sorted. --version must equal .project.json version or it fails. Default output name opensysml-extensions-library-<version>.kpar.
  • release.yml asserts v<version> == tag before anything else, then --check, then builds and attaches the archive. ci.yml runs --check and builds the archive from the committed version (the former 0.0.0-dev.N version could not pass the equality check).
  • README/CONTRIBUTING: depending on the library as a package, what the two files are, that the tag tree is the project and the .kpar derived, and the release-prep step (bump version, merge, tag).

name differs from the brief

The brief asked for name "OpenSysML Extension Libraries". OpenSysML's reader (internal/workspace/project/interchange.go:Uses) matches a usage IRI by the slug of its last two path segments against publisher/name: pkg:git/github.com/Open-MBEE/OpenSysML-Extensions-Library → open-mbee / opensysml-extensions-library, while "Extension Libraries" slugs to opensysml-extension-libraries and never matches by name (probe below). The manifest uses "OpenSysML Extensions Library" (the repository's own name as words), whose slug equals the repository slug. The README title is unchanged.

How usage was derived

write-project-meta.py strips comments and strings from every unit, collects the root of every import X::… and the first name of every qualified reference X::…, drops the 16 roots declared here, and maps the rest through a table of the root namespaces each OMG archive declares (taken from the index of the archives' own .meta.json after downloading all ten; two corrections to the OMG indexes are noted in the script: RequirementsDerivation is indexed for a unit declaring RequirementDerivation, and USCU is the short name of USCustomaryUnits). An import root that is neither local nor OMG is an error. Result (checked by --check, so a new dependency changes the committed list): Semantic, Data-Type, Function, Systems, Analysis-Domain, Cause-and-Effect-Domain, Metadata-Domain, Quantities-and-Units-Domain, Requirement-Derivation-Domain. Geometry-Domain is the one 20250201 archive nothing here uses.

Verification

OpenSysML develop built with make build-sysml (sysml v0.11.0-685-g48f60b4b8, which reads lib/ beside .project.json).

$ ./scripts/write-project-meta.py --check
.project.json and .meta.json match the tree (OpenSysML Extensions Library 1.0.0, 16 units)
$ ./scripts/build-kpar.py --version 1.0.0 --output /tmp/a.kpar && ./scripts/build-kpar.py --output /tmp/b.kpar && cmp /tmp/a.kpar /tmp/b.kpar && echo IDENTICAL
Wrote /tmp/a.kpar (OpenSysML Extensions Library 1.0.0, 19 entries)
Wrote /tmp/b.kpar (OpenSysML Extensions Library 1.0.0, 19 entries)
IDENTICAL
$ ./scripts/build-kpar.py --version 1.0.1; echo "exit $?"
error: --version 1.0.1 does not equal .project.json version 1.0.0; bump .project.json in a release-prep commit and tag that
exit 1

Drift probes (each restored afterwards): appending a line to libraries/Stochastic.sysml → .meta.json: checksum does not match the tree; version "1.0" → not a semantic version; dropping a usage entry → usage does not match the imports under libraries/ (missing: …/Data-Type-Library.kpar); editing an index path → index does not match the tree; reserialising .meta.json on one line → not in the canonical form. All exit 1.

$ sysml -validate .                                  # repository root as a project
✓ .: no errors                                       (16 ✓ packages)
$ sysml -validate /tmp/a.kpar
✓ /tmp/a.kpar: no errors                             (16 ✓ packages)

Consumer probe — fresh project whose .project.json has usage: [{"resource": "pkg:git/github.com/Open-MBEE/OpenSysML-Extensions-Library", "versionConstraint": "1.0.0"}] and a model importing DiagramLayout::*, RandomFunctions::*, OpenSysMLMathFunctions::* (@Layout, uniform(0.0, 1.0)), with this tree installed at lib/opensysml-extensions-library/ beside the consumer's .project.json; OpenSysML reads that lib/ directly:

$ sysml -validate /tmp/consumer/proj
✓ package Model
✓ package AnalysisRecords … ✓ package SysMLValidation   (the 16 installed packages are loaded)
✓ /tmp/consumer/proj: no errors

Same probe with lib/ removed: only ✓ package Model is listed and the imports still resolve, because OpenSysML bundles a vendored copy of these libraries — the package listing, not the error count, is the discriminator. With the installed copy's name changed to "OpenSysML Extension Libraries" the 16 packages are still listed: the usage matches no installed project by publisher/name, and OpenSysML's used falls back to the single unclaimed installed project by elimination (discovery.go:used → pickUnclaimed); a second installed project would make the name decisive, so the manifest keeps the matching name.

sysml -bundle . vs build-kpar.py

sysml -bundle . -o /tmp/bundle.kpar → 36 files; build-kpar.py → 19. Differences by category:

  1. Member set — -bundle includes every non-hidden file of the tree (README, CONTRIBUTING, engine-contract.json, scripts/**, validation/, even a scripts/__pycache__/*.pyc left by Python); build-kpar.py includes only the two manifests plus what .meta.json checksums (16 units + LICENSE). Both .project.json and .meta.json members are byte-identical, so OpenSysML's own metadata generation agrees with the committed .meta.json (same index, same metamodel, same checksum set and values).
  2. Member bytes — identical for all 19 shared members.
  3. ZIP entry headers — both deflate with 1980-01-01 dates and sorted names; -bundle writes create_system 3 (Unix) with external attributes 0100644, Python writes create_system 0 with mode 0600; deflate streams differ by a few bytes (Go compress/flate vs zlib), so the two archives are not byte-identical though they hold the same bytes per member.

OpenSysML reader notes for the parallel work

  • internal/workspace/project/interchange.go:Uses — usage IRI matching is slug(name)-based; a manifest name that is not the repository name as words will not match a pkg:git/<host>/<owner>/<repo> IRI. Either keep that contract documented or match on an explicit identifier.
  • internal/workspace/project/discovery.go:used — a usage no installed project matches by name is answered by elimination among the unclaimed installed projects, so a wrong name is only caught once two or more projects are installed.
  • internal/workspace/project/bundle.go:Bundle — includes every non-hidden file rather than the checksummed set, and does not skip __pycache__.
  • The OMG release archives place their manifests inside a top-level folder (Analysis/.project.json), not at the archive root; the Requirement Derivation archive's index names RequirementsDerivation for a unit declaring RequirementDerivation.

Semver impact: MINOR for the repository's consumers (new files .project.json/.meta.json, archive layout moves units under libraries/, archive file name changes to opensysml-extensions-library-<version>.kpar; no library content changes). Proposed first tag: v1.0.0, after this merges, by a maintainer.

Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/2e708b6a96b74f12994487e6595d3cfc
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/2e708b6a96b74f12994487e6595d3cfc?variant=devin
Requested by: @HuiJun

Add .project.json and .meta.json at the root so a tagged tree is itself a
project any tool can install as pkg:github/Open-MBEE/OpenSysML-Extensions-Library.
scripts/write-project-meta.py generates .meta.json and, with --check, fails
when a checksum, the index or .project.json's fields and derived usage list
drift from the tree; build-kpar.py now archives exactly what the manifests
record, keeping the libraries/ layout, and refuses a --version that differs
from .project.json. release.yml asserts the tag equals that version before
building. README and CONTRIBUTING describe depending on the library as a
package and the release-prep step.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

…ls it

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review October 26, 2026 00:46
devin-ai-integration[bot]

This comment was marked as resolved.

…manager

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@HuiJun
HuiJun merged commit b36b361 into main Oct 27, 2026
2 checks passed
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