Repository navigation
fix(libs): record a document whose metadata names undeclared types or elements - #1314
Merged
Merged
Conversation
… elements An annotation naming a metadata type no declaration supplies contributed no supertype but marked the element's supertypes provisional, so the interface recorder refused the document; the unresolved reference is the document's diagnostic, and a lookup a resolver guard cut short is already accounted for by the frames DirectSupertypes opens. A recorded about metadata usage whose targets did not resolve dropped out of the workspace-wide about gather, so its record was written off as stale among its neighbours; the record now marks the usage with ModAnnotatesOthers and the gather reads it. The spec-examples root joins corpusRoots in tests/model. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…fix/spec-examples-interface-record
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>
…fix/spec-examples-interface-record
6 tasks done
…interface-record Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/spec-examples.md
Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/spec-examples.md
6 tasks done
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
Closes gap G14 of
docs/project/spec-examples.md(the spec-examples corpus of #1302, now ondevelop; this PR was stacked on it and is retargeted todevelop). The branch carriesorigin/develop5db0f74 (#1313, #1318, #1323, #1325, #1358 included) and, ahead of its merge, the head of #1307 (958008f), each as a merge commit, so it dry-merges clean once that lands. The only conflicts were inspec-examples.md's gaps record, resolved by taking their text whole — the intro, the "Closed" paragraph with G1–G5 and the G6–G8 reclassification, and the re-worded G9–G13 rows — and adding one sentence closing G14 to that paragraph while dropping the G14 row, as the paragraph does for the other closed gaps. Every ratchet and count block was regenerated from the merged tree withexamples/spec-examplesre-extracted first:pilot-differential-baseline.jsonbyte-identical to the committed one,make docs-countscurrent,spec_examples_expected.txtunchanged — this fix moves no verdict, only recordability.With
examples/spec-examplesadded tocorpusRootsintests/model,TestInterfaceRecordDifferentialCorporahad six failures, two kinds, both in the interface recorder rather than in the extracted files (which are not edited):provisional supertypes of Kerml 7.4.13 example 11::Save(also12::previousAction,14::Save,15::Save).semanticMetadataBasesreturnedcomplete=falsewhenever an annotation's metadata type did not resolve (behavior Save { @Command; }with noCommanddeclared), andDirectSupertypesmarked the element's supertypes provisional on that flag. Provisional means "a resolver guard cut a lookup short, recompute later" — the recorder rightly refuses those. A name no declaration supplies is not that: it is the reference'sunresolveddiagnostic, and the answer is final. The flag is gone; the guard-cut case was already covered, since a lookup that re-enters a type under computation callsResolver.CutShortandLeave()reports it. A declaration arriving later still updates the answer, because the lookup read the name andResolver.Invalidatedrops the memoized closure when that name is registered (pinned byTestSemanticMetadataTypeDeclaredLaterContributesItsBase).the interface record was written among other documents: kerml/7.4.13/3.kerml(andsysml/7.27.2/3.sysml).metadata securityDesignAnnotation : SecurityRelated about SecurityDesign;names elements that do not resolve, so the record'sAboutlist is empty. The workspace-wideaboutgather admitted a recorded symbol only whenlen(Facts.About) > 0, so the recorded document dropped out of the\0aboutcontributors while its loaded form (judged syntactically byAnnotatesOthers) was in them; the record's provenance then disagreed with the receiving workspace andOpenRecordedreported it stale. The record now carriesModAnnotatesOthersfor a metadata usage written with anaboutclause, resolved or not, andcollectAboutreads it, so the contributor set is the same loaded and recorded.interfaceFormatVersion18 → 19;Modifierswidens touint64(the 32 bits were full).examples/spec-examplesjoinscorpusRoots, so the incremental and interface-record differentials run over it.Specification basis
KerML 1.1 Beta 2 §7.4.13 / SysML v2.1 Beta 2 §7.27.2–7.27.3: a metadata annotation whose type does not resolve contributes no implicit specialization; the reference is reported. An
aboutclause is a syntactic property of the metadata usage (SysML 8.2.2.21.1MetadataUsage, KerML 8.2.4.3Annotation), independent of whetherannotatedElementresolves. No row ofdocs/project/spec-compliance.mdmoves: diagnostics are unchanged (below), only the document's recordability changes.Behaviour changes
aboutmetadata usage names undeclared elements, now has an interface record (was refused / written off as stale). Diagnostics on such a document are identical before and after.Model.SupertypesProvisionalis false for an element whose annotation type is unresolved (was true), so its supertype closure is memoized.TestAllSupertypesNotMemoizedWhileMetadataProvisionalpinned the old rule as a stand-in for invalidation; it is rewritten asTestAllSupertypesMemoizedWhileMetadataTypeUnresolved, and the later-declaration guarantee it protected is pinned where it actually lives (the workspace's invalidation) byTestSemanticMetadataTypeDeclaredLaterContributesItsBase.Probe table
Ours =
sysml -validatewith a freshXDG_CACHE_HOMEon the base branch's build (before) and this branch's (after); pilot = pinnedvalidate-kerml/validate-sysml-batch(2026-08, 0.62.0).package Annot { behavior Save { @Command; } }(.kerml)1:34 error[unresolved]: unresolved reference: Command1:34 Couldn't resolve reference to Type 'Command',Must have a concrete typepackage About { metadata securityDesignAnnotation : SecurityRelated about SecurityDesign; }(.kerml)1:53 unresolved reference: SecurityRelated,1:75 unresolved reference: SecurityDesign1:17 Must have a concrete type, unresolved proxies at 1:53 (type) and 1:75 (annotatedElement)package P { #Command action def Save; }(.sysml)1:14 error[unresolved]: unresolved reference: Command1:14 Couldn't resolve reference to Type 'Command',A metadata usage must be typed by one metadata definition,Must have a concrete typeTestInterfaceRecordOfUnresolvedMetadataReferences)saverefused (provisional supertypes),aboutstale (written among other documents)How it was verified
Red → green on the gate named in the G14 row:
go test ./tests/model -run TestInterfaceRecordDifferentialCorpora/spec-exampleswith the root incorpusRoots— 6 failures (11,12,14,15.kermlprovisional supertypes of … Save/previousAction;kerml/7.4.13/3.kermlandsysml/7.27.2/3.sysmlwritten among other documents).TestInterfaceRecordDifferentialCorpora/spec-exampleskerml 176 of 176 recorded, sysml 335 of 335 recorded;TestIncrementalEqualsFreshCorpora/spec-examplespasses.semantics.TestUnresolvedMetadataTypeLeavesSupertypesSettled(KerML@Command;and SysML#Command),semantics.TestAllSupertypesMemoizedWhileMetadataTypeUnresolved,model.TestSemanticMetadataTypeDeclaredLaterContributesItsBase,tests/model.TestInterfaceRecordOfUnresolvedMetadataReferences.TestSpecExamplesDiagnosticspasses unchanged (spec_examples_expected.txtmoves no line — the fix changes recordability, not a verdict).rm -rf build/pilot-diff && go run -C tools ./cmd/pilot-diff -updatere-recordeddocs/project/pilot-differential-baseline.jsonbyte-identical (no movement: no example or diagnostic changed), andmake docs-countsreports every figure current, so neither file is in the diff.go build ./...,go vet ./...,gofmt -l .(empty),python3 scripts/changelog.py check,make lint(staticcheck + gosec) pass.go test -count=1 -timeout 60m ./...withOPENSYSML_REQUIRE_SPEC_EXAMPLES,_TRAINING_CORPUS,_PILOT_CORPORAand_PILOT_LIBRARY_XMIset: every package ok (internal/frontend/lspre-run alone, 18 s, ok — its first run timed out only because a stray git worktree under/tmpwas being indexed by the wire tests, which openfile:///tmp/wire.sysml).go test -C tools ./...: ok. The whole gate was re-run on the final merged tree (origin/develop5db0f74, fix(parser): recover from the erratum spellings in the specification examples #1307 958008f) withexamples/spec-examplesre-extracted byscripts/download-spec-examples.shfirst (the root is gitignored and feat(parser): parse the five productions the specification examples use #1315 changed the extractor, so a stale extraction moves the root digest in the baseline): every package ok, pilot-diff-updateidentical to the committed baseline except itsrecordeddate (left as committed),make docs-countscurrent,TestSpecExamples*green, spec-examples kerml 176/176 and sysml 335/335 recorded.TestStdlibConformanceis part of the full run.Checklist
make testandmake lintpass locallydocs/internals/interface-records.md,docs/project/spec-examples.mdG14)changes/unreleased/interface-record-unresolved-metadata-references.fixed.mdmake docs-countsrun if a gate count moved (re-recorded; nothing moved)Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/35fc02176ecc49129b4bdaa3d734ee2e
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/35fc02176ecc49129b4bdaa3d734ee2e?variant=devin
Requested by: @HuiJun