ENGINE 24

SFS-E24-GRT · GROSS-RECEIPTS TAX · REV 2026-07-24 · PRODUCTION

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

Gross-Receipts & Excise Tax

Is the tax the tax the receipts produce?

A developer that manages projects across several taxing jurisdictions owes a gross-receipts or excise tax in each one -- a state Business & Occupation tax, a city excise, a territorial general-excise tax -- and each carries its own classification rate, filing cadence, deductions, thresholds and due dates, and each rate can change mid-year. The tax on a worksheet is a derived figure, and it goes wrong in ways that look right on the page: a base that does not tie the general-ledger pull, a rate that was right last quarter, a deduction taken after it was exhausted, a below-threshold rule claimed above the threshold, a filing that is missing, late or unapproved. This engine reads the seven artifacts the reconciliation file carries -- the entity register, the jurisdiction rate table, the GL revenue pull, the filing register of worksheets, the per-filing tax summary, the business-licence register and the portfolio excise report -- and runs twenty-seven deterministic controls over them. Is the file complete and the review date legible, is the entity register sound and every entity's filing scope declared, is each jurisdiction's cadence known and its rate windows forward-running, does the GL pull tie the worksheet's gross, does each worksheet re-derive its base, apply the rate in force for the period, and recompute its pre-credit tax, credit and tax due to the cent, is every expected filing present, on time and approved before it was filed, is each licence active, and does the portfolio rollup recompute from the worksheets beneath it. It re-derives every tax through the same kernel that produced the data, compares every figure with exact ==, and never writes to a source artifact.

The tax on a worksheet is arithmetic that already happened, and every place it can go wrong is a place the paper still looks finished. A revenue line drops on the way from the GL pull to the worksheet and the base is short, so the tax is short, and the return files clean. A classification rate changes mid-year and last quarter's rate is applied to this quarter's receipts -- the multiplication is internally consistent and still wrong. A standard deduction already spent is taken again, a small-business credit is read off the wrong bracket, a below-threshold no-tax rule is claimed on receipts over the threshold. A filing that should exist for an entity-jurisdiction-period simply is not there, or went out after its due date, or before anyone approved it. And the portfolio total a controller signs is a number maintained beside the summary rather than re-added from it. None of these announce themselves; each surfaces when an assessment arrives. The engine re-derives every worksheet's base, rate, credit and tax from the receipts and the rate table through the one kernel that generated the data, enumerates every expected filing from the calendar and proves it present, timely and approved, ships a planted-defect file for every registered control, and states its benchmark as a command rather than a claim. A tax computed on an unreconciled base, or at a stale rate, is invisible until the jurisdiction recomputes it for you.

Run it Book a consultation

Architecture

functional block stack · static overview
Structural Precondition Entity Register Jurisdiction Rate Table GL Revenue Pull Filing Register Rate in Force Tax Re-derivation Deductions & Credits Filing Calendar Business Licence Portfolio Rollup substrate: seeded fictional data

Select a layer

Eleven control families run in registry order over each reconciliation file. The first proves the others had something to read and that the review date is legible, because a control that passes on absent evidence reports assurance it never performed.

Key specifications

at a glance
10,4001
Tests
the collected checks that pin this engine's behavior
272
Controls
independent rules run over every reconciliation file
113
Families
groups of controls, each answering one question
294
Reconciliation files
one clean baseline plus twenty-eight planted-defect files, one per control
75
Artifacts read
entity register, jurisdiction rate table, GL revenue pull, filing register, tax summary, licence register, excise report
06
Tolerance
a tax a cent off the re-derived figure is a break, not a rounding band

What it does for you

plain terms

A developer that manages projects across several taxing jurisdictions owes a gross-receipts or excise tax in each one -- a state Business & Occupation tax, a city excise, a territorial general-excise tax -- and each carries its own classification rate, its own filing cadence (monthly, quarterly, annual), its own deductions, thresholds and due dates, and each rate can change mid-year. The filer prepares one worksheet per entity per jurisdiction per period and files it. The tax on that worksheet is a derived figure, and four failures hide inside it, none of which look wrong on the page. The base does not tie the ledger: a revenue line is omitted or a non-taxable back-out is overstated, and the tax is computed on a base nobody reconciled to the GL pull. The rate is the wrong rate: a classification rate changed mid-year and the worksheet applied last quarter's rate to this quarter's receipts, and the arithmetic is internally consistent and still wrong. A deduction or credit is misapplied: a standard deduction already exhausted is taken again, a below-threshold no-tax rule is claimed above the threshold, or a small-business credit is read off the wrong bracket. And the calendar has a hole: an entity-jurisdiction-period that should have a filing has none, a return was filed after its due date, or filed before anyone approved it. None of these are judgment calls. They are equalities and comparisons -- a base against the GL, a rate against the window that covers the period, a re-derived tax against the number filed, a filing against the calendar -- which a deterministic control settles better than a spreadsheet inherited by whoever prepares the returns this year. This engine audits the tax return; where a cost lands on a project is a separate engine's job, and this one explicitly declines to check it.

