Skip to content

Source-view links artifact ids by substring: SWR-001 wrongly matched inside SDV-BCM-SWR-001 #385

@avrabe

Description

@avrabe

User report

In source view:

doc-id: SDV-BCM-SWR-001
requirement-ids: "ALA-PAA / ALA-RSS / ALA-PPA (Alarms)"

the doc id can be wrongly interpreted if we have one req which is part of another requirement. e.g. SWR-001 and SDV-BCM-SWR-001.

Assessment (verified against code)

Confirmed. rivet-cli/src/render/source.rs matches artifact ids into source lines with str::contains:

  • line ~841: let has_artifact = artifact_ids.iter().any(|id| line.contains(id.as_str()));
  • line ~856: .filter(|id| line.contains(id.as_str()))

So if both SWR-001 and SDV-BCM-SWR-001 exist in the store, a line mentioning SDV-BCM-SWR-001 also matches SWR-001 as a substring — a phantom trace edge, which for a traceability tool is a correctness bug.

Suggested fix

Whole-token match: an id matches only when delimited by non-[A-Za-z0-9-] characters (ids contain hyphens, so - is part of the token, not a delimiter). A line containing SDV-BCM-SWR-001 must not link a shorter substring id SWR-001, while an exact, delimited SWR-001 still links.

Tracked as rivet artifact REQ-144. Will fix with a regression test covering the substring-vs-whole-token case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions