fix(source-view): match artifact ids as whole tokens, not substrings (REQ-144)#387
Merged
Conversation
📐 Rivet artifact delta
Graphgraph LR
REQ_144["REQ-144"]:::modified
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
Modified
Posted by |
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Rivet Criterion Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 4c2f7da | Previous: 7965e6d | Ratio |
|---|---|---|---|
validate/10000 |
17350429 ns/iter (± 2532113) |
12753787 ns/iter (± 400759) |
1.36 |
This comment was automatically generated by workflow using github-action-benchmark.
…(REQ-144) User-reported: in the source view, an id that is a SUBSTRING of a longer id was wrongly linked — e.g. `SWR-001` linked inside `SDV-BCM-SWR-001`, a phantom trace edge. The viewer gated and linkified ids with `line.contains(id)`, a raw substring test. Add `line_contains_id_token`: an id matches only when bounded on both sides by a non-`[A-Za-z0-9-]` character (or a string boundary). Ids contain hyphens, so a hyphen is part of the token, not a delimiter — which is exactly what distinguishes `SWR-001` from `SDV-BCM-SWR-001`. Used at both the highlight gate and the linkify filter. Ids are ASCII, so byte-boundary checks align with char boundaries. Regression test covers: substring NOT matched (`SWR-001` in `SDV-BCM-SWR-001`), longer id matched, exact/delimited occurrences matched, trailing-alnum (`SWR-0011`) and leading-alnum (`xSWR-001`) not matched. `rivet validate` PASS. Implements: REQ-144 Refs: REQ-092 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
23899f6 to
4c2f7da
Compare
This was referenced Jun 2, 2026
avrabe
added a commit
that referenced
this pull request
Jun 2, 2026
…ke (#389) (#390) `graph_type_filter_renders_when_under_budget` fetched `/graph?types=requirement` with the default 5s read timeout. That endpoint does a BFS + layout over the dogfood corpus (~742 nodes / 1477 edges), which on a loaded CI runner can brush past 5s; `fetch_with_timeout` parses a timed-out/empty response's status as 0, so the timeout surfaced as `status == 0` and failed the `== 200` assertion. Same chronic flake the focus-graph tests already fixed with a 15s budget — this one test was missed. It falsely failed CI on #380, #387, and #388. Switch it to `fetch_with_timeout(..., 15s)`, matching the other graph endpoints. The test asserts on the response shape (SVG or budget message), not a hard latency bound, so the wider timeout is safe. Verified locally: passes 3/3 runs. Trace: skip Closes: #389 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Assessment
Confirmed.
rivet-cli/src/render/source.rsmatched artifact ids into source/doc lines withline.contains(id)(the highlight gate and the linkify filter). So when bothSWR-001andSDV-BCM-SWR-001exist, a line mentioningSDV-BCM-SWR-001also matchedSWR-001as a substring — a phantom trace edge, which for a traceability tool is a correctness bug (closes #385).Fix
line_contains_id_token(line, id): the id matches only when bounded on both sides by a non-[A-Za-z0-9-]character (or a string boundary). Ids contain hyphens, so-is part of the token, not a delimiter — exactly what separatesSWR-001fromSDV-BCM-SWR-001. Used at both call sites. Ids are ASCII so byte-boundary checks align with char boundaries; a non-ASCII neighbour counts as a boundary.Verification
Regression test
id_token_match_is_whole_token_not_substring:SWR-001does NOT match insideSDV-BCM-SWR-001; the longer id does.REQ-001 done,(SWR-001), bareSWR-001) match.SWR-0011andxSWR-001do NOT match (longer token).clippy
--all-targets+ fmt clean;rivet validatePASS.Implements: REQ-144 · Closes #385
🤖 Generated with Claude Code