Lane Sc: a scan site prints scan, not refusal #813

Manually merged
binjovi-bot merged 2 commits from lane-sc-scan-marker-20261117 into trunk 2026-11-17 12:05:09 +00:00
Owner

Lane Sc: a scan site prints scan, not refusal

The Debug refusal trace (SOURCERER_TRACE_REFUSALS=1) printed refusal <file>.<function> sNN at
every decline, including the declines of readers that try a pattern at every index of every body
(or a unit on every body). Those fire whether or not a statement later fails, so the trace could not
tell a scan miss from the refusal that stops the statement.

A scan site now prints scan <file>.<function> sNN (and scan ... sNN <operand> where it had an
operand): the same fields, another first word. New in core/rpg_trace.zig: scanAt, scanRet,
scanAtOperand, scanToken. A reader of the trace drops every scan line by one rule, and the
refusal lines that remain are the stopping ones. Debug builds only: a Release build compiles every
call to nothing, so the binary and every emit byte are unchanged. rpg_statements.zig is untouched.

Rule used to pick the sites (from the code): a function that a loop tries at every index of every
body, or that only such a function calls, and that declines with null or false for "the pattern is not
here". A decline there never stops a statement. A function that other, non-scan readers also call keeps
its tokens, and so does every site that refuses a proved call or a rewritten body.

Marked sites:

  • rpg_choice: extreme, boolean (the two patterns rewrite tries at each index), and the checks only they
    call: ownLabel, pair, enclosed (a "needs parentheses" test, not a refusal). original keeps its token.
  • rpg_frames.deadStore.
  • rpg_trim: assignUnit, unit (also tried by rpg_source_trim), argumentUnit, charAssign,
    substVar, substCount (the unit tries of rewrite), and sourceOf, elementAt (reached only from those).
    copyTail, loops, leading, trailing, lengthAt and halves also serve readers outside the
    scan, so they keep refusal.
  • rpg_eval.runValues s01 to s07 (a unit that rewrote nothing, with its operand). s08 and s09
    (the rewritten values did not read) keep refusal.

Not marked: rpg_frames.rewrite and frame (the call has no proved frame: the decision about one call,
not a try at each index), rpg_trim tails and loop readers, rpg_trim.rewrite's whole-body tries.

Tests: src/rpg_scan_marker_test.zig (new: the scan line shape and silence when off, every site of
each scan function is a scan site, the stopping sites keep refusal); the scanner of
src/rpg_trace_test.zig accepts scanAt, scanRet and scanAtOperand, keeps its unique and
well-formed checks, and fails on a scan word that is no scan form; src/rpg_trace_operand_test.zig
lists runValues s01 to s07 as scan operands and s08, s09 as refusal operands.

Gates

{"checks":{"net_statements":0},"census":{"statuses":{"recovered":645,"partial":0,"unresolved":0},"regressions":0,"newly_recovered":0},"golden":"golden floor 173 ceiling 0 <= dump 173/5/0","legend":"current","emit":{"worse":[],"better":0,"newly_clean":0,"clean_delta":0,"base":738,"new":738},"twins":{"groups":1022,"recovered":1015,"regressions":[],"newly":0},"allgroups":{"regressions":[],"newly":[],"worse":[]},"unit":{"exit":0,"last":"ship-unit: src/rpg_trace_test.zig ok"},"full_check":{"exit":0,"seconds":1973}}
# Lane Sc: a scan site prints `scan`, not `refusal` The Debug refusal trace (`SOURCERER_TRACE_REFUSALS=1`) printed `refusal <file>.<function> sNN` at every decline, including the declines of readers that try a pattern at every index of every body (or a unit on every body). Those fire whether or not a statement later fails, so the trace could not tell a scan miss from the refusal that stops the statement. A scan site now prints `scan <file>.<function> sNN` (and `scan ... sNN <operand>` where it had an operand): the same fields, another first word. New in `core/rpg_trace.zig`: `scanAt`, `scanRet`, `scanAtOperand`, `scanToken`. A reader of the trace drops every `scan` line by one rule, and the `refusal` lines that remain are the stopping ones. Debug builds only: a Release build compiles every call to nothing, so the binary and every emit byte are unchanged. `rpg_statements.zig` is untouched. Rule used to pick the sites (from the code): a function that a loop tries at every index of every body, or that only such a function calls, and that declines with null or false for "the pattern is not here". A decline there never stops a statement. A function that other, non-scan readers also call keeps its tokens, and so does every site that refuses a proved call or a rewritten body. Marked sites: - `rpg_choice`: `extreme`, `boolean` (the two patterns `rewrite` tries at each index), and the checks only they call: `ownLabel`, `pair`, `enclosed` (a "needs parentheses" test, not a refusal). `original` keeps its token. - `rpg_frames.deadStore`. - `rpg_trim`: `assignUnit`, `unit` (also tried by `rpg_source_trim`), `argumentUnit`, `charAssign`, `substVar`, `substCount` (the unit tries of `rewrite`), and `sourceOf`, `elementAt` (reached only from those). `copyTail`, `loops`, `leading`, `trailing`, `lengthAt` and `halves` also serve readers outside the scan, so they keep `refusal`. - `rpg_eval.runValues` s01 to s07 (a unit that rewrote nothing, with its operand). s08 and s09 (the rewritten values did not read) keep `refusal`. Not marked: `rpg_frames.rewrite` and `frame` (the call has no proved frame: the decision about one call, not a try at each index), `rpg_trim` tails and loop readers, `rpg_trim.rewrite`'s whole-body tries. Tests: `src/rpg_scan_marker_test.zig` (new: the scan line shape and silence when off, every site of each scan function is a scan site, the stopping sites keep `refusal`); the scanner of `src/rpg_trace_test.zig` accepts `scanAt`, `scanRet` and `scanAtOperand`, keeps its unique and well-formed checks, and fails on a `scan` word that is no scan form; `src/rpg_trace_operand_test.zig` lists `runValues` s01 to s07 as scan operands and s08, s09 as refusal operands. ## Gates ``` {"checks":{"net_statements":0},"census":{"statuses":{"recovered":645,"partial":0,"unresolved":0},"regressions":0,"newly_recovered":0},"golden":"golden floor 173 ceiling 0 <= dump 173/5/0","legend":"current","emit":{"worse":[],"better":0,"newly_clean":0,"clean_delta":0,"base":738,"new":738},"twins":{"groups":1022,"recovered":1015,"regressions":[],"newly":0},"allgroups":{"regressions":[],"newly":[],"worse":[]},"unit":{"exit":0,"last":"ship-unit: src/rpg_trace_test.zig ok"},"full_check":{"exit":0,"seconds":1973}} ```
Rebuild: the first Build failed at desktop-compile-linux-arm64 with no archived log
All checks were successful
binjovi/ci Binjovi completed the frozen plan
634334eb94
binjovi-bot manually merged commit 634334eb94 into trunk 2026-11-17 12:05:09 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sean/sourcerer!813
No description provided.