ENGINE 48
SFS-E48-TBR · WORKPAPER ROLLFORWARD · REV 2026-07-27 · PRODUCTION
PRODUCTION = runnable end-to-end, CI-backed, full test suite passing. All data fictional and seeded.
Trial-Balance Roll-Forward
Every column rebuilt from the extract's declared balance column, and every figure linked to its backup.
Once a fiscal year the group rebuilds a workpaper it does not maintain in between: one column per entity, carried forward from last year's structure and repopulated from the year-end trial-balance extract. Entities dissolve and lose their columns, entities are renamed and must be carried exactly once, entities are formed and arrive with a registration date that starts their first period. This engine reads the seven artifacts that cycle emits -- the entity register, last year's structure, the year-end extract, the chart-equivalence map, the populated workpaper, the embedded backup tab and the second rendered format -- and runs twenty-four deterministic controls over them. Is the file complete and the fiscal window readable, are the entity ids unique and every column entity's book present, were only code-position rows harvested, does every book in the extract foot to zero, was any column populated from the monthly-activity column instead of the balance column, did final-year entities lose their columns, was each rename carried once, are first-year entities registered inside the window, does the column set equal the register both directions, does every nonzero book balance land in a row, does every nonzero cell trace back to the extract, does every cell equal its re-derivation to the penny, does each dual-chart row sum every code it collects through the equivalence map, is a duplicated row code zero on its later instance, does every column foot to zero, does the eliminations range cover every column, does the combined column foot, is the backup tab complete and titled from the source's title column, does every figure link to a backup row that agrees with it, do both rendered formats match, and does the fixed annual fee follow entity status. Every comparison is exact == in integer cents, every date is tested against the fiscal window the file carries rather than the system clock, and no source artifact is ever written.
The failure modes of an annual roll-forward all share one property: the workpaper still balances. That is what makes them survive review. A column populated from the extract's monthly-activity column rather than its balance column foots to zero exactly the way a real column does, because activity nets to zero too -- so the footing check, the reviewer's whole defence, passes while the column carries movement instead of balances. A retained-earnings balance riding a legacy chart code disappears the moment the equivalence is dropped, and both sides still foot. An eliminations range written over last year's structure keeps evaluating happily after two columns are inserted beyond its end. A backup tab built from the source's category column instead of its title column reads plausibly forever -- Cash, Equity -- and reconciles to nothing anybody can look up. None of these announce themselves; all of them are found only by re-derivation. So the engine locates every column it reads by its declared role rather than its position, re-derives the whole grid from the extract through one kernel the generator also imports, sweeps completeness in both directions, and ships a planted-defect file for every registered control -- including one that proves the footing check genuinely cannot catch the activity-column substitution, because if it could, the control would be redundant.
Architecture
functional block stack · static overviewSelect a layer
Twelve control families run in registry order over each workpaper file. The first proves the others had something to read and that the fiscal window is legible, because a control that passes on absent evidence reports assurance it never performed.
Key specifications
at a glanceWhat it does for you
plain termsOnce a fiscal year the group rebuilds a workpaper it does not maintain in between: one column per entity, carried forward from last year's structure and repopulated from the year-end trial-balance extract. Entities dissolve and lose their columns, entities are renamed and must be carried exactly once, entities are formed and arrive with a registration date that starts their first period. Five failures hide inside that, and they share the property that makes them dangerous: the workpaper still balances. First, a column is populated from the wrong source column -- some books carry a monthly-activity figure beside the balance, and a harvest that reads by position takes movement instead of balances; activity foots to zero exactly the way balances do, so the column self-balances and the reviewer's whole defence passes. Second, a balance rides an equivalent chart code and disappears: two charts share one workpaper row, and dropping the equivalence strands a retained-earnings balance on a code the sheet displays but the sum ignores, while every column still foots. Third, the eliminations range excludes this year's columns, because a range written over last year's structure keeps evaluating without error after columns are inserted beyond its end. Fourth, the backup tab quotes the source's category column instead of its title column, so the evidence a reviewer lands on reads plausibly and reconciles to nothing. Fifth, the two rendered formats drift, and a repair applied to one leaves the other in circulation. Which return each entity owes is a separate engine's question. This is the workpaper underneath that filing, and none of it is a judgment call: it is a column located by its declared role, a sum against its constituent codes, a set compared in both directions, a range against a column list, and a figure against the row it links to -- which a deterministic control settles better than a sheet rebuilt each July.
The seeded demo runs every control over every workpaper file7. The CLI generates twenty-seven fictional workpaper files -- one clean baseline and one carrying each of the twenty-six planted defects -- then runs all twenty-four 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 column populated from the activity column still foots, and is caught anyway8. One planted defect repopulates the parent column from the book's monthly-activity column instead of its balance column, then rebuilds the combined column and the twin from those same wrong figures, exactly as a real workpaper would. The column still sums to zero, so the footing control stays silent -- a test asserts that silence, because if the footing check could catch this the basis control would be redundant. src_balance_basis catches it by re-deriving what the column would carry if populated from activity and finding that every differing row matches.
A dropped chart equivalence strands a balance while everything still balances9. The workpaper carries retained earnings on a legacy code that the chart map equates to the book's current code. One planted defect empties the equivalence list. The balance is then collected by no row at all -- and both the book and the column still foot, because the balance simply never arrives. Only the forward completeness sweep, which enumerates every nonzero book balance and asks which row collected it, reports the loss.
Functional block diagram
engineering · each block links to its sourcePlain terms
- Seeded Workpaper Files. fictional annual roll-forward files enter the control registry
- Structural Precondition. is the file complete and the fiscal window legible
- Entity Register. is the confirmed population sound
- Source Extract. was the right column of the right rows harvested
- Roll-Forward Scope. does this year's column set match the confirmed population
- Mapping and Re-derivation. does every cell tie the extract, both directions
- Column Footing. does every column sum to zero
- Eliminations and Combined. is every column eliminated and does the total foot
- Backup and Links. can a reviewer land on the evidence for any figure
- Twins and Fees. do both rendered formats agree, and does the fee follow status
- Registers, Extract & Map. the artifacts and roles every rule resolves against
- Verdict and Findings. every finding, with the reason it exists, ends at a person
Engineering
- Seeded Workpaper Files. generate_corpus writes one clean baseline plus one planted-defect file for every registered control, twenty-seven files in total. Only the entity register, the prior structure, the extract books and the chart map are stated; the whole populated grid, every link, the backup tab, the combined column and the twin export are re-derived through the same kernel the engine later recomputes with, so the relationships the engine tests are the relationships that produced the data. The corpus deliberately puts real rows on the edges that matter: the parent book carries a monthly-activity column whose figures also net to zero, one workpaper row is shared by two charts of accounts, one row code appears twice, and one book is entirely empty.
- Structural Precondition. One control. FAILs a file missing any of the seven artifact types or carrying a duplicate of one, and FAILs an absent, unreadable or backwards fiscal window, so no downstream rule holds vacuously on absent evidence.
- Entity Register. Two controls: entity ids are unique, statuses are known, every column entity names a book the extract carries, and a first-year entity registered late into the window is flagged so the preparer gets its real first-period start.
- Source Extract. Three controls: only code-position rows reach the backup, every book foots to zero, and no column was populated from a book's monthly-activity column instead of its balance column -- the substitution that self-balances and therefore survives every footing check.
- Roll-Forward Scope. Four controls: final-year entities lost their columns, each rename is carried exactly once, first-year entities are registered inside the fiscal window, and the column set equals the register's column population as exact set equality in both directions.
- Mapping and Re-derivation. Five controls: every nonzero book balance lands in a row, every nonzero cell traces back to a book, every cell equals its re-derivation to the penny, every dual-chart row sums all the codes it collects through the equivalence map, and a duplicated row code is zero on its later instance.
- Column Footing. One control, necessary but deliberately not sufficient: the failures this engine exists for all foot to zero, which is why the basis and mapping controls run beside it rather than behind it.
- Eliminations and Combined. Two controls: the declared eliminations coverage includes every entity column -- a range that ends at last year's final column silently excludes this year's additions -- and the combined column is re-struck row by row from the cells and eliminations beneath it.
- Backup and Links. Three controls: the backup tab carries every mapped account once at the extract's own balance, every title comes from the source's title column rather than its category column, and every nonzero figure links to a backup row that exists and agrees with it.
- Twins and Fees. Two controls: the two rendered exports of the workpaper carry identical values cell by cell, and the fixed annual fee is owed in full by continuing and first-year entities and is exactly zero for final-year and excluded ones.
- Registers, Extract & Map. The entity register carries each entity's id, name, status, book code, registration date where the entity is new and the fee it is shown as owing; the prior structure carries last year's column list and this year's renames; the source extract carries each book's declared column roles and its rows in code or memo position, each with an account, a title, a category and a balance -- and, for books that have one, a monthly-activity figure; the chart map carries the equivalences between the workpaper's canonical row codes and a book's own; the workpaper carries its columns, its rows, every cell with its link, the eliminations coverage and the combined column; the backup tab carries one flat row per mapped account; and the file itself carries the fiscal window, the fixed fee and the short-period review band. Every control resolves against these through the shared kernel in rollforward_engine.workpaper, which locates each column by its declared role rather than its position.
- Verdict and Findings. Findings roll up per workpaper 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 -- a change in the diff is a change in the controls, not a change in when the report was run.
Instruction set
every public command| Command | Operation | Output | Exit | Artifacts |
|---|---|---|---|---|
python run.py | regenerate the seeded fictional corpus, run all twenty-four controls, write both reports | per-file verdicts and every actionable finding, then the overall verdict | 2 for the bundled corpus, which carries a planted defect for every control by design | rollforward_report.json, rollforward_report.md, samples/ |
python -m rollforward_engine samples | analyze an existing folder of workpaper files without regenerating it | per-file verdicts and findings | 0 PASS / 1 REVIEW / 2 FAIL / 3 usage | none unless --json or --md is passed |
python -m rollforward_engine samples --generate --quiet | regenerate the corpus and print only the overall verdict | a single verdict line | 0 PASS / 1 REVIEW / 2 FAIL / 3 usage | samples/ |
python -m pytest rollforward_engine/tests -q | run the full test suite for this engine | 10405 passed | 0 when every test passes | none |
Benchmarks
measured demo results| Measure | Result |
|---|---|
| Engine tests10 | 10,405 tests collected live collection from the engine directory |
| Registered controls11 | 24 controls counted from the registry, not from documentation |
| Planted defects12 | 26 defect files every registered control has at least one file that trips it |
| Control coverage13 | 100 percent of controls with a planted defect no control ships without a file demonstrating it firing |
Control characteristics
engineeringPlain terms
The engine has no write path and therefore no autonomy to gate. It produces findings; a person decides whether the workpaper goes to the preparer.
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
| Severity | Verdict | Action |
|---|---|---|
| No findings above PASS | PASS | carry the mechanically clean workpaper into the documented preparer review and sign-off before it is sent out |
| One or more FLAG, no FAIL | REVIEW | a human resolves each flag; a genuinely empty column and a first-year entity whose registration implies a short first period both land here |
| One or more FAIL | FAIL | the workpaper does not go to the preparer until the failing control is cleared -- a column off its extract, a balance collected by no row, a column outside the eliminations range, a backup that does not tie, a dead or disagreeing link, or two rendered formats that differ |
- Read-only: workpaper files are parsed and never written back, so the engine cannot introduce the break it reports.
- Integer cents throughout, compared with exact ==; there is no tolerance band on a cell, and a penny off the re-derivation is reported as a break.
- Every column is located by its declared role rather than its position -- the balance column by its role and the title column by its role -- because reading by position is the single error that produces all of the failures that still foot.
- One derivation kernel: the controls and the generator share rollforward_engine.workpaper, so a populated cell cannot disagree with the logic that produced it, and forward and reverse completeness cannot disagree about the same balance.
- A column populated from a monthly-activity column self-balances, and the suite asserts that the footing control stays silent on it -- so the basis control is proved to be doing work the footing check cannot.
- Completeness is swept in both directions: every nonzero book balance must land in a row, and every nonzero cell must trace back to a book.
- A dual-chart row carries the sum of every code it collects through the equivalence map, and each book code is consumed by exactly one row, so a balance can neither be stranded nor counted twice.
- A figure that should be integer cents but is not produces an AMOUNT_INVALID finding contained to the one cell it was read on, rather than being coerced into the number the engine is meant to audit.
- Every registration date is tested against the fiscal window the file carries, never against the system clock, so a run in a later year returns the same findings.
- Deterministic and byte-stable: same inputs produce the same findings in the same order, with no timestamps or absolute paths in any output.
- Absent evidence is never a passing control; a missing artifact fails completeness rather than letting the controls that read it pass unread.
Operating limits
what it refuses to do- The engine never populates a workpaper, files a return, pays a fee or writes to a source artifact. It reads the workpaper file and stops.14
- It reads the seven artifacts the annual roll-forward emits. It does not connect to a general ledger, a spreadsheet, an entity-management system or any tax authority's filing channel.15
- It does not decide which return an entity owes or when it is due. That is a filing-calendar question and a separate engine's; this engine is the workpaper the filing is prepared from and nothing more.16
- It audits the extract it is given. If a book is missing from the extract entirely, the register control reports the column that names it, but the engine cannot know that a book which is present is complete -- only that it foots and that the workpaper ties to it.17
- It applies the statuses, the fixed fee and the review band the file itself carries; it does not decide whether an entity's status is correct in law or whether the fee is the figure the jurisdiction currently charges. All shipped data is fictional -- the groups, entities, books, chart codes, balances and dates are invented, and the fiscal year is set in a fictional future.18
See it run
brand animationIntegration
how to run itDistribution: public repository, MIT license.
- 1python -m pytest --collect-only -q -o addopts= (tb-rollforward-automation/)
- 2len(rollforward_engine.engine.REGISTRY)
- 3distinct rule-id prefixes in rollforward_engine.engine.REGISTRY
- 4samples/*.json after python run.py
- 5len(rollforward_engine.model.DOC_TYPES)
- 6rollforward_engine/tests boundary tests on the cent and the day
- 7python run.py (tb-rollforward-automation/); rollforward_engine/tests planted-defect suite
- 8rollforward_engine/tests test_activity_column_defect_still_self_balances and test_the_activity_column_also_foots_to_zero
- 9rollforward_engine/tests test_a_balance_collected_by_no_row_is_reported
- 10python -m pytest --collect-only -q -o addopts= (tb-rollforward-automation/)
- 11len(rollforward_engine.engine.REGISTRY)
- 12len(rollforward_engine.generate.DEFECTS)
- 13rollforward_engine/tests: every registered rule has a planted defect
- 14tb-rollforward-automation/README.md and rollforward_engine read-only / determinism tests
- 15rollforward_engine/model.py DOC_TYPES
- 16tb-rollforward-automation/README.md scope statement
- 17rollforward_engine/engine.py check_reg_entities_valid and check_src_books_self_balance
- 18rollforward_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