Skip to content

ADR: Reset is one person's start-over

ADR: Reset is one person's start-over

Status
accepted
Date
2026-09-03

DELETE /api/bids took no user and deleted everybody's rows. It was documented, deliberate, and had stopped being defensible two versions earlier without its comment changing.

In plain words

The demo's reset button used to delete every visitor's bids, which let any signed-in user wipe out other people's data (broken access control). Now a reset removes only the caller's own bids, and a stranger who bid on the same car keeps their bid and their lead.

What that is worth: a developer sees how a comment that was once right can expire while the code still reads as settled, and the organization's users can no longer erase each other's work with one button.

What it did

The demo has a "Reset bids" button so a visitor can start the auction over. The endpoint behind it:

app.MapDelete("/api/bids", (BidService bids, MarketService market) =>
{
    bids.Reset();
    market.Reset();
    return Results.NoContent();
}).RequireAuthorization();

No user parameter. BidService.Reset() cleared _standing, _byUser and the store, and EfBidStore.Clear() was db.Bids.ExecuteDelete(): every row in the table, for everybody.

The behaviour was not an accident. The method carried a comment defending it:

The demo's start-over button. It clears everybody, not just the caller, because the room's bids (ADR-027) are shared and a reset that left half of an auction standing reads as a bug however carefully it is explained.

That reasoning was correct when it was written. At the time a bid belonged to a browser session, there was one visitor by construction, and "everybody" meant "you".

When it stopped being correct

1.0.0.48 gave bids owners. 1.0.0.49 put them in Azure SQL Database. From that point:

  • Any signed-in visitor could delete every other visitor's bids.
  • The deletion was durable, because the store went with it.
  • And this repository's own changelog says of 1.0.0.48: "two visitors on the live site can outbid each other and both be told the truth about it", which the reset endpoint made false.

An authenticated user destroying another user's data is broken access control, and it is the first item on the OWASP top ten. On a portfolio demo where the data is invented bids it costs nothing. As a thing a reviewer reads in a repository that spends forty-seven records arguing about care, it costs a great deal.

The comment is the interesting part. It is not a case of nobody thinking about it. Somebody thought about it, wrote down a good reason, and the reason expired without the sentence changing. That is harder to catch than an absent thought, because the file reads as though the question has been settled.

Decision

The reset belongs to the caller. The original reasoning survives, narrowed to the vehicles the caller actually touched.

public IReadOnlyList<string> Reset(string userId)
{
    if (!_byUser.TryRemove(userId, out var mine)) return [];
    string[] touched = mine.Keys.ToArray();
    _store.Clear(userId);
    foreach (string vehicleId in touched) { /* recompute the standing */ }
    return touched;
}

Three things it does, and one it deliberately does not.

It returns what it touched, and the endpoint hands that to the room. The room's counter-bids on those vehicles go with the caller's, which is the whole of the original argument: a reset that takes your bid and leaves the room's answer standing reads as a bug. That argument only ever needed to apply to the vehicles the person bid on. BidService does not reach into MarketService; it reports, and the composition root connects them.

It recomputes each vehicle's standing rather than deleting it. Deleting the standing would hand the vehicle back to its opening ask, which discards a third person's bid on the same car as a side effect: the same defect, one size smaller. Instead the top remaining bid across the other users becomes the new standing, so a stranger who bid on that car keeps their bid and keeps the lead they earned. The scan is over users and their bids, which is small, rather than over the hundred thousand vehicles, which is not.

The store deletes one person's rows, WHERE UserId = @userId, rather than truncating the table.

It does not try to restore the room's earlier bid on those vehicles. The room answers bids; with the buyer's bid gone there is nothing for its earlier answer to be a reply to. Removing it is the honest state, and it is what the original decision chose too.

What the tests hold

The one that matters names the situation rather than the mechanism:

