
TL;DR
Continuing our series on Tendero, the AI-native ecommerce platform, in this article I tell the story of a shop that started, answered and reported itself healthy, and never indexed a single product.
- The build was clean, every test was green, the API said
Healthy, and the outbox had processed 0 of 115 messages. - No line of code was wrong. Two lines that start the system were: one dependency that did not exist, and one that did and was never declared.
- The dependency graph that starts the system is code too. Now a test reads it.
Healthy, and doing nothing
dotnet build -warnaserror: clean.
76 backend tests and 5 frontend suites: green.
curl /health on the API: Healthy.
The API answered. The storefront rendered. The dev server’s proxy worked.
And nothing was ever indexed. The outbox — the table where Tendero keeps each event until a background worker delivers it — held 115 messages, and 0 had been processed. Search returned 500, because the index products_es did not exist.
How can a system be healthy and do nothing at all?
Because the code was fine, and the bug was in the other program: the one that says which service starts after which. In Aspire that graph is code — a few WaitFor lines in a C# file — but no compiler checks it against reality and no unit test runs it. One edge was missing and one was invented. The rest of this article is how we found them, and the test that now reads that graph.
A shop in one command
It was 2026-08-30. Tendero, the open-source .NET and Angular shop this series is about, had just gained its two Angular apps in Aspire, the tool that starts the whole stack with one command: Postgres, Elasticsearch, the API, the background worker and both front ends.
You describe each resource in a C# file, the AppHost, and the edges between them. WithReference hands one resource the address of another. WaitFor says do not start me until that one is healthy. The AppHost that day, simplified:
var api = builder.AddProject<Projects.ElGuerre_Tendero_Api>("api") .WithReference(database).WaitFor(database) .WithExternalHttpEndpoints();
The work that day was done by the AI coding agent I build Tendero with, Claude Code: it wrote the AppHost, ran the stack and reported back.
Three diagnoses
The first diagnosis was the health check. WaitFor needs something to wait on. A resource with no health check never becomes healthy, so an edge to it means nothing. The API exposed /health, but Aspire only uses a health check you declare, so it gained .WithHttpHealthCheck("/health"), and Elasticsearch gained its own on /_cluster/health.
A real fix. And the agent reported that it worked: 81 of 115 messages processed.
The number was real. The explanation was not. Those 81 had been processed by a worker the agent had started by hand hours earlier, to reproduce the bug on its own. timeout 45 had killed the dotnet run launcher but not its child process, which was still alive and still polling the outbox.
Before you believe a measurement, prove that the system you measured is the system you built.
The second diagnosis was the worker’s edge to the API. The worker had .WaitFor(api). The agent had added it to make the start order in the dashboard look tidy. But the worker never talks to the API. It reads Postgres and Elasticsearch, nothing else. An edge that does not exist can only hold things back. Removed — real, and still not enough.
The third diagnosis was the one that closed it. The worker had no .WaitFor(elasticsearch). The hosted service that creates products_es and products_en runs while the host starts. When Elasticsearch was not ready yet, that service threw, the process died, and Aspire did not restart it. There was no line about it in the terminal where the stack was started, because each resource’s logs go to Aspire’s dashboard, not to standard output.
The clue was on screen for an hour before anyone used it: the two Angular apps also had WaitFor(api), and they started fine. If the edge to the API had been the whole story, they would have hung too.
Forgotten kills, invented blocks
Put the two mistakes next to each other:
A dependency you forget to declare kills the process. A dependency you invent holds it back — and if what it waits for never reports healthy, it holds it forever.
Neither is visible to the build or to any test, because neither is a defect in the code you test. An edge in the AppHost is a statement about the world — this service needs that one — and nothing checks it until the system starts from cold.
The fixes, with their comments, are still in the AppHost: the worker’s real edge (AppHost.cs, lines 963–971), the comment where the invented one used to be (lines 1124–1127) and Elasticsearch’s health check (lines 119–128).
We started looking for other wrong wiring
The same mistake, one resource to the left
The next day, on a different machine, the first search after starting the stack failed:
Search failed: ... POST /products_es/_searchNo connection could be made because the target machine actively refused it. (localhost:27529)
Elasticsearch was not broken. The container was Up, the port was mapped, and its own log showed it creating the indexes three seconds after the failed search. A container that is Up is not a service that is listening.
The day before had fixed the worker and nothing else. The API reads Elasticsearch on every search, and it had the connection string with no WaitFor. So the API reported itself healthy, the storefront started, and the first query reached a node that was still loading.
var api = builder.AddProject<Projects.ElGuerre_Tendero_Api>("api") .WithHttpHealthCheck("/health") .WithReference(database).WaitFor(database) .WithEnvironment("ConnectionStrings__elasticsearch", elasticsearchEndpoint) .WaitFor(elasticsearch) // …
→ Reference: AppHost.cs, lines 672–700, simplified here
Fixing a class of bug on the resource where you found it is not fixing the class. And this class has a shape you can search for. The connection string is the declaration of the dependency, so it should never appear without its WaitFor.
The path that only existed on one machine
The same day, importing the catalogue answered 500 on a freshly cloned repository. The seed file’s path, seed/products.sample.json, was relative to the API’s content root — src/Api/, where the file does not exist. Every earlier run had passed an absolute path, so nobody had seen it. The AppHost now passes the repository root (lines 12–15).
Two days later the same shape came back, bigger: four of the five seed files had never been wired. Nothing failed. Their readers are forgiving by design, so the shop simply ran without its attributes, its categories, its tariffs and its promotions — with a green build and 241 passing tests. That one became a test: every seed file in the repository must be named in the AppHost.
The edges we leave out on purpose
The rule is not wait for everything. The storefront references the API and does not wait for it: the dev server has nothing to ask the API when it starts, and waiting only tied a four-second start to the backend’s (lines 940–948). The AI layers — vector search and the models — are handed over only when their switch is on, and nothing waits for them, so that a missing model makes search less clever instead of stopping the shop (lines 180–184).
So the rule grew up: a dependency the service needs to start is waited for; an optional one is not — and the code says which, in a comment beside it.
The rule, as a test
A rule in an article is advice; a rule in a test fails. So it became AppHostDependencyTests, with two checks that read the AppHost as text:
- every statement that hands a project a connection string also waits for the same resource;
- the worker does not wait for the API.
It reads text, because Aspire’s testing package would be a new dependency for two assertions, and the optional layers pass because they are handed over in their own statements, behind their switch. It cannot prove that an edge is true — only starting the system can — but it catches both mistakes of this story the day somebody makes them again.
The test nobody runs
The only test that finds the whole class is this one:
Start the thing from cold, with an empty database, on a machine that has never run it.
Nobody runs it: it is slow, it needs Docker to pull images, and the build was green, so what could be wrong?
In Tendero it now runs on every pull request. CI’s end-to-end job starts the real AppHost on a fresh runner and waits until one request proves the whole chain: a request through the backoffice’s proxy for an order that does not exist. A 404 means the dev server serves, its proxy resolves, the API listens, Postgres answers and the schema exists. A proxy with no API behind it, or an API with no schema, answers 5xx (ci.yml, lines 333–399). It asks through the backoffice because the front ends do not wait for the API — the edge left out on purpose — so the dev server alone would open the gate too early.
What I take to every project
- Declare the edges you have, not the ones that make the dashboard tidy.
- A connection string is a dependency: wait for it, or say in the code why not.
- A container that is
Upis not a service that is listening. - Fix the class, not the instance: look one resource to the left.
- Prove the system you measured is the one you built — the process, its start time, the binary, the volume. It costs seconds. The one time the agent skipped it, it cost an hour.
The AppHost was 77 lines that day. It is 1,354 today, and many of its comments are lessons from this story.
The repository is public and MIT licensed, and the code exactly as this article describes it is tagged blog/08-your-build-is-green-and-nothing-works.
How we know it works
- The tests that fail: we broke the AppHost by hand four times. Removing the API’s
WaitFor(elasticsearch)turned the first check red (api → elasticsearch), and so did removing the worker’sWaitFor(database)(workers → database). AddingWaitFor(api)to the worker turned the second check red, both in its main chain and in a statement behind anif. Each time the file was restored and both checks went green again. - The check on every pull request: both dependency checks and the seed-file check run with the architecture tests, and the end-to-end job starts the whole stack from cold.
- The mutation score: none. The AppHost is a program that starts containers, so Stryker does not run on it; the mutations were made by hand, for the reason article 04 gives: a test that has never failed has not proved anything yet.
Next article: The parameter and the header are not alternatives — ?culture=es or Accept-Language, and why the parameter has to win: an AI agent has no browser locale.
Tendero — commerce for humans and agents.