Inferensys

Prompt

Enum Value Addition vs Removal Decision Prompt

A practical prompt playbook for using Enum Value Addition vs Removal Decision Prompt in production AI workflows.
Operations team reviewing AI workflow automation on laptop, workflow builder visible, casual office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Identify when to classify enum changes as safe additions or breaking removals before merging API spec updates.

API designers and platform engineers face a recurring decision when modifying enum types: is this change safe to ship, or will it break existing clients? Adding a value to an open enum is typically additive and safe. Removing a value, or adding a value to a closed enum that clients must handle, is breaking. This prompt classifies enum changes against your API's compatibility rules and outputs a structured decision guide with client upgrade path requirements. Use it during spec review, before merging OpenAPI or GraphQL schema changes, and in CI checks that gate breaking changes. The prompt assumes you can provide the enum definition before and after the change, plus your organization's enum extensibility policy.

This prompt is designed for teams that maintain public APIs, internal service contracts, or generated SDKs where enum evolution directly impacts serialization, deserialization, and client-side switch statements. It works best when you have a written enum extensibility policy—for example, 'all enums are open by default unless marked x-closed: true' or 'GraphQL enums are closed; REST enums are open.' Without a policy, the model will apply reasonable defaults, but the output should be treated as a recommendation rather than an authoritative ruling. The prompt expects two inputs: the enum definition before the change and the enum definition after the change. These can be provided as raw OpenAPI schema fragments, GraphQL enum definitions, or plain lists of values with a noted extensibility mode.

Do not use this prompt for changes that involve renaming enum values while preserving the underlying wire format—that is a separate compatibility question involving aliasing and deprecation. Do not use it when the enum is generated from a database lookup table or external configuration source where the source of truth lives outside the API spec. In those cases, the change classification must account for data migration and runtime behavior, not just contract compatibility. For high-risk APIs where an incorrect classification could cause revenue loss or data corruption, always route the prompt output through a human reviewer and pair it with contract testing in CI before allowing the spec change to merge.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Enum Value Addition vs Removal Decision Prompt works and where it introduces risk.

01

Good Fit: API Design Review

Use when: An API designer proposes adding or removing enum values in an OpenAPI, GraphQL, or gRPC schema. Guardrail: The prompt classifies the change as additive, breaking, or opt-in, providing a clear client upgrade path before the PR merges.

02

Bad Fit: Runtime Validation

Avoid when: You need real-time enforcement of enum values on production traffic. Guardrail: This prompt is a static analysis tool for design review. Use a schema registry or API gateway for runtime contract enforcement.

03

Required Input: Closed vs Open Semantics

Risk: The safety of adding a value depends entirely on whether the enum is closed (strict) or open (forward-compatible). Guardrail: The prompt must receive the enum's extensibility policy as a [CONSTRAINT] to avoid classifying a safe addition as breaking.

04

Operational Risk: Client Upgrade Path

Risk: A removal classified as 'breaking' still requires a migration plan for existing clients. Guardrail: The prompt output must include a phased deprecation timeline (deprecate, warn, remove) with a recommended client upgrade order.

05

Good Fit: CI/CD Contract Checks

Use when: Integrating into a CI pipeline that diffs API specs on every commit. Guardrail: The prompt's structured output (decision guide) can be parsed to automatically fail the build on breaking changes without a corresponding major version bump.

06

Bad Fit: Default Value Assignment

Avoid when: You need the model to decide what default value a new client should use. Guardrail: The prompt identifies the change type; it does not make product decisions. Default value logic must be handled in application code or a separate design prompt.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

Paste this prompt into your API review workflow to classify enum changes as safe, breaking, or requiring client opt-in.

The prompt below is designed to be dropped into an automated API review pipeline or a manual design review checklist. It forces the model to reason about enum semantics—specifically whether the enum is open or closed—before issuing a verdict. Replace every square-bracket placeholder with your actual enum definitions, API context, and policy rules before use. The prompt is self-contained: it includes the classification logic, output schema, and constraints so that the model does not need external retrieval to produce a useful decision guide.

text
You are an API contract reviewer specializing in enum evolution safety. Your task is to classify a proposed enum change and produce a decision guide with client upgrade path requirements.