[Fact]
public void Reset_leaves_a_stranger_bidding_on_the_same_vehicle_alone()
{
    service.PlaceBid(vehicle, 23_300, Now, Buyer);
    service.PlaceBid(vehicle, 24_000, Now, "somebody-else");

    service.Reset(Buyer);

    Assert.Empty(service.SnapshotFor(Buyer));
    Assert.Single(service.SnapshotFor("somebody-else"));
    Assert.Equal(24_000, service.Apply(vehicle).CurrentBid);
}

Both halves: the caller's bid is gone, and the stranger's is untouched and still leading. A test asserting only the first would pass on the old behaviour.

What it broke, which is the interesting part

smoke.spec failed on the first run after this change, and on the second, on the assertion right after it places a bid. Two runs is not a flake, and the change was mine, so the question was what it took away.

smoke.spec reads the minimum next bid off the field's placeholder and posts it, once, with no retry. The room raises prices every eight seconds, so that has always been a race: read a number, and by the time the click lands the number can be stale and the server is right to refuse it. market.spec hit exactly this and was given a helper that reads the number again when the server says no.

smoke.spec never needed one, and now it is clear why. market.spec's reset used to clear the room globally, so through most of a suite run there was nothing bidding against anybody, and smoke.spec was posting into a quiet field. Scoping the reset to one user left the room's other bids standing, which is correct, and the race that was always in smoke.spec started happening.

So the test was passing because a different test kept clearing the world.

The helper moved to tests/e2e/bidding.ts and both specs use it. Two tests solving the same problem two ways, one of them by accident, is worse than either answer.

This is the second time this kind of dependency has surfaced here, and the shape is worth naming: a test that passes because of something another test does to shared state is not a passing test, and it looks exactly like a passing test until the day somebody fixes the thing it was leaning on. It also means the fix looks like the cause, which is how a correct change gets reverted.

Consequences

  • Two visitors on the live site can now do what the changelog has been claiming they could do for twelve versions.
  • The reset button still does what it appears to do for the person pressing it, including clearing the room's replies to them.
  • IBidStore.Clear takes a user id, so an implementation cannot truncate the table by accident.
  • One narrow behaviour change to the demo: pressing reset no longer returns every vehicle on the site to its opening ask, only the ones you bid on. That is what the button always claimed to do.

Where it sits

The reset now runs through Application, where Auction.ResetAsync asks BidService.ResetAsync for the vehicles one user touched and hands that list to MarketService.Forget, and the IBidStore.ClearAsync(userId) port is implemented by the relational adapter in Infrastructure and the Cosmos adapter in Infrastructure.Cosmos. Application owns the port and both adapters implement it, and because the port demands a user id, neither store offers a way to wipe the whole table. It cost the old feel of the button, which no longer sends every vehicle back to its opening ask, and it exposed a race in smoke.spec that needed a shared retry helper. If an operator ever needed a full wipe, that would be a separate admin-only action and this one would stay scoped to the caller.

Files

Addendum, 2026-10-03: who connects the reset to the room

The Decision says the endpoint hands what the reset touched to the room and the composition root connects them. That connection now lives in the Application ring: Auction.ResetAsync (api/TheYard.Application/Shared/Auction/StandingReader.cs) asks BidService for the vehicles it touched and tells MarketService to forget its answers on those. The endpoint only checks the session and calls it. BidService still does not reach into MarketService.

Enforced by

Not machine-checked. Held by review.

Store

The Yard, home

Steven StoutStaff .NET engineerRemote

Production .NET that stays up. Built with AI, measured on every version.

Steven Stout

Hi, I'm Steve. I build the systems that make delivery boring in the best way, then coach people inside them.

  • 200+

    production releases, none took the platform down

    Conway Investment Research, 2019 to 2024. Sole engineer for the first three years on a live financial advisory platform.

    See how
  • 50%

    shorter release cycle

    Storee Construction, 2024 to 2026. Four ASP.NET applications onto one .NET 10 platform on Azure, with a four-person team I hired and mentored.

    See how

01Verified

Steven Stout

A real person, and the work is mine.

  • Identity

    Checked by LinkedIn, not by me.

    LinkedIn verified my government ID.

  • Running system

    You are looking at it.

    Version 1.0.5.273 is live. Nothing ships unless it passes the automated gates first.

