Skip to content

det ports: one-line field declarations (-20.7% code lines) and named 88 condition methods, under proof - #4202

Merged
squid-protocol merged 4 commits into
mainfrom
feat/det-readable-88-levels
Oct 3, 2026
Merged

squid-protocol merged 4 commits into
mainfrom
feat/det-readable-88-levels

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

Makes det ports smaller and more readable, with no change in behaviour.

What changed

  • One-line field declarations. Each COBOL item's Field is now declared and bound to its storage in one line, in record order after the storages:
    private final Field f3_FD_TRANCAT_ACCT_ID = Field.zoned(s_FD_TRAN_CAT_BAL_RECORD, 0, 11, 0, false, false, false);
    This replaces the declaration list plus the fields0()..fieldsN() init chunks, which took two lines per item. The largest constructor is COACTUPC's, with 1,332 items, and it proves.
  • Named 88 condition methods. An 88's test (without subscripts) is emitted once as private boolean isApplAok(), with its lineage /** 88 APPL-AOK of APPL-RESULT. */, and called at each use. 382 methods across the 50 cases. It is the same expression the use site held.
  • det_parity counts paragraph methods only, so the 88 methods are excluded from the methods count.

Measured over all 50 cases (translate-only, main vs this branch)

main branch change
code lines (non-blank, non-comment) 88,720 70,387 −20.7%
total lines 103,823 86,164 −17.0%
bytes 8,169 KB 7,832 KB −4.1%

Almost all of the saving comes from the field declarations. Naming the 88 tests saved nothing (+0.4% on its own), because each test was already one expression. The construct map's ~3,800-line estimate for that rule was based on the model ports' shape, not the det output. The 88 rule is kept for readability and lineage.

The det port's size relative to COBOL drops by about a fifth: roughly ×4.2 → ×3.3 in code lines. Measured on the main service file per program, structure is preserved (COBOL vs det ρ, 49 programs):

main branch
functions ρ (floor 0.85) 0.937 0.932
branches ρ 0.855 0.855

Proof

Not done: typed accessors / typed values for simple items (the SENTINEL-style representation). That is the next rule, a separate PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ

squid-protocol and others added 4 commits October 3, 2026 00:03
…0.7% code lines)

- An 88's test without subscripts is emitted once as private boolean is<Name>(),
  documented with its lineage (/** 88 APPL-AOK of APPL-RESULT. */), and called at
  each use: the same expression, so behaviour does not change. 382 methods across
  the 50 cases; on its own +0.4% code lines (each test was already one expression).
- Each COBOL item's Field is declared and bound to its storage on one line
  (private final Field x = Field.zoned(...)), in record order after the storages,
  replacing the declaration list plus the fields0..N() init chunks: -20.7% code
  lines over the 50 cases. The largest constructor (COACTUPC, 1,332 fields) proves.
- det_parity: condition methods are not paragraphs; the methods count excludes them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ
…; lesson: measure the det output

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ
@squid-protocol
squid-protocol marked this pull request as ready for review October 3, 2026 08:24
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 984fffe into main Oct 3, 2026
38 checks passed
@squid-protocol
squid-protocol deleted the feat/det-readable-88-levels branch October 3, 2026 10:01
squid-protocol added a commit that referenced this pull request Oct 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ
squid-protocol added a commit that referenced this pull request Oct 3, 2026
…nstalls the translator's parser (#4220)

Three test_det_programs tests asserted 'private Field x;', the declaration shape
before #4202 (now 'private final Field x = Field.zoned(...)'). They test that an
item stays byte storage; _byte_storage() asserts that property directly (a
Field bound to its storage AND no typed declaration), stricter than before.
No behaviour changed: the items are byte storage as before, and the GnuCOBOL
end-to-end runs of all 9 test programs in bytes / typed / groups (27) match.

CI missed it: the full-suite job never installed tree-sitter-language-pack, so
every det-translator test importorskip'ped and the suite passed without them.
smoke-test.yml full-suite and full-suite-gate.yml now install it (pinned 1.20.0;
wheels for linux, macOS, Windows): +60 tests, ~18 s.


Claude-Session: https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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