Back to Blog
January 26, 20267 min readModernizing Legacy Oil

Modernizing Legacy Oil and Gas Software: Safety-Critical Systems Extraction

R
Replay Team
Developer Advocates

The most dangerous code in the world isn’t a zero-day exploit; it’s the 20-year-old safety-critical system at the heart of an oil refinery that no one knows how to maintain. In the Oil and Gas (O&G) sector, "technical debt" isn't just a line item on a balance sheet—it’s a physical risk. When legacy SCADA interfaces, pipeline monitoring tools, and refinery management systems become "black boxes," the cost of a rewrite isn't just the $18-month average timeline; it's the catastrophic risk of failure during the transition.

TL;DR: Modernizing legacy oil and gas software requires a shift from risky "Big Bang" rewrites to visual reverse engineering that extracts business logic directly from user workflows, reducing modernization timelines by 70%.

The $3.6 Trillion Black Box Problem#

The global technical debt has ballooned to $3.6 trillion, and the energy sector carries a disproportionate share. Most O&G enterprises are running on "archaeology-grade" software. These systems are mission-critical, yet 67% of legacy systems lack any meaningful documentation.

When a VP of Engineering at a Fortune 500 energy firm decides to modernize, they typically face two bad options:

  1. The Big Bang Rewrite: A high-risk, 18-24 month project that has a 70% failure rate.
  2. The "Patch and Pray": Adding layers of wrappers around a crumbling core, further obscuring the business logic.

The problem isn't the code itself; it's the loss of context. The original developers are retired. The requirements documents are lost. The only "source of truth" is the behavior of the software as it's used by operators in the field. This is where Replay changes the trajectory of modernization.

Comparing Modernization Strategies for O&G#

ApproachTimelineRisk ProfileDocumentationCost
Big Bang Rewrite18–24 MonthsHigh (70% fail rate)Manual/Incomplete$$$$
Strangler Fig12–18 MonthsMediumManual$$$
Visual Reverse Engineering (Replay)2–8 WeeksLowAutomated/Live$

⚠️ Warning: Manual "software archaeology"—the process of developers reading old COBOL or C++ to guess business rules—is the primary cause of timeline overruns in O&G modernization.

From Video to React: The Mechanics of Extraction#

In a safety-critical environment, you cannot afford to "guess" how a pressure valve threshold is calculated. You need to see it in action. Replay utilizes Visual Reverse Engineering to record real user workflows. It doesn't just record pixels; it captures the state, the logic, and the intent behind the UI.

Instead of spending 40 hours manually documenting a single complex telemetry screen, Replay's AI Automation Suite extracts the underlying structure in approximately 4 hours. It transforms a video of an operator navigating a legacy system into documented React components and clean API contracts.

Step 1: Workflow Recording#

An operator performs a standard task, such as a "Wellhead Pressure Adjustment." Replay records the interaction, capturing every state change and data point.

Step 2: Component Extraction#

Replay's Blueprints editor analyzes the recording to identify UI patterns. It doesn't just "scrape" the screen; it understands the hierarchy of the legacy application.

Step 3: Logic Mapping#

The platform generates the corresponding modern code. Below is an example of a React component extracted from a legacy SCADA monitoring screen using Replay.

typescript
// Generated by Replay Visual Reverse Engineering // Source: Legacy_SCADA_Terminal_v4.exe (Pressure Monitoring Workflow) import React, { useState, useEffect } from 'react'; import { Alert, Gauge, TrendLine } from '@enterprise/oil-design-system'; interface PressureData { psi: number; threshold: number; status: 'NORMAL' | 'CRITICAL' | 'WARNING'; } export const PressureMonitor: React.FC<{ wellId: string }> = ({ wellId }) => { const [data, setData] = useState<PressureData | null>(null); // Business logic preserved from legacy workflow: // Threshold logic extracted from terminal state transitions const checkSafetyStatus = (psi: number): 'NORMAL' | 'CRITICAL' | 'WARNING' => { if (psi > 2500) return 'CRITICAL'; if (psi > 2100) return 'WARNING'; return 'NORMAL'; }; return ( <div className="p-6 bg-slate-900 text-white rounded-lg"> <h3>Wellhead ID: {wellId}</h3> {data && ( <> <Gauge value={data.psi} max={3000} status={data.status} /> {data.status === 'CRITICAL' && ( <Alert variant="destructive"> CRITICAL: Pressure exceeds safety limits (2500 PSI) </Alert> )} <TrendLine dataSource={`/api/v1/wells/${wellId}/history`} /> </> )} </div> ); };

