Skip to content

fix(semantics): subset the base feature of a usage kind and derive its type from it - #475

Merged
HuiJun merged 10 commits into
developfrom
fix/library-index-supers-and-parameter-order
Sep 21, 2026
Merged

HuiJun merged 10 commits into
developfrom
fix/library-index-supers-and-parameter-order

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

What and why

Empties the "Decisions to Reassess" table of docs/project/spec-compliance.md. Both rows recorded a workaround whose premise no longer holds:

  • Base features. semantics/implicit.go implicitUsageBases named the stdlib base definition of each usage kind (Parts::Part, Actions::Action, …) because library records once carried no specialization edges, so the base feature would have been a dead end for member lookup. The records have carried Supers for a while (libs/record.go factRecord.Superssymbols.LibraryFacts.SupersModel.recordedSupertypes), so the table now names the base feature the spec names (Parts::parts, Items::items, Actions::actions, Connections::binaryConnections for a two-ended connection, …). A SysML usage now implicitly subsets that feature — implicitUsageBaseFeature, a member contributor and implicit general beside the KerML implicitKerMLFeatureBase, never a DirectSupertypes entry — and its type is derived from it (baseFeatureTypes: the feature's declared types plus those of the features it subsets, most-specific kept, KerML Feature::type). kindBaseDefinitionFQNs keeps KindBaseFQNs, computeImplicitBases and the suppression rule (declaredGeneralizationReaches) working on definitions, so the effective typing is unchanged for every kind except a two-ended connection/interface usage, which now derives {Connection, BinaryLinkObject} from binaryConnections as the library states (definitions with two ends still specialize BinaryConnection/BinaryInterface). Member lookup through the feature works: Parts::parts reaches Part and items through the recorded edges.
  • Parameter order of a library-indexed behavior. The row assumed a cached library symbol has no parsed AST for ownedParameters to read. It does: the on-disk record path re-parses every library document and the embedded snapshot restores Symbol.Decl, so positional redefinition already holds on every load path. No IndexRecord change and no format bump is needed; a test now locks the three paths.

The libs/loader.go recordEntries the first row pointed at no longer exists; the edges live in record.go.

Specification basis

SysML v2 §7 — each library package states the base feature of its usage kind (Parts::parts "is the base feature of all PartUsages", Connections::binaryConnections "of all binary ConnectionUsages", …); KerML 8.3.3.3 (Feature::type through subsetting); KerML 7.4.7.3 / SysML v2 7.17.2 (positional parameter redefinition). Rows moved: "Features of the stdlib base type of an untyped usage" ⚠️ → ✅; the untyped-connector row names the base features; both "Decisions to Reassess" rows removed.

How it was verified

  • New: model/implicit_typing_test.go TestImplicitUsageBaseTypes now asserts, per kind, both the derived definition and the base feature among ImplicitGenerals; TestUsageBaseFeatureSuppressionFollowsDeclaredChain (part p : Vehicle keeps parts, part p :> q with q a part does not); a semantics test asserts the derived definitions for every table entry and both binary features (binaryConnections[Connection, BinaryLinkObject]); libs/loader_cache_test.go TestLibraryBehaviorParametersRedefinedByPosition (cold load, warm disk cache, embedded snapshot).
  • Stand-in libraries in semantics/implicit_test.go gained the base features the real library has; no assertion weakened.
  • go build ./..., go vet ./..., gofmt -l . empty, go test -count=1 ./..., make lint, python3 scripts/check-doc-ids.py, python3 scripts/changelog.py check.
  • Corpus gates with corpora downloaded (OPENSYSML_REQUIRE_TRAINING_CORPUS=1 OPENSYSML_REQUIRE_PILOT_CORPORA=1 go test -count=1 ./tests/corpus -run 'TestTrainingExamples|TestPilotCorpora'): no movement. Pilot library identity gate (OPENSYSML_REQUIRE_PILOT_LIBRARY_XMI=1 go test -count=1 ./tests/identity -run TestPilotLibraryXMI): passes.
  • internal/workspace/libs/stdlib.snapshot regenerated (derived supertypes of the two binary base features changed; format version unchanged).

Checklist

  • make test and make lint pass locally
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (see CONTRIBUTING.md)
  • Changelog entry added as changes/unreleased/<slug>.<section>.md, not as an edit to CHANGELOG.md
  • baselines regenerated and make docs-counts run if a gate count moved (compliance rows need nothing: the census is counted at docs build)
  • No internal work-item labels (waves, slices, F4, K5) in the body, docs, or changelog

devin-ai-integration Bot and others added 5 commits September 20, 2026 18:53
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
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

@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review September 20, 2026 20:31
devin-ai-integration[bot]

This comment was marked as resolved.

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

This comment was marked as resolved.

devin-ai-integration Bot and others added 3 commits September 20, 2026 20:51
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
devin-ai-integration[bot]

This comment was marked as resolved.

@HuiJun
HuiJun merged commit 3c452f7 into develop Sep 21, 2026
15 checks passed
@HuiJun
HuiJun deleted the fix/library-index-supers-and-parameter-order branch September 21, 2026 09:29
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