Repository navigation
fix(project): link a usage by elimination only when its resource spells a location - #1561
Merged
Merged
Conversation
…deferred it The final pass no longer recomputes a deferred usage's candidates, which a later claim could have emptied; the list that deferred it is carried on the pending record and is what the warning names. Co-Authored-By: jason.han <hanhuijun@gmail.com> (cherry picked from commit acd68dfea3f81ed794442f547da77946f7d981c8)
…ls a location A resource that names a project (pkg:sysand/<publisher>/<name>, any other pkg:<type>/<publisher>/<name>) is matched by name alone and stays unresolved when that project is not installed; only a version-control purl (pkg:git, svn, hg) or a plain URL, which spell where a project is kept, is linked by elimination among the unclaimed installed projects. 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)".
|
Co-Authored-By: jason.han <hanhuijun@gmail.com>
6 tasks done
Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/guide/03-command-line.md # docs/internals/design/package-management.md # internal/workspace/project/discovery.go
6 tasks done
…hing A usage constrained to a project that is both installed and enclosing claims it without a queue entry; the elimination pass now repeats while anything was claimed, so the deferred usage links its one remaining candidate. Co-Authored-By: jason.han <hanhuijun@gmail.com>
This was referenced Oct 30, 2026
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
Follow-up to the reader's usage linking (
internal/workspace/project/discovery.go): a usage that names no installed project by publisher/name is linked by elimination among the unclaimed installed projects — needed because a version-control IRI spells a repository's path (pkg:git/github.com/MBSE4U/sysmod-sysmlv2for the projectmbse4u/sysmod), not the project. Two corrections to that rule:Usage.spellsLocation(): a version-control package URL (pkg:git/,pkg:svn/,pkg:hg/) or a plain scheme URL (https://…,ssh://…,file://…,git@host:…). Every otherpkg:<type>/<publisher>/<name>form (pkg:sysand/…,pkg:registry/…, …) names a project: it is matched by name alone and stays unresolved when that project is not installed. Before, such a usage could fall back to the one unrelated installed project and the model validated against the wrong one.usedno longer recomputes a deferred usage's candidates (a list a later claim could have emptied); they travel on thependingrecord. A single remaining candidate still links.The rule, as the guide and
docs/internals/design/package-management.md§3 now state it: slug match of publisher/name first; else, for a location-spelling resource only, among the installed projects no usage claims (a claimed project's other versions count as claimed) those satisfying the usage's constraint — one publisher/name → that project at the highest satisfying version; several → unresolved, one warning naming each candidate; none → unresolved. Installed projects no usage claims are not loaded.Behaviour change: named forms no longer fall back to an unrelated install (they are unresolved, as before the elimination rule). No fixture moved; no update flag re-recorded anything.
Left as is here: a named usage whose version is not installed (
pkg:registry/acme/gears@1.0.0with only 2.0.0 underlib/) still takes the latest installed version of that project, silently — develop's "exact, else latest" rule from #1517, which this PR does not touch. #1568 replaces it on both the named and the elimination path: highest installed version the constraint admits, else aproject.loadwarning at the consumer's.project.jsonnaming the installed versions and the usage selects nothing.Merged with develop at
12e4fc392(one merge commit, no rebase). The merge keeps the elimination-link warning that landed with #1563 —Projects.Linking,eliminationUsage, theinstalledKeyexemption for an enclosing project installed under the roots, andpickUnclaimednever picking the consumer itself — beside thespellsLocationrestriction: a location-spelling usage linked by elimination is said once as a warning, a named usage says nothing and links by name alone. The guide's and the design doc's §3 paragraphs carry both. The exhaustion test now expects its two elimination links said (Linkinghas two entries) rather than silence.How it was verified
internal/workspace/project:TestUsedLeavesAMissingNamedUsageUnresolved(pkg:registry/acme/gears,pkg:sysand/acme/gears@1.0.0,pkg:npm/acme/gearsbeside a loneacme/widgets→ nothing used, nothing unlinked),TestSpellsLocation(11 resources),TestUsedSurvivesADeferredUsageWhoseCandidatesAreAllClaimedLater(unconstrainedpkg:gitusage deferred, later usages claim both candidates → both linked by elimination, each said once, no ambiguity, no panic),TestUsedRevisitsADeferredUsageAfterAClaimOfASelectedProject(consumer and installed Gears both input paths; a later usage claims Gears without a queue entry → the deferred usage links Widgets, its one remaining candidate); the existingTestUsed*andtests/kparfixtures (MBSE4U reproducer, two-version Gears, ambiguous usage, exit policy, quiet) unchanged and passing.gofmt -l .empty;go vet ./...,go build ./...;go test -count=1 -timeout 40m ./...withOPENSYSML_REQUIRE_TRAINING_CORPUS,_PILOT_CORPORA,_SPEC_EXAMPLES,_PILOT_LIBRARY_XMI,_PSSM_SUITEset → all packages ok;make lint;make man-check;make docs-counts;python3 scripts/changelog.py check;tests/wasmbudgets.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/020c7f4cdced4720a9afe70d9e4490ae
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/020c7f4cdced4720a9afe70d9e4490ae?variant=devin
Requested by: @HuiJun