The seeded demo runs every control over every reconciliation file7. The CLI generates twenty-nine fictional reconciliation files -- one clean baseline and one carrying each of the twenty-eight planted defects -- then runs all twenty-seven controls over each. The clean file returns PASS with no flags; every defect file returns REVIEW or FAIL and names the control it tripped along with the reason that control exists.

A rate that was right last quarter is wrong for this period8. A boundary test sets a classification rate window to change mid-year and files a worksheet for a period inside the new window at the prior window's rate. eff_rate_matches_period looks up the rate whose window covers the period's start date and fails because the worksheet applied a rate no longer in force, even though the tax computed on it re-derives internally -- a rate right one quarter and stale the next is invisible in a column of consistent arithmetic.

The determination is recomputed, not read back9. A test flips a summarised tax-due figure to contradict its worksheet's receipts. rpt_summary_recomputes rebuilds the tax from the worksheet's gross, back-out and standard deduction through the shared kernel -- base, rate, credit and net -- and fails because the stated determination no longer matches the receipts, proving the rollup is recomputed rather than trusted.

Functional block diagram

engineering · each block links to its source
Functional block diagram of the Gross-Receipts & Excise Tax engine reconciliation files complete complete complete complete complete complete complete complete complete complete resolves resolves resolves resolves resolves resolves resolves resolves resolves re-derived tax re-derived tax findings findings findings findings findings findings findings findings findings findings findings SeededReconciliation Files StructuralPrecondition Entity Register JurisdictionRate Table GL Revenue Pull Filing Register Rate in Force Tax Re-derivation Deductions & Credits Filing Calendar Business Licence Portfolio Rollup Registers & Rate Table Verdict and Findings SFS-E24-GRT · FUNCTIONAL BLOCK DIAGRAM · REV 2026-07-24

Plain terms

  • Seeded Reconciliation Files. fictional gross-receipts & excise tax reconciliation files enter the control registry
  • Structural Precondition. is the reconciliation file complete and the review date legible
  • Entity Register. is the register sound and every filing scope declared
  • Jurisdiction Rate Table. is the cadence known and every rate window sound
  • GL Revenue Pull. is the pull sound, attributable, mapped, and does the base tie it
  • Filing Register. is every worksheet well-formed, unique per obligation and attributable
  • Rate in Force. was the rate the worksheet used the rate in force for the period
  • Tax Re-derivation. does the tax re-derive from base times rate, net of credit
  • Deductions & Credits. do the base, the back-out and the credit follow the rules
  • Filing Calendar. is every expected filing present, timely and approved
  • Business Licence. is each licence active, and any renewal flagged
  • Portfolio Rollup. does the rollup recompute from the worksheets
  • Registers & Rate Table. the entity register, rate table, GL pull and worksheets every rule resolves against
  • Verdict and Findings. every finding, with the reason it exists, ends at a person

Engineering

  • Seeded Reconciliation Files. generate_corpus writes one clean baseline plus one planted-defect file for every registered control, twenty-nine files in total. Only the entities, the jurisdiction rate table, the GL revenue lines and the worksheet calendar facts are stated; each worksheet's gross, back-out, base, rate, pre-credit tax, credit and tax due, the per-filing tax summary and the portfolio totals are derived through the same tax kernel the engine later recomputes with, so the relationships the engine tests are the same relationships that produced the data.
  • Structural Precondition. One control. FAILs a file missing any of the seven artifact types or carrying a duplicate, and FAILs an unreadable as_of, so no downstream rule holds vacuously on absent evidence.
  • Entity Register. Two controls: unique entity ids, and every active entity declaring a non-empty set of filing jurisdictions that all exist in the jurisdiction register.
  • Jurisdiction Rate Table. Two controls: a known cadence and a classification on every jurisdiction, and rate windows that run forward with a non-negative basis-point rate.
  • GL Revenue Pull. Five controls: required fields present, unique line ids, a known entity and jurisdiction on every line, every line mapped to a worksheet, and each worksheet's gross summing the GL lines under it.
  • Filing Register. Three controls: required descriptive fields present, one worksheet per obligation with a unique id, and a known entity and jurisdiction for every worksheet.
  • Rate in Force. One control: the classification rate whose window covers the period's start date is looked up and compared to the rate the worksheet applied, catching a stale rate and an uncovered period.
  • Tax Re-derivation. Two controls: the pre-credit tax equals the base struck at the rate, and the tax due equals the pre-credit tax net of the credit clamped at zero, both compared with exact ==.
  • Deductions & Credits. Three controls: the base re-derives from gross less back-out less standard deduction, the back-out ties the ledger, and the credit re-derives from the jurisdiction's threshold and small-business schedule.
  • Filing Calendar. Four controls: every expected filing enumerated and present, filed on or before its due date, flagged when unfiled and due soon, and approved before it was filed.
  • Business Licence. Two controls: every active entity holds an active licence in each jurisdiction it files in, and an active licence renewing inside the lead window is flagged for renewal.
  • Portfolio Rollup. Two controls: each summarised tax-due figure re-derives from the worksheet's receipts through the shared kernel, and the portfolio total and filing count tie the summary.
  • Registers & Rate Table. The entity register carries each entity's id, status and required jurisdictions; the jurisdiction rate table carries each jurisdiction's cadence, classification, rate windows, threshold and small-business cap and the periods expected this cycle; the GL revenue pull carries the receipts lines; the filing register carries the worksheets. Revenue, rate, deduction, calendar and rollup controls all resolve against these, and the tax for a worksheet re-derives from its gross, back-out and standard deduction through the one kernel in grt_engine.grt.
  • Verdict and Findings. Findings roll up per reconciliation file: 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
