Engineering 9 min

Multi-state statutory compliance is a rules engine, not a spreadsheet

Written by

Akash Kurup

Statutory logic that is correct today and wrong next April is not correct. Temporal versioning, not conditional branching, is what makes multi-jurisdiction compliance maintainable.

A note on scope before the design. What follows is about computing statutory figures from payroll data that already exists, not about running payroll. The payroll system stays where it is; what we are building is the layer that turns its output into registers somebody will sign.

Why the obvious implementation rots

Multi-state statutory logic usually starts as conditional code. A branch for each state, a branch for each employee category, a branch for the year the rule changed. It works, and then it accumulates. Within a few years the professional tax function is two hundred lines nobody will touch, and the only person who understands the interaction between a mid-year transfer and a retrospective revision has left.

The deeper problem is that this design cannot answer the question auditors actually ask, which is not "what does an employee earn" but "what did this employee earn in August of last year, under the rules in force then, and why".

Rules as versioned data

Statutory rules are data with a validity period. Modelling them as anything else guarantees the rot.

{
  "rule_id": "pt.mh.slab",
  "jurisdiction": "MH",
  "component": "professional_tax",
  "effective_from": "2026-04-01",
  "effective_to": null,
  "applies_to": { "employment": ["permanent", "contract"] },
  "slabs": [
    { "upto": 7500,  "amount": 0 },
    { "upto": 10000, "amount": 175 },
    { "upto": null,  "amount": 200, "february_override": 300 }
  ],
  "source": "MH PT Act, Schedule I, as amended 2026-04-01"
}

Rules are selected by jurisdiction and by the date of the period being computed, never by the date the calculation runs. A rerun of an August period in December must produce the August answer. Every rule carries a citation to the instrument it came from, because in an inspection the number is only half the answer.

The calculation is a dependency graph

Components depend on each other, and the order is not arbitrary. Provident fund depends on a wage definition that itself excludes certain allowances. Employee state insurance depends on gross, subject to a threshold with its own contribution-period rules. Tax deducted at source depends on projected annual income, which depends on everything else and on declarations that arrive late.

We express this as an explicit directed acyclic graph and topologically sort it. Two properties follow that a procedural implementation does not give you. Adding a component is a local change rather than an exercise in finding the right place in a long function. And every computed value can name its inputs, which is what makes a register explainable line by line.

Retrospection is the normal case

Arrears, backdated promotions, late attendance corrections and retrospective statutory revisions are not edge cases, they are most months. Recomputing from scratch and paying the difference is wrong, because statutory contributions in the original period were computed and remitted under the rules of that period.

Every run is therefore immutable and identified. A correction produces a new run that references the original, and the delta is attributed to the period it belongs to rather than the period it was discovered in. The register for August continues to show what was actually filed for August, with the correction visible as a correction.

Testing something that must not be wrong

  • Golden cases per jurisdiction, derived from worked examples in the statute, run on every change.
  • Property tests. Contributions never exceed statutory ceilings. A register total always equals the sum of its rows. The sum of component-wise deltas equals the run-level delta.
  • Replay. Every historical run recomputes to a byte-identical result. This is the test that catches an accidentally retroactive rule edit, and it is the most valuable one in the suite.
  • Boundary dates. Rules that change on the first of April, employees who transfer mid-period, and February, which has its own professional tax behaviour and reliably breaks naive implementations.

The payoff

When a state revises a slab, the change is a new rule record with an effective date. No code change, no regression risk to other jurisdictions, and the historical registers stay exactly as they were filed. That is the whole argument for treating statutory computation as a rules engine, and it is worth the additional design cost the first time.

Frequently asked questions

Why is multi-state statutory compliance challenging with traditional methods?

Traditional multi-state statutory compliance often relies on conditional code that quickly becomes complex and unmaintainable. This approach struggles to answer historical queries accurately, as it doesn't track rule changes over time. When rules change or employees transfer, the system can become fragile and difficult to update without introducing errors.

How does AKINO Labs propose modelling statutory rules for compliance?

AKINO Labs models statutory rules as versioned data, each with a specific validity period. Rules are selected based on the jurisdiction and the exact date of the period being computed, not the current date. This ensures that historical calculations always reflect the rules in force at that specific time, making compliance maintainable and auditable.

What is the main advantage of using a rules engine for statutory compliance?

The main advantage is that statutory rule changes become data updates, not code modifications. When a state revises a rule, a new rule record with an effective date is added. This eliminates code changes, reduces regression risk across other jurisdictions, and ensures historical registers remain accurate as originally filed, simplifying maintenance and audits.

How does a statutory rules engine handle retrospective payroll adjustments?

A statutory rules engine treats every calculation run as immutable and identified. Retrospective adjustments, such as arrears or backdated promotions, result in a new run that references the original. The delta is attributed to the period it belongs to, ensuring the original register for that period remains unchanged, with corrections clearly visible as separate adjustments.

Sources and further reading

  1. Profession tax, Maharashtra. Maharashtra Goods and Services Tax Department. Administers profession tax under the Maharashtra State Tax on Professions, Trades, Callings and Employments Act, 1975, the schedule the example rule in this article models.
  2. Employees' Provident Fund Organisation. Ministry of Labour and Employment, Government of India. Publishes the provident fund contribution rules and returns that sit alongside each state's levies in a multi-state payroll.

0 comments

2000 characters left

Loading comments
Buy what exists. Build what doesn't.

Want this applied to your own operation?

A working session on your own estate, with a prioritised view of what to build, what to buy and what to leave alone.

Or speak to us directly
Kinjal DesaiFarhad WadiaHemang ShahMonesh ShahaniHeld by a principal. We respond within one business day.