A Debug-only refusal-site tracer: hooks in rpg_eval.zig and rpg_statements.zig, no behaviour change #759

Manually merged
binjovi-bot merged 1 commit from lt into trunk 2026-11-08 11:16:48 +00:00
Owner

A Debug-only refusal-site tracer: hooks in rpg_eval.zig and rpg_statements.zig, no behaviour change

src/core/rpg_trace.zig writes one stderr line where a reader of the recovery
declines or refuses. It runs only in a Debug build, and only when the
environment variable SOURCERER_TRACE_REFUSALS is exactly 1. A Release
build compiles every call to nothing. With the variable unset a Debug build
reads the variable and returns: the emitted text, the receipts and the exit
code do not change (emit-bytes-diff.sh of origin/trunk against this change is
empty).

The coordinator runs it on a pre-ship Debug build:

SOURCERER_TRACE_REFUSALS=1 sourcerer dump --savf FILE ... 2>tokens

and tallies the tokens (sort tokens | uniq -c | sort -rn). A line is one of

refusal <file>.<function> sNN
trace statement-begin
trace module-begin

A refusal token is a code location: the file, the function and the number of
the return in that function, in source order. It never carries an operand, a
symbol, an operation number, a count or a text, so it holds no content of the
program under recovery. trace module-begin marks the start of each recovery
pass of a module and trace statement-begin the end of each statement group, so
the refusals between two markers belong to one group.

Sites:

  • The readers of the call path: rpg_argument_copy, rpg_copy_lifetime,
    rpg_decimal_call, rpg_decimal_convert, rpg_decimal_copy, rpg_frames,
    rpg_programs (every return null / return false), and in rpg_eval.zig
    call, callFact and builtinCall.
  • Control flow: rpg_shape.zig (controlStatus at each control_flow failure,
    the block_owner one included, and the boundary readers it calls),
    rpg_flow.zig, rpg_branches.zig, rpg_loop_exits.zig, closeBlocks and the
    block_owner failure of the until arm in rpg_statements.zig, and
    unhandledOperation in rpg_render_ctx.zig (one token per stage of the
    operation_semantics failure).
  • Value flow in rpg_eval.zig: the address-push arm (operations 33 and 34) and
    every stack_value and storage_span rejection of the load (62) arm, the
    load through an address (32) and the store (writeValue).

Not traced, on purpose: the scan predicates that run for every operation of a
statement (rpg_flow.mentionsData, rpg_flow.isData, rpg_shape.monitorCut,
rpg_branches.Graph.target). They answer no for nearly every operation and
buried every other token (700 thousand of 800 thousand lines over 60 public
saved files).

rpg_trace_test.zig pins that the module is silent when the variable is unset
and prints only the fixed lines when it is set, and that every site written in
the instrumented files matches ^refusal [a-z_]+\.[A-Za-z_]+ s[0-9]{2}$, is
unique, and names the file that holds it.

rpg_eval.zig step has new tokens only; rpg_statements.zig net growth is 0
lines (two blank lines go, for the import and the closeBlocks hook).

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":487,"new":487},"twins":{"groups":726,"recovered":708,"regressions":[],"newly":0},"allgroups":{"regressions":[],"newly":[],"worse":[]},"full_check":{"exit":0,"seconds":937}}
# A Debug-only refusal-site tracer: hooks in rpg_eval.zig and rpg_statements.zig, no behaviour change `src/core/rpg_trace.zig` writes one stderr line where a reader of the recovery declines or refuses. It runs only in a Debug build, and only when the environment variable `SOURCERER_TRACE_REFUSALS` is exactly `1`. A Release build compiles every call to nothing. With the variable unset a Debug build reads the variable and returns: the emitted text, the receipts and the exit code do not change (`emit-bytes-diff.sh` of origin/trunk against this change is empty). The coordinator runs it on a pre-ship Debug build: SOURCERER_TRACE_REFUSALS=1 sourcerer dump --savf FILE ... 2>tokens and tallies the tokens (`sort tokens | uniq -c | sort -rn`). A line is one of refusal <file>.<function> sNN trace statement-begin trace module-begin A refusal token is a code location: the file, the function and the number of the return in that function, in source order. It never carries an operand, a symbol, an operation number, a count or a text, so it holds no content of the program under recovery. `trace module-begin` marks the start of each recovery pass of a module and `trace statement-begin` the end of each statement group, so the refusals between two markers belong to one group. Sites: - The readers of the call path: `rpg_argument_copy`, `rpg_copy_lifetime`, `rpg_decimal_call`, `rpg_decimal_convert`, `rpg_decimal_copy`, `rpg_frames`, `rpg_programs` (every `return null` / `return false`), and in `rpg_eval.zig` `call`, `callFact` and `builtinCall`. - Control flow: `rpg_shape.zig` (`controlStatus` at each `control_flow` failure, the `block_owner` one included, and the boundary readers it calls), `rpg_flow.zig`, `rpg_branches.zig`, `rpg_loop_exits.zig`, `closeBlocks` and the `block_owner` failure of the `until` arm in `rpg_statements.zig`, and `unhandledOperation` in `rpg_render_ctx.zig` (one token per stage of the `operation_semantics` failure). - Value flow in `rpg_eval.zig`: the address-push arm (operations 33 and 34) and every `stack_value` and `storage_span` rejection of the load (62) arm, the load through an address (32) and the store (`writeValue`). Not traced, on purpose: the scan predicates that run for every operation of a statement (`rpg_flow.mentionsData`, `rpg_flow.isData`, `rpg_shape.monitorCut`, `rpg_branches.Graph.target`). They answer no for nearly every operation and buried every other token (700 thousand of 800 thousand lines over 60 public saved files). `rpg_trace_test.zig` pins that the module is silent when the variable is unset and prints only the fixed lines when it is set, and that every site written in the instrumented files matches `^refusal [a-z_]+\.[A-Za-z_]+ s[0-9]{2}$`, is unique, and names the file that holds it. rpg_eval.zig `step` has new tokens only; rpg_statements.zig net growth is 0 lines (two blank lines go, for the import and the `closeBlocks` hook). ## 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":487,"new":487},"twins":{"groups":726,"recovered":708,"regressions":[],"newly":0},"allgroups":{"regressions":[],"newly":[],"worse":[]},"full_check":{"exit":0,"seconds":937}} ```
binjovi-bot manually merged commit 435ab27fa4 into trunk 2026-11-08 11:16:48 +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!759
No description provided.