Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

CCB: shared custody halves the base before the income reduction, not after

Aperta
#560 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend, databases

Direzione di ricerca

Read child_benefit_base_person.py and child_benefit.py to trace where the shared-custody divisor is applied relative to the reduction. Add a regression test using the one-child, age-4, income-50,000 example, then run the relevant child benefit tests. Done means the shared-custody amount is 3,560.545 per year and the no-reduction controls still match.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

For a shared-custody parent, child_benefit takes half of the base amount and then subtracts the full income reduction. ITA 122.61(1.1) works the other way: it calculates the full benefit (base minus reduction) and then takes half of it. Above the first income threshold, the model pays shared-custody parents too little.

Where in the code

  • child_benefit_base_person.py divides the base by p.divisor when full_custody is false.
  • child_benefit.py then returns max_(0, base - reduction), with the full child_benefit_reduction.

So the model computes B/2 − R. The Act gives (B − R)/2.

Example (benefit year July 2025 – June 2026, base tax year 2024)

One child aged 4, shared custody, adjusted family net income 50,000 CAD.

  • Base B = 7,997
  • Reduction R = (50,000 − 37,487) × 7% = 875.91
  • Expected (ITA 122.61(1.1)): (7,997 − 875.91) / 2 = 3,560.545 per year
  • PolicyEngine Canada 0.99.1: 3,122.59 per year
  • Difference: −437.95 per year (about −36.50 per month)

The CRA Child and Family Benefits Calculator, run on 21 October 2026 with the same facts, shows 296.71 CAD per month for the CCB. PolicyEngine annual / 12 is 260.22.

Controls

  • Full custody, same income: PolicyEngine 7,121.09 — matches the Act.
  • Shared custody at income 30,000 and 37,487 (no reduction): 3,998.50 — matches.
  • Shared custody at 37,488: 3,998.465 expected, 3,998.43 from the model — the gap starts as soon as the reduction starts.
  • Property check: for one child, shared custody should give exactly half of full custody. At 50,000 the model gives 3,122.59, while half of its own full-custody result is 3,560.54.

Suggested fix

Apply the custody share after the reduction. For example, compute the base and reduction per child at the full rate, take max_(0, base − reduction), and only then apply the shared-custody divisor. A test with the example above (expected 3,560.545) would catch a regression.

How this was checked

We ran the unmodified PolicyEngine Canada 0.99.1 wheel from PyPI (SHA-256 2941641ef6e1c7e428f4717d194ac7e27332dc6e3423ce1936f9c379d0fcb79d, same code as master 029687260d) in a clean environment and compared it with an independent model of ITA 122.6 and 122.61. The CRA calculator run is saved with its request and response. We are happy to share the inputs and the scripts.

This is separate from #557: that issue is about updating parameters to 2026–27. This bug is in the formula and shows up with the current 2025–26 parameters.

Found with Arxo (arxo.io) during a review of open benefit models against the statute.

Lingua principale
Python
Stelle
18
Fork
35
Merge medio
5h 36m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PolicyEngine/policyengine-canada

Tutte le issue di PolicyEngine/policyengine-canada

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.