rpg_source.zig: settle() reads the finished text with a validator and reports its findings in the receipt #788

Manually merged
binjovi-bot merged 1 commit from validator into trunk 2026-11-11 12:58:37 +00:00
Owner

rpg_source.zig: settle() reads the finished text with a validator and reports its findings in the receipt

Emitter.run ends with settle() (after render() and the short-names
re-render). It calls rpg_source_validate.check on the final lines of the
free-form render (e.out.text and the forms of e.out.lines), so a statement
that a late pass (dropUnreferenced, failUndeclared, fitGlobals,
checkNames, the render) refused is a failure line there, whatever its entry
was when balance() ran. settle() writes only Emitter.findings: it
re-balances nothing, re-renders nothing and adds no failure line. The columns
and the mixed render are not read.

The savf rpgle JSON receipt has a new key validator:
{findings: [{rule, line, statement?, detail}], counts: {rule: n}}, outside
form_counts. A detail ends with (validator: RULE). The text of the emit
is unchanged (emit-bytes-diff: identical; capture-emit-diff: same).

Rules, each a detector now:

  • blocks: ELSE, ELSEIF, WHEN, OTHER, ON-ERROR or an end without its head, a
    head without its end (rpg_source_blocks.broken over the final lines), a
    DCL-PROC without END-PROC and the reverse.
  • loop_exit: LEAVE or ITER with no emitted DOW, DOU or FOR around it.
  • return: a procedure whose DCL-PI declares a return type and that has no
    RETURN line.
  • interface: a call that is emitted to a procedure or prototype whose DCL-PI
    or DCL-PR holds a fail_pi_parameter_v1 or fail_pr_parameter_v1 line.
  • condition_literal: a DOW, DOU, IF or WHEN whose condition is a bare number.
  • bif_numeric: a %REM operand declared as other than a number, read from the
    declarations of the same text.

Measured on v0.1.504 with this build (statements, emits and failure counts of
the six public Async programs are the same as the base binary's):

rule six Async programs non-matching twins matching twins
return 45 (9, 8, 7, 7, 8, 6) 1 0
blocks 12 (ELSE and ENDIF, one pair in each program) 1 0
condition_literal 6 (dow 1;, one in each program) 0 0
bif_numeric 6 (a char(2182) based field, one in each program) 0 0
loop_exit 0 0 0
interface 0 1 0

The twins are the 852 program rows of the committed twins (the sources of
runs/emit/0.1.504): 475 have the matrix verdict match or
match_except_file_identity; of the other 377, 304 are different, 36
failed, 6 refused, 3 have no matrix row and 28 have no verdict (no emit).
44 of the 824 emits are in columns or mixed and are not read. The three non-matching findings are on
failed rows: init-auto-char-heldout (a DCL-PROC with no END-PROC),
lsel-for-arr-if-if (a call to RETHROW whose DCL-PI holds a failure line) and
return-switch-utf8-stripped (WORK declares int(10), its RETURN is not
recovered). The census of v0.1.503 counts RNF7423 once in each of the six
programs: 6, as here.

Tests: src/rpg_source_validate_test.zig.

Gate (coordinator)

gate.sh v0.1.504 -> this build over 87 captures plus the committed twins: dev emits same x5, L10-test unchanged, emit-bytes-diff identical, 0 of 87 captures changed, suspect 94/94, wrong parameters 24/24. Findings on the six public Async programs: return 45, blocks 12, condition_literal 6, bif_numeric 6; none on any of 475 host-matching twins.

# rpg_source.zig: `settle()` reads the finished text with a validator and reports its findings in the receipt `Emitter.run` ends with `settle()` (after `render()` and the short-names re-render). It calls `rpg_source_validate.check` on the final lines of the free-form render (`e.out.text` and the forms of `e.out.lines`), so a statement that a late pass (`dropUnreferenced`, `failUndeclared`, `fitGlobals`, `checkNames`, the render) refused is a failure line there, whatever its entry was when `balance()` ran. `settle()` writes only `Emitter.findings`: it re-balances nothing, re-renders nothing and adds no failure line. The columns and the mixed render are not read. The `savf rpgle` JSON receipt has a new key `validator`: `{findings: [{rule, line, statement?, detail}], counts: {rule: n}}`, outside `form_counts`. A `detail` ends with `(validator: RULE)`. The text of the emit is unchanged (emit-bytes-diff: identical; capture-emit-diff: same). Rules, each a detector now: - `blocks`: ELSE, ELSEIF, WHEN, OTHER, ON-ERROR or an end without its head, a head without its end (`rpg_source_blocks.broken` over the final lines), a DCL-PROC without END-PROC and the reverse. - `loop_exit`: LEAVE or ITER with no emitted DOW, DOU or FOR around it. - `return`: a procedure whose DCL-PI declares a return type and that has no RETURN line. - `interface`: a call that is emitted to a procedure or prototype whose DCL-PI or DCL-PR holds a `fail_pi_parameter_v1` or `fail_pr_parameter_v1` line. - `condition_literal`: a DOW, DOU, IF or WHEN whose condition is a bare number. - `bif_numeric`: a %REM operand declared as other than a number, read from the declarations of the same text. Measured on v0.1.504 with this build (statements, emits and failure counts of the six public Async programs are the same as the base binary's): | rule | six Async programs | non-matching twins | matching twins | |---|---|---|---| | `return` | 45 (9, 8, 7, 7, 8, 6) | 1 | 0 | | `blocks` | 12 (ELSE and ENDIF, one pair in each program) | 1 | 0 | | `condition_literal` | 6 (`dow 1;`, one in each program) | 0 | 0 | | `bif_numeric` | 6 (a `char(2182) based` field, one in each program) | 0 | 0 | | `loop_exit` | 0 | 0 | 0 | | `interface` | 0 | 1 | 0 | The twins are the 852 program rows of the committed twins (the sources of `runs/emit/0.1.504`): 475 have the matrix verdict `match` or `match_except_file_identity`; of the other 377, 304 are `different`, 36 `failed`, 6 `refused`, 3 have no matrix row and 28 have no verdict (no emit). 44 of the 824 emits are in columns or mixed and are not read. The three non-matching findings are on `failed` rows: `init-auto-char-heldout` (a DCL-PROC with no END-PROC), `lsel-for-arr-if-if` (a call to RETHROW whose DCL-PI holds a failure line) and `return-switch-utf8-stripped` (WORK declares `int(10)`, its RETURN is not recovered). The census of v0.1.503 counts RNF7423 once in each of the six programs: 6, as here. Tests: `src/rpg_source_validate_test.zig`. ## Gate (coordinator) `gate.sh` v0.1.504 -> this build over 87 captures plus the committed twins: dev emits same x5, L10-test unchanged, emit-bytes-diff identical, 0 of 87 captures changed, suspect 94/94, wrong parameters 24/24. Findings on the six public Async programs: return 45, blocks 12, condition_literal 6, bif_numeric 6; none on any of 475 host-matching twins.
Add the validator: settle() reports what the compiler would refuse in the finished emit
All checks were successful
binjovi/ci Binjovi completed the frozen plan
b97bb1ebee
Emitter.run ends with settle(), which reads the final lines of the free-form
render with rpg_source_validate.check and stores the findings. It changes no
emitted text. The receipt has a new key validator {findings, counts}, outside
form_counts. Rules: blocks, loop_exit, return, interface, condition_literal,
bif_numeric.
binjovi-bot manually merged commit b97bb1ebee into trunk 2026-11-11 12:58:37 +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!788
No description provided.