ENGINE 12

SFS-E12-BUP · REVENUE RECOGNITION · REV 2026-07-22 · PRODUCTION

PRODUCTION = runnable end-to-end, CI-backed, full test suite passing. All data fictional and seeded.

Buyer Upgrades

A liability until the unit closes

A buyer pays for a home upgrade months before the home closes. That money is not revenue when it arrives -- it is a liability, and it stays one until the unit actually closes. Between those two dates the same figure has to appear consistently in four places, each maintained by a different person on a different cadence. This engine reads all four and runs twenty deterministic controls over them: does every upgrade belong to a real unit exactly once, is deferred revenue released on close and only on close, does the closing entry balance, is sales tax carried as a liability, and do the four schedules agree. It never posts and never writes to a source artifact.

The failure mode here is almost never a wrong number. It is the same number failing to move everywhere at once -- released in the schedule but not the ledger, repriced in one report and not the next. Those breaks survive review precisely because every individual page still foots. The engine ships one planted defect per registered control, so the benchmark is a command rather than a claim.

Run it Book a consultation

Architecture

functional block stack · static overview
Structural Precondition Unit Integrity Deferred Revenue Lifecycle Cost of Sales Sales Tax Four-Way Agreement Budgeted Versus Actual substrate: seeded fictional data

Select a layer

Seven control families run in registry order over each upgrade book. The first proves the others had something to read.

Key specifications

at a glance
10,2791
Tests
the collected checks that pin this engine's behavior
202
Controls
independent rules run over every upgrade book
73
Families
groups of controls, each answering one question
224
Books
one clean baseline plus one planted defect per control
55
Artifacts read
the schedules an upgrade programme keeps
06
Tolerance
one cent recognised early is a failure

What it does for you

plain terms

An upgrade programme keeps four schedules of the same money, and the money changes character exactly once: on the day the unit closes it stops being a liability and becomes revenue. Every recurring failure here is that change happening in some schedules and not others. A unit closes and the deferred balance is released in the closings schedule but never posted to the ledger, so the liability account carries a balance for units that no longer exist. An upgrade is repriced and the cost-to-complete is updated while the proforma keeps the old figure, so margin is reported against a price nobody is charging. A change order is executed and the committed cost never lands, so an overrun looks like an overrun rather than an approved increase. None of these makes any individual page fail to foot, which is exactly why they survive review and why a rule finds them and a reviewer does not.

The seeded demo runs every control over every book7. The CLI generates 22 fictional upgrade books -- one clean baseline and one carrying each planted defect -- then runs all 20 controls over each. The clean book returns PASS with no flags; every defect book returns REVIEW or FAIL and names the control it tripped along with the reason that control exists.

Paid, finished and settled is still not revenue8. A test sets buyer-paid, work-complete and invoice-settled on an open unit and asserts the recognition control stays silent, because none of those recognises revenue. A companion test recognises a single cent before close and asserts it fails. There is no immaterial amount of premature recognition.

A flipped sign is caught in both directions9. The cost-to-complete states cost positive and the proforma states it negative, so the tie negates one side. Tests assert that the correct negative line passes and that a positive one fails -- the check that would be inverted by the obvious raw comparison.

Functional block diagram

engineering · each block links to its source
Functional block diagram of the Buyer Upgrades engine upgrade books complete complete complete findings findings findings tied to tied to tied to findings findings findings findings Seeded Upgrade Books StructuralPrecondition Unit Integrity Deferred Revenue Cost of Sales Sales Tax Four-Way Agreement Budgeted Versus Actual Ledger Balances Verdict and Findings SFS-E12-BUP · FUNCTIONAL BLOCK DIAGRAM · REV 2026-07-22

Plain terms

  • Seeded Upgrade Books. fictional upgrade books enter the control registry
  • Structural Precondition. is the book complete enough to be worth reading
  • Unit Integrity. does every upgrade belong to a real unit, once
  • Deferred Revenue. is revenue released on close, and only on close
  • Cost of Sales. does the closing entry balance, and follow revenue
  • Sales Tax. is tax a liability rather than revenue
  • Four-Way Agreement. do the four schedules carry the same number
  • Budgeted Versus Actual. is the forecast/fact marker current
  • Ledger Balances. the book of record every schedule is tied back to
  • Verdict and Findings. every finding, with the reason it exists, ends at a person

