fix(externals): resolve refs with a hyphenated (kebab) prefix (REQ-143)#384
Merged
Conversation
User-reported (0.14.0): `/artifacts/linc-mesh:A-AVTP-STREAM` in serve
returned "Artifact does not exist", and external `prefix:ID` refs with a
kebab-case prefix were unresolved in document rendering, although the
artifact existed in the external project.
Root cause: `parse_artifact_ref` required the prefix to be purely
`is_ascii_lowercase()` — no hyphens — so a project slug like `linc-mesh`
fell through to `ArtifactRef::Local("linc-mesh:A-AVTP-STREAM")` and was
looked up as a local id (404). But externals are stored as
`<prefix>:<id>` with that same hyphenated prefix, so the parser no longer
round-tripped its own stored form. Every external whose prefix contained
a hyphen was unreachable in the serve detail view and in document link
resolution (both delegate to this one function).
Fix: accept a kebab-case slug prefix — leading lowercase letter, then
lowercase letters / digits / hyphens. Updated the Kani round-trip proof
to the new contract. Regression tests: `linc-mesh:A-AVTP-STREAM` and
`linc2:REQ-1` parse as External; non-slug `H-1:2` / `-bad:REQ-1` stay
Local; all 28 externals tests pass.
Also files REQ-144 (source-view substring mis-link) and REQ-145
(test-results `rivet_tc_id` property) — two more user reports triaged
this iteration, draft, to be worked next.
Fixes: REQ-143
Refs: REQ-085, REQ-144, REQ-145
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📐 Rivet artifact delta
Graphgraph LR
REQ_143["REQ-143"]:::added
REQ_144["REQ-144"]:::added
REQ_145["REQ-145"]:::added
classDef added fill:#d4edda,stroke:#28a745,color:#155724
classDef removed fill:#f8d7da,stroke:#dc3545,color:#721c24
classDef modified fill:#fff3cd,stroke:#ffc107,color:#856404
classDef overflow fill:#e2e3e5,stroke:#6c757d,color:#495057,stroke-dasharray: 3 3
Added
Posted by |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
User report (0.14.0)
Root cause
externals::parse_artifact_refrequired the prefix to be purelyis_ascii_lowercase()— no hyphens (the old doc-comment even said so). A kebab-case project slug likelinc-meshfailed that check, solinc-mesh:A-AVTP-STREAMfell through toArtifactRef::Local(...)and was looked up as a local id → 404.The kicker: externals are stored as
<prefix>:<id>using that same hyphenated prefix (ProjectContextdoesartifact.id = format!("{}:{}", ext.prefix, artifact.id)), so the parser no longer round-tripped its own output. Every external whose prefix contained a hyphen was unreachable in:render_artifact_detail→parse_artifact_ref), andOne shared gate, so one fix restores both surfaces.
Fix
Accept a kebab-case slug prefix: leading lowercase letter, then lowercase letters / digits / hyphens. Requiring a leading letter keeps an ordinary local id with a colon (e.g.
H-1:2) from being misread as a cross-repo ref.Verification
linc-mesh:A-AVTP-STREAMandlinc2:REQ-1→External;H-1:2and-bad:REQ-1→Local. The existingH-1.2andrivet:REQ-001cases still pass. All 28externals::testsgreen.--all-targets+ fmt clean;rivet validatePASS.Also in this iteration (triaged, filed, not yet fixed)
Two more user reports filed as draft REQs to work next:
SWR-001wrongly linked insideSDV-BCM-SWR-001);render/source.rsusesstr::contains, needs whole-token match.rivet_tc_idproperty instead ofclassname.name.Fixes: REQ-143
🤖 Generated with Claude Code