One function

apply_setoff in shivprime94/file-itr

The author described this change as fix(itr-engine): expire unabsorbed BF capital loss on last usable AY (#25). It counts as a record because the check below fails on the code as it stood at e34e2c23a and passes on f57b975ca, with nothing else changed between the two runs.

Fix saved2026-08-01
Sharing licenceMIT · LICENSE
Change size+11 2

What the code was meant to do, written into the code itself as a docstring

Statutory set-off & carry-forward over classified income (Phase 2). Works per item (not from bucket_income totals) because s.115BBH(2)(b) quarantines each VDA loss individually — netting inside the VDA bucket would be an illegal set-off. NORMAL and VDA buckets are never reduced (s.71(3) / s.115BBH(2)(b)).

The change

7878 rem = _absorb(bfl.amount, label, lt_order, buckets,
7979 "s74.cf_ltcl_setoff_ltcg_only", steps)
8080 if rem > 0:
81- carry.append(CarryForwardOut(bfl.kind, bfl.ay_incurred, rem,
82- usable_through, False))
81+ # s.74(2): the loss is usable through ay_incurred + 8. Remainder
82+ # left after set-off in that last usable AY expires — it must not
83+ # reappear as carry_forward for a later year.
84+ if taxpayer.ay >= usable_through:
85+ dead.append(DeadLoss(
86+ label, rem, "s74.cf_years",
87+ f"s.74(2): unabsorbed remainder expires after last usable "
88+ f"AY {usable_through}"))
89+ else:
90+ carry.append(CarryForwardOut(bfl.kind, bfl.ay_incurred, rem,
91+ usable_through, False))
8392
8493 # Unabsorbed current-year losses carry forward from this AY (s.74(1)),
8594 # conditional on this year's return meeting s.80/139(3).

The check that tells the two apart

failpass·skills/itr-india/engine/tests/test_setoff.py::test_bf_remainder_on_last_usable_year_expires_not_carried

Check file skills/itr-india/engine/tests/test_setoff.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before ite34e2c23a71e9a6bc86dc00f2b7cb74c2dae0ad4
Broken version dated2026-08-01
Moduleskills.itr-india.engine.setoff
Units changedapply_setoff
Fingerprintc9286a2b47dafbbb
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in shivprime94/file-itr