Engineering

  • Seeded Upgrade Books. generate_corpus writes one clean baseline plus one planted defect per registered control, 22 books in total. Only the units and their orders are stated; every dependent figure is derived, so a planted defect is guaranteed to be the only thing wrong.
  • Structural Precondition. Two controls. Fails a book missing any of the five artifact types, so no downstream rule can hold vacuously.
  • Unit Integrity. Three controls over orphaned units, duplicate order ids and closed units missing a close date.
  • Deferred Revenue. Four controls: the recognition gate, the per-unit split, and both ledger ties.
  • Cost of Sales. Four controls over entry balance, timing, committed cost and change order references.
  • Sales Tax. Two controls: derivation from the declared rate, and the tie to the liability account.
  • Four-Way Agreement. Four controls chaining cost-to-complete, proforma, variance tab and the unit rows beneath them.
  • Budgeted Versus Actual. One control, wrong in both directions: stale after close, or premature before it.
  • Ledger Balances. Five accounts: unearned revenue, revenue, cost of sales, contra work-in-progress and sales tax payable. A missing balance fails the tie that needed it rather than skipping quietly.
  • Verdict and Findings. Findings roll up per book: any FAIL is FAIL, FLAGs without FAILs are REVIEW, clean is PASS. The CLI exit code is the verdict, so a pipeline can gate on it. Reports carry no timestamps or absolute paths, which is what makes the committed report diffable.

Instruction set

every public command
CommandOperationOutputExitArtifacts
python run.py
generate the seeded fictional corpus, run all twenty controls, write both reportsper-book verdicts and every actionable finding, then the overall verdict2 for the bundled corpus, which carries one planted defect per control by designupgrade_report.md, upgrade_report.json, samples/
python -m upgrade_engine samples
analyze an existing folder of upgrade books without regenerating itper-book verdicts and findings0 PASS / 1 REVIEW / 2 FAIL / 3 usagenone unless --json or --md is passed
python -m upgrade_engine samples --generate --quiet
regenerate the corpus and print only the overall verdicta single verdict line0 PASS / 1 REVIEW / 2 FAIL / 3 usagesamples/
python -m pytest
run the full test suite for this engine10279 passed0 when every test passesnone

Benchmarks

measured demo results
MeasureResult
Engine tests1010,279 tests collected
live collection from the engine directory
Registered controls1120 controls
counted from the registry, not from documentation
Planted defects1221 defect books
every registered control has at least one book that trips it
Control coverage13100 percent of controls with a planted defect
no control ships without a book demonstrating it firing

Control characteristics

engineering

Plain terms

The engine has no write path and therefore no autonomy to gate. It produces findings; a person decides.

Engineering

Deterministic envelope. seeded fictional inputs, read-only operation, offline default mode.

Demo gate. FAIL on the bundled corpus, by design -- it carries one planted defect per registered control

SeverityVerdictAction
No findings above PASSPASSsend the mechanically clean book to the documented manual review
One or more FLAG, no FAILREVIEWa human resolves each flag; none of them misstates a figure
One or more FAILFAILa schedule disagrees with another or with the ledger; correct it before the close package is relied on

Operating limits

what it refuses to do

See it run

brand animation
Buyer Upgrades diagram: three blocks reading deposit, close of escrow and revenue connected left to right by arrows, with close of escrow highlighted as the only trigger; below, a banded assertion that four schedules must carry one number, and a row of the seven control families with their counts.
The Buyer Upgrades engine tile states the gate the whole programme turns on: a deposit is a liability until close of escrow, and only then does it become revenue.

Integration

how to run it

Distribution: public repository, MIT license.

Substantiation
  • 1python -m pytest --collect-only -q -o addopts= (buyer-upgrade-automation/)
  • 2len(upgrade_engine.engine.REGISTRY)
  • 3distinct rule-id prefixes in upgrade_engine.engine.REGISTRY
  • 4samples/*.json after python run.py
  • 5len(upgrade_engine.model.DOC_TYPES)
  • 6upgrade_engine/tests/test_control_semantics.py
  • 7python run.py (buyer-upgrade-automation/); output re-run on demand
  • 8upgrade_engine/tests/test_control_semantics.py::test_paid_and_complete_is_still_not_recognised
  • 9upgrade_engine/tests/test_control_semantics.py::test_proforma_cost_sign_is_enforced
  • 10python -m pytest --collect-only -q -o addopts= (buyer-upgrade-automation/)
  • 11len(upgrade_engine.engine.REGISTRY)
  • 12len(upgrade_engine.generate.DEFECTS)
  • 13upgrade_engine/tests/test_planted_defects.py::test_every_registered_rule_has_a_planted_defect
  • 14buyer-upgrade-automation/README.md and upgrade_engine/tests/test_readonly_and_determinism.py
  • 15upgrade_engine/model.py DOC_TYPES
  • 16upgrade_engine/engine.py cos_change_order_referenced
  • 17upgrade_engine/engine.py tax_derived_from_rate
  • 18upgrade_engine/generate.py

Show us where the hours go.

One conversation: you describe the work that consumes your team's month; we tell you plainly what this engine can take over, what it can't, and what a scoped first phase would cost. Your people keep approval authority.

Book a free consultation