TaxPilot

Search the docs

Search the Help centre, Developer docs and Legal centre.

Open TaxPilot

Forms

Write or change a form definition: fields, tables, applicability, checks, references, support level and form revisions.

Updated November 22, 2026

Every CRA, Alberta and Québec form TaxPilot knows is a FormDef object. Each release has 256 of them across 14 jurisdictions (federal, every province and territory, Alberta and Québec). The same definition drives calculation, the on-screen form, the PDF print plan, the e-file data set and the Supported forms page.

The FormDef shape

Defined in packages/t2/src/engine/defs.ts:

Fields

A FieldDef has an id (form.line, such as t2.300), form, section, line, label, type (amount, bool, text, date, number, choice) and kind (input, calc or carryforward). A calc field has deps and a calc(ctx) that returns a Value, a Cents amount or null for blank. Useful options:

  • formula: the text printed beside the line. Keep it in step with the calc.
  • overridable: lets a user override the calculated value with a reason.
  • required: true or a function, so review lists the input as missing only where it applies.
  • suggest and derive: a suggested or defaulted value with a note explaining where it came from.
  • validate, choices, help, refs, drillTo, showIf, hidden, noPrint.

Inside calc, applies and checks, the Ctx gives you amt(id), val(id), bool(id), text(id), num(id), rows(tableId) and meta (the corporation, the return's period, days and daysSplit). Helpers in src/forms/helpers.ts include sumOf, least, sumColumn, need, isCcpc, ref, amt, na, blocked and unknown.

A small example

Schedule 44 (src/forms/2026/s44.ts) has one input table and no calculation. Its applicability reads two T2 questions:

src/forms/2026/s44.ts (excerpt)
applies: (c) => {
  const q = c.bool("t2.163")
  if (q === true) return { status: "required", reason: "T2 line 163 is Yes: …" }
  if (q === false || c.bool("t2.162") === false) return { status: "not-required", reason: "T2 line 162 or 163 is No." }
  return { status: "unknown", reason: "Answer T2 lines 162 and 163." }
},

Note the three outcomes. An unanswered question gives unknown with the question to answer, never a guess.

Add a form

  1. Write the definition in src/forms/2026/.Copy the CRA PDF's line numbers and labels exactly. Use parameters for every rate or limit, and a limitations entry for anything you leave out.
  2. Register it in FORMS_2026 in src/forms/2026/index.ts.Releases build from that list. FORMS_2026_1 in src/forms/revisions/2026.ts is derived from it.
  3. Add its sources and catalogue entry.Sources go in the release's parameter file or src/rules/2026.ts (SRC). Rebuild the catalogue with pnpm --filter @workspace/t2 catalogue if the form is new to it.
  4. Test it.Add engine tests for the calculation and its boundary dates. Every new form also gets a Playwright test in apps/web/e2e (see e2e/forms.spec.ts and e2e/form-cases.ts).
  5. Re-record the hashes and generated docs.Run pnpm --filter @workspace/t2 calc-hash, then the engine tests (which refresh src/catalogue/verification.json), then pnpm --filter @workspace/t2 report.

Support levels on Supported forms

coverage() in src/coverage.ts derives each form's status from code and test evidence only. It's never set by hand. The app's Supported forms page labels them:

When CRA revises a form

If CRA moves, relabels or drops a line without changing the calculation, don't edit the base form. Write a FormRevision (src/forms/revise.ts) and build the release's forms with reviseForm. The revision maps field ids to new lines, labels, formulas, sections or columns, adds new questions in addFields, and gives the revised PDF in pdf. The revised form shares every calc function with its base by reference, so results can't change (test/form-revision.test.ts).