Skip to content

Fix #4006: CICS harness models interval control (START/RETRIEVE/CANCEL) on a virtual clock - #4019

Merged
squid-protocol merged 3 commits into
mainfrom
fix/4006-interval-control
Sep 29, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
fix/4006-interval-control

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Fixes #4006
Part of #3989 (phase 3, lane B)

#4016 (#4003) and #4018 (#4004) have merged. This branch is rebased on main, which includes lane A's #4009, and its baseline and report are regenerated.

What

Scheduler. drive_scenario implements SPEC §4, and both sides share it: the Java driver runs the same rules.

  • When a task ends, its STARTs become requests. A PROTECT request is kept only if the starter ended normally; IBM, START PROTECT: "If the starting task abends before the sync point is taken, the request … is canceled". A CANCEL NORMAL drops a request.
  • The scheduler then runs expired requests: earliest expiry first, ties broken by issue order.
    • With TERMID: one task takes every expired request for its TRANSID and terminal, and RETRIEVEs their data in expiry order. IBM: "Only one task is started if several START commands … expire … before the terminal is available".
    • Without TERMID: a non-terminal task with trigger: start and no EIBAID.
  • Next comes the operator step whose time has come. Virtual time jumps to the next expiry or step.
  • After the last step, requests keep running until none expires before until.
  • The terminal's next input follows the RETURN TRANSID of the last task that was attached to the terminal.

Stub ($GGCICS_NOW is the virtual clock):

  • START (IBM, EXEC CICS START):
    • A request expires at now + INTERVAL, or at TIME today. The six-hour rule applies: "if the START gets triggered at any time within 6 hours after the time specified … it runs immediately". A TIME earlier than that runs tomorrow.
    • Errors: INVREQ for hh/mm/ss out of range, LENGERR for FROM length, TRANSIDERR (checked against transactions.cfg from the CSD) and TERMIDERR.
    • The event carries INTERVAL or TIME as given, REQID only when the program named one, PROTECT and expires.
  • RETRIEVE: NORMAL; LENGERR truncates and sets LENGTH to the record's own length; ENDDATA when no data is left, which also covers a task that no START started.
  • CANCEL REQID: NORMAL only for an unexpired request, whether this task's own or the scheduler's (requests.cfg), and NOTFND otherwise ("fails to match an unexpired interval control command").
  • Refused by name: START AFTER/AT/RTRANSID/QUEUE/…, RETRIEVE SET/WAIT/…, and CANCEL without REQID.

Java (generated CicsTask). A started task's EIBCALEN is 0, and a terminal task's follows #4009's RETURN LENGTH:

  • start(transid, termid, interval, from, reqid, protect) and startAt(...) for TIME, returning StartResult(resp, expires).
  • retrieve(maxLength) returns RetrieveResult, and cancel(reqid).
  • withClock, withRetrieveData and withRequests feed the task.
  • Programs gains default transaction and terminal checks.
  • The Java driver was rewritten around a Scenario class that mirrors drive_scenario.

Comparison fix (not an oracle change):

  • The runner compared a final TS item's text with no padding. SPEC 6.1 says a text value is blank-padded to the area's known length, and a TS item's length is known: it is the item's own. So trailing blanks are optional.
  • The crucible logs GTLOG's 34-byte items as their text ("R=00 L=0020 D=ORDER 0001 READY"), so the old comparison failed every gt-start-retrieve cell on trailing blanks alone.
  • The phase-2 unit test that pinned the old reading is updated. Embedded, missing and extra non-blank bytes still fail.

Cells (side × status)

side before pass/fail/unsupported after
engine-facts 10 / 0 / 0 10 / 0 / 0
forge-compile 10 / 0 / 0 10 / 0 / 0
cobol-stub 15 / 1 / 21 24 / 1 / 12
java 0 / 37 / 0 0 / 37 / 0
  • gt-start-retrieve (5 scenarios) now passes: interval-data, no-data, time-six-hours (the 09:30 START runs first), retrieve-lengerr and protect-abend.
  • gt-terminal-coalesce (4 scenarios) now passes: three-in-one, staggered, cancel-in-time and cancel-too-late.

Tests

  • drive_scenario, driven by fake tasks: dispatch order and time jumps, coalescing and the first-request trigger, PROTECT versus abend, CANCEL, until, and the terminal following its RETURN TRANSID.
  • Parsing: stub lines to START, RETRIEVE and CANCEL events; the Java output to the same events.
  • Stub, compiled with cc: START expiry (INTERVAL, TIME within six hours, TIME the next day) and its INVREQ, TRANSIDERR and TERMIDERR; CANCEL (own request, requests.cfg, expired); RETRIEVE LENGERR and ENDDATA.
  • CicsTask under javac: the same rules.
  • Translator: unit tests for START, RETRIEVE and CANCEL.
  • End to end: the EQUIVALENCE_E2E=1 fixture passes, and CardDemo account view passes 9/9 events.

Audits: ruff, mypy and dead-key show no new findings. Touched files are formatted.

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol and others added 2 commits September 29, 2026 15:38
…ANCEL) on a virtual clock

- Scheduler (drive_scenario, SPEC 4), shared by both sides: when a task ends
  its STARTs become requests (a PROTECT one only if it ended normally; a
  CANCEL drops one); then expired requests run -- earliest expiry first, ties
  by issue order; one with a TERMID takes every expired request for its
  TRANSID and terminal, RETRIEVEing their data in expiry order -- then the
  next operator step; virtual time jumps to the next expiry or step, and
  requests keep running until none expires before `until`. Started tasks are
  non-terminal (or terminal with TERMID) with their start trigger.
- Stub: START computes expiry from the virtual clock ($GGCICS_NOW): now +
  INTERVAL, or TIME today with IBM's six-hour rule (earlier than that:
  tomorrow); INVREQ / LENGERR / TRANSIDERR / TERMIDERR. RETRIEVE: NORMAL,
  LENGERR truncating with LENGTH = the record's length, ENDDATA. CANCEL REQID:
  NORMAL only for an unexpired request (NOTFND otherwise).
- CicsTask: start / startAt / retrieve / cancel / withClock /
  withRetrieveData / withRequests; the Java driver runs the same scheduler.
- Comparison: a final TS item's text is blank-padded to the item's own length
  (SPEC 6.1: trailing blanks optional), as the crucible's GTLOG items are
  logged.

cobol-stub: gt-start-retrieve (5) and gt-terminal-coalesce (4) now pass.

Part of #3989.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EC8FWfn3aPmsUPnRgKNVup
@squid-protocol
squid-protocol marked this pull request as ready for review September 29, 2026 19:38
@squid-protocol
squid-protocol force-pushed the fix/4006-interval-control branch from 0444cbc to c01badb Compare September 29, 2026 19:38
@squid-protocol
squid-protocol merged commit 99450e5 into main Sep 29, 2026
38 checks passed
@squid-protocol
squid-protocol deleted the fix/4006-interval-control branch September 29, 2026 20:05
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.

CICS harness: interval control START/RETRIEVE/CANCEL with a virtual clock (unlocks through 33 cobol-stub cells)

1 participant