arXiv:2608.26746cs.SEAug 2026

Manuscript Offprint

arXiv:2608.26746

FaultLens: Learning Compact Behavioral Test Suites for Generated Operational Programs

Zeming Liu, Hang Lyu, Jingtao Zhang

Abstract

Generated operational programs are commonly validated with either a few hand-written examples or an exhaustive regression suite. The former misses sparse boundary and interaction faults; the latter can be unnecessarily expensive when validation crosses time, observations, thresholds, and action budgets. We introduce FAULTLENS, a method for learning compact behavioral test suites while preserving an auditable connection to executed evidence. The method executes a rich probe domain once, stores the resulting fault-probe kill relation as a sparse outcome cache, and learns probe orderings only from earlier program generations. A fault-driven greedy component exploits known kill structure. A mutation-independent diversity component covers probe families, cases, templates, and temporal bins. Their alternating hybrid is designed to remain useful when the next program contains a fault mechanism not seen during ordering construction.

We study twenty generated operational policies in a resource-selection case study with four environments, ten execution seeds, 1,200 measured run summaries, 2,160 controlled program transformations, and 4,120,200 executed program-probe pairs. Of 1,960 intended faulty transformations, 1,779 alter a contract or output somewhere in the finite audit domain; 200 additional controls preserve behavior. A 32-probe hybrid learned on program generations 1–3 covers 576/582 (99.0%) dynamically killable faults in generations 4–5, using 1.2–2.0% of the exhaustive domain. When an entire fault family is withheld from ordering construction, diversity raises scenario-family macro coverage from 84.6% to 94.9%. As a downstream deployment study, a conservative admission rule reduces severe tail regressions from 15/20 program-environment groups to 0/20. The results show that compact test selection can generalize across generated programs and partially across fault mechanisms, while also making its misses explicit.

1 Introduction

Code-generating models increasingly produce small operational programs that map telemetry and state to concrete actions. Examples include selecting a cache policy, choosing a replica set, activating a feature configuration, or allocating a limited set of database indexes. Such programs are attractive because they can be inspected, versioned, tested, and rolled back. They are also difficult to validate: a program can parse and return legal actions while encoding a shifted phase boundary, an order dependency, stale state, a damaged threshold, or an unsafe resource set.

Other generated artifacts expose similarly structured requirements for physical consistency, temporal prompt transitions, and content-style separation [1–3].

Executing generated artifacts is now a standard part of agent evaluation [4], but the validation budget is rarely treated as a first-class object. A few examples provide weak behavioral evidence. Exhaustive scenario-derived suites provide better evidence but may cross every round, observation type, threshold neighborhood, multiplicity, and permutation. That cost is especially visible when a probe invokes an external planner or remote system rather than a microsecond-scale local function.

This paper asks a narrower question than program synthesis or policy learning: given an interpretable exhaustive probe domain and historical generated programs, can we learn a much smaller suite that retains fault sensitivity on future programs? The distinction matters. We do not generate the operational program, optimize its task objective, or claim semantic correctness. We learn which already-defined behavioral probes should run first under a declared budget.

The main challenge is generalization. Mutation-guided prioritization can find high-yield tests, but it can overfit to correlated mutants. A selector trained on several threshold faults may repeatedly choose nearly identical threshold probes. The next failure may instead be temporal or order-sensitive. FAULTLENS therefore combines two rankings:

  1. an active ranking greedily covers training mutants using their executed kill relation; and

  2. a diversity ranking ignores mutant outcomes and covers structural features of the probe domain.

The hybrid alternates unique probes from both lists. This fixed allocation spends half the nominal budget exploiting observed evidence and half exploring scenario structure. We evaluate it with two separation protocols. The first learns from program generations 1–3 and evaluates generations 4–5. The second removes an entire fault family from training and evaluates only that family on future programs.

Our contributions are:

  • a sparse counterfactual outcome cache that evaluates arbitrary probe subsets without synthesizing outcomes or rerunning programs;

• a hybrid active-diversity ordering for compact behavioral validation;

• cross-program and whole-fault-family protocols that expose selector overfitting; and

  • an executed case study comprising twenty generated programs, 2,160 transformations, 4.12 million program-probe executions, downstream operational measurements, and fully reproducible figures.

The strongest result is not exhaustive detection. The complete domain defines which transformations are behaviorally effective. The substantive result is that a ranking learned without the held-out programs retains 99.0% coverage at 32 probes, and structural diversity materially improves generalization when the held-out fault mechanism is unknown.