# Zero Conflicts, Wrong Price: Validate MongoDB Agent Catalog Changes

> Source: <https://argonlabs.tech/blog/validate-mongodb-agent-catalog-changes>
> Published: 2026-11-03 00:00:00+00:00

**Key takeaway:** A conflict-free MongoDB merge plan still needs an application-level acceptance contract: Argon Labs' validator requires exactly one update to products/shoe with the five allowed fields, unchanged price_cents 4900 and currency USD, and an integer sale_price_cents equal to price_cents * (10000 - disco

# Zero Conflicts, Wrong Price: Validate MongoDB Agent Catalog Changes

Run five synthetic MongoDB MCP cases to validate catalog proposals before merging: derived prices, unexpected fields, extra documents and deletes.

[Argon Labs](https://argonlabs.tech/about)8 min read

Current capability notes: checkout materializes a physical database; native actor attribution is per branch/run; undo needs complete images and retained history. CLI sandboxes require watch and scheduled sweep. [Read the capability matrix](https://argonlabs.tech/features#capabilities).

A MongoDB merge plan can have zero conflicts and still contain the wrong price. Conflict detection asks whether changes collide. Your application must also decide whether the proposed document satisfies its business rules.

We tested that distinction with a synthetic catalog, Argon's public MCP server and real MongoDB writes. A correct discount was merged. Four invalid proposals were rejected before applying their plans, and the parent collection stayed unchanged. The validator is Python application code; it is not a built-in Argon policy or approval service.

## Why catalog enrichment needs a separate check

MongoDB's [October 13 catalog enrichment article](https://www.mongodb.com/company/blog/innovation/enriching-product-catalogs-for-agentic-commerce-discovery) describes richer product context and consistency across product feeds, APIs and product pages. That is useful engineering background for an agent that proposes catalog updates. It does not establish that generated values are correct, or that this example improves search traffic.

Our earlier [MCP sandbox tutorial](https://argonlabs.tech/blog/mongodb-mcp-sandbox-reviewed-merge-tutorial) demonstrates the create, preview, apply and discard sequence. Here we add a narrow acceptance contract and deliberately bad proposals. The new question is: what must a reviewer check even when the merge engine reports no conflict?

## A contract small enough to inspect

The parent starts with one product: `shoe`, priced at 4,900 integer cents in USD. The task may add a discount and its derived sale price. It may not change the original price or currency, add another product, delete the product or introduce another field.

```
{ "_id": "shoe", "price_cents": 4900, "currency": "USD" }
```

A discount of 1,000 basis points means ten percent. This fixture uses an explicit rounding-down policy:

```
sale_price_cents = price_cents * (10000 - discount_bps) // 10000
# 4900 * 9000 // 10000 = 4410
```

Real catalogs need their own currency, tax and rounding rules. This calculation is only the declared policy for the synthetic example.

## Inspect the saved plan, not just its summary

The script creates its own project and sandbox, writes through PyMongo, and requests `argon_merge_preview`. The MCP response provides a plan ID and counts. It then reads that same saved plan with the public `argon merge list` CLI to inspect the before and proposed documents. It does not generate a second preview and accidentally review a different plan.

1. Require a pending plan without conflicts and exactly one change.
2. Require an update of `products/shoe` , with the expected before document and no deletion.
3. Require exactly the five allowed fields and unchanged original values and types.
4. Require an integer discount between 0 and 10,000 basis points, and an integer sale price matching the declared formula.
5. Apply only when the rejection list is empty. Otherwise discard the sandbox.

Missing keys and unexpected types fail closed. In particular, Python booleans are not accepted as integer prices or discounts. The checks use explicit conditionals rather than `assert`, so Python's `-O` mode cannot remove the acceptance rules.

The script also reads the entire parent product collection before the decision and after cleanup. Checking only the intended product could miss an unwanted extra document.

## Run the five cases locally

Use Python 3.12 or later, the Argon 2.3.0 CLI, and a disposable local MongoDB replica set. Follow the [installation guide](https://argonlabs.tech/quickstart#install) and the [MCP tutorial's local replica-set setup](https://argonlabs.tech/blog/mongodb-mcp-sandbox-reviewed-merge-tutorial). The script refuses remote hosts and credentials. Do not point it at production.

[Download catalog_review.py](https://argonlabs.tech/examples/catalog_review.py). It is self-contained, needs no model or API key, and writes protocol messages, the reviewed plan and a summary into a new directory for every run.

```
python3 -m venv .venv
. .venv/bin/activate
python -m pip install "pymongo>=4.6,<5"
argon --version # expected: argon version 2.3.0
export ARGON_TEST_MONGODB_URI="mongodb://localhost:27017/?replicaSet=rs0"
(
  for scenario in valid invalid-value unexpected-field extra-document delete-document; do
    python -O catalog_review.py --scenario "$scenario" --expected-version 2.3.0 --output-dir "catalog-$scenario" || exit 1
  done
)
```

The valid scenario automatically applies its plan to its own synthetic parent. Each invalid scenario must be rejected for the run to pass. A rejected proposal is an expected test outcome, not a script failure. A mismatch, protocol failure or cleanup failure exits unsuccessfully. Use fresh output paths for another run.

## Observed results

These five cases were executed on November 3, 2026 with public Argon 2.1.4, MongoDB 7.0.43, Python 3.12.14 and PyMongo 4.19.0 on macOS arm64, including Python optimization mode. These are scripted fixture results, not a model evaluation or a performance benchmark.

| Proposal | Conflicts | Application decision | Parent afterward | 
|---|---|---|---|
| Sale price 4,410 cents | 0 | Apply | One enriched product | 
| Sale price 4,400 cents | 0 | Reject: derived price | Original product only | 
| Extra supplier-cost field | 0 | Reject: field set | Original product only | 
| Extra product inserted | 0 | Reject: change count | Original product only | 
| Original product deleted | 0 | Reject: operation | Original product only | 

Only the valid run sent `argon_merge_apply`. All five runs discarded their sandbox and removed their owned fixture databases. Removing a sandbox after a successful merge does not reverse the parent change; the script verifies that separately before removing its synthetic parent during final cleanup.

## What this does not prove

The validator is intentionally specific to one task. It does not judge whether a product description is truthful, whether a proposed discount is commercially sensible, or whether an agent is authorized to make it. Anyone who can bypass this application and call the underlying write or merge tools can bypass its rules. Keep production credentials and apply permissions under an appropriate access-control design.

The experiment also has no concurrent writers. Reading a plan and checking a parent is not an atomic authorization boundary, and this test makes no guarantee about changes arriving between validation and apply. Evaluate those races separately for your deployment. For competing edits, start with [the two-agent conflict walkthrough](https://argonlabs.tech/blog/two-ai-agents-one-mongodb-document); for operational limits, read [Argon's capability boundaries](https://argonlabs.tech/features#capabilities).

The useful separation is concrete: use branching to isolate the proposal, inspect the persisted plan to see its scope, and use explicit application rules to decide whether its data is acceptable. Zero conflicts answers only one of those questions.

## Continue reading

- [What Happens When Two AI Agents Change the Same MongoDB Document?](https://argonlabs.tech/blog/two-ai-agents-one-mongodb-document)
- [Code Sandboxes Isolate What Agents Run. What Isolates What They Write?](https://argonlabs.tech/blog/code-sandbox-vs-data-sandbox-for-ai-agents)
- [A Reproducible MongoDB MCP Tutorial: From Sandbox to Reviewed Merge](https://argonlabs.tech/blog/mongodb-mcp-sandbox-reviewed-merge-tutorial)

Argon is open source and MIT-licensed.