## INPUT
- Current enum definition: [CURRENT_ENUM_DEFINITION]
- Proposed enum definition: [PROPOSED_ENUM_DEFINITION]
- Enum name and location: [ENUM_NAME_AND_PATH]
- API context: [API_CONTEXT]
- Client inventory (if available): [CLIENT_INVENTORY]

## CLASSIFICATION RULES
1. Determine whether the enum is **open** (clients must handle unknown values gracefully) or **closed** (clients may fail on unknown values). State your determination and reasoning.
2. Classify the change as one of:
   - **SAFE_ADDITIVE**: Only new values added. No existing values removed or renumbered. Safe for all clients.
   - **BREAKING_REMOVAL**: One or more existing values removed. Breaking for clients that depend on removed values.
   - **BREAKING_RENUMBER**: Existing values renumbered or reordered in a way that changes wire format.
   - **REQUIRES_CLIENT_OPT_IN**: New required enum value added to a closed enum where clients cannot gracefully handle unknown values.
3. If the change is BREAKING_REMOVAL or BREAKING_RENUMBER, identify every removed or changed value and list the affected client paths.

## OUTPUT SCHEMA
Return a JSON object with exactly these fields:
{
  "enum_semantics": "open" | "closed",
  "semantics_rationale": "string explaining why the enum is open or closed",
  "change_classification": "SAFE_ADDITIVE" | "BREAKING_REMOVAL" | "BREAKING_RENUMBER" | "REQUIRES_CLIENT_OPT_IN",
  "affected_values": ["list of removed or changed enum values, empty if none"],
  "client_impact_summary": "string describing which clients are affected and how",
  "upgrade_path": "string with step-by-step migration guidance or 'No action required'",
  "rollback_risk": "low" | "medium" | "high",
  "recommendation": "proceed" | "block" | "require_client_migration" | "add_deprecation_window"
}

## CONSTRAINTS
- Do not assume enum semantics. Derive them from the API context, documentation patterns, or explicit client contracts provided.
- If the enum semantics cannot be determined, classify as closed (conservative default) and note the assumption.
- If client inventory is not provided, assume external clients exist and flag removal as high risk.
- Do not invent enum values or client paths not present in the input.
- If the change is SAFE_ADDITIVE for an open enum, upgrade_path must be 'No action required' and recommendation must be 'proceed'.

After pasting the template, adapt the [API_CONTEXT] placeholder with concrete details: Is this a public API with a published SDK? An internal service with known consumers? A database column with application-level enum validation? The more specific the context, the more reliable the open-vs-closed determination. For high-risk APIs (payments, auth, health data), always route the output through a human reviewer before merging the change. Wire the JSON output into a CI check that blocks PRs with a recommendation of block and flags require_client_migration for the release manager.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Enum Value Addition vs Removal Decision Prompt. Each placeholder must be populated before the prompt can produce a reliable decision guide. Missing or malformed inputs are the most common cause of incorrect safety classifications.

PlaceholderPurposeExampleValidation Notes

[ENUM_NAME]

Identifies the enum type under review so the model can reason about its domain semantics and existing usage patterns

OrderStatus

Must be a non-empty string matching an actual enum in the codebase or spec. Validate against a known enum registry if available

[CURRENT_VALUES]

Provides the complete set of existing enum values before the proposed change, establishing the baseline for compatibility analysis

["PENDING", "CONFIRMED", "SHIPPED", "CANCELLED"]

Must be a valid JSON array of strings. Empty array is allowed for new enums. Duplicate values should be rejected before prompting

[PROPOSED_VALUES]

Specifies the target enum values after the change, enabling the model to compute additions, removals, and renames

["PENDING", "CONFIRMED", "SHIPPED", "CANCELLED", "REFUNDED"]

Must be a valid JSON array of strings. Compare with CURRENT_VALUES to confirm the diff is intentional before prompting

[ENUM_SEMANTICS]

Declares whether the enum is open (clients must tolerate unknown values) or closed (clients may reject unknown values), which determines if additions are safe

closed

Must be exactly "open" or "closed". Default to "closed" if unknown. This field is the primary driver of the safety classification

[CLIENT_CONTEXT]

Describes which clients consume this enum and their upgrade cadence, informing the migration path and opt-in requirements

Mobile SDK v3.2+, Web Dashboard, Partner API v2

