“Verify, then trust”: A closed-loop method for AI-powered legacy modernization

blog

Concrete Specifications

One of the most common—and costly—failure patterns in modernization is trying to rebuild a system and incorporate new requirements at the same time. It can create a cascade of unintended complexity.

That’s why successful modernization starts with replication. It’s far safer and more likely to succeed if you first reproduce the existing system accurately before layering on new architecture patterns or innovation requirements. 

In this post, we’ll explore how AI can accelerate that replication step: more importantly, how to wrangle a powerful, non-deterministic technology into producing a trustworthy behavioral copy.

How can you trust AI to do what’s right and what works? Spoiler alert: you don’t.

Closed-Loop Validation

Mechanical Orchard’s mainframe modernization platform, Imogen, uses a closed-loop validation system that refines AI-generated code until it meets strict behavioral equivalence standards relative to the original application.

Step 1: Real-time data capture

We integrate Imogen with system schedulers or use real-time monitoring to capture inputs and outputs from production workloads in the existing system. These can include:

  • relational database data (with or without change data capture)
  • datasets / files (including generational datasets)
  • MQ messages
  • job parameters and other relevant runtime configuration

Once captured, the data is stored in a way that allows all relevant data for a given execution of a workload to be 'replayed' against the modern system: we call these replica packets.

Figure 1: Replica packet representation

Step 2: Contextualization and code generation

Context is critical when it comes to recreating the existing behavior. It can include, among other things:

  • the relevant source code for the workload, or a portion of it
  • job execution parameters and metadata
  • information about how to replicate legacy behaviors in the new system and framework, such as how to send emails, write MQ messages, or make database updates

Imogen’s AI engine uses this context to characterize the existing system, which then guides the code generation process. 

Step 3: Convergence

The resulting code is automatically integrated with the Imogen runtime framework and then executed against the replica packets captured earlier. Imogen runs the generated code against the data packets, captures the results, including compiler messages, runtime errors, and information about whether the outputs and side effects matched those described in the data packets. 

If the resulting code fails to match the original workload in terms of equivalence, Imogen automatically tries again (and again if needed), each time including information about how the outputs were not equivalent, until the process succeeds, as depicted by all replica packets ‘going green’.

Figure 2: Status of workload replication by data packet

Step 4: Review and Equivalence

The converted workload is now ready for review by developers, who can then promote the code into the equivalence environment. In this environment, the new workload is run alongside the legacy one, where it is given the same inputs, and outputs are again checked for equivalence. 

The new workload is run in equivalence mode until the code meets performance, non-functional, and behavioral requirements, at which point it can go into production and the corresponding legacy workload decommissioned. 

Figure 3: Sample Elixir code outputted by Imogen

Verify, then trust

Mechanical Orchard’s closed-loop validation model makes sure that any AI-generated code is not just theoretically correct but rigorously validated against real-world data within actual workflows and business processes. The code Imogen generates is clean and idiomatic, making it easy to read, understand, and maintain for human or AI developers.

Conversation

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Footnote

Leave a comment

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
0 Comments
Author Name
Comment Time

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere. uis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

ReplyCancel
Delete
Author Name
Comment Time

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere. uis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

ReplyCancel
Delete

You might like

Go up

Subscribe
to our newsletter

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.