tests: comment filters keep a trailing comment, so a check can read text that is only in a comment (42 sites)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
Research direction
Start with the 42 matching filters under tools/tests, beginning at the examples in test_builtin_defaults_contract.py, test_runtime_lifecycle_invariants.py, and test_vcpkg_pin.py. For each hit, inspect the assertion and determine whether trailing comment text can affect it; add a failing mutant test for each affected check. Record each hit’s outcome, then use a shared comment-cut helper where needed and verify the mutants fail when the asserted text appears only in a trailing comment.
Written by the indexing model from the issue text.
Description
Evidence at e062cb52e
Many tests drop a source's comments with a whole-line filter: a line is kept only if it does not start with # after stripping.
Such a filter keeps any # that follows code on the same line, so a trailing comment stays in the text the test checks.
git grep -n -E 'startswith\("#"\)|split\("#", 1\)' -- tools/tests (at e062cb52e) prints 42 hits. Most are whole-line filters, for
example tools/tests/test_builtin_defaults_contract.py:137:
code = "\n".join(line for line in module.splitlines() if not line.lstrip().startswith("#"))
A few cut at the first # instead (for example tools/tests/test_runtime_lifecycle_invariants.py:126 and
tools/tests/test_vcpkg_pin.py:109), so they handle trailing comments.
Found while fixing #2901: the test test_the_generated_header_is_group_readable checked for a grant, and a grant inside a trailing
comment passed the whole-line filter. That test now cuts each line at its first #; its mutant M2 fails with the grant in a
trailing comment.
Not shown
- Per-site verdicts. This issue does not classify each of the 42 hits as a defect or not. It only names the shape and the count.
- Whether any of the 42 checks passes wrongly today because of a trailing comment. Only the one case above was constructed and run.
Falsifier
A test under tools/tests that fails or passes on a trailing comment's text in its own test body, on a file where the whole-line
filter and a first-# cut give different results for the check, would show the shape is not the same across hits. A count of
hits alone is not a falsifier.
Work
- Per hit: read the check and say whether a trailing comment can make it pass or fail wrongly. Record each hit as fixed, filed by
number, or not the same shape with the reason. - For each hit that can pass wrongly, add a mutant test first: a trailing comment that holds the asserted text must not satisfy
the check. It must fail on the current tree. - Use one shared helper for the comment cut where the repo has no such helper yet, and move the hits to it.
- Dominant language
- C++
- Stars
- 3
- Forks
- 5
- Avg merge
- 4h 37m
- Merged PRs (30d)
- 524
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from EchoTools/nevr-runtime
-
bug
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
EchoTools/nevr-runtime#2912 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
EchoTools/nevr-runtime#2910 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
EchoTools/nevr-runtime#2909 ·
Maintainers usually reply within 1 day
-
build: the generated defaults header is written 0600, so a seat outside nevr-build cannot read itOpenbacklog
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
EchoTools/nevr-runtime#2901 · 1 comment ·
Maintainers usually reply within 1 day
-
backlog
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
EchoTools/nevr-runtime#2897 ·
Maintainers usually reply within 1 day
All issues in EchoTools/nevr-runtime
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
category:port-update
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
bug-unconfirmed
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
libc++
Difficulty 1/5 Under an hour Newbie friendliness 88/100
llvm/llvm-project#246508 ·
Maintainers usually reply within 1 day
-
good first issue help wanted phase:0 priority:P3 type:task
Difficulty 2/5 1-3 hours Newbie friendliness 67/100