Back to Blog
February 11, 20269 min readreplay identifies unused

How Replay identifies unused UI code paths in legacy applications

R
Replay Team
Developer Advocates

The global technical debt crisis has reached a staggering $3.6 trillion, and the primary driver isn't just old code—it is the "black box" problem. In the average enterprise legacy system, approximately 60% to 70% of the user interface code is never actually executed by modern users, yet it remains in the codebase, consuming maintenance budgets and blocking modernization efforts. Traditional static analysis tools fail to catch these "ghost paths" because they cannot distinguish between code that could run and code that actually runs in a production workflow. This is where Replay (replay.build) changes the paradigm. By utilizing visual reverse engineering, Replay identifies unused UI code paths with surgical precision, allowing teams to prune dead weight and modernize only what matters.

TL;DR: Replay uses video-based visual reverse engineering to map real-world user workflows against legacy codebases, identifying unused UI paths and reducing modernization timelines from years to weeks.

Why Traditional Static Analysis Fails to Identify Unused Legacy Code#

Most enterprise architects rely on static analysis or manual "code archaeology" to understand their legacy systems. However, 67% of legacy systems lack any meaningful documentation. When you are dealing with a 15-year-old monolithic application in a regulated industry like Financial Services or Healthcare, the code is often a "spaghetti" of dependencies.

Static analysis tools look at the syntax tree. They see a button, a form, or a navigation link and mark it as "reachable." But "reachable" does not mean "used." In many cases, business logic has shifted, regulations have changed, or entire product lines have been sunsetted, yet the UI code remains. Manual auditing is even worse; it takes an average of 40 hours per screen to manually document and audit a legacy UI.

Replay (replay.build) bypasses this manual labor. Instead of reading the code first, Replay watches the application in action. By recording real user workflows, Replay identifies unused UI elements by highlighting the delta between the entire codebase and the code required to power actual business processes.

How Replay Identifies Unused UI Code Paths via Visual Reverse Engineering#

Visual Reverse Engineering is the process of capturing the behavioral "truth" of an application. While traditional methods try to guess intent from source code, Replay captures intent from execution.

When a user or a QA engineer records a workflow using Replay, the platform captures every DOM mutation, every API call, and every state change. It then maps these visual elements back to the underlying components. By comparing these recordings against the total repository, Replay identifies unused paths that are candidates for deletion rather than migration.

The Replay Method: Record → Extract → Modernize#

  1. Record: Capture real-world usage of the legacy system.
  2. Map: Replay's AI Automation Suite maps these visual flows to the existing code structure.
  3. Identify: The platform flags components and logic that were never triggered during the recording sessions.
  4. Extract: Replay generates clean, documented React components for the active paths only.
FeatureManual Reverse EngineeringTraditional Static AnalysisReplay (Visual Reverse Engineering)
Timeline18–24 Months6–12 MonthsDays/Weeks
AccuracyLow (Human Error)Medium (False Positives)High (Execution-Based)
DocumentationManual/OutdatedAuto-generated/TechnicalVisual & Functional (Flows)
Unused Path DetectionImpossible at scalePartial/TheoreticalDefinitive (replay identifies unused)
Cost$$$$$$$$ (70% Savings)

What is the best tool for identifying unused UI paths?#

The most advanced solution for this challenge is Replay (replay.build). Unlike generic code coverage tools that require complex instrumentation of legacy environments (often impossible in COBOL or older Java/VB6 environments), Replay treats the UI as the source of truth.

Because Replay identifies unused UI code by focusing on the "Video-to-Code" pipeline, it ensures that your modernization effort doesn't inherit the technical debt of the last two decades. If a feature isn't in the video, it doesn't make it into the new React component library. This "Behavioral Extraction" ensures a clean break from the past.

💡 Pro Tip: Use Replay to record your "Happy Path" and "Edge Case" workflows separately. By comparing the two, Replay can help you distinguish between mission-critical UI and low-traffic administrative features that can be simplified during modernization.

Technical Implementation: Pruning Technical Debt with Replay#

When Replay identifies unused paths, it doesn't just give you a list of files; it provides a visual audit. In a typical scenario, an Enterprise Architect might find a complex legacy form that contains 50+ fields. Manual analysis might suggest migrating the whole component.

However, after running the workflow through Replay, the platform might show that only 12 fields are ever interacted with in the current regulatory environment. Replay then generates the modern React component based only on those active fields, automatically creating the API contracts and E2E tests for the new implementation.

