Skip to content

integer.dag §2 remodel: derive all interval bounds from the width axis; decode chain -> roster fold - #6313

Merged
briansrls merged 7 commits into
mainfrom
integer-remodel
Jul 6, 2026
Merged

briansrls merged 7 commits into
mainfrom
integer-remodel

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

integer.dag §2 remodel — every interval bound derived, zero hand-spelled constants

The exemplar PR for the "reduce repeated patterns to folds/modeling" lane (operator request 2026-07-06). Survey of the ailment across the corpus (signature scan: dense constructor-list literals, numbered fn families, else-if chains, duplicate fn bodies modulo digits) ranked src/v2/std/integer.dag the top real offender (score 35: 9 dense digit-lists + 2 numbered fn families). The remainder class (authorization pending this PR): extdeps/languages/{rust,ecmascript,wasm,python}.dag (5–11 near-identical stamped fn bodies each), realization_width.dag, cpp_abi.dag, dag/std/integer.dag.

What dissolved

  1. All 20 hand-spelled interval-bound constants deleted (2^7−1 … 2^128−1 as digit Cons-lists — int128's 38-digit magnitude spelled twice, ~8.7KB, 287 digit tokens). Every bound now derives from the width axis the Compose rows already declare: integer_machine_interval_spec(signedness, width_bits) = pow2 by repeated decimal doubling + sub_one by borrow fold. §5 upgrade: a transcription-wrong bound is now unwritable — nothing verified those digit strings before; now they cannot exist.
  2. The 10-way decode if-else chain (from_node, each arm reconstructing a spec) → one fold over integer_standard_integer_type_roster (chain order preserved).
  3. The 10-arm spec dispatch → derivation from the two irreducible axis groundings (signedness/width_bits tables — the name↔axis facts).
  4. No re-invented digit tables: the arithmetic grounds in the existing decimal_digit_value bijection + two roster-fold inverses (decimal_digit_of_units, nonzero_decimal_digit_of_positive_units). All fns total; no impossible match arms (nonzero-ness carried structurally by NonZeroDoubleLead); no Outcome noise.

Honest size accounting

integer.dag: 782 → 946 lines (26.0 → 29.4KB). Hand-authored authority shrank massively (20 unverifiable constants → 0); raw lines grew because the file gains a genuinely new capability the substrate lacked: arbitrary-precision decimal arithmetic (double / sub-one / pow2 / canonicalize), ~200 lines, reusable (integer-literal rendering, emit lanes). integer.dag's repetition was constants needing an engine; the remainder files' repetition is fn-family stamping needing only dedup — those will show raw negative diffs.

Verification (all by execution, exact function named per receipt)

claim_batch --source-root src/v2 --entry src/v2/test/claim/integer/interval_derivation_test.dag --function <f>, release build @ afcbc5a, all PASS:

  • interval_derivation_matches_all_legacy_spelled_bounds — the migration oracle: all 20 pre-remodel spelled bounds frozen VERBATIM as data rows in the witness; derived == legacy for all 10 specs (both bounds), 107ms.
  • derivation_discriminates_planted_off_by_one — red control: a planted Int8 max=128 row is rejected (the oracle can go red).
  • pow2_digit_shapes_hold — pow2(0)=1, pow2(7)=128, pow2(127) has 39 digits.
  • interval_min_not_above_max_for_all_standard_types — roster property.
  • from_node_round_trips_all_standard_types — decode(spec_node(t)) == Accepted(t), all 10.

Consumers re-run green on final tree: mvp_int_cross_target_coercion_test.dag::witness_cross_target_rust_i32_to_python_int_accepts (PASS, 7.7s — exercises Int32 bounds live through rust.dag emit + coercion_widening via the new derivation), staging_test.dag (5 PASS), byte_cardinality_grounding_test.dag (2 PASS). cargo test --workspace receipt in comment below.

Named follow-ups (not this PR, scope discipline)

  • decimal.dag split: the decimal-numeral vocabulary (~330 lines) is §3-honestly its own std concept, but its compares need int_compare, which lives in integer.dag (importers: typescript.dag, swift.dag) — re-homing int_compare (algebra.dag beside Ordering/OrderedRing?) is a §3 placement decision to make first.
  • rust.dag 12-arm interval dispatch collapse: blocked on the RustIntKind vs Signedness constructor-name collision (Signed/Unsigned both) — the Constructor-owner ruling (§1c): binding-edge resolution, collision wall, scan deleted — the engine PR #6235 wall forbids importing integer's constructors there; dissolves with the RustIntKind de-fork (31-duplicate census lane).
  • The comparison band (integer_interval_bound_compare + pointer-width tables) was deliberately NOT refactored: pointer-width symbolic comparisons encode semantic choices (e.g. Signed×Unsigned ⇒ Less regardless of endpoint) that a rank-projection rewrite could silently change; behavior preservation wins.

🤖 Generated with Claude Code

@gunbai-bot gunbai-bot Bot changed the title complexity lens enforcement integer.dag §2 remodel: derive all interval bounds from the width axis; decode chain -> roster fold Jul 6, 2026
@briansrls
briansrls marked this pull request as ready for review July 6, 2026 04:47
@gunbai-bot

gunbai-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

CI red @ f1752a4 investigated — systemic compile-wall, no fix to push

Run 28805933233: rust_tests PASS (32m); sole red is the ci job's floor step "gunbc ci (.dag witnesses + gates)" killed at exactly the 135m step budget (16:19:01 → 18:34:14).

Step log breakdown:

  • plan resolve: ~78m (batch walk started t+4670.5s)
  • batch 1 of 5 (dag_compile_clean_gate): ~57m in-flight at kill
  • zero witness/gate FAIL or Refused lines — the only error line is the GHA step timeout.

This is the same wall as every open PR and main today (compare #6314 receipt run 28798100556: 72m resolve + 51m batch-1). This PR's diff is not implicated; the f1752a4 head is just a main-integration merge picking up #6321.

Fix vehicles, both open: #6326 (interim floor budget 135→195, receipt-backed) and #6315 (structural: affected-set-scoped compile-clean gate). Note for the budget re-derivation: resolve on this tree is now ~78m (up from 72m), so the wall grows with the corpus — the structural fix remains the real dissolution.

No push; PR remains 2×-approved and mergeable.

@gunbai-bot

gunbai-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

CI red @ c82a8d3 (auto-refresh merge of main): ci job killed at 10m17s — the by-design #6323 job-level kill (operator re-ruling 2026-07-06), not a defect; rust_tests in flight. Correction to my previous comment: #6326 (interim budget raise) was closed as superseded by #6323; the remaining fix vehicle for the wall is #6315 (affected-set-scoped compile-clean) plus the census-cliff parse work. Under the era-4 regime this PR's merge basis is approvals on HEAD + rust_tests green + mergeable — ci will stay dark by design until the wall dissolves. No push.

@briansrls
briansrls merged commit d63f367 into main Jul 6, 2026
2 of 3 checks passed
@briansrls
briansrls deleted the integer-remodel branch July 6, 2026 19:50
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