Skip to content

Two commands write a reason for every undecided case and discard it into one number #3232

Description

@gHashTag

Two commands carry a hand-written reason on their "nothing decided" variant and
then throw it away at the only place that reads it.

tri prose report

Outcome::Other is constructed at eight sites, each with a distinct reason:

"unreadable"  "cannot write probe"  "compiler did not run"
"declarations changed -- refused"  "no line in the error"
"line out of range"  "stops on a comment"  "cap reached"

The sole reader bound it to a wildcard and counted. A ninth case,
Outcome::Prose(0), was folded into the same counter. The output line is:

... NOT DECIDED, nothing claimed   {other}

Three of those reasons -- unreadable, cannot write probe,
compiler did not run -- say the tool failed. A reader of "NOT DECIDED"
cannot tell them from cap reached, which is an ordinary result. That is the
broken-ruler shape: a failed instrument reported as a finding.

tri unparsed locate

Identical. Located::None(&'static str) is constructed at six sites and its own
doc comment reads "Nothing claimed, and why". The why went into
Located::None(_) => silent += 1. Reasons: unreadable,
error names no line, no module body,
the split does not reproduce the failure, fewer than two items,
every prefix parses.

Fixed here

Both tally by reason and print the breakdown, with the instrument-failure
reasons marked:

... NOT DECIDED, nothing claimed   N
       4  cap reached
       2  compiler did not run  <-- the tool failed, not the spec

Outcome::Other also changes from String to &'static str. Every site
already passed a literal; the type now says the set is fixed and enumerable,
which is what lets BROKEN_INSTRUMENT name members of it and be checked.

Tests are at the call site, because the defect is a discarding pattern
there and any test of a counting helper would pass. Both are verified by
mutation: restoring the wildcard fails them by name. A second assertion checks
that every reason named in BROKEN_INSTRUMENT is actually constructed
somewhere, so the annotation cannot silently mark nothing -- also
mutation-verified.

How these were found

tri gates warnings (in #3230) classified both as field 0 is never read.
A triage fan-out over the 16 dead-code warnings classified 16 items as
8 UNWIRED / 7 TEST_ONLY / 1 INTENTIONAL.

Worth recording: the adversarial stage was capped at the first 6 of the 8
UNWIRED claims, and these two were the ones the cap dropped -- reported as
"not surviving" when they had simply never been checked. They were confirmed by
hand instead. A cap that does not say what it dropped reads as coverage.

tri prose report could not be run end-to-end here: it shells out to t27c,
which is not built in this tree, and exits with "no compiler". The change is
verified by the test suite and by the two warnings disappearing, not by its
output.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-boundaryNo '## Boundary' section, so the Queen can reserve nothing for it and no bee can take it

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions