Skip to content

fix(resolve): do not report name collisions among a view's exposes alone - #1635

Merged
HuiJun merged 3 commits into
developfrom
fix/expose-name-conflict
Oct 28, 2026
Merged

HuiJun merged 3 commits into
developfrom
fix/expose-name-conflict

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown
Contributor

What and why

Since name-conflict started covering imported memberships, a view whose exposes bring two members of one name warns, although an Expose is the thing a view uses to show elements and both are shown:

package V {
    part a { part p; }
    part b { part p; }
    view v { expose a::**; expose b::**; }
}

sysml -validate reported warning[name-conflict]: Duplicate of imported member name 'p' while sysml -render V::v draws both p. Recursive exposes over real models hit this constantly.

checkImportedNames (internal/semantic/resolve/distinguishability.go) now skips a name when every colliding membership comes only through an Expose. gatherImported records per membership whether every import reaching it is an Expose (importedMember.exposedOnly), so a membership an expose brings first and a plain import reaches again still counts as imported. The warning stays when a plain import or an inherited member is part of the collision, since a name written in the view then changes what it resolves to. The hiding itself (KerML 7.2.5.4) does not change: the colliding names are still not members of the view, and an unqualified p written inside it stays unresolved with the hidden-import hint. Owned-duplicate reporting and strict mode do not change either.

Specification basis

  • KerML 8.3.2.4.5 Namespace::importedMemberships excludes "Memberships that have distinguisibility collisions with each other or with any ownedMembership", so colliding imported memberships are not in membership, and validateNamespaceDistinguishibility (which ranges over membership) is not violated by them.
  • SysML ViewUsage::exposedElement = ownedImport->selectByKind(Expose).importedMemberships(Set{}).memberElement->select(includeAsExposed) reads each Expose's own memberships, so a collision among exposes never changes what the view exposes.

The docs/project/spec-compliance.md row on imported memberships colliding by name now says this and lists the new tests. The row's status is unchanged.

How it was verified

  • go build ./..., go vet ./... clean; gofmt -l . empty.
  • go test -count=1 ./internal/semantic/resolve/... ./internal/check/... ./tests/resolve/... passes. New cases: two exposes colliding give no diagnostic and ExposedMembers still returns both V::a::p and V::b::p (tests/resolve/expose_name_conflict_test.go); import a::* + expose b::*, two exposes plus a plain import, an inherited member plus an expose, and a package with two colliding imports all still warn (same file and internal/check/passes/imported_name_conflict_test.go).
  • By hand on the repro above: sysml -validate gives warning[name-conflict] on develop and nothing on this branch; sysml -render V::v draws both V::a::p and V::b::p.
  • External check, sysml -validate over the 153 .sysml files under src, extensions and examples/sysml-diagram-samples of the MEMO application's repository: 29 → 0 name-conflict warnings, and no new diagnostic of any kind.

Corpus gates

Corpora fetched with ./scripts/download-pilot-corpora.sh, ./scripts/download-spec-examples.sh and ./scripts/download-training-examples.sh; go test -count=1 ./tests/corpus -run 'TestPilotCorpora|TestSpecExamples|TestTrainingExamples' passes (TestPilotCorporaDiagnostics, TestSpecExamplesDiagnostics, TestTrainingExamplesSemanticErrors). No ratchet moved: pilot_corpora_expected.txt and the spec-examples expectation are unchanged, since every imported-collision row in those corpora comes through a plain recursive import (the Annex A models) and keeps its warning; training_examples_expected.txt is untouched.

Pilot differential

The differential records the imported-collision rows, so its baseline is re-recorded (go run -C tools ./cmd/pilot-diff -update; the pilot column is live, 0 jar not found). Every movement against the committed baseline:

Row Movement Adjudication
examples/general-views-demo/vehicle.sysml:102 only-ours unmapped warning retired (Duplicate of imported member name 'mass') This change. definitionView's single expose VehicleStructure::**[…] reaches Vehicle::mass, vehicle::mass and heavyVehicle::mass; all three come through the Expose, so it is no conflict.
examples/self-model/asciidoc/markup.sysml:16 only-ours unresolved-reference severity error → warning Not this change; develop drift. a66b0c6 (#1622, "warn, not fail, when a markup converter is missing") made this diagnostic a warning after the baseline was last recorded, without re-recording it. A clean pilot-diff -out run on current origin/develop (55fafe2) already gives warning on this row, and differs from this head's recording only by the vehicle.sysml:102 row above. The row is deterministic: with no AsciiDoc converter configured (OPENSYSML_ASCIIDOCTOR unset) it is the same on every run, and two runs at this head recorded byte-identical JSON.

Totals: 518 → 519 fully agreeing, 360 → 359 only ours, 1469 → 1468 our diagnostics; agreed (1098), severity-only (11), only-pilot (2462) and pilot diagnostics (3571) unchanged. docs/project/pilot-differential.md gets the round, its Results and current-counts tables; make docs-counts regenerated the README and architecture figures (the errata-corrected figure moves 520/358 in step), and the skills that quote the headline are refreshed so the skill-count guard holds.

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

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

@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 October 28, 2026 15:53
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration Bot and others added 2 commits October 28, 2026 15:55
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…n retired

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@HuiJun
HuiJun merged commit 42188b2 into develop Oct 28, 2026
30 checks passed
@HuiJun
HuiJun deleted the fix/expose-name-conflict branch October 28, 2026 17:33
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