[Bug] `evidence add` reads a JUnit report as a v1 document when a test name contains `repowise-evidence-v1`

Open
#6,340 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@aloneangel45 is already working on this.

Since Nov 26, 2026.

  • #6352 by @aloneangel45 — open
  • #6437 by @Papito084 — open
  • #6460 by @canblmz1 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
cli, testing

Research direction

Start with the format detection function in packages/core/src/repowise/core/evidence/add.py at lines 225–228, then read the related sniffing logic in hyperfine.sniff. Run the JUnit regression case and the v1 cases in tests/unit/evidence/test_add.py; done means JUnit is detected despite the test name, both v1 cases still detect as v1, and unclaimed input still falls back to v1. Three open pull requests are already linked.

Written by the indexing model from the issue text.

Description

bug good first issue

Summary

Format detection checks for the literal repowise-evidence-v1 anywhere in the first bytes before it sniffs. A JUnit report whose test is parametrized with that string is read as v1 and refused.

packages/core/src/repowise/core/evidence/add.py:225-228

head = data[:SNIFF_BYTES]
if EVIDENCE_FORMAT.encode() in head:
    return EVIDENCE_FORMAT
return detect_profile_format(head) or EVIDENCE_FORMAT

Mechanism

  • The substring test runs before detect_profile_format, so any XML, JSON or text format that mentions the name loses to v1.
  • --input-format junit skips detection and works.

Repro

A pytest JUnit report with name="test_sniff[repowise-evidence-v1]", then input_format and prepare_evidence:

detected: repowise-evidence-v1
--input-format None: EvidenceRefusedError: the file is not a JSON object
--input-format junit: ok

Impact

Repowise's own tests/unit/evidence JUnit run cannot be ingested without the flag, and any project that names the format in a test hits the same thing.

Done looks like

  • Treat a file as v1 only when it is a JSON object whose format value is repowise-evidence-v1. Check this with a regex on the head, like hyperfine.sniff. Otherwise sniff the registered formats first.
  • Must not change: the fallback to v1 for an unclaimed file, so the v1 parser still explains what is wrong.
  • First issue: one function.

Tests

tests/unit/evidence/test_add.py: the JUnit case above detects as junit. A v1 document with format first or later in the object still detects as v1.

Dominant language
Python
Stars
7.1k
Forks
756
Avg merge
21h 5m
Merged PRs (30d)
797

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from repowise-dev/repowise

All issues in repowise-dev/repowise

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.