Engineering choices4 min read
Technical case studies
Eleven engineering problems that came up on the project, from a one-of-a-kind piece sold on two channels to an assistant that must not make up a single figure. For each one, I give the solution that was kept, what it achieved and its limits.
The other sections describe the code as it is. Here I tell how it got there. Each study starts from a problem where the obvious solution wasn’t enough. They all follow the same outline: the problem, the constraints, the alternatives, the decision, the implementation, the results, then the limits.
The studies
| Study | The problem | The decision |
|---|---|---|
| Holding a piece during payment | a one-of-a-kind piece could sell twice, in the store and online, while Stripe was collecting | a hold derived from pending orders, with no table to expire or clean up |
| A promised date you can keep | the delivery date wasn’t computed the same way from one screen to the next, and then it shifted with suppliers | one rule, the upper bound, a promise frozen at payment and a view of the link that threatens it |
| Payments that cannot be edited | the law wants any edit to cash records to show, even one made with full privileges | a hash chain computed by the database, verified every morning and after every migration |
| An erasure that survives a restore | when a copy was restored, erased customers came back | a register of hashes outside the database, replayed when a copy is restored |
| The storefront only has the rights it needs | the storefront is open to the whole Internet and it shares the ERP’s database | a dedicated Postgres role, column-level grants and triggers that check what it writes |
| A request that may or may not have gone out | a refund with no answer stayed pending forever, and a stale read overwrote a newer state | the unknown outcome kept as a state, keys taken from the announced fact, states that never move backwards |
| A morning check that says what it could not read | a paid order never shipped or a forgotten refund throws no error | anomaly readings every morning, a “blind” section when a reading fails, an outside witness |
| An assistant that does not bring the facts | a language model writes plausible figures in places where a figure commits the store | take away the model’s ability to carry facts, then cross-check every number it still writes |
| Two applications born from a fork | two copies of the same pricing rule drifted apart and nothing flagged it | shared packages, extracted piece by piece, and a twin check at push time |
| Tests that read the code in place of the reviewer | an action with no guard or a cache never expired pass the compiler and ordinary tests | tests that read the source code, carry their written exceptions and run at every push |
| An ERP too heavy to maintain | the ERP was growing four times faster than it was shrinking | change the writing rule rather than launch a big clean-up |
How to read them
- I cite my sources. A file or a symbol (
file.ts#SYMBOL) says where the rule is. A commit (git show <hash>) says when it showed up and why. Code excerpts are read from the repository when this doc is built, like those of the Skills and evidence pages. Identifiers are in English, while comments and test names are in French. - I only say an alternative was rejected when a record shows it: a commit message, a code comment, a dated decision. The others are the ones a reader would ask about. They’re there to place the decision in context, and I don’t claim anyone debated them.
- The figures are dated. They describe the project at the time of the study, and I give the counting method when it matters.
- The limits are part of the result. Each study says what the solution doesn’t solve and what’s left to do.
- Holding a piece during paymentThe storefront and the store sell the same stock, and the money arrives through Stripe minutes or days later. Here’s how we keep a one-of-a-kind piece from selling twice, with no reservation table to expire or clean up.
- A promised date you can keepA made-to-order piece takes several weeks to arrive. Its date is shown from the storefront to the quote, and then it shifts with suppliers. Here’s how the promise stays the same everywhere, freezes at payment and says in advance which link threatens it.
- Payments that cannot be editedFrench law wants point-of-sale software to make any edit visible. So the database chains each payment to the previous one, and here’s how.
- An erasure that survives a restoreThe right to erasure, the retention of accounting records and disaster recovery don’t pull the same way. An erased person had to stay gone when a copy of the database comes back, without their address being kept anywhere.
- The storefront only has the rights it needsTwo applications on the same database, one of them open to the whole Internet. Here’s how we limit what a flaw in the storefront could do.
- A request that may or may not have gone outA refund sent to Stripe that gets no answer, an email Resend said nothing about, a sale sent twice from the store. Here’s how the ERP treats the unknown outcome as a state of its own, with keys taken from the fact being announced and states that don’t move backwards.
- A morning check that says what it could not readThere’s no queue and nobody on call, so nothing guarantees that a paid order ships or that a refund goes out. Every morning, the ERP searches its own data for what shouldn’t last, and it tells “nothing to report” apart from “I couldn’t look”.
- An assistant that does not bring the factsA language model writes plausible figures. In an ERP, a figure commits money, the law or a promise made to a customer. So Fisher drafts, reads and answers without the model supplying a single fact.
- Two applications born from a forkThe storefront started as a trimmed-down copy of the ERP. Here’s how we keep two copies of the same calculation rule from drifting apart, without rewriting everything at once.
- Tests that read the code in place of the reviewerA server action with no guard, a write that forgets to expire its cache, a state overwritten by a concurrent action. An ordinary test doesn’t see any of these mistakes. So architecture rules became tests that read the source code and block the push.
- An ERP too heavy to maintainAn ERP of 600,000 lines, half of them tests, built fast with AI. It was growing four times faster than it was shrinking. There was no big clean-up, the writing rule is what changed.