Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions changelog.d/qd-fix-legend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Fixed — `--quality-delta` default legend now defines `fix=` on a row with no `why=`

A complexity row carrying a repeated-decision facet (`fix="name the decision once: …"` or `fix="name the loop once: …"`)
has no `why=`, and the default (compact) legend defined `fix=` only inside the `why=` reading. A range whose printed
rows carried `fix=` without `why=` (for example one minor complexity row) therefore met an undefined attribute, and
`legendcoveragecheck` arm (G) failed with `quality-delta-refs-default | r@fix`. The compact dictionary now has its own
`r fix=` reading, which steps aside wherever an `r` row carries `why=`, so other answers keep their bytes.
The full legend already carried the QD-REPEATED-DECISION sentence. `repeateddecisioncheck` arm (L2) pins the
default legend on a two-commit range.
3 changes: 3 additions & 0 deletions src/compactlegend.h
Original file line number Diff line number Diff line change
Expand Up @@ -1596,6 +1596,9 @@ inline constexpr CompactCompletenessTerm kCompactAttributeReadings[] =
{ "monster", "r monster=1: over 5x the ccx bar and grew by now-was (10+): major at any %; put the new branch in a helper", true, "r", MapHeaderRead::No, {}, "quality-delta" },
{ "similar", "r similar=N: the params list is new or grew and holds N>=3 adjacent same-typed params (C/C++); a swapped call compiles; pass a named struct; never gates", true, "r", MapHeaderRead::No, {}, "quality-delta" },
{ "why", "r why=: a tangle row's risen inputs, a minor clone row's differing operands or shrunk member, an unhandled-arm row's values with no outcome (add the arm or a default); fix=: the shape the row calls for, with lines", true, "r", MapHeaderRead::No, {}, "quality-delta" }, // also defines fix=
// QD-FIX-LEGEND: a repeated-decision row (complexity, sev=minor) carries fix= with no why=, so the row above never fires for it;
// this one steps aside wherever an r row carries why= (that row already defines fix=), so only fix-without-why answers gain bytes.
{ "fix", "r fix=: the shape the row calls for, with lines; name the decision/loop once: one condition (6+ tokens) or loop body repeats at those lines; report-only", true, "r", MapHeaderRead::No, {}, "quality-delta", "r", "why" },
{ "locals", "r locals=: a tangle row's steering locals (set in one step, read by a branch 10+ statements later)", true, "r", MapHeaderRead::No, {}, "quality-delta" },
{ "ratchet", "r ratchet=TAG: a tangle row above its best since TAG (an input rose over its minimum); why= adds best since TAG", true, "r", MapHeaderRead::No, {}, "quality-delta" },
{ "n", "improved n= more=: what this change made better, never a row or gating; i kind= sym= was= now= p=: over the kind's bar at baseline, lower now", true, "improved", MapHeaderRead::No, {}, "quality-delta" },
Expand Down
23 changes: 22 additions & 1 deletion test/repeateddecisioncheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
# (S) the row's severity and gating are what they are without the facet: every row here is origin="new-symbol"
# (C) PREMISE COUNT — all seven rows found; a missing row FAILS
# (L) a document with the facet defines it (full legend); one without carries no such sentence
# Red-before: on a binary without the facet, P1 and P2 FAIL. Guard-off (no minimum condition length, no statement test, no
# (L2) the DEFAULT legend of a range whose minor complexity row carries fix= and no why= defines fix= (QD-FIX-LEGEND)
# Red-before: on a binary without the facet, P1 and P2 FAIL; on b576a95e3 (no compact fix= term), L2 FAILS. Guard-off (no minimum condition length, no statement test, no
# bracket stop, overlapping repeats allowed): N2, N3, N4 and N5 FAIL.
#
# Usage: bash test/repeateddecisioncheck.sh [BIN]
Expand Down Expand Up @@ -270,6 +271,26 @@ if [ "$rc0" != 0 ] && [ "$rc0" != 2 ]; then no "(L) the no-facet run failed (rc=
elif ! printf '%s' "$FULL0" | grep -q '<quality-delta '; then no "(L) the no-facet run printed no quality-delta document"
else case "$FULL0" in *'deciding it once is the cheapest fix'*) no "(L) a document without the facet pays for its sentence";; *) ok "(L) a document without the facet carries no such sentence";; esac; fi

echo "── (L2) default legend on a range: a minor row's fix= with no why= is defined"
# QD-FIX-LEGEND: the compact dictionary defined fix= only beside why= (a tangle or clone row), so a range whose one printed
# row is a MINOR complexity row carrying only fix= met an undefined attribute (legendcoveragecheck (G) r@fix on #720/#722).
G="$TMP/range"; mkdir -p "$G/src"
( cd "$G" && git init -q . && git config user.email t@t && git config user.name t && git config commit.gpgsign false ) || { echo "git setup failed"; exit 2; }
cp "$TMP/groups.h" "$G/src/groups.h"
( cd "$G" && git add -A && git commit -qm base ) || { echo "git setup failed"; exit 2; }
# one more branch in dropSilent: ccx grows by 1 over a body already over the bar, so its row is sev="minor"
sed 's/^ if( left >= 2 )$/ if( left > 9 \&\& mode == 0 ) { return 9; }\n if( left >= 2 )/' "$TMP/groups.h" >"$G/src/groups.h"
( cd "$G" && git commit -qam grow ) || { echo "git setup failed"; exit 2; }
RG="$( cd "$G" && "$BIN" "$G" --quality-delta=HEAD~1..HEAD --no-cache 2>/dev/null )" # status: exits 0 or 2 by design; the document is the verdict
L2ROW="$( printf '%s' "$RG" | tr '<' '\n' | grep '^r kind="complexity"' | grep 'sym="dropSilent"' | head -1 )"
L2LEG="$( printf '%s' "$RG" | sed -n '1s/-->.*//p' )"
case "$L2ROW" in
*'sev="minor"'*'fix="name the decision once: '*) case "$L2ROW" in *' why='*) no "(L2) premise: the row carries why= (row: $L2ROW)";;
*) case "$L2LEG" in *'fix='*) ok "(L2) the default legend defines fix= for a minor fix-only row";;
*) no "(L2) the default legend leaves fix= undefined (legend: ${L2LEG:0:200}...)";; esac;; esac;;
*) no "(L2) premise: no minor dropSilent row with a decision fix= (row: $L2ROW)";;
esac

echo
[ "$fail" = 0 ] && { echo "ALL PASS"; exit 0; }
echo "FAILURES"; exit 1
Loading