regenerate the seeded fictional corpus, run all twenty-seven controls, write both reportsper-file verdicts and every actionable finding, then the overall verdict2 for the bundled corpus, which carries a planted defect for every control by designgrt_report.json, grt_report.md, samples/
python -m grt_engine samples
analyze an existing folder of reconciliation files without regenerating itper-file verdicts and findings0 PASS / 1 REVIEW / 2 FAIL / 3 usagenone unless --json or --md is passed
python -m grt_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 grt_engine/tests -q
run the full test suite for this engine10400 passed0 when every test passesnone

Benchmarks

measured demo results
MeasureResult
Engine tests1010,400 tests collected
live collection from the engine directory
Registered controls1127 controls
counted from the registry, not from documentation
Planted defects1228 defect files
every registered control has at least one file that trips it
Control coverage13100 percent of controls with a planted defect
no control ships without a file 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 whether a worksheet is treated as filed correctly and whether a return or renewal is chased.

Engineering

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

Demo gate. FAIL on the bundled corpus, by design -- it carries a planted defect for every registered control

SeverityVerdictAction
No findings above PASSPASScarry the mechanically clean reconciliation file into the documented sign-off and filing review
One or more FLAG, no FAILREVIEWa human resolves each flag; an unfiled worksheet due inside the lead-time window and a business licence due to renew inside it both land here
One or more FAILFAILthe worksheet is not treated as filed correctly until the failing control is cleared -- a base off the ledger, a stale rate, a misapplied deduction or credit, a missing, late or unapproved filing, or a rollup that does not recompute

Operating limits

what it refuses to do

See it run

control architecture
Corporate obligation-matrix architecture for Gross-Receipts & Excise Tax: entity and document records pass through jurisdiction and policy controls to verified reporting evidence.
The Gross-Receipts & Excise Tax engine tile states the question that has to hold worksheet by worksheet: every base tied to the GL pull, struck at the rate in force for the period, net of the deductions and credits the jurisdiction's rules allow, tied to the cent to the number filed, with the filing calendar complete, timely and approved and a portfolio rollup that recomputes from the worksheets beneath it.

Integration

how to run it

Distribution: public repository, MIT license.

python run.py
python -m pytest grt_engine/tests -q
Source on GitHub Engine README All tests, by engine Run in Codespaces
Substantiation
  • 1python -m pytest --collect-only -q -o addopts= (gross-receipts-tax-automation/)
  • 2len(grt_engine.engine.REGISTRY)
  • 3distinct rule-id prefixes in grt_engine.engine.REGISTRY
  • 4samples/*.json after python run.py
  • 5len(grt_engine.model.DOC_TYPES)
  • 6grt_engine/tests/test_control_semantics.py::test_tax_due_recomputes_to_the_cent
  • 7python run.py (gross-receipts-tax-automation/); grt_engine/tests/test_planted_defects.py::test_defect_fires_its_intended_rule
  • 8grt_engine/tests/test_control_semantics.py::test_rate_in_force_at_the_window_boundary
  • 9grt_engine/tests/test_control_semantics.py::test_summary_must_recompute_from_receipts
  • 10python -m pytest --collect-only -q -o addopts= (gross-receipts-tax-automation/)
  • 11len(grt_engine.engine.REGISTRY)
  • 12len(grt_engine.generate.DEFECTS)
  • 13grt_engine/tests/test_planted_defects.py::test_every_registered_rule_has_a_planted_defect
  • 14gross-receipts-tax-automation/README.md and grt_engine/tests/test_readonly_and_determinism.py::test_analysis_does_not_touch_the_source
  • 15grt_engine/model.py DOC_TYPES
  • 16grt_engine/engine.py module docstring (Scope)
  • 17grt_engine/engine.py check_eff_rate_matches_period
  • 18grt_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