BlueShop LabBlueShop Loop

Designing for
AI-Driven Change

Building an AI-friendly,
AI-resilient system.

Sofiane El Ouali

BlueShop

A shop for customers.
Tools for staff.
Services working together.

Building and evolving BlueShop with AI agents.

BlueShop shop with products and shopping navigation

How do we keep improving BlueShop safely?

Where should the agent change the code?

How do we find mistakes in that change?

How do we stop the same mistake happening again?

The recipe and the result

A perfect recipe.
A burnt dinner.

Clear instructions do not guarantee a good result.

The goal for BlueShop

AI-friendly

Easy to explore and understand.

Find the right specifications,
code and tools.

AI-resilient

Make mistakes visible.

Use feedback to correct them
at each stage.

Each check gives feedback for the next correction.
Reports show what we checked and what needs attention.

Specifications before code

Describe the expected behavior first.

Do not sell an item
that is no longer in stock.

We write the rules and expected results in YAML files.

The business areas behind the shop

Discover

CatalogProducts, options and search

RecommendationWhich products to suggest

MarketingPromotions and rewards

ReviewProduct reviews and moderation

Buy and deliver

CartBasket, checkout and prices

OrderOrder details and status

PaymentPayment requests and status

StockStock levels and reserved items

LogisticsShipping and delivery

Care and improve

CustomerProfiles, addresses and loyalty

SupportCustomer questions and support tickets

NotificationMessages to customers and staff

AnalyticsReports about shop activity

Clear responsibilities help an agent find where a change belongs.

How we organize the application

Separate responsibilities

Keep business rules separate from database and network code.

Event-driven

One service announces a change.
Other services react to it.

Reactive

Handle other requests while waiting for a database or service.

Functional, declarative code

Combine small functions to describe the flow of data.

Give the agent a way to work

FindThe relevant rules and code.

ChangeThe system with the right tools.

CheckThe result and investigate failures.

KeepUseful lessons for the next change.

One change. Three questions.

Follow a change from code to a running system.

Can we spot problems in the change?

Does it produce the expected business result?

GivenAn item is out of stock.

WhenA customer tries to buy it.

ThenThe purchase is not allowed.

The test checks the result, not just the action.

Would this test catch a mistake?

JUnit logo
JUnit
Testcontainers logo
Testcontainers
Serenity BDD logo
Serenity BDD
Cucumber / Gherkin logo
Cucumber / Gherkin
Vitest logo
Vitest
Playwright logo
Playwright
JaCoCo logo
JaCoCo · coverage
PIT logo
PIT · mutation

Can other services still understand and use it?

A service asks for stock

Request → Stock API → Response

OpenAPI describes the request and response.

OpenAPI logo
OpenAPI

Stock announces a change

Stock → Event → Recommendation

Avro describes the event; Kafka carries it.

Apache Avro logo
Avro
Apache Kafka logo
Kafka

A change can break another service, even when its own code works.

What happened inside the shop?

Test the intended version. Then follow what happened inside it.

A trace groups recorded steps of work.
Follow a request or event across services.

OpenTelemetry logo
OpenTelemetry
OpenTelemetry Collector logo
OpenTelemetry Collector
SigNoz logo
SigNoz
ClickHouse logo
ClickHouse

Behavior tests and coverage reports

End-to-end (E2E) tests

Does the behavior match
the expected result?

Run a user task.
Check that its result is correct.

E2E coverage report

Which parts of the system
did our tests reach?

Match recorded requests and events
to their definitions.

A passing test can leave parts of the system untested.
An observed operation can still behave incorrectly.

Useful test data, repeatable situations

Synthetic data: fictional customers, orders and stock.
Golden data: reviewed situations with results we trust.

Set up the caseAn order with stock reserved for it.

Define the resultCancel the order → release its reserved stock.

Repeat the testControl starting data, versions and relevant dependencies.

The tests use the real application.

Record what happens during a test

01Record the steps

Services capture requests and messages.

02Save the records

The platform retains activity from test runs.

03Understand what happened

People and agents can see how services interacted.

Example: Stock changes → a message is sent → Recommendation processes it.

What did our tests reach?

01Compare

The report compares what the system defines with what the test reached.

02Investigate

People and agents use the trail to understand what needs attention.

03Improve

Use the finding to strengthen a test or make another useful change.

A gap is a question to investigate, not automatically a defect.

How does the matcher build the report?

WHAT HAPPENED
Test activityHTTP requests
Kafka sends and receives
Record & retainServices record steps
Collector keeps test traces
Saved tracesTest run and business IDs
WHAT EXISTS
OpenAPIAPI operations
Avro + service codeEvent formats and connections
DefinitionsOperations and events
COMPAREMatcherTraces
+ definitions
RESULTCoverage
report
Observed Not observed

A missing observation is a question to investigate.

Let’s see it in action.

A look at the shop, followed by the report.

01 Explore the shop

02 Open the report

03 Examine the details

Models change. Invest in the system.

Models and agents will change. The lasting investment is a system that gives each new agent clear rules, useful tools and a way to check its work.

The system should generate repeatable test data for reviewed business situations with known expected results. This is golden synthetic data: data we can trust to check behavior.

An AI-friendly system is easy to explore and use. An AI-resilient system makes mistakes visible through tests, traces and reports, so people and agents can correct them.

Keep useful fixes and lessons in the project, so the next agent starts with better checks and clearer guidance.

Appendix

A closer look at how the report is built.

The right response, before the event update

The item ran out of stock and disappeared from recommendations.
Had Recommendation processed the stock event first?