That's who I am. Here's how I work.

02Strengths

Ten strengths, each with the proof beside it. The numbers match my resume and LinkedIn, and the live ones are read from this site as you look.

  • 01

    Keeps production alive

    200+ releases on a live financial platform, and none took it down. Sole engineer for the first three years.

    See the Conway work

  • 02

    Simplifies messy systems

    Four ASP.NET applications onto one .NET 10 platform on Azure, and a release cycle 50% shorter.

    See the Storee work

  • 03

    Marries dev and infrastructure

    Blue-green releases at Storee that flipped in about 5 seconds with nobody signed out, and Azure Front Door at two employers.

    See this site's cloud

  • 04

    Designs data that holds up

    White-label clients on one shared database, the isolation built into the data, and no cross-client issues.

    See the Conway work

  • 05

    Keeps AI-written code honest

    15 quality numbers that may only improve: 273 releases in a row with none worse.

    See the quality numbers

  • 06

    Resourceful

    $30,000+ cut from Azure and vendor spend at Conway. This site's Azure bill is public, resource by resource.

    See the bill

  • 07

    Builds people up

    Hired and mentored a four-person team. 13 colleagues recommend me by name.

    Read the recommendations

  • 08

    Takes ideas to production

    This site: designed, built and run solo, with 352 versions measured through one gate.

    How it was built

  • 09

    Writes clearly

    Posts on real engineering problems, in plain words.

    Read the blog

  • 10

    Owns decisions

    153 decision records, each with its tradeoff and the call I made.

    See the decision records

Built with AI. Gated so quality never slides.

Steven Stout’s showcase: a used-vehicle auction on .NET and React, built and run by one engineer, live on Azure, with its decisions written down.

No quality number has gotten worse at any release since 1.0.5.1 on 10 November: 273 releases in a row.

One engineer, an AI agent and a gate that checks 15 quality numbers on every release. 352 versions measured, with every result public, the worst days included.

82 releases in the last 7 days, each through the same gate.

Async methods with no CancellationToken, may only fall

11091.0.3.1391.0.5.2731.0.4.115, the ratchet
Every number, on the Quality page

TheYard, right nowLive

Answering in

unread

02505007501,000

server time at p95, the usual five minutes of the last day.

Azure this month

unread

the bill, by resource, read from Azure. The Admin tab shows every line.

Since the last roll

unread

 

rolled in place by the pipeline, behind one gate.

People who have visited

unread

30 days agotoday

Scanners, my own tools' and my own reads left out.

03Start here

04Where teams are heading

How I see engineering with AI, and the setup on this site that backs it.

AI-augmented teams · Architecture and ownership

AI writes more of the code. Someone still has to own what ships.

Teams are going to be heavily AI-augmented. That moves the senior job toward architecture and technical ownership: deciding what to build in pieces small enough to verify, and owning what ships.

  • Task tracking will get automated too. Judgment stays human: seeing a design fail at scale before it does.
  • On this site the AI's first design held the whole catalogue in memory. I caught it when the App Service plan hit 82 per cent and moved the work to the store.

What the AI wrote, what I decided

07Tech stack

  •    
  •    
  •    

Read from the build, never typed by hand

What TheYard runs on

What we use, where it runs, its AWS twin, the version as built, and the file that proves it.

Cloud patterns, not one vendor: every Azure piece in this stack has a named AWS twin. Mapped, not yet run on AWS.

  • .NET 1114 projects
  • React 19.3TypeScript 7.0
  • Azure9 Bicep files
  • 11GitHub Actions workflows
The whole stack, with the file that proves each line

The last release the gate stopped was 1.0.5.258 on 2 December, at its browser 1 of 2 job.

08How it is built

09How it is run

10Who and why

Next step

11What has to work, where is it today, and what does success look like?

Book 20 minutes opens an email to me with those three questions in it, and I answer with a time.

Book 20 minutes

Your email app should have opened with this message. If it did not, copy it and send it from any mailbox.

Or message me on LinkedIn