Skip to content

fix: abort-contract payload sweep -- 15 msuiter_abort() sites regain the mandatory i/j/c bullets (#129 sibling) - #130

Merged
ShixiangWang merged 1 commit into
mainfrom
fix/abort-contract-payload
Nov 24, 2026
Merged

ShixiangWang merged 1 commit into
mainfrom
fix/abort-contract-payload

Conversation

@ShixiangWang

Copy link
Copy Markdown
Contributor

What this repairs

The error discipline frozen in R/classes-utils.R (ARCHITECTURE section 3.5)
requires every validator violation to raise msuiter_error_<topic> through
msuiter_abort(topic, message, i, j, c, ...), where i = what is wrong,
j = where, c = how to fix. Those three are mandatory formals with no
defaults
. A call site that omits one does not raise the structured
condition at all: base R raises missingArgError / getvarError instead,
with a locale-language message and no actionable payload.

A parse-tree census over R/*.R (utils::getParseData, SYMBOL_FUNCTION_CALL
== "msuiter_abort", depth-0 SYMBOL_SUB collection) found 486 call sites,
15 of which passed two or three of the five names
. Each is repaired here
with content appropriate to the site:

File Sites Bullet restored
R/calibrate-plot.R 2 se selector; pass_window passthrough
R/engines-ard.R 2 counts matrix class; k0 whole number
R/engines-sparse.R 2 counts matrix class; k whole number
R/fit.R 1 bca bootstrap interval selector
R/ms-compare.R 1 n_draws Monte Carlo tail count
R/ms-convert.R 1 opportunity vector shape
R/viz-bootstrap.R 1 index / colname selector
R/viz-profile.R 5 index, colname and channel selectors

No behavioural change: the same violations raise the same topics with the
same message; they now additionally carry the full three-part payload, so a
caller catching msuiter_error_* can read condition$i, condition$j and
condition$c instead of a bare base-R error.

The law that keeps it repaired

tests/testthat/test-abort-contract.R walks the shipped R/ tree with the
same census and asserts every call carries i, j and c. A firing-control
unit proves the census actually sees a planted omission (a gate that can never
go red is not a gate). Locally: nb=5 failed=0 error=0 warning=0, elapsed
0.4 s.

Governance footprint

  • tools/ci/shard-weights.tsv: the law row joins the T0 roster at a 0 s
    integer weight
    (5 expects).
  • tools/ci/pr-gate-budget.tsv: roster addition at constant t0-measured.
    Because the row weighs 0 s, the sealed manifest sum does not move -- the
    generator re-prices to the committed value and ci-selfcheck agrees, so the
    equality law stays exact rather than being re-sealed for a change that moves
    no seconds. (The 16 prior re-seals each added a 1 s row; this one does not.)
  • tools/ci/shard-manifest.tsv: regenerated via tools/ci/gen-shard-manifest.R
    (fail-closed on any sum mismatch).

Verification (local, this branch)

  • Frozen gate signature devtools::check(".", document=FALSE, manual=FALSE, cran=TRUE, vignettes=TRUE, env_vars=character(), error_on="note"):
    2 WARNINGs + 2 NOTEs (the frozen signature).
  • tests/testthat/test-ci-shard-map.R: nb=212 failed=0 error=0 warning=0
    (re-run after the rebase onto the CS-17 merge).
  • tools/ci-selfcheck.py: PASS (all CI wiring assertions hold), exit 0.

🤖 Generated with Claude Code

…the mandatory i/j/c bullets (#129 sibling)

The error discipline in R/classes-utils.R (ARCHITECTURE section 3.5)
requires every validator violation to raise msuiter_error_<topic> with
the three-part information payload: i = what is wrong, j = where,
c = how to fix. i, j and c are mandatory formals with NO defaults, so a
call site that omits one does not raise the structured condition at all
-- base R raises missingArgError / getvarError instead, in the locale
language, with no payload for a caller to act on.

A parse-tree census over R/*.R (utils::getParseData, SYMBOL_FUNCTION_CALL
== "msuiter_abort", depth-0 SYMBOL_SUB collection) found 486 call sites,
15 of which passed two or three of the five names. This change restores
the missing bullet(s) at each, with content appropriate to the site:

  R/calibrate-plot.R  (2 sites)  se/pass_window validation
  R/engines-ard.R     (2 sites)  counts matrix + k0 whole number
  R/engines-sparse.R  (2 sites)  counts matrix + k whole number
  R/fit.R             (1 site)   bca bootstrap interval selector
  R/ms-compare.R      (1 site)   n_draws Monte Carlo tail count
  R/ms-convert.R      (1 site)   opportunity vector shape
  R/viz-bootstrap.R   (1 site)   index / colname selector
  R/viz-profile.R     (5 sites)  index, colname and channel selectors

The law is enforced going forward by a new static gate,
tests/testthat/test-abort-contract.R: a firing-control unit proves the
census sees a planted omission, then the gate walks the shipped R/ tree
and asserts every call carries i, j and c. The file joins the sealed T0
roster at a 0 s integer weight (5 expects, witnessed nb=5 failed=0), so
the pr-gate budget sum stays at its committed measurement of 625 -- a
zero-weight roster row moves no seal, and the generator plus
ci-selfcheck both re-price to 625.

Verification: local frozen gate signature (2 WARNINGs + 2 NOTEs);
test-ci-shard-map.R nb=212 failed=0; tools/ci-selfcheck.py PASS.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@ShixiangWang
ShixiangWang merged commit d358e9d into main Nov 24, 2026
9 checks passed
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