How I used Kiro specs, hooks, and property-based tests to check TypeScript ports against real GnuCOBOL, 2,000 cases at a time.
I built this for the Kiroween 2026 hackathon. The project is called Lazarus. It ports COBOL batch programs to TypeScript and then proves, case by case, that each port gives the same output as the original compiled COBOL. This post covers what it does, how Kiro shaped the build, and the parts that were harder than I expected.
The problem: ports that are a penny wrong
A lot of money still runs on COBOL. Reuters estimated in 2017 that COBOL handles about 95% of ATM swipes. That figure is old and hard to check, but the point stands: banks want to move off COBOL, and the hard part is showing that the new code behaves the same.
A wrong port usually doesn't crash. Take a weekly gross pay of 1,112.02. Tax is 25% of the amount over 1,000.00, which is exactly 28.005. The COBOL program rounds half to even, so it stores 28.00:
WHEN WS-GROSS <= 4000 COMPUTE WS-TAX ROUNDED MODE NEAREST-EVEN = (WS-GROSS - 1000) * 0.25 A port that uses ordinary half-up rounding gives 28.01. Net pay comes out a penny short. Nothing errors. It happens every week, for every employee whose tax lands on a half penny.
What Lazarus does
Lazarus has three COBOL programs, which I wrote for this project. They are not real legacy code, but each one targets a different COBOL trap:
- INTCALC: loan interest with an overdraft penalty (ROUNDED, high-order truncation, negative zero).
- PAYROLL: gross-to-net pay with tax bands (COMP-3 packed decimal, ON SIZE ERROR, banker's rounding).
- INVOICE: an invoice line with discount and VAT (silent overflow, a truncated discount, bad VAT codes).
When you press Prove it, fast-check generates 2,000 input records. Each record runs through real GnuCOBOL 3.1.2 on AWS Lambda and through the TypeScript port, and the outputs are compared byte for byte. Progress streams back about four times a second. A warm PAYROLL proof takes about 0.7 seconds. If every case matches, the program is declared Alive.
A test that always passes proves nothing, so there is a sabotage panel. You pick one of seven realistic porting mistakes and prove again. With the half-up-tax mistake, the proof fails on the first generated case. fast-check then shrinks the input in 19 steps to the 1,112.02 record, where COBOL writes 0002800, and the port writes 0002801.
How Kiro shaped the build
Specs first
I wrote three specs before writing code: the equivalence harness, the reanimation lab and the graphical proof. Writing requirements first changed the plan more than once.
One requirement for the lab said, roughly, "prove the tests are not passing by default". I had been planning a manual mutation script. Writing that requirement down turned the script into the sabotage panel, which became the most useful part of the demo.
The graphical proof spec has a requirement called Honesty. It says the visuals show only numbers taken from the run's events or result: runs, cases, shrinks, executions, duration and seed. That ruled out a lot of tempting animation. Every counter, every green square and every shrink step on screen comes from the real NDJSON stream or from a recorded run, and recorded runs are labelled as recorded, with their date.
Hooks that re-prove on save
The hook I relied on most re-runs the proofs whenever I save a port, the shared numeric rules or the harness:
{ "name": "Re-prove ports on save", "trigger": "PostFileSave", "matcher": "src/(ports|semantics|harness)/[^/]+\\.ts$", "action": { "type": "command", "command": "npm test --silent -- --reporter=verbose 2>&1 | grep -E '^(INTCALC|PAYROLL|INVOICE):| (input|cobol|port|replay):|Test Files|Tests |FAIL' | tail -30", "timeout": 180 } } A second hook fires when a .cbl file changes. It tells Kiro that the COBOL is the source of truth and to fix the port until it matches, even if the COBOL looks wrong. A third hook blocks commits while .kiro/ is gitignored. Testing that guard on purpose showed it never blocked anything: git check-ignore skips files that are already tracked. Adding --no-index fixed it. I only found that because I tested the failing case and not just the passing one.
Steering: no JavaScript numbers for money
The steering file tech.md says never to use JavaScript number for money or PIC 9 fields, and lists COBOL's truncation and rounding rules. Because of that, the first port used exact bigint rationals from the first line. There was never a floating-point version to unpick.
Property-based testing found real bugs
On the very first run, fast-check shrank a failure to a balance of -0.01. My own div() had dropped the dividend's denominator. The unit test for division used whole numbers, so it passed.
After 3,974 cases, fast-check found something stranger. An overdrawn balance of -999,999,999.98 makes the interest overflow its PIC S9(7)V99 field, and high-order truncation leaves zero. GnuCOBOL wrote -000000000. My port wrote +000000000. COBOL decides the sign before it truncates, so you can get negative zero. Nobody writes a unit test for that.
I also checked the tests themselves. Removing ROUNDED from the INTCALC port fails within 2 generated cases. Six of the seven sabotage mutants are caught. The seventh changes <= to < on the 1,000.00 tax band edge, and both branches give zero tax there, so the UI labels it as an equivalent mutant.
MCP servers
- Context7 checked my three.js, Zustand and fast-check usage against current docs. It turned up two problems: cached GLB models kept an old WebGL context alive, and
THREE.Timerwasn't connected to page visibility. Both fixed in91c7c3b. - Playwright MCP drove a live review at desktop and phone sizes. It found a demo-mode stall (
ab38697), captions announcing a result before it was on screen (542cf7e) and a missing favicon (a245364). - AWS IaC MCP ran cfn-lint on the synthesized proof API template: 0 errors and 1 warning, a redundant
DependsOn. cfn-guard didn't run, so I'm not claiming any compliance result.
The hard parts
Streaming through CloudFront. The proof API is an arm64 Lambda container image, streaming NDJSON through a Function URL with RESPONSE_STREAM, behind CloudFront with Origin Access Control. The Lambda Runtime Interface Emulator buffers the whole response, so I could only confirm streaming on real AWS. I wrote that up as an ADR. On AWS, each progress line arrived in its own chunk about 250 ms apart. With OAC, the client has to send x-amz-content-sha256 on POST requests, or CloudFront returns 403. CloudFront origin request policies also reject X-Amz-* headers, which failed my first deploy.
CSP versus KTX2. KTX2 is the usual compressed texture format for three.js models, but three.js's Basis transcoder needs new Function, which my Content Security Policy forbids. The 3D lab model uses WebP textures instead, and the CSP stays strict.
Dropping React Three Fiber. R3F 9 constructs the deprecated THREE.Clock. I moved to plain three.js with THREE.Timer.
Reserved concurrency. I set the proof Lambda's reserved concurrency to 1 to cap cost, and had to wait for an account concurrency quota increase before I could. Extra requests get a 429, and the UI offers to replay the recorded proof instead.
What I'd do next
- Support more COBOL: OCCURS tables, REDEFINES and file I/O.
- Build input generators straight from any copybook's PIC layout.
Links
- Live app: https://lazarus.ogbes.com
- Source: https://github.com/gtogbes/lazarus
- Demo video: https://youtu.be/I7vRcGWXvEg

