Skip to content

engineering notes

Decisions, with the alternatives I rejected

Seven short decision records. Each one states the problem, the context, the choice, the alternative and what the choice costs, adds how it was checked where there is evidence for that, then says in plain language why it matters. They come from the demonstrations, where the evidence sits.

Note 1 · Hold-and-confirm demonstration

A payment is recorded in one place, and that place asks the provider

Problem
A payment notification can be missed, repeated, late or out of order, so trusting its arrival or its content can decide the wrong outcome.
Context
A seat is held while a customer pays through a payment provider. The provider sends a notification, but a notification can be lost, repeated, late or out of order.
Decision
One function records a payment. The notification handler and a reconciliation poller both end in it. It asks the provider for the payment status instead of trusting the notification, and it returns the same result however often it runs.
Alternatives
Acting on the notification itself. It is the simplest, and it lets the number, order and content of notifications decide the outcome.
Consequences
Every recording costs one status query. The poller has to cover holds that already expired, or a lost notification for one would never be found.
Verification
A seeded simulation of 250 random sequences of 60 steps asserts after every step that a seat is never confirmed twice and that every confirmed reservation has exactly one recorded payment.
Why this matters
The outcome depends on what the provider says happened, not on how many messages arrived or in which order.
Note 2 · Hold-and-confirm demonstration

A checkout that cannot record its payments refuses to start

Problem
A checkout that takes a payment it cannot record leaves a customer charged with nothing on record.
Context
Starting a checkout creates a hold and a payment. Both are only safe if the store that records them is working.
Decision
Checkout checks the health of the recorder first and refuses, before any hold or payment exists, if it is not working.
Alternatives
Starting the checkout and logging a warning, which accepts payments the system cannot record.
Consequences
Checkout is unavailable while the recorder is down. That is the intended trade.
Verification
A test makes the recorder unavailable and asserts that checkout refuses with a clear message and that no hold and no payment were created.
Why this matters
Turning a customer away politely costs less than taking money that cannot be accounted for.
Note 3 · Hold-and-confirm demonstration

Put the test double at the network edge

Problem
A test of a payment path must never reach a real network, and stubbing an internal function lets a helper bypass the stub.
Context
The code talks to a payment provider. In tests the provider is simulated, and nothing should be able to reach a real address.
Decision
All provider traffic goes through one injected transport that records every destination. Tests end with an assertion that nothing was addressed outside an allowed set, and a scan checks that no source file imports a network module.
Alternatives
Stubbing the function that sends, which another function can bypass by calling the real one.
Consequences
The simulated provider has to be kept in step with the transport, and the allowed set has to be maintained.
Verification
A source scan fails if any source file imports a network module, and a boundary assertion fails if provider traffic is addressed outside an allowed in-memory set.
Why this matters
The tests can run anywhere and cannot send anything to a real recipient.
Note 4 · Audit-gate demonstration

An exception to a rule needs an end date

Problem
A known advisory that cannot be fixed blocks the pipeline until someone lowers the audit level, and nobody raises it again.
Context
A dependency audit step fails the build on serious advisories. Sometimes an advisory has no fix yet.
Decision
An exception names the advisory, gives a reason of at least 20 characters and ends within 180 days. When it ends, the advisory fails the build again and the expired exception is named in the report. An exception that matches nothing is reported as unused.
Alternatives
Lowering the audit level, which hides every later advisory at that level and is rarely raised again.
Consequences
Someone has to renew or remove each exception, and the step depends on the npm audit output format.
Verification
Tests cover an exception on its last valid day, the day after it, a window over the limit and a missing or short reason, using fixture reports and a fixed date.
Why this matters
A temporary decision stays temporary, and a reviewer can see why each exception exists.
Note 5 · Release-plan demonstration

Every lesson becomes a guard that a test enforces

Problem
A list of lessons from past failures is forgotten unless something checks it.
Context
A register of failure modes goes stale if nobody checks it, and the lessons in it are forgotten.
Decision
Each failure mode names a guard: a code path or a test. A test reads the register and fails if a named guard no longer exists, if a row has no guard, or if the numbering skips. The demonstration includes a sample register and that test.
Alternatives
A written list of lessons that relies on people remembering it, or a post-incident review document only. Both record what happened and neither stops it from happening again.
Consequences
Every incident costs the work of writing a guard. Guards have to be named in a form a script can find. A rewrite that moves code has to re-point the guards.
Verification
A test reads the register and fails if a named guard no longer exists, if a row has no guard, or if the numbering skips.
Why this matters
A fixed mistake is harder to reintroduce quietly, because a check stands in front of it.
Note 6 · Approved-edits demonstration

Approval should be bound to the exact change

Problem
A plain yes or no approval can be given for one change and then used for a different one.
Context
A change proposed by a person or a tool should be applied only if a person approved exactly that change, not a description of it.
Decision
The approval quotes a fingerprint of the proposal, and the tool refuses to apply if the proposal or the file changed afterwards.
Alternatives
A plain yes or no confirmation, which can be given for one change and then used for another.
Consequences
The approver has to read the proposal to quote it, and every edit takes two steps. Every approval is recorded by name, so the log is an audit trail.
Verification
The tool refuses to apply a change if the proposal or the file changed after approval, every approval is recorded by name, and the repository’s tests cover this.
Why this matters
A person stays in control of exactly what changes, and there is a record of who approved it.
Note 7 · Question-answering demo

Refusing to answer when the site has no answer

Problem
A question box that guesses can state things the site never said.
Context
A question box over the case studies should help a reader find evidence, not invent it. It also had to run without an API key and fit a free hosting tier.
Decision
Passages are embedded locally (turned into numbers that capture meaning) and the closest ones are returned with citations. Below a similarity threshold the app refuses instead of guessing. If the embedding model cannot load, search falls back to keyword ranking. A language model is optional, constrained to the numbered passages, and its failure falls back to the passages.
Alternatives
A hosted embedding service and an always-on language model: better phrasing, but a key, a per-question cost and site content leaving the machine.
Consequences
Without a model, answers are the cited passages themselves.
Verification
The repository includes an evaluation script. Below a similarity threshold the app refuses, and answers cite numbered passages so each one can be checked against its source.
Why this matters
A reader gets evidence they can follow, or an honest "no answer", and the demonstration runs without a paid key.