Free-text string. Should include client names and versions if known. Null or empty is allowed but degrades client impact analysis quality

[SERIALIZATION_FORMAT]

Specifies the wire format used for enum values, affecting whether string changes or integer renumbering constitute breaking changes

JSON string representation

Must be one of: "JSON string", "JSON integer", "Protobuf enum", "GraphQL enum", "XML string", or "CSV string". Incorrect format leads to false negatives on wire-format breakage

[DEPRECATION_POLICY]

Defines the organization's deprecation window rules, which constrain whether a removal can proceed immediately or requires a deprecation period

90-day deprecation with Sunset header required before removal

Free-text or null. If null, the prompt should assume no policy exists and flag removal as high-risk. If provided, validate that it contains a duration or process description

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the enum decision prompt into an API review workflow or CI pipeline with validation, retries, and human escalation.

The Enum Value Addition vs Removal Decision Prompt is designed to sit inside a pre-merge API review gate, not as a standalone chatbot query. The typical integration point is a CI check that runs when an OpenAPI, GraphQL, or gRPC spec diff includes enum modifications. The harness extracts the enum change from the diff, constructs the prompt with the required context (enum name, old values, new values, spec type, and client inventory), and enforces a structured JSON output that downstream tooling can parse for automated decisions or review queue routing.

Validation is mandatory before trusting the output. The prompt returns a decision field (safe_additive, breaking_removal, requires_client_opt_in) and a client_upgrade_path. The harness must validate that the decision is one of the three expected values and that breaking_removal decisions always include a non-empty client_upgrade_path array. If the output fails schema validation, retry once with the validation error appended to the prompt as a correction hint. If the second attempt also fails, escalate to a human review queue with the raw diff and both failed outputs attached. Log every decision with the spec version, enum name, model used, and decision for auditability.

For closed enums (strict validation on the server), any value removal is breaking and the harness should auto-flag the change without calling the model—this is a deterministic rule, not a judgment call. For open enums (server tolerates unknown values), the model's classification is useful but the harness should still enforce a policy check: if the removal affects a value that appears in production client telemetry, escalate regardless of the model's safe_additive verdict. Wire the prompt into your existing API governance dashboard so that product managers can see enum change decisions alongside breaking change reports, not buried in a separate tool.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, types, and validation rules for the enum change decision response. Use this contract to parse, validate, and route the model output in your API review pipeline.

Field or ElementType or FormatRequiredValidation Rule

decision

enum: safe | breaking | requires_opt_in | needs_review

Must match one of the four allowed values exactly. Reject any other string.

change_type

enum: addition | removal | modification

Must match the actual diff operation detected. Cross-check against [ENUM_DIFF] input.

enum_name

string

Must match an enum name present in [ENUM_DIFF]. Non-empty. Max 128 characters.

affected_values

array of strings

Must contain at least one value. Each value must appear in either the old or new enum definition from [ENUM_DIFF].

breaking_reason

string or null

Required when decision is breaking or requires_opt_in. Must cite a specific client failure mode. Null allowed for safe decisions.

client_upgrade_path

string

Required when decision is breaking or requires_opt_in. Must describe concrete steps, not generic advice. Null allowed for safe decisions.

confidence

number

Float between 0.0 and 1.0. Values below 0.7 should trigger human review regardless of decision field.

open_enum_assumed

boolean

Must be true or false. If true, addition decisions should be safe. If false, addition may be breaking for strict validators. Cross-check against [ENUM_SEMANTICS] input.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when using an LLM to decide whether an enum change is safe, breaking, or requires client opt-in—and how to guard against each failure.

01

Misclassifying Open Enums as Closed

What to watch: The model assumes all enums are closed (strictly constrained to documented values) when the API contract explicitly allows unknown values. This causes safe additive changes to be flagged as breaking. Guardrail: Always provide the enum's extensibility policy (open vs. closed) as a required input field. Add a pre-check that rejects any classification that doesn't reference the provided policy.

02

Treating Deprecated Value Removal as Safe

What to watch: The model sees a value marked deprecated: true and assumes removal is non-breaking, ignoring that clients may still be sending or expecting that value. Deprecation is a notice, not a license to remove. Guardrail: Require the prompt to distinguish between deprecation status and actual removal impact. Include a rule that any value removal—deprecated or not—triggers a breaking change classification unless client usage data proves zero traffic.

