Skip to content

feat: support combined anonymous instance identifier format#61

Merged
Artifizer merged 1 commit intoGlobalTypeSystem:mainfrom
mattgarmon:main
Feb 20, 2026
Merged

feat: support combined anonymous instance identifier format#61
Artifizer merged 1 commit intoGlobalTypeSystem:mainfrom
mattgarmon:main

Conversation

@mattgarmon
Copy link
Copy Markdown

@mattgarmon mattgarmon commented Feb 19, 2026

Summary by CodeRabbit

  • New Features

    • Support for UUID "tails" on IDs, allowing combined anonymous instances to be recognized and matched.
    • Validation now enforces UUID format for trailing segments and refines hyphen/tilde rules.
  • Tests

    • Added comprehensive tests covering UUID-tail parsing, validation, matching, and malformed-case rejection.
  • Chores

    • Updated submodule reference.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 19, 2026

📝 Walkthrough

Walkthrough

Adds UUID-tail support for GTS IDs: a new is_uuid(&str) validator, ParsedSegment.is_uuid_tail flag, detection/splitting of a trailing UUID portion in validate_gts_id, and propagation of the flag into GtsIdSegment with adjusted single-segment validation and matching.

Changes

Cohort / File(s) Summary
Submodule Reference
\.gts-spec
Updated submodule commit pointer; metadata-only change.
UUID Validation & Parsing
gts-id/src/lib.rs
Added pub fn is_uuid(&str) -> bool; added pub is_uuid_tail: bool to ParsedSegment with clippy allow; updated validate_gts_id/validate_segment to detect and separate a trailing UUID tail, enforce hyphen rules, reconstruct segments_raw, and added tests for UUID-tail and tilde/hyphen edge cases.
UUID Tail Propagation & Matching
gts/src/gts.rs
Added pub is_uuid_tail: bool to GtsIdSegment; initialized and propagated the flag in constructors/parsing; relaxed single-segment prohibition to permit single combined anonymous instances only when the last segment has a UUID tail; updated matching logic to compare raw segment when pattern segment is a UUID tail.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐇 I hopped through tilde-fields all night,

found a shiny UUID tail in sight.
I split the string and gave a cheer,
now segments and tails can both appear.
Hop, hop—parse right, with nary a fright! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main change: adding support for combined anonymous instance identifier format with UUID tails, as evidenced by new validation logic, UUID detection functions, and comprehensive tests across multiple modules.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@mattgarmon mattgarmon force-pushed the main branch 2 times, most recently from 18cc42a to 8daeff8 Compare February 19, 2026 17:59
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@gts-id/src/lib.rs`:
- Around line 818-833: Run rustfmt on the repository and apply formatting fixes
to the test block around the function
test_uuid_tail_without_preceding_tilde_rejected in gts-id/src/lib.rs; ensure the
test formatting (indentation, spacing, and trailing commas) matches cargo fmt
expectations and re-run cargo fmt so the call to validate_gts_id and the match
on GtsIdError::Id are consistently formatted per rustfmt.

In `@gts/src/gts.rs`:
- Around line 148-158: match_segments currently treats two UUID-tail segments as
equal by comparing only parsed fields (vendor, package, namespace, type_name,
ver_major, ver_minor, is_type), which are empty for UUID tails; update
match_segments so that when both Segment::is_uuid_tail is true and the pattern
segment does not contain a wildcard ('*'), you first compare the raw
Segment::segment string (the actual UUID) for equality before falling back to
parsed-field comparisons; modify the branch that handles UUID-tail segments in
match_segments to perform this explicit segment-string check to ensure
non-wildcard UUID-tail matching requires the same UUID.

Comment thread gts-id/src/lib.rs
Comment thread gts/src/gts.rs
Signed-off-by: Matt Garmon <matt.garmon@acronis.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
gts/src/gts.rs (1)

263-266: UUID tail matching works correctly, though could be more explicit.

The current implementation addresses the past review concern about different UUIDs comparing equal. The logic is functionally correct because:

  • If pattern is UUID tail and segments differ → returns false
  • If pattern is UUID tail and segments match → continues to empty field comparisons which pass
  • If candidate is UUID tail but pattern isn't → vendor/package checks fail

However, the suggested fix from the past review was more explicit:

if p_seg.is_uuid_tail || c_seg.is_uuid_tail {
    if p_seg.is_uuid_tail != c_seg.is_uuid_tail || p_seg.segment != c_seg.segment {
        return false;
    }
    continue;
}

This would:

  1. Explicitly reject mismatched UUID-tail flags
  2. Skip unnecessary empty-string field comparisons via continue

The current code works, but consider adopting the more explicit form for clarity and slight efficiency gain.

♻️ Optional: More explicit UUID tail handling
-            // Non-wildcard UUID tail - compare raw segment string (the actual UUID)
-            if p_seg.is_uuid_tail && p_seg.segment != c_seg.segment {
-                return false;
-            }
+            // UUID tail segments must match exactly (both must be UUID tails with same UUID)
+            if p_seg.is_uuid_tail || c_seg.is_uuid_tail {
+                if p_seg.is_uuid_tail != c_seg.is_uuid_tail || p_seg.segment != c_seg.segment {
+                    return false;
+                }
+                continue;
+            }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@gts/src/gts.rs` around lines 263 - 266, Replace the implicit UUID-tail
handling with an explicit branch: when either p_seg.is_uuid_tail or
c_seg.is_uuid_tail is true, first require they match (p_seg.is_uuid_tail ==
c_seg.is_uuid_tail) and then require the raw segment strings to match
(p_seg.segment == c_seg.segment); if either check fails return false, otherwise
continue the loop to skip the subsequent empty-field comparisons. Target the
loop that inspects p_seg and c_seg (using the is_uuid_tail and segment fields)
and replace the current single-case check with this explicit two-step check and
a continue on success.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@gts/src/gts.rs`:
- Around line 263-266: Replace the implicit UUID-tail handling with an explicit
branch: when either p_seg.is_uuid_tail or c_seg.is_uuid_tail is true, first
require they match (p_seg.is_uuid_tail == c_seg.is_uuid_tail) and then require
the raw segment strings to match (p_seg.segment == c_seg.segment); if either
check fails return false, otherwise continue the loop to skip the subsequent
empty-field comparisons. Target the loop that inspects p_seg and c_seg (using
the is_uuid_tail and segment fields) and replace the current single-case check
with this explicit two-step check and a continue on success.

@Artifizer Artifizer merged commit d91c151 into GlobalTypeSystem:main Feb 20, 2026
8 checks passed
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.

2 participants