Rules releases
Learn what a rules release contains, how a return picks one, how releases are published and frozen, and how returns move between them.
A rules release is the package of forms, parameters, CRA data rules and filing specifications used for a range of taxation periods. Each return is pinned to one release, and every approved version records which one it used. A published release never changes: a fix ships as a new release.
release publish records its manifest in releases.lock.json. From then on test/releases.test.ts fails if any pinned component changes.The Release type
Declared in packages/t2/src/repo.ts:
makeRelease({ id, taxYear, notes, params, forms?, cra?, filingSpecs?, range?, enacted?, withdrawn? }) builds one. Only a 2026 release (or a test fixture) may default to the 2026 forms, CRA rules and filing spec. Any other year must name its own, so a past release never inherits 2026 material.
RELEASES holds 2020.1, 2021.1, 2022.1, 2023.1, 2024.1, 2025.1 and 2026.1. Read them with listReleases() (without the heavy fields, plus each release's statutes), release(id), and packageInfo(id) for the range, status, build, manifest and artifactHash.
src/rules/releases.lock.json has no entries, so all seven releases are drafts and no return can be recorded as filed under them. Tests use the approved fixture 2026.1a-test, registered with registerTestRelease.
How a return picks a release
applicablePackages(period)lists the releases whoserangecovers the period and that this deployment's channel may select.formSetFor(period)returns the newest of them. A period after every range uses the newest release, andevaluateraises a blocking error until a matching release is added.- The channel comes from
NEXT_PUBLIC_RULES_CHANNELviarulesChannel():devandqamay select drafts,production(the default) only published releases. A retired release is never selected for new work. - Every year check (
newerRelease,revisionOf,releaseImpacts,repinReturn,createAmendment) testsappliesTo(range, return), never a year label.
Manifests and hashes
buildManifest in src/rules/manifest.ts pins every component as { kind, id, rev, hash }: each parameter version, each form (by its source file's hash), each logic rule version, each rounding policy, each filing adapter and the CRA rules. artifactHash is a SHA-256 over the component hashes. Engine and helper code isn't pinned; corpus replay guards it.
Separately, rulesHash(formSetId) covers the parameters, CRA rules, form revisions, filing specs and CALC_SOURCE_HASH (every calculation source file). Each approved version stores it. Re-record CALC_SOURCE_HASH after any calculation change with pnpm --filter @workspace/t2 calc-hash.
Publish a release
pnpm --filter @workspace/t2 release publish 2026.1 --approved-by "Name of approving specialist"
pnpm --filter @workspace/t2 release check # fails while any non-test release is a draftpublish (packages/t2/scripts/release.ts) refuses a test release or one already published, runs vitest run corpus releases, and only if that passes writes { artifactHash, manifest, approvedBy, releasedAt, buildId } to the lock file. check is the promotion gate for main. CI builds main and pull requests into it with the production channel.
Moving a return to a newer release
A return moves only through repinReturn(state, session, returnId, to, reason). It needs a reason, checks that the new range covers the return, pins any "take the maximum" CCA claims at their current amounts first, and records a ruleset.repin audit entry with the number of values that changed. On an approved return it needs return.reopen, withdraws the approval, sends the return back to review and clears the T183CORP signature.
newerRelease(ret)tells the UI a newer release exists.compareReleases(corp, ret, to)lists the line changes the What changed table shows.revisionOf(corp, ret, to?)compares a locked version's stored output with its snapshot evaluated under another release, and says why (why) and whether it's retroactive.releaseImpacts(state, session, to?)lists the approved and filed returns a release would change.- A filed return never changes.
createAmendment(state, session, id, { release })starts a separate amended return.
For the user's side of this, see How rules releases work and Update a return's tax rules.
Related
- Versioned parametersRead and edit a release's parameter file: entries, versions that apply by date, enactments, citations and what loadParams rejects.
- Taking in ITA amendmentsDetect a change to the Income Tax Act, a provincial statute or a CRA form, and ship it safely as a new rules release.
- CRA data rules and filing specsSee how the CRA Error Code List is compiled into checks, how filing specifications and adapters build .COR and AT1 files, and what is unverified.