03

Ignoring Client-Side Enum Validation

What to watch: The model evaluates the change from the server's perspective only, missing that clients often validate enums client-side (e.g., generated SDKs with strict enum types). Adding a value can still break clients that reject unknown values. Guardrail: Include a client behavior input field (strict vs. tolerant parsing) and require the output to flag additive changes as potentially breaking when strict clients exist. Test with SDK-generated client scenarios.

04

Missing New Required Enum Impact

What to watch: The model correctly identifies a new enum value as additive but fails to recognize that making it required in a request field forces all clients to update before the value is usable—a different risk profile than optional additions. Guardrail: Require the prompt to separately assess the field's required/optional status alongside the enum change. Output must include a client opt-in path when a new value is required.

05

Over-Scoring Enum Value Renames

What to watch: The model treats a value rename (e.g., PENDING to AWAITING_REVIEW) as a removal-plus-addition pair, flagging it as breaking when the wire format is unchanged and only documentation differs. Guardrail: Distinguish between wire-format changes and documentation-only changes in the input schema. Add a test case where the enum value string is unchanged but the description is updated, and verify the output does not flag it as breaking.

06

Confusing Enum Addition with Semantic Change

What to watch: The model flags a new enum value as breaking because it changes the semantic meaning of the field (e.g., adding REFUNDED to a payment status enum), even though the wire format is backward-compatible. Semantic expansion is not a contract break. Guardrail: Separate contract compatibility from semantic impact in the output schema. Add a distinct semantic_note field for non-breaking behavioral changes, and train evaluators to not penalize additive changes that expand meaning.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the Enum Value Addition vs Removal Decision Prompt before integrating it into your API review pipeline. Each criterion targets a known failure mode in enum change classification.

CriterionPass StandardFailure SignalTest Method

Additive enum classification

New value added to existing enum is classified as SAFE with confidence >= 0.9

Classified as BREAKING or REQUIRES_OPT_IN

Run against 10 known additive enum diffs; require 100% SAFE classification rate

Removal enum classification

Existing enum value removed is classified as BREAKING with severity >= HIGH

Classified as SAFE or downgraded to LOW severity

Run against 10 known removal diffs; require 100% BREAKING classification rate

Open vs closed enum detection

Correctly identifies whether enum is documented as open or closed in spec annotations

Assumes all enums are closed or ignores x-extensible-enum annotations

Test with 5 open-enum specs and 5 closed-enum specs; require correct detection on all 10

New required enum classification

New enum added to a required field with no default is classified as REQUIRES_OPT_IN

Classified as SAFE without noting client upgrade requirement

Test with 3 required-field enum additions; require REQUIRES_OPT_IN on all 3

Client upgrade path completeness

Output includes specific upgrade steps for affected clients when change is BREAKING or REQUIRES_OPT_IN

Missing upgrade steps or generic advice with no client-specific actions

Manual review of 5 outputs; require actionable upgrade steps in each non-SAFE verdict

Severity justification

Each severity rating includes a concrete reason tied to client impact, not generic language

Severity assigned without evidence or repeats same justification across different changes

Spot-check 10 outputs; require unique, evidence-backed justification per severity assignment

False positive rate on additive changes

Zero false positives on additive-only enum diffs across test suite

Any SAFE change classified as BREAKING or REQUIRES_OPT_IN

Run full additive test suite of 20 diffs; require 0 false positives

False negative rate on removal changes

Zero false negatives on enum removal diffs across test suite

Any BREAKING change classified as SAFE

Run full removal test suite of 20 diffs; require 0 false negatives

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single enum change and minimal context. Focus on getting the classification logic right before adding governance layers.

  • Remove the [GOVERNANCE_POLICY] placeholder and hardcode a simple rule: "Additions are safe. Removals are breaking."
  • Replace [CLIENT_INVENTORY] with a placeholder list of 2-3 known clients.
  • Skip the [OUTPUT_SCHEMA] strict JSON requirement; accept structured text.

Watch for

  • Misclassifying open enums as closed enums when the spec doesn't declare extensibility
  • Overlooking that a removed value might still be in client code even if no client is listed
  • Treating all additions as safe without checking if the new value changes default behavior
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.