The response finished before Recommendation started processing the event.

Redrawn from real SigNoz traces · 10 Oct 2026 · sequence shown, not duration

Ask for a check of the saved update

“strengthen the existing journey with exact projection state/version assertions and keep the strong response checks.”

Sofiane · saved Codex conversation · 10 Oct 2026

Projection = saved stock data. Assertions = checks in the test.

read.inboxEventIds.includes(event.id)
projection.variantUpdatedAt === event.version
Wait for this event’s
saved update
→Request
recommendations
→Check the response
and expected items

Selected checks from the real test · product IDs, stock values and product version are also checked

Stronger checks, without calling more APIs

BeforeThe test did not check the saved stock update.

AfterIt checks this event’s update before requesting recommendations.

VerificationThe updated test passed repeatedly, without retries.

ReportThe Stock sender and Recommendation receiver are matched.

The test checks more. It calls the same APIs.

Keep the test. Explain why it matters.

Keep the stronger test

Wait for the stock event to update Recommendation’s saved data.

Then check the response.

Write down the reason

A correct response can arrive before the stock event is processed.

Keep this check, even when the response looks correct.

On the next change, the agent can read the reason
and run the test again.

Close the loop with a new run

repeat1 · Define behaviorYAML rules + expected results2 · Build and checkDeploy to the test environment3 · Run E2E testsCheck expected results4 · Record activityHTTP + Kafka → saved traces5 · Match and reportAPI + event definitions ↔ traces6 · Investigate and improveTests, code, tracing, notesRun the tests again. Rebuild the report.

Start with one user task. Find a gap, make a useful change,
then run the test and rebuild the report.

Configure what the services record

Shared configuration records requests and events as spans:
one span is one recorded step.

HTTP APIs and controllers

WebFlux records the method, route and status.
We add the test run ID and business IDs.

Kafka senders and receivers

Spring Kafka records sending and processing.
We add business IDs, event ID, type and schema.

Playwright request headers
X-BlueShop-Traffic-Class: SYNTHETIC
X-BlueShop-Synthetic-Run-Id: E2E-<run>
→
Label on the HTTP spanblueshop.synthetic.run_id

Application code adds business IDs when the request path does not contain them.

Keep test traces for investigation

Application
Record 100%
→OpenTelemetry Collector
Keep E2E traces
→SigNoz + ClickHouse
View and store

Without these traces, the report can miss work that happened.

Other rules keep event traces too.
For normal traffic, we may keep only a sample.

- name: keep-synthetic-e2e
  type: string_attribute
  string_attribute:
    key: blueshop.synthetic.run_id
    values: ["^E2E-.*"]
    enabled_regex_matching: true

Recorded steps include product and event IDs

Both services record the product, its option (variant), and the event.

Stock sends

stock.stock-events send

Recommendation processes

stock.stock-events process

blueshop.product.id21705ce3…

blueshop.variant.id80e77d96…

blueshop.event.idcc7dabba…

blueshop.event.typeStockAvailabilityChanged

Real span labels from SigNoz · 10 Oct 2026 · IDs shortened

Collect IDs and remove duplicates

Read IDs from span labels.
Keep each type + ID pair once.

product · 21705ce3…product · 21705ce3…↓one product in the list
const match = /^blueshop\.([a-z0-9_]+)\.id$/.exec(key);
new Map(
  entityReferences.map((reference) => [
    `${reference.kind}:${reference.value}`,
    reference,
  ]),
).values()

From the matcher · ID extraction and duplicate removal

Follow the work beyond one trace

read IDssearchTraces from this runStart hereCollected IDsProducts and ordersMore tracesFind the same IDs

Work can continue after the browser gets a response.

Search within a limited time period.
The same product ID can also appear in unrelated work.

Three sources, one coverage report

API controllers + modelsDescribe requests and responsesSpringdoc → OpenAPIGenerated list of API operationsAvro + Kafka service codeSchemas, topics, senders, receiversEvent inventoryCollected list of event connectionsTests → APIs + KafkaOpenTelemetry records tagged stepsCollector → ClickHouseStored traces, viewed in SigNozMatcher → reportObserved / not observed

Definitions show what exists. Traces show what our tests reached.

Schema Registry stores event schemas. The matcher reads the Avro topic map and service code.

Same product. But is it the same event?

Producer = the sender. Consumer = the receiver.
Match the same stock event, not just the same product.

if (!sameEventScope(producer, consumer)) return false;

if (producer.eventId && consumer.eventId) {
  return producer.eventId === consumer.eventId;
}

Check the sender, channel, event type and format.
Then compare the event IDs.

From the matcher · event-ID comparison

The report shows where to investigate

Actual report section: Stock event and Recommendation consumer matched, but this does not prove the recommendation response or a complete purchase journey.
From the saved coverage report · 10 Oct 2026

Stock sent an event.
Recommendation processed that same event.

ObservedA request or event matched a system definition.

Not observedMissing test, stopped test, or missing trace?

What should we improve next?

Coverage reportWhat was observed?InvestigationWhat needs attention?ChangeImprove the next run

Next: change an E2E test to check an extra result.
The matcher reports activity; the test checks behavior.

Slide overview

    Presentation controls

    → Space Next slide
    ← Previous slide
    Home First slide · End Last slide
    O Overview
    F Fullscreen · Esc Close dialog or fullscreen

    The deck uses local assets and works without external services. Without JavaScript, all slides remain readable. Tool logos belong to their respective projects. Logo provenance is retained in the accompanying assets.