Repository navigation
fix(project): bundle the files a project's .meta.json records - #1566
Merged
Merged
Conversation
Bundle archived every non-hidden regular file under the directory, so the Extensions Library tree gave 36 members where its own build-kpar.py gives 19. A directory with a .meta.json is now archived as the two manifests plus exactly the files the metadata records (checksum keys and index targets), a recorded file missing from the tree an error naming it; one without is archived as KerML 10.3 describes, the project file and the model files, with the .meta.json generated from them. The round-trip test reproduces the recorded files, and a new one bundles a repository-shaped tree whose metadata records a subset of it. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
A recorded path reached through a linked directory leading outside the project is refused, as Unbundle refuses to write through one. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
6 tasks done
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 and why
internal/workspace/project.Bundlearchived every non-hidden regular file under the directory, sosysml -bundleon the Open-MBEE/OpenSysML-Extensions-Library tree gave 36 members (README, CONTRIBUTING,scripts/**,validation/,engine-contract.json, evenscripts/__pycache__/*.pyc) where the project's ownscripts/build-kpar.pygives 19, although the two manifests were byte-identical.The rule now: a directory with a
.meta.jsonis archived as the two manifests plus exactly the files the metadata records — everychecksumkey and everyindextarget, at their recorded paths. A recorded file missing from the tree is an error naming it (.meta.json records LICENSE, which is not in the directory); a recorded path that escapes the directory is refused (.meta.json records "../README.md": …); a recorded entry that is not a regular file is refused. The kept.meta.jsonis still verified on the read-back, so a stale checksum refuses the bundle as before. A directory without a.meta.jsonis archived as KerML 1.1 §10.3 describes a project archive — "a model interchange file for each of the root namespaces in the project" and the two manifests — so its members are.project.jsonand the model files (.sysml,.kerml) outside hidden entries, library directories and nested projects, with the.meta.jsongenerated from them; a README,__pycache__, editor backups (X.sysml~),.git/and build scripts never travel. A project that wants itsLICENSEor anything else in the archive records it in a.meta.json, as the Extensions Library does.Consequences stated plainly: an archive another tool wrote round-trips to the files its
.meta.jsonrecords. sysand'smbse4u-sysmod_5.1.4.kparcarried a README and a license its metadata does not record, so unbundling and re-bundling it gives 5 members, not 7; the round-trip test now says so. TheBundledoc comment anddocs/guide/03-command-line.mddocument the rule.Acceptance:
sysml -bundleagainstbuild-kpar.pyand the published releaseClone of OpenSysML-Extensions-Library at
b36b361f85af4764de8e2817cbae62fb9e74ffdbwithscripts/__pycache__/x.pycadded:unzip -lof all three, sizes and names (thedevelopbinary gives 36 members on the same tree):diffof the three listings: empty.cmpof each of the 19 members extracted from ours againstbuild-kpar.py's and against the publishedopensysml-extensions-library-1.0.0.kpar: every member identical. The published archive is byte-identical tobuild-kpar.py's (SHA-2561eb10ec8…); ours differs from both only in the ZIP container headers (Go's writer records a Unix mode and extended-timestamp field where Python'sZipInfo(external_attr=0, create_system=0)does not), not in any member.Specification basis
KerML 1.1 Beta 2 §10.3 (Model Interchange Projects): "The archive shall contain a model interchange file for each of the root namespaces in the project … In addition, the archive shall contain, at its top level, exactly one file named .project.json and exactly one file named .meta.json." No row in
docs/project/spec-compliance.mdmoves.How it was verified
go test ./internal/workspace/project—TestBundleArchivesTheFilesTheMetadataRecords(recorded subset, missing recorded file named,../path refused), the metadata-generation test now expecting the model files alone (with an editor backup in the tree),TestBundleLeavesNestedProjectsOut,TestBundleLeavesTheLibraryDirectoryOut.go test ./tests/kpar—TestBundleIsDeterministicAndUnbundleReproducesTheRecordedFiles(renamed;compareRecordedcompares the recorded set, the sysmod round trip expects 5 members) and the newtests/kpar/bundle_test.go: a repository-shaped tree built at test time (two units,LICENSE, README, CONTRIBUTING,scripts/build.pywith__pycache__,Widgets.sysml~,.git/HEAD,.github/) whose.meta.jsonrecords three files bundles to exactly those plus the manifests, byte for byte;LICENSEremoved →cannot bundle …: .meta.json records LICENSE, which is not in the directory;.meta.jsonremoved → the project file and the two model files, index generated.go build ./...ok,go vet ./...ok,gofmt -l .empty,make lint(staticcheck + gosec, both modules) ✓,go test ./...withOPENSYSML_REQUIRE_TRAINING_CORPUS=1 OPENSYSML_REQUIRE_PILOT_CORPORA=1 OPENSYSML_REQUIRE_SPEC_EXAMPLES=1after the three download scripts — all packages ok,python3 scripts/changelog.py checkok,python3 scripts/check-doc-links.py→ 0 broken links,python -m mkdocs build --strictok,make extension-libraries-check→ in sync.origin/develop, against chore(extensions): re-pin to the project-interchange upstream and prove the vendored copy is the published project #1563 (the sibling), and textually clean against chore(pilot): pin the OMG pilot implementation to release 2026-09 (0.63.0) #1529's head for every file this PR touches — the bundle section oftests/kpar/kpar_test.godoes not overlap chore(pilot): pin the OMG pilot implementation to release 2026-09 (0.63.0) #1529's OMG tier-map edits; chore(pilot): pin the OMG pilot implementation to release 2026-09 (0.63.0) #1529's own conflicts with develop are indocs/project/*files this PR does not change.confinedToasUnbundledoes, thread resolved; the current head has no open finding of any severity, flags included.Checklist
make testandmake lintpass locallychanges/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (compliance rows need nothing: the census is counted at docs build)F4,K5) in the body, docs, or changelogLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/1e9164f57f814014a9f0aba35666e2a3
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/1e9164f57f814014a9f0aba35666e2a3?variant=devin
Requested by: @HuiJun