quality-delta: a Bash test that captures `x=$(cmd)` and never reads the command's exit status passes on a crash (new defect-shape facet, report-only)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Read src/shstatus.h to understand how command status checks are analyzed, then inspect src/defectshape.h, especially Script::unreadRcSites and vacuousJudgmentSites. Add the report-only facet and its coverage in test/defectshapecheck.sh, following the zero-evidence section. Done means the unsafe capture gets one row, the safe variants get none, and the facet is documented across the listed legend and help surfaces with the specified gates passing.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Claim it in this issue first. Size: M. Depends on: nothing. Language: C++ (Bash is the input). You will extend src/defectshape.h. Read src/shstatus.h first: it already answers "does this script test the exit status of each command it runs".
The problem, in user terms
CodeRabbit found the same bug in three of our own test scripts (PRs #808, #819, #825): the test runs the binary inside $( ... ), then passes if the captured text matches. If the binary prints the expected line and then crashes or exits non-zero, the test still prints PASS. --quality-delta is meant to catch defect shapes that review keeps finding by hand, and it says nothing here.
test/statuscheck.sh (unsafe):
#!/usr/bin/env bash
BIN="${BIN:-build/ripwire}"
ok() { echo "ok: $1"; }
no() { echo "FAIL: $1"; FAIL=1; }
out="$( "$BIN" . --legend=compact 2>/dev/null )"
if printf '%s' "$out" | grep -q 'legend'; then ok "legend printed"; else no "legend missing"; fi
exit "${FAIL:-0}"
test/statuscheck_good.sh is the same file with rc=$? read on the capture line and [ "$rc" = 0 ] && in the if.
Actual, with both committed in a scratch repo:
$ ripwire . --quality-delta=HEAD~1..HEAD --no-cache
<quality-delta ... regressions="0" minor="0" ... gating="0" ...></quality-delta>
Expected: a defect-shape row on test/statuscheck.sh for the capture line, and none on statuscheck_good.sh.
The existing vacuous-assert facet does not fire here because it asks what a FAILED run leaves behind (an empty text that an absence-grep reads as PASS). This case is the reverse: the run prints matching text, then fails. The existing zero-evidence facet needs an empty answer too. The three CR threads were measured against the PR ranges on main: 0 rows each.
Where to look
src/defectshape.h:enum class Facet(about line 76),kFacetNames,kFacetCount. A new facet adds an entry in each;src/quality.h:1417has astatic_assertthat every facet fits the site value's facet bits.src/defectshape.h,Script::unreadRcSites(about line 4190) andvacuousJudgmentSites: the nearest neighbours; copy their scope walk.src/shstatus.h:analyze()gives, per command, whether its status is tested and what consumes it. You should not need to change it. If you do,test/lib/exitstatus.pyis its twin andtest/gateexitcheck.sharm (H4) fails when the two disagree.- Where an existing facet's name appears (so a new one gets the same coverage):
git grep -l zero-evidencelistssrc/cli.h,src/compactlegend.h,src/verbs_quality.h,docs/COMMANDS.md,docs/EVALS.md, the quality-bar skill pages and about a dozen gates. The commit that addedzero-evidenceandcount-drift(PR #750,changelog.d/cr-qd3-zero-evidence-count-drift.md) is the template for the full set of files.
Suggested approach
- Shape: a capture
x=$( cmd ... )wherecmdis a command under test (shstatus already decides that), the capture's status is read nowhere in its scope (shstatus verdictunchecked, norc=$?, no||, noifaround it, noset -e), and a later judgment readsxpositively (grep -qwithout-v,[ "$x" = ... ],case). That is a site. - REPORT-ONLY, like every other facet except format-arity. Many arms ignore status on purpose: precision first, and a missed site is fine.
- Name it in the style of the others (a short hyphenated noun, for example
status-unread). The owner may rename it in review. - Stay silent on: a capture followed by a test of
$?orrc; a command whose status shstatus says is read; a negative judgment (grep -qv,[ -z "$x" ]), whichvacuous-assertalready owns; a command that is not under test (shstatus decides).
The test to add (red first)
test/defectshapecheck.sh: a new section in the style of section 4e (zero-evidence) with ds_has_p for the positives and the zero-evidence harness's twin pairs for the negatives (a negative must print no row, and its positive twin must print one, so a vacuous negative arm fails). Positives: the file above, a capture inside a function, a case "$x" in judgment. Negatives: the _good file above, a || no "..." after the capture, a capture read through rc=$? then compared. Run the facet over test/*.sh and put the count of rows in the PR.
Acceptance criteria
- The unsafe file above prints one
defect-shaperow withdefect="<facet>"andstatuscheck_good.shprints none. - The new facet is report-only:
gating="0"on every fixture. bash test/defectshapecheck.sh,bash test/qualitykindscheck.sh,bash test/gateexitcheck.shand the legend gates pass. The legend (--legend=fullandcompact),--help,docs/COMMANDS.mdand the quality-bar skill pages all name the new facet.- Precision: run it over
test/*.shon main and list every row. Record how many are real (state the denominator).zero-evidenceshipped at 26 of 30; report yours the same way. ripwire . --quality-delta=origin/main..HEADgates 0.
Size
M: one facet in defectshape.h (about the size of zero-evidence), one gate section, the surface lines in six or seven files.
How to verify locally
cmake -S . -B build && cmake --build build -j # plain build: no build type
mkdir /tmp/sh-status && cd /tmp/sh-status && git init -q . && mkdir test
# commit a base, then the two scripts above, then:
/path/to/build/ripwire . --quality-delta=HEAD~1..HEAD --no-cache
cd - && bash test/defectshapecheck.sh && bash test/gateexitcheck.sh
Not in scope
Other shells, Python test gates (a different facet), and making the facet gate.
Claiming it only takes a comment here. Contributors are credited by handle in the CHANGELOG entry and the release notes. Thank you!
- Lingua principale
- C++
- Stelle
- 2.6k
- Fork
- 182
- Merge medio
- 21h 12m
- PR unite (30g)
- 262
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di redhat-et/ripwire
-
bug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
TS/JS: a generator function expression (const f = function* / async function*) is not indexedForse già presa @shivam512262 l’ha presa 6 giorni fa. Apertabug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
redhat-et/ripwire#730 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 78/100
redhat-et/ripwire#334 · 8 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
redhat-et/ripwire#68 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement help wanted
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di redhat-et/ripwire
Issue simili
-
difficulty:easy func:gui prio:normal type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NatronGitHub/Natron#2118 ·
I maintainer di solito rispondono entro 1 giorno
-
bug difficulty:easy prio:low
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
NatronGitHub/openfx-io#523 ·
I maintainer di solito rispondono entro 1 giorno
-
area:text difficulty:easy prio:low type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
NatronGitHub/openfx-arena#293 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug: Potential ?
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
MarlinFirmware/Marlin#28935 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
ZuluSCSI/ZuluSCSI-firmware#1077 ·
I maintainer di solito rispondono entro 1 giorno