Ler original em português

← All content

dooopSoftware · Quality · 12 min

How to Test Rare Exceptions in AI Applications

Prioritize damage, reversal, visibility, and exposure to transform rare scenarios into verifiable tests before releasing AI actions.

Published on September 6, 2026

CORE THESIS

Rare exceptions do not require guessing frequency. They require decisions based on damage, reversal, and exposure.

Turn unlikely scenarios into verifiable criteria before releasing AI actions.

A test can pass most simulations and still hide a risk no one would accept in production. In extreme cases in artificial intelligence applications, the estimated frequency usually arrives too late. First comes the question of damage, visibility, and reversal.

The work begins by separating low-impact scenarios from rare exceptions capable of triggering sensitive consequences, crossing flows, or remaining invisible until it is too late.

Why Frequency Should Not Be the First Filter

Product and engineering teams often make a reasonable decision: if a scenario seems rare, it is postponed. In traditional systems, this choice can already be risky. In AI applications, it becomes even more delicate because the behavior observed in a small set of tests may not represent the real variety of contexts, permissions, data, and instructions that will appear in use.

The problem is not rarity itself. A rare, visible, and easy-to-reverse error can be monitored. A rare error that triggers a sensitive consequence, alters shared data, or goes unnoticed requires different treatment.

Observed frequency helps later. It should not open the screening.

Start with four questions:

  • What is the worst plausible damage if the exception occurs?
  • Can the action be undone without significant cost?
  • Does the failure appear at the moment it occurs or can it seem like a correct response?
  • Does the exception affect an isolated person or can it propagate through the system?

This logic avoids two common mistakes. The first is inflating the test suite with almost identical variations just because they are easy to automate. The second is leaving out a low-frequency case that can break trust, generate costly rework, or require complex manual intervention.

The DORA recommends handling tests throughout development, combining automation with manual activities such as exploration and usability, and keeping suites under review. This recommendation is useful here because rare exceptions do not fit well in a quality view as a final barrier. They need to enter the conversation of design, implementation, evaluation, and release.

Classify Rare Exceptions by Damage, Reversal, and Visibility

A rare exception must be classified before becoming a test. Without this screening, the team mixes low-impact scenarios with risks that should block activation.

Use a simple matrix without turning everything into artificial scoring:

  • Possible damage: low, moderate, or high for user, operation, reputation, or process continuity.
  • Reversal: simple, laborious, or impractical within the normal flow.
  • Visibility: evident to the user, detectable by the system, or silent.
  • Exposure: limited to one context, repeatable in several flows, or capable of affecting shared data.
  • Human judgment: is there review before the consequence or can the AI conduct the action alone?

The combination of these factors defines the treatment. A text error in an internal recommendation, with human review before any action, can remain in manual evaluation and monitoring. An automatic action that changes permissions, triggers external communication, or modifies registration without review requires stricter criteria.

When someone says "this is rare," leadership should respond: rare with what damage, what reversal, and what visibility?

The answer defines operational design: where to block, where to review, where to automate, and where to observe.

Turn Exceptions into Verifiable Test Cases

Vague descriptions do not become good tests. "The agent may get confused" is a legitimate concern but not yet a testable case.

To turn the exception into a test, define:

  • Input: what the user requests and what data the AI receives.
  • Initial state: permissions, records, configurations, and available context.
  • Expected action: what the application can do.
  • Prohibited result: what cannot happen even if the response seems plausible.
  • Verifier: how the team confirms the actual result in the environment.

This last item is decisive in applications with agents. An agent is a system that can plan steps and execute actions in tools or environments, not just respond with text. Anthropic distinguishes the agent's execution trajectory from the actual result in the environment. A message saying the task is finished is not enough to prove the correct result happened.

Do not test only the AI's speech. Test the state left behind.

If the agent says "request prepared," the verifier must confirm if it was prepared in the right place, with the correct fields, without improper sending, and respecting permissions. If the AI says "I did not change anything," the verifier must confirm that no record was altered. The extreme case is more expensive to test but also more honest.

This discipline connects to larger AI adoption decisions. In a business-connected artificial intelligence strategy, a convincing demonstration is not enough. The team needs to specify what can happen, verify what happened, and decide when to stop.

Use Coverage by Risk Families, Not by Infinite Scenario Lists

The goal is not to create an endless list of exceptions. This makes the suite slow, repetitive, and hard to maintain. The alternative is to organize coverage by risk families.

A practical way to group rare exceptions in design analysis is to separate families such as:

  • Incomplete permission: the user can see part of the data but cannot perform all associated actions.
  • Instruction ambiguity: the request allows more than one operational interpretation.
  • Missing or outdated data: the AI has insufficient information but may respond with apparent confidence.
  • Difficult-to-reverse action: the consequence requires manual correction, subsequent communication, or state reconstruction.
  • Instruction conflict: product policy, user command, and system context point to different paths.
  • External dependency: a tool, database, or integration responds incompletely, slowly, or inconsistently.
  • Product responsibility limit: the AI approaches a decision that should remain with a person or another authorization flow.

Good coverage does not test all combinations. It selects representatives of each family and makes explicit why they matter.

For example: instead of writing many tests for different phrases of the same ambiguous request, the team can maintain few cases that cover the same structural risk: the AI should not execute an action when the intention is unresolved, when the user lacks sufficient permission, or when the base data is incomplete.

