Quote Amount Sign Envelope — Database Layer Completed, Registry v2.9
Why This Matters
Release 5.35.2 registered the quote domain’s invariants and recorded one of them honestly as planned rather than delivered: quote amounts were validated as positive at the API boundary, but the database did not yet independently guarantee it. SpeyBooks’ kernel rule is that no monetary invariant may rely on a single enforcement layer — if the application layer were ever bypassed or wrong, the database must still refuse bad data. This release completes that second layer. The gap was found by the registration review itself, scheduled in the open, and closed within a day. That is the transparency model working end to end: found by process, recorded publicly, fixed mechanically.
Quote Amount Sign Envelope
-
Database constraints on quote line amounts Unit prices must be strictly positive, and the derived net, VAT, and gross amounts must be non-negative, enforced directly by the database on every row. The strictly-positive rule on unit prices matches the API boundary validation exactly, so both layers agree on what a legal quote line is. Enforced at database + service layers — migration 090.
-
Defence in depth, deliberately redundant The constraints enforce the invariant two ways: at the root cause (a positive unit price, from which the existing arithmetic constraints propagate sign) and directly on the stored amounts. Either alone would hold; together there is no derivation argument to audit.
-
Clearer validation for negative quantities Entering a negative quantity on a quote previously produced a server error, because the request passed initial validation and was rejected deeper in the stack. The API boundary now rejects it up front with a proper validation message, matching how negative prices were already handled. No valid request changes behaviour.
-
Verified before it shipped The migration’s guards refuse to run against unexpected states — already applied, partially applied, or data that would violate the new rules — and every refusal path plus every rejection path was exercised against fixtures before the production run. Existing data was confirmed clean beforehand.
Operational Impact
- The kernel’s verified invariant count moves from 33 to 34 delivered, machine-checked on every deploy and every push.
- The quote invariant registered as planned in 5.35.2 is now delivered; the quote domain’s invariant set is complete at four of four.
- Negative-quantity requests now receive a 400 validation response instead of a server error; no valid request changes behaviour.
- The database now independently rejects what the API boundary rejects, with both layers stating the same rule.
Versioning
Kernel axiom registry → v2.9. No API request or response shapes changed; the only behavioural difference is the improved error response for invalid input described above.