Skip to content

fix(#695): the third call site the round-1 repair missed - #702

Merged
fdaviddpt merged 2 commits into
mainfrom
fix/695-audit-round2
Sep 15, 2026
Merged

fdaviddpt merged 2 commits into
mainfrom
fix/695-audit-round2

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Gate 3 round 2 of the v0.33.0 release (token rel-0330-r2-96ee92d0) returned three
findings, all ranked misreports, none in a blocking row.
gate3_disposition.py --round 2 --verdict findings --blocking no answered
carry-forward-and-proceed -- the tag may move. Two findings are carried forward as
trap.d/ fragments, per the ranking table's own routing for that row.

The third is fixed here, for one reason: it is a defect in the round-1 repair, and leaving
it would also leave a false sentence in the release notes I am about to write.

What the repair missed

Round 1 changed _remember_wc_size_get_into's contract -- it used to answer 0 for a path
it holds no measurement for, and now answers the empty string, so _remember_emit_file's
"no usable size" arm can actually be reached. Two of the getter's three call sites
were updated to say size unknown. The third, the rotated-slices listing, still formatted
the value straight into %s bytes:

/path/archive-2026-01-01.md ( bytes)

A number-shaped slot holding nothing, which reads as neither a size nor an absence. It
appears in exactly the scenario the repair exists for -- the batched wc -c failing
wholesale. The auditor reproduced it against the shipped functions with a stub wc that
exits 1.

changelog.d/695.fixed.audit.md claimed the unmeasured size was "kept distinct from zero
all the way through". It was not. Both the code and that sentence are corrected.

The control, and what it does not do

Source-shape, not behavioural, and the docstring says so: reaching that third site
behaviourally means driving the whole render with rotated slices present and wc broken,
while the invariant -- a line that formats a byte count has a size unknown branch within
a few lines of it -- is cheap and the next call site added will meet it. Verified red
before the fix and green after, with a must-fire control pinning that the detector still
finds the format string it scans for (otherwise it would pass over a renamed one).

Carried forward, not fixed

  • trap.d/695.outward-walk-assumes-lexical-scope.md -- _is_protected credits an
    enclosing function's local LC_ALL=C to a function merely defined inside it. bash
    scoping is dynamic, so that holds only when the nested function is called from within its
    definer. No instance in this tree today: the one nested pair is called from inside,
    and that definer carries no such declaration.
  • trap.d/695.emit-read-max-is-an-unvalidated-knob.md -- REMEMBER_EMIT_READ_MAX is the
    one numeric read in lib-memory-context.sh with no digit guard. A non-numeric value
    prints a bash error, does not abort inside an if, and falls through to the read arm --
    the same failure round 1 fixed from the other direction.

Verification

Local suite 2486 passed, 58 skipped.

With this merged, gate 3 is closed at its two-round cap and v0.33.0 proceeds to the fold,
the release commit, the tag and the publish.

Part of #695

[AI-generated]

…ps logged

Round 2 of the v0.33.0 release audit (token rel-0330-r2-96ee92d0) returned
three findings, all ranked `misreports`, none blocking:
carry-forward-and-proceed. Two are carried forward as trap.d fragments.
The third is a defect in the round-1 repair itself and is fixed here,
because leaving it would also leave a false sentence in the release
notes.

The round-1 repair changed _remember_wc_size_get_into's contract: it used
to answer `0` for a path it holds no measurement for, and now answers the
empty string, so that _remember_emit_file's "no usable size" arm can
actually be reached. Two of the getter's three call sites were updated to
say `size unknown`. The third -- the rotated-slices listing -- still
formatted the value straight into `%s bytes`, so with the batched `wc -c`
failing (the exact scenario the repair exists for) it renders

    /path/archive-2026-01-01.md ( bytes)

a number-shaped slot holding nothing, which reads as neither a size nor
an absence. Same three-state `case` the deferred listing already carries.

The new control is source-shape rather than behavioural, and says so:
reaching that third site behaviourally means driving the whole render
with rotated slices present and `wc` broken, while the invariant -- a
line that formats a byte count has a `size unknown` branch near it -- is
cheap, and the next call site added meets it. Verified red before the
fix and green after, with a must-fire control pinning that the detector
still sees the format string it scans for.

changelog.d/695.fixed.audit.md claimed the unmeasured size was "kept
distinct from zero all the way through". It was not, and that sentence
is corrected rather than left to ship.

Carried forward, per the ranking table's `misreports` row:

  trap.d/695.outward-walk-assumes-lexical-scope.md -- _is_protected
  credits an enclosing function's `local LC_ALL=C` to a function merely
  defined inside it. bash scoping is dynamic, so that only holds when
  the nested function is called from within its definer. No instance in
  this tree today: the one nested pair is called from inside, and that
  definer carries no such declaration.

  trap.d/695.emit-read-max-is-an-unvalidated-knob.md --
  REMEMBER_EMIT_READ_MAX is the one numeric read in
  lib-memory-context.sh with no digit guard; a non-numeric value prints
  a bash error, does not abort inside an `if`, and falls through to the
  read arm -- the same failure the round-1 repair fixed from the other
  direction.

Local suite: 2486 passed, 58 skipped.

Part of #695

Co-Authored-By: Max <noreply>
macos-latest 3.10 went red on #702, a pull request touching none of this
code. It was not a flake, and the red leg was the smaller half of what
it exposed.

#660 moved the capture-gap check into _remember_deferred_phase, where it
is the LAST thing that phase does -- session-start-hook.sh writes the
notice at the end, after the records and after the evidence-store prune.
So the hook returning says nothing about whether the check has run yet.
Every assertion in tests/test_capture_gap_notice.py reads that file
immediately after the hook returns.

The positives fail intermittently, which is the red leg. The six
negatives are worse: `assert not notice.exists()` is satisfied just as
well by a phase that has not reached the check yet, or that died before
it -- the negative and the absence are the same file-not-found. Those
six have been passing without being able to fail, on every leg, since
#660 landed. CLAUDE.md says this in as many words: "an assertion that
something does not happen also passes when nothing happens at all".

Split along that line:

  the three positives stay on the DEFAULT deferred path and poll, which
  is what proves the phase actually reaches its end;

  the six negatives run the phase inline (REMEMBER_DEFER=0), where "did
  not fire" is a verdict rather than a race.

_env() takes the choice as an explicit keyword rather than a flag
somebody has to remember, and its docstring carries the reason.

I had already fixed one instance of this shape on #696 -- the evidence
store prune, in this same file -- without noticing the rest of the file
had it too. Three mechanisms missed it (the per-PR review, both audit
rounds, and eleven green legs); the twelfth leg caught it.

Local suite: 2486 passed, 58 skipped.

Part of #695

Co-Authored-By: Max <noreply>
@fdaviddpt
fdaviddpt merged commit cc983b7 into main Sep 15, 2026
16 checks passed
@fdaviddpt
fdaviddpt deleted the fix/695-audit-round2 branch September 15, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant