Skip to content

fix(#695): the round-1 release-audit findings worth fixing before v0.33.0 - #701

Merged
fdaviddpt merged 1 commit into
mainfrom
fix/695-audit-round1
Sep 15, 2026
Merged

fdaviddpt merged 1 commit into
mainfrom
fix/695-audit-round1

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

The v0.33.0 release audit (gate 3, round 1, dispatch token rel-0330-429b3dd1)
returned six findings, none in a blocking row. gate3_disposition.py answered
stop-tag -- round-one findings always stop the tag, blocking or not. Five are fixed
here; the sixth is filed as #700.

The one that only a whole-delta audit could see

_function_spans in the #695 scanner closed a function at the first } at column 0,
on its own stated assumption that no function is defined inside another. #696 broke that
assumption: capture_was_seen() { is defined at column 0 inside
_remember_deferred_phase() {. So the outer span was computed as ending at the inner
function's brace, and the inner's local LC_ALL=C was credited to 148 outer lines that
have no such declaration -- reported protected while unprotected.

Neither pull request contains this. #696 added no scanner; #699 added no nesting. It
existed only once both had landed, and both were green. Nothing falls through it today
(a direct sweep of lines 861-1008 finds no letter ranges), so it is a latent guard defect
rather than a shipping bug -- but the scanner is the entire standing defence for a class
that already shipped a total-failure bug, and the two existing must-fire controls both use
flat fixtures, so neither could see this shape.

Now a stack, with a nested fixture pinning both halves: the outer lines must not inherit,
and the inner's own must still be recognised.

The one where my own test passed for the wrong reason

local LC_ALL=C does not reach a child process. local on a name the environment never
exported leaves it unexported:

LC_ALL unset in the environment    -> child sees no LC_ALL
LC_ALL exported in the environment -> child sees LC_ALL=C

Two of #699's thirteen functions spawn tr '[:lower:]' '[:upper:]' on a drive letter. On
the host this whole issue is about -- LANG=tr_TR.UTF-8 with LC_ALL unset, which is what
setting a system language actually produces -- that tr still ran under Turkish rules,
where i upper-cases to the dotted İ: two bytes in a slot that holds one ASCII letter.

tests/test_id_guards_locale_695.py did not catch it because its harness passes LC_ALL
in the subprocess environment, so local shadowed an already-exported name and the child
did see C. It passed for a reason that does not hold on a real host.

Fixed with an LC_ALL=C prefix on the command itself. The new control puts a recording
tr
on PATH and asserts the locale it was actually called under -- so it runs on every
platform and does not need a glibc runner to fail. The #699 changelog fragment that
claimed this was already fixed is corrected in the same commit.

The one that defeats a threshold shipping in this same release

_remember_wc_size_get_into returned ${!key:-0} for a path it holds no measurement for,
and the render loop rewrote anything non-numeric to 0 as well. Two separate places
turning "never measured" into the size zero -- which made _remember_emit_file's own
"no usable size" arm unreachable from its only caller. 0 is a digit string and
0 -gt 16384 is false, so an unmeasured file of any size took the read path that
#660's threshold exists to keep it off: 4 MB measured at 24.1s on windows-latest, on the
session-start foreground path.

The batched wc -c can fail wholesale (ARG_MAX, wc absent), which leaves every file
unmeasured at once. Unknown is now kept distinct from zero end to end, and the compact-mode
notice says size unknown rather than printing 0 bytes for a file nobody measured.

The controls use a recording cat for the same reason as above: the bytes come out
identical either way, so output alone cannot tell the two arms apart -- which is how this
went unnoticed.

The rest

  • The deferred default-path control asserted one of the three records its own docstring
    named. It now polls both this fixture's storage mode can produce, and states why the
    third needs external storage and where it is covered instead.
  • _REMEMBER_PHASE is write-only and unexported -> _REMEMBER_PHASE is write-only: nothing reads it, and it is not exported #700. It changes no behaviour either
    way and picking between delete/export/log is a design call, not a repair.

Verification

Local suite 2483 passed, 58 skipped. The one failure on the way was this repo's own
blanket-win32-skip guard catching a triage row I had not written yet -- added, which is the
guard doing its job.

Round 2 of the audit runs against this head once it is green.

Part of #695

[AI-generated]

…e the tag

The v0.33.0 release audit (round 1, token rel-0330-429b3dd1) returned six
findings, none in a blocking row. Five are fixed here; the sixth is filed
as #700.

**The scanner credited a nested function's declaration to its parent.**
_function_spans closed a function at the first `}` at column 0, on the
stated assumption that no function is defined inside another. #696 broke
that assumption: capture_was_seen() is defined at column 0 inside
_remember_deferred_phase(), so the outer span was computed as ending at
the inner function's brace and the inner's `local LC_ALL=C` was credited
to 148 outer lines that have none. Neither PR contains this -- #696 has
no scanner, #699 has no nesting -- it existed only once both had landed,
which is the kind of thing only a whole-delta audit sees. Nothing falls
through it today (a direct sweep of those lines finds no ranges), but
the scanner is the entire standing defence for a class that already
shipped a total-failure bug. Now a stack, with a nested fixture pinning
both halves.

**`local LC_ALL=C` never reached the `tr` child.** `local` on a name the
environment never exported leaves it unexported, so on a host whose
language comes from LANG alone -- what setting a system language
actually produces -- the drive-letter uppercase still ran under Turkish
rules and mapped `i` to the dotted `İ`. My own test in #699 passed
because its harness exports LC_ALL, so `local` shadowed an
already-exported name: it passed for a reason that does not hold on a
real host. The new control puts a recording `tr` on PATH and asserts
what locale it was actually called under, which runs on every platform
and does not need a glibc runner to fail. The changelog fragment that
claimed this was fixed is corrected in the same commit.

**An unmeasured file size laundered into 0**, in two places, which made
_remember_emit_file's own "no usable size" arm unreachable from its only
caller: `0` is a digit string and `0 -gt 16384` is false, so a file of
any size took the read path that #660's own threshold exists to keep it
off -- 4MB measured at 24.1s on windows-latest, on the session-start
foreground path. The batched `wc -c` can fail wholesale, leaving every
file in that state at once. Unknown is now kept distinct from zero end
to end, and the compact-mode notice says `size unknown` rather than
printing `0 bytes` for a file nobody measured.

**The deferred default-path control asserted one of the three records
its own docstring named.** It now polls both that this fixture's storage
mode can produce, and says why the third needs external storage and
where it is covered instead.

Local suite: 2483 passed, 58 skipped. The one failure on the way was
this repo's own blanket-win32-skip guard catching a triage row I had not
written yet -- added.

Part of #695

Co-Authored-By: Max <noreply>
@fdaviddpt
fdaviddpt merged commit a5e5de4 into main Sep 15, 2026
16 checks passed
@fdaviddpt
fdaviddpt deleted the fix/695-audit-round1 branch September 15, 2026 15:01
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