[plantuml] clean up uid normalization and namespace resolution - #496
Merged
Merged
Conversation
hoe-jo
requested review from
LittleHuba,
castler,
limdor and
ramceb
as code owners
October 1, 2026 11:53
hoe-jo
force-pushed
the
joho_harmonize_uid_derivation
branch
from
October 1, 2026 14:02
bd4e946 to
869df0f
Compare
- Id leaf of classes, enums, packages and namespaces is the alias, else the name. - References use the shared lookup and see entities declared before them, plus the scope-local hit. - Simple names match the last segment of qualified declarations. - Package-nested relationships resolve after all entities are registered. - New errors: DuplicateEntity (incl. re-declared classes, which PlantUML merges) and AmbiguousReference. Goldens with aliased classes now use the alias as id.
…ndpoints Relationship endpoints only accepted '.'-separated qualified names; '::' silently truncated the reference to its first segment (e.g. `A --> ns::B` resolved "ns"). The grammar now accepts '::' as an alternative separator and an optional leading '.' for an explicit root-anchored reference, matching declarations and extends/implements. Adds parser coverage for ::-qualified endpoints (with and without multiplicities), a ::-qualified relationship label (must not be mistaken for an endpoint), and a leading-'.' root-marker endpoint. Also adds a resolver fixture for an unresolved qualified extends target, now that it goes through the same lookup. cross_diagram/qualified_reference moves from an error-case regression baseline to a positive case now that the grammar resolves it.
Namespace blocks silently dropped relationship statements written inside them (Package already supported this). Add a relationships field to the Namespace AST node, parse it the same way as Package, and resolve it in a second pass after all entities are registered, mirroring the package path.
The component resolver tracked its nesting as a Vec<String> and joined raw names, so `component "a::b"` and `component "a.b"` produced two different ids and a quoted `"score::mw::log"` endpoint kept its '::'. Scope, element ids, port ids and parent ids now go through InternalScope and RootAnchor, as the class resolver already does, and references are normalized before lookup. ComponentResolver gains with_root_anchor(); new() keeps the empty anchor. relation_quoted_name now yields `score.mw.log`. New fixture invalid_duplicate_component_separator covers the duplicate across separators.
The component resolver searched every descendant scope, fell back to a global alias/label match and was ambiguous whenever a root element and a nested one shared a leaf, even when `S.r` named the nearer one. References now go through uid_normalization::resolve_reference, the same lookup the class resolver uses: `S.r`, else the unique leaf; qualified names are `S.r` or the root path. Intermediate scopes and descendants are not searched and the label of an aliased element no longer matches. When no element matches, ports are looked up the same way and resolve to their owning component; the port role comes from the port the reference named. Several matching ports are ambiguous and reported by port id. The leaf key used to index elements and ports moves to uid_normalization::leaf_key and is shared with the class resolver. New fixtures: relation_simple_name_prefers_direct_hit, invalid_qualified_name_does_not_search_descendants, invalid_ambiguous_nested_reference, invalid_unresolved_label_reference.
hoe-jo
force-pushed
the
joho_harmonize_uid_derivation
branch
from
October 1, 2026 14:45
869df0f to
f5b0178
Compare
castler
approved these changes
Oct 5, 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.
No description provided.