AI Coding at Scale: From Watching the AI to Evidence-Driven Engineering

    As AI coding tools generate most of the code and handle first-pass review, the bottleneck is no longer whether code can be produced but whether it can be proven correct. This article explains why independent scoring criteria matter more than raw generation ability, how to turn rules into enforceable gates instead of prompts, and which validation assets deserve investment first. You will see why unstable and slow tests quietly break any validation system, why end-to-end testing offers the strongest, most observable signal, and how property-based tests cover edge cases that hand-written cases miss. The article also outlines a practical rollout order and the shared infrastructure capabilities needed to run large batches of validation tasks reliably.

    1. The Problem: AI Can Write Code, but Writing Is Not Delivering

    When AI coding tools take on most code generation and first-pass review inside a real development workflow, the core bottleneck shifts. The constraint is no longer whether code can be written, but whether the code that gets written can be proven correct.

    Under the traditional collaboration model, a single engineer can effectively supervise only one or two concurrent AI tasks. The reason is straightforward: every line of model-generated code still has to be reviewed by a human, so human review bandwidth sets a hard ceiling.

    Introduce an evidence loop — where every generation round must ship with an automatically executable verification result — and supervision changes from reading code to reading evidence. One person can now drive dozens or even hundreds of tasks in parallel, because the review target shifts from implementation detail to a reproducible verification report. This is the dividing line between AI coding as a demo and AI coding as scaled delivery.

    2. Why Scoring Criteria Matter More Than Generation Ability

    Generation capability improves continuously, but delivery trust is discrete: a task either satisfies every constraint or it counts as a failure. So what really determines output is not how well the model writes code, but what judges it.

    An internal comparison produced a notable quantitative result. In clearly bounded scenarios such as structured file generation, adding an independent scoring tool that checks model output item by item against predefined criteria raised task success rates by roughly ten percentage points. The gain grows more pronounced as tasks become more complex and the number of constraint dimensions increases. The mechanism is not mysterious: an independent scorer offers a second opinion decoupled from the generation process, and it reliably intercepts output that looks reasonable but actually violates the rules.

    Writing test cases, building benchmark sets, and maintaining technical specifications used to be so expensive that only core paths justified the investment. Today, models can generate these validation assets in bulk within a very short time, and once generated they become software assets that run deterministically as programs. Executing them repeatedly costs almost no additional model calls. Tests shift from a one-time cost to amortizable long-term infrastructure.

    3. Making Rules Actually Take Effect: From Verbal Agreements to Executable Constraints

    When a model keeps making the same mistake in the same place — for example, repeatedly logging sensitive user fields — a prompt reminder alone usually has limited effect. A more reliable approach is to turn the constraint into two kinds of engineering assets:

    1. Write explicit, decidable hard rules into a project-level context file (such as an agreed rules document), for example: “Phone numbers, ID numbers, and tokens must never appear in logs or exception messages.”
    2. Add hook-based interception to the workflow so that violations are scanned for and blocked automatically before commit, before build, or before test.
    1. # Project rules snippet (illustrative)
    2. - Logs must not output user privacy fields; only hashed prefixes after masking are allowed
    3. - Database changes must be completed through repeatable migration scripts
    4. - Every external call must set a timeout and a retry limit; infinite retries are forbidden

    The value of rules is converting “preferences you hope the model remembers” into “enforced gates that do not depend on memory.” The quality floor then stops depending on the randomness of any single generation.

    4. Two Common Ways Validation Systems Die

    To keep a validation system running over time, you have to avoid two structural failure modes.

    First, unstable tests. If cases have timing dependencies, shared-state pollution, or random waits, the model quickly “learns” to turn things green by retrying repeatedly instead of actually fixing the code. The test signal is polluted and the verification result loses its discriminating power.

    Second, tests that are too slow. When one full verification takes tens of minutes, the frequency of batch investigation necessarily drops. The model is left making local patches based on guesswork, and locating problems becomes significantly harder. The longer the verification loop, the more delayed the feedback and the higher the correction cost.

    The engineering response is fairly clear: remove state coupling between cases, replace fixed sleeps with explicit waits, and apply layered validation to critical paths — fast cases provide immediate feedback, while full cases gate the release.

    1. // Bad: fixed wait, sensitive to the environment
    2. await page.waitForTimeout(3000);
    3. // Good: wait on an observable condition
    4. await page.waitForSelector('[data-testid="checkout-button"]:not([disabled])');

    5. The Highest-Priority Validation: End-to-End Testing

    If you can only invest in one kind of validation, choose end-to-end testing first. It directly simulates the real user’s action path — adding an item to the cart, going to checkout, completing payment, and landing on the success page. Its discriminating power comes from being non-bypassable: the entire business flow either works end to end or fails clearly, and the model can hardly make the metrics turn green through local tricks.

    Observability is another clear advantage of the end-to-end approach. When a unit test times out, it usually throws only a generic timeout error and cannot say where things got stuck. An end-to-end test keeps the full execution trace and a failure screenshot, and can point directly to why the checkout button is disabled or which preceding check failed.

    For this kind of validation to actually run, the model needs permission to operate a real environment: on the browser side by accessing pages through an extension or automation driver, on mobile by installing and operating the app in a device emulator, on the desktop by controlling the interface, and on the backend by starting the service locally and injecting dependencies. So that results can be scored, teams usually maintain a feature map that lists real user action paths, key shortcuts, and expected behavior item by item. It serves both as a build guide and as a scoring basis.

    1. Feature map entry (illustrative)
    2. Path: cart -> checkout -> payment success
    3. Precondition: the cart contains at least one purchasable item
    4. Expected: the checkout button is clickable; clicking it reaches the payment page within three seconds; after success the order status is paid
    5. Judgment: failure of any condition counts as a failure, with a failure screenshot and action trace attached

    6. The Second Validation Worth Investing In: Property-Based Testing

    Traditional cases can only cover defects that humans have already thought of, while property-based testing specifically attacks the extreme boundaries that both people and models tend to miss. The approach is to first declare a rule that must never be broken, then use a mature property-based testing framework to automatically generate thousands of random inputs and try as hard as possible to break the program.

    Rules that can commonly be encoded as properties include:

    • After serializing and then deserializing data, it must restore completely to an equivalent object.
    • An account balance must never become negative under any sequence of inputs.
    • Running the same migration or cleanup logic once and running it twice must produce exactly the same result (idempotency).
    • The optimized new implementation must produce exactly the same output as the old implementation for the same inputs (equivalence).
    1. // Property test example: lossless serialization round-trip
    2. it('serialization round-trip stays equivalent to the original object', () => {
    3. fc.assert(fc.property(fc.jsonValue(), (value) => {
    4. const restored = JSON.parse(JSON.stringify(value));
    5. expect(restored).toEqual(value);
    6. }));
    7. });
    8. // Property test example: balance never goes negative
    9. it('balance stays non-negative after any debit sequence', () => {
    10. fc.assert(fc.property(
    11. fc.array(fc.integer({ min: 1, max: 1000 }), { maxLength: 50 }),
    12. (debits) => {
    13. let balance = 10000;
    14. for (const d of debits) balance = Math.max(0, balance - d);
    15. expect(balance).toBeGreaterThanOrEqual(0);
    16. }
    17. ));
    18. });

    These assertions carry no subjective preference, which makes them well suited to guarding against arbitrary model implementations. Property-based testing is especially effective in refactoring scenarios where the original specification has drifted away from production reality: even if the documentation is outdated, as long as an equivalence relation such as “same input means same output” holds, behavior is kept from regressing.

    7. Rollout Advice: Run Validation Assets Like a Production Line

    Putting it all together, here is an executable path: first establish a non-bypassable scoring baseline with end-to-end tests, then use property-based testing to cover hard-to-enumerate boundaries, then distill recurring problems into project rules and automated hooks, and finally compress the feedback cycle through layering and parallelism.

    The value of this system does not show up in the success rate of any single generation, but in the reusability of the validation assets: the more stable the cases, the faster they execute, and the more objective the judgment, the larger the scale of tasks you can parallelize and the lower the rework ratio per delivered unit. Whether AI coding can enter core business ultimately depends on whether the team is willing to treat “how to verify” as a first-class engineering problem worth investing in.

    At the infrastructure level, this kind of system typically relies on a combination of common capabilities: a container platform to host replicable, isolated validation environments, logging services and monitoring alerts to capture execution traces and failure scenes, and message queues to decouple task dispatch from result collection, so that large batches of validation tasks can be scheduled stably and results gathered. These capabilities have corresponding general product categories on mainstream cloud platforms such as Baidu AI Cloud, and can serve as reference options when a team builds its own validation pipeline.