ENGINE 10
SFS-E10-APX · PAYABLES CONTROLS · REV 2026-07-21 · PRODUCTION
PRODUCTION = runnable end-to-end, CI-backed, full test suite passing. All data fictional and seeded.
Accounts Payable
The payables cycle proved rather than assumed
Accounts payable is where controls are asserted most often and proven least often. This engine reads the fixed-format posting artifacts the cycle already emits and runs thirty deterministic controls over them: did the post actually happen and balance, is this payment allowed to be released yet, is every job routed to a valid approver chain with duties segregated, and will year-end information reporting be complete. It never posts, never pays, and never writes to a source artifact. Every exception it raises ends at a person.
A control engine is only credible if it can be wrong in public. This one ships the defects it claims to catch: one planted defect per registered control, each of which must trip its own control and leave the other twenty-nine silent. The benchmark is a command, not a claim.
Architecture
functional block stack · static overviewSelect a layer
Six control families run in registry order over each document set. The first proves the others had something to read.
Key specifications
at a glanceWhat it does for you
plain termsThree payables failures recur across the industry and all three are invisible to the people running the cycle. A posting run aborts on batch contention and is filed as though it succeeded -- the report still balances, because nothing moved. A payment is released through an open compliance gate: no taxpayer certificate on a first payment, waivers missing from a subcontractor's lower tiers, insurance expired before the payment date. And a routing matrix drifts until a job maps to no workflow, or one person holds both data entry and final review. Each is deterministic to detect from artifacts that already exist, and none of them needs a model's judgment.
The seeded demo runs every control over every document set7. The CLI generates thirty-one fictional document sets -- one clean baseline plus one planted defect per control -- and runs all thirty controls over each. The clean set reports PASS with every control held; each defective set reports the exact control it was built to trip. The run exits 2 because the corpus deliberately contains failures.
Absent evidence must not read as a passing control8. One fixture removes an entire artifact type from its document set. Every control that reads that artifact returns nothing, which without a structural precondition would render as a clean result. The set_complete control is registered first and fails the set, so the report opens with proof that the controls below it had something to read.
Every control must prove both of its sides9. Each of the thirty controls is exercised against its own planted defect, which it must catch, and against the clean baseline, where it must stay silent. A coverage test asserts the planted-defect set and the registry are the same set, so a control cannot be added without a fixture that exercises it, and an implementation that always passes or always fails cannot satisfy the suite.
Functional block diagram
engineering · each block links to its sourcePlain terms
- Seeded Document Sets. fictional posting document sets enter the control registry
- Structural Precondition. proves the controls below had something to read
- Posting Integrity. did the post happen, and did it balance
- Payment Release Gate. is this payment allowed out yet
- Routing and Duties. does every job reach a real approver, with duties split
- Information Reporting. will year-end reporting be complete
- Commitment Hygiene. do commitments mirror their contracts
- Findings. each control yields a finding carrying its own rationale
- Verdict. one verdict per document set, worst finding wins
- Human Gate. a person decides; the engine has no write path
Engineering
- Seeded Document Sets. generate_corpus writes one clean baseline plus one planted defect per registered control from a single seeded Random instance
- Structural Precondition. check_set_complete -- FAILs when any of the five artifact types is absent
- Posting Integrity. eight controls: proof, ledger recap, posting totals, rejects, posted count, error markers, job-cost tie, header date
- Payment Release Gate. eight controls: taxpayer certificate, waivers, insurance currency and limits, funding, duplicates, retention, off-cycle approval
- Routing and Duties. five controls: job mapping, approver presence, final-review group, duty segregation, declared direct-post
- Information Reporting. five controls: threshold coverage, identifier presence and structure, split-vendor detection, filed-count reconciliation
- Commitment Hygiene. three controls: schedule of values not a lump line, identifier convention, change-order attachment
- Findings. frozen Finding(rule, status, location, message); location is doc_type:document_id/field path and the message states why the control exists
- Verdict. any FAIL rolls up to FAIL; otherwise any FLAG rolls up to REVIEW; otherwise PASS. The process exit code carries the same verdict.
- Human Gate. the engine emits markdown and JSON only. It holds no connection to a ledger, payment provider or approval system, so nothing it produces can post or pay.
Instruction set
every public command| Command | Operation | Output | Exit | Artifacts |
|---|---|---|---|---|
python run.py | generate the seeded fictional corpus, run all thirty controls, write both artifacts | per-document-set verdicts and every actionable finding, then the overall verdict | 2 for the bundled corpus, which carries one planted defect per control | ap_report.md, ap_report.json, samples/ |
python -m ap_engine ./samples | analyze an existing folder of document sets, read-only | per-document-set verdicts and findings | 0 PASS, 1 REVIEW, 2 FAIL, 3 usage or IO error | none |
python -m ap_engine ./samples --quiet | print only the overall verdict line | a single overall verdict line | 0 PASS, 1 REVIEW, 2 FAIL, 3 usage or IO error | none |
python -m pytest -q | run the curated suite exactly as CI does | 12,223 passed | 0 | none |
Benchmarks
measured demo results| Measure | Result |
|---|---|
| Engine tests10 | 12,223 tests collected live collection from the engine directory |
| Curated invariant grid11 | 1,977 parametrized cases bounded arithmetic and verdict identities, asserted exactly over integers |
| Planted-defect cases12 | 152 cases every control against its own defect and against a clean baseline |
| Opt-in property sweep13 | 99,223 tests collected the exhaustive grid, gated behind SWEEP=1 so it never slows CI |
Control characteristics
engineeringPlain terms
The engine has no write path and therefore no autonomy to gate. A verdict is an input to a person's decision, never a substitute for it: posting, payment release and approval all remain outside the engine, and no finding it raises is actioned without review.
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 control
| Severity | Verdict | Action |
|---|---|---|
| No findings above PASS | PASS | send the mechanically clean result to the documented manual gates |
| One or more FLAG, no FAIL | REVIEW | route the flagged items to a person for judgment; do not treat as cleared |
| One or more FAIL | FAIL | hold the affected posting or payment and resolve at source before re-running |
- Money is integer cents everywhere and is compared with exact equality; there is no tolerance band anywhere in this engine, and a non-integer amount is rejected rather than coerced.
- The engine is read-only: source artifacts are hashed before and after a run and asserted byte-identical, so it is structurally incapable of introducing the defects it looks for.
- One planted defect exists per registered control, and a coverage test asserts the two sets are identical, so a control cannot be added without a fixture that exercises it.
- The structural precondition control runs first, so a document set missing an artifact type cannot report as clean simply because the controls that read it never ran.
- The package declares no runtime dependencies; the optional workbook rendering is behind a guarded import and never byte-compared.
Operating limits
what it refuses to do- The engine never posts, releases a payment, drafts a journal entry, creates an import payload, or mutates a source system. It has no connection to a ledger, payment provider or approval system.14
- A PASS verdict means the implemented mechanical controls found nothing; it is not sign-off, audit assurance, or authorization to pay.15
- The engine reads structured document sets, not scanned images. There is no optical character recognition, and an artifact with no machine-readable content is reported as unclassifiable rather than guessed at.16
- There is no remediation loop. Resyncing to authority and booking adjustments is a mutation, which a read-only control engine must not perform; this engine is a sensor other loops consume.17
- All shipped data is fictional and seeded. The engine names no commercial software product and carries no real vendor, entity, person, or document identifier.18
See it run
brand animation
Integration
how to run itDistribution: public repository, MIT license.
- 1python -m pytest --collect-only -q -o addopts= (accounts-payable-automation/); 12,223 tests collected on 2026-07-21 and pinned in site-datasheets/counts.json
- 2accounts-payable-automation/ap_engine/engine.py REGISTRY; mirrored in the rule-registry table of accounts-payable-automation/README.md
- 3accounts-payable-automation/ap_engine/engine.py RULE_FAMILIES
- 4accounts-payable-automation/ap_engine/generate.py DEFECTS; test_checks_coverage.py asserts the defect set equals the registry
- 5accounts-payable-automation/ap_engine/model.py DOC_TYPES
- 6accounts-payable-automation/ap_engine/tests/test_readonly_and_determinism.py -- source artifacts are hashed before and after a run and asserted byte-identical
- 7python run.py (accounts-payable-automation/); output re-run on 2026-07-21; committed as accounts-payable-automation/ap_report.md
- 8accounts-payable-automation/ap_engine/engine.py check_set_complete; fixture in generate.py _defect_set_incomplete; asserted in ap_engine/tests/test_generate_and_cli_coverage.py
- 9accounts-payable-automation/ap_engine/tests/test_planted_defects.py (152 cases) and test_checks_coverage.py
- 10python -m pytest --collect-only -q -o addopts= (accounts-payable-automation/); re-run 2026-07-21 and pinned in site-datasheets/counts.json
- 11accounts-payable-automation/ap_engine/tests/test_curated_invariant_grid.py
- 12accounts-payable-automation/ap_engine/tests/test_planted_defects.py
- 13SWEEP=1 python -m pytest --collect-only -q -o addopts= (accounts-payable-automation/); re-run 2026-07-21
- 14accounts-payable-automation/README.md and ap_engine/tests/test_readonly_and_determinism.py
- 15accounts-payable-automation/README.md -- verdict roll-up; site-datasheets/specs/ap.json control_characteristics.plain
- 16specs/2026-07-21-ap-engine-design.md -- Out of scope
- 17specs/2026-07-21-ap-engine-design.md -- Architecture; accounts-payable-automation/README.md -- What this demonstrates
- 18accounts-payable-automation/README.md confidentiality note; finance-atlas/atlas_tests/test_deny_list.py repo-sweep surface
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