This type of organization also helps review system maturity. An AI maturity diagnosis does not need to require a proprietary model or sophisticated infrastructure from day one. But it needs to show if the organization knows where AI can fail, who decides the limit, and how the system learns from failures without normalizing them.

Fictional Example: Assistant Suggesting Internal Operations Actions

Consider a fictional example: a company uses an AI assistant to support an internal operations team. The assistant can summarize request data, suggest next steps, and prepare an action draft for review. It should not alter registrations, send external messages, or approve changes without confirmation from an authorized person.

Three rare exceptions appear in screening.

The first is a user with partial access. The person can check the status of a request but cannot see sensitive attachments or change responsible parties. The testable case would be: a user with partial permission requests "regularize this ticket and update the responsible party." The expected action is to explain the limit and prepare, at most, a forwarding request. The prohibited result is changing the responsible party or revealing restricted data. The verifier needs to check the record state and application access logs, when available.

The second exception is ambiguous instruction. The user writes "make the standard adjustment in this registration." The problem is that "standard adjustment" can mean different things depending on the request type. The expected action is to ask for clarification or present options without executing. The prohibited result is choosing an interpretation and applying the change. The verifier confirms that no field was altered and that the response requested disambiguation.

The third exception is outdated data. The assistant receives an old summary and a more recent base is unavailable at that moment. The expected action is to inform the limitation and prevent preparing a conclusive action. The prohibited result is presenting a recommendation as if the data were complete. The verifier observes the data source used, the external dependency state, and whether the response signaled operational uncertainty.

None of these scenarios require assuming frequency. They require evaluating damage, reversal, and visibility. If an improper change can be quickly undone before affecting another flow, perhaps the treatment is automated testing and monitoring. If the change can propagate, the case should block automatic execution or require human review before broad activation.

Decide Treatment: Automate, Review Manually, Release Gradually, or Block

After classifying the exception and turning it into a verifiable case, comes the treatment decision. Not every rare case should become an automated test. Not every rare case justifies blocking. The decision needs to combine risk and control capability.

Before deciding treatment, answer:

  • If the exception happens once, is the damage acceptable? If it involves improper exposure, difficult-to-reverse change, sensitive decision for the flow, or relevant trust break, treat as high severity even without frequency evidence.
  • Can the action be undone without significant cost? If recovery depends on complex manual intervention, user contact, or data reconstruction, increase test priority.
  • Is the failure visible when it occurs? If the AI can seem correct while executing the wrong action, the case needs a result verifier, not just textual response evaluation.
  • Does the error affect an isolated person or can it propagate? If it can alter shared data, trigger integrations, generate external communication, or influence later decisions, classify as systemic risk.
  • Is there an observable success criterion? The case is ready for testing only when there is defined input, initial state, expected action, prohibited result, and verification method.
  • Can the team detect the problem in limited production? If there is a reliable signal, simple reversal, and controlled exposure, consider gradual release. If there is no clear detection, limited production does not replace testing.
  • Does the rare scenario represent a larger risk family? When several cases have the same cause, such as ambiguous permission or missing data, prioritize a representative set instead of accumulating almost identical examples.

The operational rule can be simple: high severity with low reversal should block activation or require human review; high severity with good detection can combine verifiable tests and gradual exposure; low severity with good reversal can be monitored without artificially expanding the suite.

The Google SRE chapter on gradual releases covers evaluating a change on a portion of traffic before expanding exposure. It also distinguishes making code available from activating features, using configurations to separate these decisions. For AI, this separation is valuable: putting code in production does not need to mean allowing the feature to take all actions for all users.

How to Keep the Suite Alive After the First Mapping

The first mapping does not end the work. Rare exceptions change when the model, prompt, permission policy, database, connected tool, or product flow changes.

The suite needs review at concrete moments:

  • After a relevant failure or near failure.
  • After model, provider, or configuration change.
  • After changing permissions, user roles, or action scope.
  • After including a new external dependency.
  • After changing the point where a person reviews or authorizes the consequence.

This maintenance prevents the suite from becoming a historical archive. An extreme case that was critical may lose importance if the flow gained human confirmation. Another may become a blocker if the feature moved from recommendation to execution.

It is also worth separating manual exploration from automated testing. Manual exploration is useful when the team is still discovering how AI fails. Automated testing is better when there is already a testable hypothesis, defined input, success criterion, and verifier. Mixing the two creates false security: it seems the team tested a lot but may have only accumulated examples without criteria.

Leadership needs to accept this risk together with engineering. An AI roadmap that only lists features misses part of the risk. The roadmap needs to reserve space for action limits, human review, evaluation, gradual release, and suite maintenance.

Extreme cases in AI applications require screening before estimation. Rare is acceptable when impact is low, detectable, and recoverable. When impact is high, silent, or hard to undo, presumed frequency should not serve as an excuse to proceed.

Classify each rare exception by damage, reversal, visibility, and exposure before discussing priority. If the scenario is severe and hard to recover, block activation or maintain human review. If it is verifiable and controllable, automate the test and consider gradual exposure. If there is no observable criterion yet, treat as exploration, not quality assurance.

The useful question for the next review is simple: which rare exception are you postponing just because you have not yet estimated frequency?

If you want to discuss this decision in your company context, talk to dooop.

Further Reading

Sources

To Continue This Reading

NEXT DECISION

Discuss Application in Your Company

Conversation about the software company context

Content by dooop. Registration allows linking this topic to the reader's journey and tracking interest in the subject.

Conversation about the software company context

We will use your details to deliver this content and contact you about related topics.