💡 Pro Tip: When modernizing safety-critical systems, use Replay's Flows feature to map the entire architecture before writing a single line of new code. This prevents "feature creep" and ensures parity with the legacy system.

Eliminating the Documentation Gap#

67% of legacy systems have no documentation. In the Oil and Gas industry, this isn't just a technical hurdle—it's a compliance nightmare. Regulatory bodies like BSEE or PHMSA require rigorous proof of system integrity.

Replay automates the "archaeology" by generating:

  • API Contracts: Automatically mapping how the front-end communicates with the legacy back-end.
  • E2E Tests: Generating Playwright or Cypress tests based on actual user recordings.
  • Technical Debt Audit: Identifying redundant workflows that can be eliminated in the modern version.

Example: Generated API Contract#

Replay observes the network traffic and state changes during a "Fuel Loading" workflow and generates a standardized OpenAPI specification.

yaml
# Generated by Replay AI Automation Suite openapi: 3.0.0 info: title: Legacy Terminal Automation API version: 1.0.2 paths: /terminal/load-authorize: post: summary: Extracted from "Authorize Driver" workflow parameters: - name: driver_id in: query required: true schema: type: string responses: '200': description: Authorization successful content: application/json: schema: $ref: '#/components/schemas/AuthResponse' components: schemas: AuthResponse: type: object properties: gate_code: type: string max_allowable_volume: type: integer

Security for Regulated Environments#

For O&G companies, the cloud isn't always an option. Safety-critical data often resides on isolated networks (Air-gapped) or requires strict SOC2 and HIPAA-level compliance (for occupational health data).

Replay is built for these constraints:

  • On-Premise Availability: Deploy Replay entirely within your own infrastructure.
  • SOC2 & HIPAA-Ready: Enterprise-grade security out of the box.
  • No Data Leakage: Your proprietary business logic and workflows remain yours.

💰 ROI Insight: A major midstream operator reduced their terminal management modernization timeline from an estimated 14 months to just 11 weeks using Replay, saving approximately $2.2M in developer hours.

The 4-Step Extraction Process#

Modernizing legacy oil software doesn't have to be a "rip and replace" nightmare. Follow this structured approach:

Step 1: Assessment and Inventory#

Use Replay to audit your current screen inventory. Identify the "high-value, high-risk" screens that handle safety-critical data.

Step 2: Visual Recording#

Record subject matter experts (SMEs) performing their daily tasks. Replay captures the "hidden" logic—the things operators do that aren't in any manual.

Step 3: Automated Extraction#

Use the Library feature to convert legacy UI elements into a modern, standardized Design System. Replay identifies repeated patterns (buttons, inputs, gauges) and maps them to clean React components.

Step 4: Validation and E2E Generation#

Generate End-to-End tests from the original recordings. Run these tests against the new modernized system to ensure 100% functional parity. If the legacy system expected a 0.5s delay on a valve response, your new system should be tested against that exact behavior.

Frequently Asked Questions#

How long does legacy extraction take?#

While manual modernization takes roughly 40 hours per screen (including discovery, documentation, and coding), Replay reduces this to approximately 4 hours. For a typical enterprise suite of 50-100 screens, you are looking at weeks instead of years.

What about business logic preservation?#

This is the core value of Replay. By recording the actual state changes and data flow during a live session, Replay captures the "as-is" logic of the system, not the "as-intended" logic written in a 10-year-old document.

Does Replay support desktop legacy apps (Delphi, VB6, PowerBuilder)?#

Yes. Because Replay uses visual reverse engineering, it is agnostic to the underlying legacy language. If it runs on a screen, Replay can extract the workflow.

Is the code "clean" or just "wrapper" code?#

Replay generates clean, idiomatic TypeScript and React. It uses your organization’s specific Design System (via the Library feature) to ensure the output is maintainable and adheres to your modern standards.


Ready to modernize without rewriting? Book a pilot with Replay - see your legacy screen extracted live during the call.

Ready to try Replay?

Transform any video recording into working code with AI-powered behavior reconstruction.

Launch Replay Free