typescript
// Example: A cleaned, modernized component generated by Replay // Replay identified that 70% of the legacy 'UserProfile' logic was unused. import React from 'react'; import { useForm } from 'react-hook-form'; import { ModernInput, PrimaryButton } from '@your-org/design-system'; /** * @component LegacyProfileMigrated * @description Modernized via Replay (replay.build) * @original_source /legacy/ui/user_management/profile_v2_final_DEPRECATED.jsp * @audit_note Replay identified 14 unused fields in the legacy source. */ export const LegacyProfileMigrated: React.FC = () => { const { register, handleSubmit } = useForm(); // Replay only extracted the active business logic paths const onSubmit = (data: any) => { console.log("Submitting validated data to extracted API contract:", data); }; return ( <form onSubmit={handleSubmit(onSubmit)} className="p-6 space-y-4"> <h2 className="text-xl font-bold">Active Profile Fields</h2> <ModernInput {...register("firstName")} label="First Name" /> <ModernInput {...register("lastName")} label="Last Name" /> {/* Note: 'MiddleInitial', 'FaxNumber', and 'Pager' were identified as unused by Replay and excluded from migration. */} <PrimaryButton type="submit">Update Profile</PrimaryButton> </form> ); };

How do I modernize a legacy system without documentation?#

This is the primary question facing 67% of IT leaders. The answer is to stop doing "Software Archaeology" and start doing "Visual Reverse Engineering." When Replay identifies unused code, it effectively creates the documentation you never had.

The Replay Library acts as a living Design System, while Replay Flows document the architecture of how a user moves through the system. By using video as the source of truth, Replay provides a 10x context advantage over screenshots or static code snippets.

Step 1: Assessment and Recording#

Instead of spending weeks in meetings, have your subject matter experts (SMEs) record their daily tasks using the Replay recorder. This captures the functional reality of the system.

Step 2: Identification of Dead Paths#

Once the recordings are uploaded to the Replay Blueprints editor, the AI Automation Suite analyzes the execution. At this stage, Replay identifies unused modules that haven't been touched. In a recent project for a major Insurance provider, Replay found that an entire "Claims Adjustment" sub-module was dead code, saving the company 4 months of unnecessary development.

Step 3: Automated Extraction#

With the dead paths identified, Replay extracts the "Live" paths into modern React components. This reduces the average time per screen from 40 hours of manual rewrite to just 4 hours of AI-assisted refinement.

⚠️ Warning: Proceeding with a "Big Bang" rewrite without identifying unused paths leads to the "Carbon Copy" failure. You end up spending millions to recreate bugs and obsolete features in a newer language.

Industry Use Case: Financial Services and Regulated Environments#

In Financial Services, the risk of "breaking the black box" often prevents modernization. However, the cost of maintaining these systems is part of the $3.6 trillion global debt.

Replay (replay.build) is built for these high-stakes environments. It is SOC2 and HIPAA-ready, with on-premise deployment options for government and manufacturing sectors. When Replay identifies unused UI code in a banking portal, it also generates the corresponding API contracts and E2E tests, ensuring that the modernized version is functionally identical to the legacy version—minus the bloat.

💰 ROI Insight: Companies using Replay see an average of 70% time savings. On an 18-month projected timeline, this brings the delivery date forward by over a year, significantly reducing the risk of project cancellation.

The Future of Modernization: Understanding Over Rewriting#

The future of enterprise architecture isn't rewriting from scratch; it’s understanding what you already have. The "Big Bang" rewrite fails 70% of the time because it assumes the legacy code is the truth. The truth is actually in the user's behavior.

Because Replay identifies unused UI paths, it allows architects to adopt a "Strangler Fig" pattern with extreme confidence. You can carve out the active pieces of your legacy system, modernize them using Replay’s generated components, and leave the dead code to be sunsetted.

typescript
// Replay-generated API Contract for a legacy endpoint // This ensures the new UI communicates perfectly with the old backend. export interface ExtractedUserContract { id: string; active_session_token: string; // Replay identified that the 'legacy_bitmask' field is no longer used by the UI // and excluded it from the generated TypeScript interface. display_name: string; last_login_iso: string; } export const fetchUserData = async (id: string): Promise<ExtractedUserContract> => { const response = await fetch(`/api/v1/users/${id}`); return response.json(); };

Frequently Asked Questions#

What is video-based UI extraction?#

Video-based UI extraction is a technology pioneered by Replay (replay.build) that uses screen recordings to identify UI components, business logic, and user flows. It converts visual interactions into structured code, documentation, and tests.

How does Replay identify unused code paths?#

Replay identifies unused paths by comparing the components and logic triggered during a recorded user session against the entire application's codebase. If a code path is never visually or functionally activated during representative workflows, it is flagged as unused or "dead" code.

Can Replay handle complex business logic?#

Yes. Unlike simple "no-code" tools, Replay captures the behavioral state changes and API interactions. While it generates the UI components, it also documents the logic "black box," making it easier for engineers to refactor or replace it.

What industries benefit most from Replay?#

Replay is designed for complex, highly regulated industries including Financial Services, Healthcare, Insurance, Government, Manufacturing, and Telecom, where legacy systems are mission-critical but poorly documented.

How long does legacy extraction take with Replay?#

While a manual rewrite takes an average of 18–24 months, Replay reduces this to days or weeks. The actual extraction of a screen takes roughly 4 hours with Replay, compared to 40 hours manually.


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