@classytic/ca-tax 0.0.5 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,243 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.12] - 2026-08-30
4
+
5
+ ### Fixed
6
+
7
+ **AT1 Schedule 6's "missing credit line" was not actually a gap — traced to a
8
+ confirmed answer and the incorrect `issues` entry removed.** 0.0.11 shipped
9
+ Schedule 6 (Royalty Tax Credit) with an `issues` entry stating no formula
10
+ existed in the transcribed spec range to compute a final claimable credit
11
+ dollar amount. Tracing the AT1 jacket's own balance-owing formula (spec
12
+ §3.2.3.1, `090 = 080 − (081+082+085+086+087)`) shows it never references a
13
+ Schedule 6 total the way it references Schedule 9's SR&ED credit (081) or
14
+ Schedule 8's political credit (074) — because the **Alberta Royalty Tax
15
+ Credit is administered as an instalment program**, not an annual claimed
16
+ credit. TRA pays or credits ARTC instalments to the corporation during the
17
+ year based on estimated entitlement; the corporation simply reports what it
18
+ received at AT1 jacket line **000082** ("Instalments and other payments and
19
+ ARTC instalments credited to income tax account"), already collected by
20
+ this app's shared "Payments & Instalments" schedule. Schedule 6/7 exist to
21
+ establish the royalty amount, shelter and rate TRA uses for that
22
+ determination — not to produce a number this return deducts. Schedule 6 was
23
+ complete as built; only the messaging (an engine `issues` entry, a module
24
+ docstring, and the UI schedule hint) implied an unresolved defect where none
25
+ existed. Corrected all three.
26
+
27
+ ## [0.0.11] - 2026-08-30
28
+
29
+ ### Added
30
+
31
+ **Nine entirely-unmodeled AT1 schedules — engine, filing builders, server
32
+ composition and UI, all wired end to end.** Before this release the AT1
33
+ engine modeled 12 of the 21 real Alberta schedules; Schedules 3, 4, 5, 6, 7,
34
+ 8, 9, 11 and 15 existed only as bottom-line jacket passthroughs with zero
35
+ supporting-schedule math. Each is now a real, tested module reachable from a
36
+ preparer's form through to a filed Net File payload:
37
+
38
+ - **Schedule 3** — Other Tax Deductions and Credits: three independent
39
+ non-refundable credit continuities (Investor Tax Credit, Capital Investment
40
+ Tax Credit, Agri-Processing Investment Tax Credit) sharing one ceiling
41
+ (Maximum Allowable Deduction). CITC is gated behind ITC's carryforward;
42
+ APITC's three earliest vintages each carry their own percentage cap
43
+ (20%/30%/50%), the rest uncapped.
44
+ - **Schedule 4** — Foreign Investment Income Tax Credit: one row per country,
45
+ mirroring federal Schedule 21's own occurrences.
46
+ - **Schedule 5** — Royalty Tax Deduction: the Crown Royalty Tax Deduction
47
+ pool (unsuccessored) plus SSPI/FSPI successored pools, each with its own
48
+ mandatory (not discretionary) claim formula.
49
+ - **Schedule 6** — Royalty Tax Credit. **Known gap, not guessed at:** the
50
+ specification's own field map stops at line 006034 — no line anywhere
51
+ multiplies rate × min(royalty, shelter) into a claimable credit dollar
52
+ amount. Every other line files; the credit itself is absent with an
53
+ `issues` entry until an authoritative source resolves it.
54
+ - **Schedule 7** — Royalty Tax Credit/Deduction Supplemental Information:
55
+ Crown Payment Information, Partnership Income Tax Information and
56
+ Adjustments to ACR — the disclosure schedule Schedules 5 and 6 both depend
57
+ on (per the spec, omitting it disallows the credit entitlement outright).
58
+ - **Schedule 8** — Political Contributions Tax Credit: per-contribution
59
+ receipts plus the three-rate-period tiered credit formula (to-2003,
60
+ from-2004, and the 2003/2004 straddling tax year).
61
+ - **Schedule 9** — SR&ED Tax Credit (Alberta's own credit, distinct from
62
+ Schedule 16's federal-mirroring deduction pool), including the page-3
63
+ associated-group expenditure-limit allocation.
64
+ - **Schedule 11** — Manufacturing and Processing Profits Deduction: a
65
+ historical schedule (tax years beginning before 2001-04-01 only), gated on
66
+ both the date and the 10%-of-gross-revenue test.
67
+ - **Schedule 15** — Resource Related Deductions: eight resource-expense
68
+ continuity pools, each regular + successor (EDA, CMEDB, CEE, CDE, CCOGPE,
69
+ FEDE, SFEDE, CFRE — the last two per-country). No resource-allowance pool
70
+ exists on this schedule; it was repealed federally for post-1989 years.
71
+
72
+ No PDF exists for Schedules 3, 4, 6, 7, 8, 9, 11 or 15 under
73
+ `research/sources/tra-forms/pdf/` — every field number was transcribed
74
+ directly from the TRA specification text (Chapter 3, 2025.2) and cross-
75
+ checked against the engine's own filing-builder tests. Two small,
76
+ purpose-built `FormDefinition`s (`AT1_SCHEDULE_3`, `AT1_SCHEDULE_15`) were
77
+ hand-authored and registered in `src/forms/registry.ts` so every line number
78
+ the return editor shows a preparer is checked, not just asserted — matching
79
+ this package's existing "hand-authored from the specification, no fillable
80
+ form to extract" convention (see `schedule12.ts`).
81
+
82
+ **Genuine spec ambiguities flagged with an `issues[]` entry rather than
83
+ guessed at, across the nine schedules:** Schedule 3's undocumented cross-
84
+ vintage APITC application order when shared room can't cover every vintage
85
+ (oldest-vintage-first is a documented engine default); Schedule 5's line 025
86
+ formula literally omitting the reimbursements term line 013 includes (kept
87
+ literal, not "fixed"); Schedule 6's missing credit line (above); Schedule
88
+ 7's line 061, which has no defining row in its own spec block but is cited
89
+ by Schedule 5's field definition; Schedule 9's line 009031, missing from the
90
+ spec's own field list, derived from the surrounding add/deduct lines with an
91
+ `issues` flag whenever the derived figure is used instead of a direct entry;
92
+ Schedule 11's line 011001, whose caption cites a Schedule 12 line that
93
+ doesn't exist anywhere else in the specification (the computable business-
94
+ rule formula was followed, the discrepancy documented); Schedule 15's
95
+ CCOGPE↔CDE negative-pool routing ambiguity (four lines with an undocumented
96
+ designation gate) and CFRE's "global foreign resource limit" (referenced by
97
+ the claim-cap formula, never defined — treated as nil with a flag rather
98
+ than invented).
99
+
100
+ `AT1_SCHEDULES_WITH_BUILDERS` now lists 21 schedule codes (was 12).
101
+ `AlbertaReturnInput.schedules` gained nine new optional keys
102
+ (`otherDeductionsCredits`, `foreignInvestmentTaxCredit`,
103
+ `royaltyTaxDeduction`, `royaltyTaxCredit`, `royaltySupplemental`,
104
+ `politicalContributions`, `sredTaxCredit`, `manufacturingProcessing`,
105
+ `resourceDeductions`) alongside the existing eleven.
106
+
107
+ **Fixed:** a real barrel-export collision discovered mid-build —
108
+ `Schedule4Input`/`Schedule4Result`/`computeSchedule4` and (more seriously)
109
+ `Schedule8Input`/`Schedule8Result`/`computeSchedule8` silently collided with
110
+ unrelated federal T2 exports of the identical names (`schedule4-losses.js`,
111
+ `schedule8.js`, the CCA module) under ESM/TS star-export rules — an explicit
112
+ local export always wins over a same-named star re-export, with no build
113
+ error. Verified live: calling the unprefixed `computeSchedule8` actually
114
+ invoked the federal CCA function and threw `entries is not iterable`. Both
115
+ AT1 pairs are now exported under `Alberta`-prefixed names
116
+ (`computeAlbertaSchedule4`/`AlbertaSchedule4Result`,
117
+ `computeAlbertaSchedule8`/`AlbertaSchedule8Result`).
118
+
119
+ **Also fixed, found while composing Schedule 17 (Reserves) for this
120
+ release:** `insurancePolicyReserves` and `bankReserves` — the two AT1-only
121
+ reserve kinds with no federal Schedule 13 Part 2 equivalent — are now
122
+ selectable in the UI and carry real Alberta-override wiring
123
+ (`assemble-at1-schedules.ts`'s `scheduleSeventeen`); previously the engine
124
+ supported all 8 reserve kinds but composition only ever passed federal
125
+ figures, so Schedule 17 could never diverge from federal for any kind.
126
+
127
+ 1211 → 1252 tests. 12 → 21 of the 21 real AT1 schedules now modeled (one,
128
+ Schedule 16's SR&ED deduction pool, remains out of scope — no federal T661
129
+ pool module exists to derive it from).
130
+
131
+ ## [0.0.10] - 2026-08-30
132
+
133
+ ### Added
134
+
135
+ **AT1 Schedule 21's SEVENTH and EIGHTH sections — analysis of losses by year
136
+ of origin (pages 3-4 of the live form) — verified against the actual
137
+ rendered PDF, not just the NetFile spec text.** Two 21-row vintage ledgers:
138
+
139
+ - `computeNonCapitalLossByYearOfOrigin` (`schedule21-year-of-origin.ts`) —
140
+ non-capital losses, one row per taxation year (0 = current, 1-20 =
141
+ preceding — the 20-year expiry limit), six columns per row. Row 0 is
142
+ fully DERIVED, not asked for twice: the spec states line 157 "must equal
143
+ 021021" (the schedule's own current-year loss) and line 165 "must equal
144
+ 021047" (the pool's total carried back) — both already computed
145
+ elsewhere. Only the 20 preceding vintages need direct entry, since that
146
+ history genuinely cannot be derived.
147
+ - `computeOtherLossByYearOfOrigin` — farm / restricted-farm / listed-
148
+ personal-property, same 21 rows but one raw balance per type per year, no
149
+ sub-formula. Listed personal property is refused (zeroed, not merely
150
+ warned) beyond occurrence 7 — it expires after 7 taxation years, not 20.
151
+
152
+ `schedule21Values` merges both into the same `Schedule Number="021"` block
153
+ as the five pools and the limited-partnership grid — one payload, not four.
154
+
155
+ **Confirmed out of scope, not silently missing:** the live form's ninth
156
+ section, Continuity of Restricted Interest and Financing Expenses (RIFE,
157
+ page 5, lines 200-250/310-350). An exhaustive search of the entire NetFile
158
+ transmission spec found no `021200`-`021350` field anywhere — RIFE
159
+ continuity exists on the paper form but is not part of the electronic
160
+ filing schema this engine targets.
161
+
162
+ ## [0.0.9] - 2026-08-30
163
+
164
+ ### Added
165
+
166
+ **AT1 Schedule 21's sixth section — Continuity of Limited Partnership Losses
167
+ (lines 131-141) — was entirely unmodeled (form, engine, and filing all
168
+ missing it) until now.** New `computeLimitedPartnershipLossRow` /
169
+ `computeLimitedPartnershipLosses` (`schedule21-limited-partnership.ts`), one
170
+ row per partnership: `closing = preceding-year balance + wind-up transfer +
171
+ current-year loss − applied`, with `applied` capped at `preceding + wind-up`
172
+ per the spec ("cannot exceed 021133 + 021135"). `schedule21Values` now
173
+ merges these rows into the SAME Schedule 021 payload block as the five
174
+ jurisdiction pools (not a second `Schedule Number="021"` element). The
175
+ column-139 total is exposed on the result for the caller to carry to
176
+ Schedule 12 line 072, per the form's own instruction — that cross-schedule
177
+ wire-up is not done here, same convention as every other Schedule 21 pool's
178
+ Schedule 12 links.
179
+
180
+ ## [0.0.8] - 2026-08-30
181
+
182
+ ### Fixed
183
+
184
+ **AT1 Schedule 21's loss-continuity formula was missing three terms the real
185
+ form has.** Verified against the spec's own formula (§3.2.3.21): closing
186
+ balance = `(carried forward − expired) + wind-up transfer + current-year loss
187
+ − applied against income − s.80 adjustment − other adjustments − carried
188
+ back`. `computeLossContinuity` previously omitted wind-up transfer, s.80
189
+ adjustment and other adjustments entirely — not just from the UI, from the
190
+ FORMULA. `LossContinuityResult` gains `windUpTransfer`, `section80Adjustment`,
191
+ `otherAdjustments`, and the intermediate `balanceAtBeginningOfYear` (033).
192
+
193
+ **`schedule21Values` silently dropped every line except opening/current/
194
+ carry-back/closing.** Even where the engine already computed
195
+ `expired`/`appliedCurrentYear` (reused from federal), the filing builder never
196
+ wrote lines 032/035/041/043/045 (and each pool's equivalents) to the XML —
197
+ they existed in memory and never reached TRA. Rewritten to read the pool's
198
+ own line numbers directly off `AT1_SCHEDULE_21_POOLS` (the form definition's
199
+ own table, not a second hand-copied one) and emit every field the pool's
200
+ form entry actually has a box for.
201
+
202
+ ## [0.0.7] - 2026-08-29
203
+
204
+ ### Added
205
+
206
+ **A genuine NEW Class 13/14 addition now amortises correctly, on both
207
+ federal Schedule 8 and AT1 Schedule 13.** 0.0.6's Class 13/14 support (added
208
+ in 0.0.4) only ever handled an EXISTING opening-UCC pool with no addition —
209
+ correct for that case, but it refused a real new leasehold layer or
210
+ limited-life property outright, even though the full Reg 1100(1)(b)/(c) /
211
+ Schedule III mechanic (`computeClass13`/`computeClass14`) already existed in
212
+ `cca-straight-line.ts` and just wasn't wired into either pipeline.
213
+
214
+ - `FederalT2Input` gains `class13?: Class13Input` / `class14?: Class14Input`
215
+ — separate from `ccaClasses`, which keeps its existing-balance-only
216
+ behaviour. Injects the Schedule 1 deduction (line 403, combined with any
217
+ declining-balance CCA into one line) same as before.
218
+ - `AlbertaSchedule13Input` gains `class13?: AlbertaClass13Input` /
219
+ `class14?: AlbertaClass14Input` — federal and Alberta share the same
220
+ layers/properties (a lease term doesn't change by jurisdiction); only the
221
+ CLAIM can diverge, same "omit = defaults to federal's actual claim"
222
+ semantics every other AT1 column already has. Alberta's claim is still
223
+ capped at the same Schedule III maximum federal's is — a discretionary
224
+ election can claim less, never more than the layer's own ceiling allows.
225
+ - Verified against a hand-derived example (a $25,000, 7-year leasehold,
226
+ first year): the 5-year floor and half-year rule correctly cap the year-1
227
+ claim at $3,571, not the full $25,000 the old degenerate stub would have
228
+ claimed.
229
+
230
+ ## [0.0.6] - 2026-08-29
231
+
232
+ ### Changed
233
+
234
+ **Raised the `@classytic/primitives` / `@classytic/tax-core` peer floors.**
235
+ They were still declared at `>=0.9.0` / `>=0.1.0` — stale by many minor
236
+ releases (current: 0.26.1 / 0.3.0) and well below what every actual consumer
237
+ already runs (`apps/server` uses `^0.23.0` / `^0.3.0`). Raised the peer and
238
+ dev floors to `>=0.23.0` / `>=0.3.0`, matching the versions this package is
239
+ actually built and tested against.
240
+
3
241
  ## [0.0.5] - 2026-08-29
4
242
 
5
243
  ### Added