NashTech Blog

Verify a Ticket with AI – Part 2: TEST vs PROD Parity, and Letting AI Near Production Safely

Table of Contents

Verify a Ticket with AI – Part 2: TEST vs PROD Parity, and Letting AI Near Production Safely

Introduction

In Part 1 we let an AI agent verify tickets with throwaway Playwright specs, getting cases from the acceptance criteria and from the code diff. All of that ran on the TEST environment.

But “passed on TEST” is only half the answer. A surprising number of release bugs are not code bugs at all. The code is the same everywhere. The configuration is different: a feature flag, a plan setting, a price, a third-party key.

This post covers two things:

  1. How the agent checks TEST vs PROD parity for the things a ticket depends on,
  2. The guardrails that let us run automated checks on production without breaking anything.

1. “It works on TEST” is not the same as “it will work on PROD”

Some real examples from our team:

  • A fix was verified on TEST. On PROD, the editor still crashed, because a feature flag was ON there and OFF on TEST.
  • A new regional plan worked on TEST. On PROD, one role permission was missing from the plan setup.
  • A signup test passed on TEST. On PROD, the tax line disappeared, because a header used by our firewall rule collided with a header the tax service reads.

In every case the code was identical. Only the configuration was different.

2. Parity check: compare what the ticket depends on

We don’t try to diff the whole environment. That would be huge and full of noise. Instead, the agent builds a short dependency list for the ticket from the diff (Part 1) and compares only that:

Depends onHow the agent reads itTESTPRODMatch?
Feature flag newEditorpublic config endpointONON✅
Flag bioSectionpublic config endpointOFFON⚠️
Plan “Basic” → privilege listread-only plan API14 items13 items⚠️
Price list templateread-only catalog APIv12v12✅

Every mismatch becomes a question, not an automatic bug: is the difference intended (a staged rollout) or a mistake? The agent can’t know a team’s rollout plan, so a person answers.Plain Text

// scratch/verify-ticket/parity.spec.ts – read-only, runs on both envs
test('ticket dependencies: flags', async ({ api }) => {
  const flags = await api.config.getPublicFlags();

  test.info().annotations.push({
    type: 'parity',
    description: JSON.stringify({
      newEditor: flags.newEditor,
      bioSection: flags.bioSection,
    }),
  });
});

The spec doesn’t assert anything. It records values from each environment, and the report puts them side by side.

3. Guardrails for AI on production

Running an agent against production makes everyone nervous, and they should be. These are our rules. They are enforced in code where possible, not only written in a document.

Rule 1: PROD scope is a tag, enforced by a fixture

Only specs tagged @prod can run when ENVIRONMENT=PRODUCTION. A fixture fails any other spec before it starts. We don’t rely on test.skip or on the agent remembering.Plain Text

export const test = base.extend({
  _prodGuard: [
    async ({}, use, testInfo) => {
      if (env.name === 'PRODUCTION' && !testInfo.tags.includes('@prod')) {
        throw new Error('Not a @prod test – refusing to run on PRODUCTION');
      }
      await use();
    },
    { auto: true },
  ],
});
Rule 2: read-only by default

Parity checks and most PROD verification are GET only. If a case truly needs to write (for example, publish a page on a dedicated test account), the agent must say so in the plan and wait for approval.

Rule 3: snapshot before any write

Before a PROD write, the agent records the current state (settings, published status, the list of items) so it can be restored exactly. We learned this the hard way: a PATCH endpoint that replaces instead of merges silently wiped fields on an account.

Rule 4: dedicated accounts, ask before touching shared ones

PROD tests only use accounts made for testing. If a change could affect an account other people use, the agent asks first.

Rule 5: watch the scratch folder

A scratch spec started with a broad command can pick up every file in the folder, including half-finished experiments. On PROD we run scratch specs by exact file path, never by folder or tag.

4. Putting it together: one ticket, end to end

  1. TEST: main + side-effect cases (Part 1) → pass / fail / blocked.
  2. Parity: dependency list compared on TEST and PROD → match / mismatch.
  3. PROD (after release): read-only @prod checks on the cases that matter most.
  4. Verdict: one table, with the open questions for the team.

The final report reads like this:

Verdict: Ready, with one question. 7/8 cases pass on TEST, 1 blocked (third-party iframe). Parity: flag bioSection is OFF on TEST and ON on PROD. Is that intended? If yes, case 4 must be re-checked on PROD after release.

5. What we learned

  • Configuration drift causes more “it worked on TEST” incidents than code does. Comparing only what the ticket depends on keeps the check small and useful.
  • A mismatch is a question, not a verdict. The agent reports it. A person who knows the rollout plan decides.
  • Guardrails belong in code. A fixture that refuses to run is stronger than any instruction to the agent.
  • Snapshots are cheap, restores are expensive. Recording state before a write takes a second. Rebuilding a broken account takes an afternoon.

Wrapping up

Across both parts:

 Part 1 – On TESTPart 2 – Towards PROD
QuestionIs the ticket done right?Will it behave the same in production?
Where cases come fromAC + code diffTicket’s config dependencies
Main outputpass / fail / blocked per casematch / mismatch + questions
Safetygitignored scratch folder@prod tag fixture, read-only, snapshots

An AI agent makes ticket verification faster. But the real gain is that it makes verification wider: it reads the diff to find side effects, and it compares configuration to find drift. These are two checks most teams skip because there is no time. Now there is.

Picture of Hien Ngo Thi

Hien Ngo Thi

Suggested Article

Scroll to Top