Skip to content

branch_solver: fault plans for RESP-driven arms; strengthen.py backend (#4175) - #7580

Closed
squid-protocol wants to merge 5 commits into
feat/solver-wiringfrom
feat/solver-faults
Closed

squid-protocol wants to merge 5 commits into
feat/solver-wiringfrom
feat/solver-faults

Conversation

@squid-protocol

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

Copy link
Copy Markdown
Owner

Stacked on #7578 (base feat/solver-wiring), which is stacked on #7577: retarget each to main as the one below merges. Follows #4175 (owner, 2026-11-02: "build the fault-plan synthesis").

What

RESP as a solver input. Each EXEC CICS now answers one response symbol, restricted to IBM's DFHRESP values. Its RESP(item) and EIBRESP hold that symbol.

  • check leaves the symbol free within DFHRESP, so it stays sound against IBM's full condition sets.
  • reach --inputs first asks for a witness whose responses are all ones a scenario's fault plan can give. The plannable sets come from equivalence_cics_faults.py's FILE_FAULT_CONDITIONS / UI_FAULT_CONDITIONS, minus the refused pairs, plus LINK/XCTL's documented PGMIDERR / NOTAUTH / INVREQ.
  • The input then carries the faults entry: {"cmd", "<resource key>": NAME, "nth": 1, "resp", "resp2"}.
  • The resource name comes from a literal, or from an item with exactly one value.
  • A command performed from two places gets one plan.
  • An arm that needs an unplannable response says so in why (Equivalence harness gaps that block the L1->L4 ladder: abend injection, SEND/RECEIVE/RETURN/SYNCPOINT/DELAY faults, CEEDAYS, X6 WRITEQ #6271).

backend CASE PROMPT_FILE answers strengthen.py's prompt, so the solver can replace the model:

strengthen.py run CASE --work DIR --no-mutation --backend-command "python tests/tools/branch_solver.py backend CASE {prompt_file}"

The oracle proves each input alone, as it does a model's proposal, and no model tokens are spent.

Example (COUSR03C, carddemo-userdel)

target solver input
280:WHEN@287 (READ answers NOTFND) {"cmd": "READ", "file": "USRSEC", "nth": 1, "resp": "NOTFND", "resp2": 80}
313:WHEN@323 (DELETE answers NOTFND) PF5, context 1, {"cmd": "DELETE", "file": "USRSEC", "nth": 1, "resp": "NOTFND", "resp2": 80}
280:OTHER READ answering DUPKEY (140)

Oracle check (ablation).

  • Setup: carddemo-userdel with its only fault-plan scenario (pf5-delete-not-found) removed, which leaves DELETE-USER-SEC-FILE:313:WHEN@323 uncovered. Then strengthen.py run --backend-command "python tests/tools/branch_solver.py backend ...", with no model.
  • Branches covered: 30/32 → 31/32; the strengthened case is proven. The solver's input was PF5, a typed USRIDINI (a user id the case already uses), and DELETE USRSEC → NOTFND. It took the arm on the real GnuCOBOL oracle.
  • The one branch still open, 199:true, is the outcome check confirms unreachable.
  • The first attempt missed: the input lacked the typed user id, so the READ before the DELETE failed. That led to the two fixes in the last commit: map input fields now go into receive, and the solver prefers the case's own values.
  • Running it needs Maven on JDK 17 (JAVA_HOME). Generated-data cases (@generate inputs) are not loadable by strengthen.py yet.

Checks

  • test_branch_solver.py: 21 passed (new: a RESP arm's fault plan; a witness preferring the case's own values).
  • audit_check.py: all clear.

Files: 3 (branch_solver.py, test_branch_solver.py, .claude/skills/ladder-slice/SKILL.md).

🤖 Generated with Claude Code

squid-protocol and others added 4 commits November 2, 2026 19:13
#4175)

Each EXEC CICS answers one response symbol (its RESP item and EIBRESP hold it,
one of IBM's DFHRESP values). `reach --inputs` prefers responses a scenario's
fault plan can give (equivalence_cics_faults.py's tables) and emits the
`faults` entry: command, resource, nth 1, resp, resp2. `backend CASE
PROMPT_FILE` answers strengthen.py's prompt, so `strengthen.py run
--backend-command` closes gaps with the oracle and no model.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…'s own values (#4175)

A symbolic map's input field the condition reads (<map>I's <field>I) goes into
the scenario's `receive`, and a witness first tries values the case's
scenarios already use for the same field, so a data-dependent path (a READ
that must find the record) has a chance. Oracle check: with the DELETE-NOTFND
scenario of carddemo-userdel removed, strengthen.py with the solver as backend
re-covered DELETE-USER-SEC-FILE:313:WHEN@323 (30/32 -> 31/32, proven).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@squid-protocol

Copy link
Copy Markdown
Owner Author

Folded into #7608, which carries this PR's commits together with the rest of the stack, so CI runs once instead of five times (2026-11-03 backlog). The branch is kept.

squid-shepherd Bot pushed a commit that referenced this pull request Nov 3, 2026
…7581, #7583, solver-more, #7584) (Part of #4175) (#7608)

* tools: branch_solver -- z3 over the det reading of a COBOL program (#4175)

Checks stated infeasible branch outcomes (confirmed / witness /
inconclusive, sound over-approximation of everything it does not model)
and finds inputs that take an outcome, emitted in the strengthen.py /
survivor_attack.py input format. z3 is the new `solver` extra.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* infeasible outcomes: cbsa-bankdata 917:true is family R, not C (owner)

The claim rests on how unlikely 100 FUNCTION RANDOM failures in a row are,
not on a constant: branch_solver finds a path through the program alone
(#4175). Owner ruling 2026-11-02: refile as R.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test_infeasible_outcomes: bankdata 917 is pinned as family R (owner ruling)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* survivor_attack facts + ladder-slice: use branch_solver (#4175)

`facts` settles an `unreachable` verdict whose reason says a paragraph is
never reached when branch_solver finds no input that enters it (attack
result `solver-unreachable`, accepted by det_mutation.py state), and prints
the reasons it questions without recording them. `packet` shows the
solver's verdict on the paragraphs a reason names. ladder-slice asks the
solver for inputs and checks infeasible entries before they are written.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* branch_solver: encode text one byte per character, nothing lossy (#3813, test_source_reads)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* branch_solver: drop unused locals and an implicit string concatenation (CodeQL)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* branch_solver: fault plans for RESP-driven arms; strengthen.py backend (#4175)

Each EXEC CICS answers one response symbol (its RESP item and EIBRESP hold it,
one of IBM's DFHRESP values). `reach --inputs` prefers responses a scenario's
fault plan can give (equivalence_cics_faults.py's tables) and emits the
`faults` entry: command, resource, nth 1, resp, resp2. `backend CASE
PROMPT_FILE` answers strengthen.py's prompt, so `strengthen.py run
--backend-command` closes gaps with the oracle and no model.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* branch_solver fields + survivor_attack: settle Field mutants of items no reachable statement uses (#4175)

`branch_solver.py fields CASE` lists the WORKING-STORAGE items whose accessor no
reachable statement runs; anything the runtime may touch outside a statement
(LINKAGE, FILE, EIB, DFHAID, SQLCA, FILE STATUS, ODO objects, ADDRESS OF, DTO
records, numeric-edited items set at creation, BMS maps a reachable SEND/RECEIVE
names) counts as used. `facts` settles a mutant of such an item's Field
declaration as `solver-unread`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* field_observability: settle det-port Field-declaration mutants no input can see (#4175)

Three facts, every doubt left to an attack:
- dead window: X and the bytes of both windows are read by no reachable
  statement and no runtime reader (DTOs, LINKAGE, FILE, SQLCA, sent maps,
  EIBCALEN / EIBAID-under-HANDLE-AID / ADDRESS EIB);
- map subfield: an unnamed BMS attribute / length whose bytes and the
  mutant's only hold X'00', spaces or typed lengths when SEND MAP reads them
  (a walk flag proves every SEND follows a clear; protected fields without
  FSET are never keyed, IBM 3270);
- DFHAID: every key press satisfies the same EIBAID comparisons with the
  mutant as without.
Plus offset-only relocation when nothing else touches either window.
survivor_attack facts records `solver-unobservable` (det_mutation accepts it).
The walk gains flow-sensitive Boolean flags (branch_solver Walk(flags=)).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* branch_solver reach: map input fields into `receive`; prefer the case's own values (#4175)

A symbolic map's input field the condition reads (<map>I's <field>I) goes into
the scenario's `receive`, and a witness first tries values the case's
scenarios already use for the same field, so a data-dependent path (a READ
that must find the record) has a chance. Oracle check: with the DELETE-NOTFND
scenario of carddemo-userdel removed, strengthen.py with the solver as backend
re-covered DELETE-USER-SEC-FILE:313:WHEN@323 (30/32 -> 31/32, proven).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* branch_solver: SQLCODE as a solver input; reach emits sql_faults (#4175)

Each EXEC SQL's SQLCODE is one symbol (free for check); reach prefers 0, the
codes the case's sql_faults already plan and the common ones, and emits
{line, nth, sqlcode}. A LINKed program's input names no AID unless the case's
scenarios do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* branch_solver: STRING literal prefixes; one-way loop counters keep their start bound (#4175)

STRING ... INTO x (no POINTER): the literal pieces it starts with (each cut at
its delimiter) are x's first bytes, the rest any value. A numeric item that
holds a known number at a PERFORM UNTIL head and that the loop (its ranges to
their end, GO TO paths with fall-through) only increases (ADD / COMPUTE x = x
+ n) or only decreases stays >= / <= that number. The loop-body closure now
stops a PERFORMed range at its end instead of falling through.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* field_observability: length-only mutants of items only moved into shorter items (#4175)

An alphanumeric item or group the program only ever reads by MOVE X TO Y, each
Y alphanumeric and no longer than the shorter window, hands Y the same leading
bytes with either length (WS-CURDATE-MM-DD-YY 8 -> 9, moved into CURDATEO).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* branch_solver: caller-aware check (--callers); --github report for CI (#4175)

estate_entry: what the estate's programs can send a program's COMMAREA (XCTL /
LINK naming it, RETURN TRANSID of its transaction), region by region (offset,
size, kind, scale), to a fixpoint over the estate: a sender's values come from
its own value sets, which see ITS entry values through whole-area moves --
copy-in from LINKAGE, through unstructured buffers (INITIALIZE fills kept),
reference modifications at a literal or LENGTH OF x + n. Every doubt is any
value. `check --callers` reports `confirmed-callers` for a witness no input
the estate sends reaches (assumption: its programs are the only callers).
`check --github` writes the report to the job summary and warns on family C
witnesses (solver-check.yml).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci: solver-check -- branch_solver verdicts on a PR's stated infeasible outcomes (#4175)

A PR that touches tests/equivalence/infeasible_outcomes/ gets branch_solver's
verdict on every claim of the cases it touches in the job summary, and a
warning on the file for a family C claim an input of the program reaches.
Informational: never fails (the det sweep stays the gate). Not a required
check; the path filter is the selector. Hash-pinned install set
ci/requirements/solver.txt (z3-solver 4.15.4.0, tree-sitter-language-pack
1.22.1), generated with tests/tools/pin_ci_requirements.sh.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci: pin z3-solver in the treesitter lock; bankdata 917:true is a stated assumption, not infeasible (#7577 rulings)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* solver-check: list it as a non-gate, trigger on the tools it runs, pair the corpora cache, retry the pip install

The combined solver branch failed four CI-rule tests on its new workflow:
gate_controls (every PR workflow is a gate or says why not), workflow
inputs (a path-filtered workflow triggers on what it reads), cache keys
(a corpora restore pairs with a guarded save) and ci_retry (a hash-pinned
pip install goes through ci_retry.sh).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018srRvf2aRvMjAx5eu3BDUj

* solver-check: a case the PR deleted no longer aborts the bash -e step; list branch_solver.py as a cics spec importer (Part of #4175)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* solver-check: list ready_for_review and carry the draft condition (test_workflow_draft_gate)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* test_cics_spec: branch_solver imports DFHRESP (#4175)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* test_cics_spec: drop the duplicate branch_solver entry

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

---------

Co-authored-by: Joe Esquibel <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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