File size: 56,016 Bytes
61d7581
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
901bf8c
61d7581
 
901bf8c
61d7581
 
 
 
 
 
 
 
 
 
 
901bf8c
61d7581
 
901bf8c
 
61d7581
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
{
 "_header": "EXPECTED VALUES PENDING THE MAINTAINER'S SIGN-OFF. Hand-worked records for IRPR s. 18(2)(a)-(c), s. 18.1 and s. 17 limb by limb (roadmap T2.3), drafted 2026-09-12 by track A step A8 from the corpus text of SOR-2002-227-s17, -s18-p1, -s18-p2, -s18-p3 and -s18.1; nothing in this file is approved legal content. Each case's 'working' line shows the arithmetic; there is no in-test oracle (roadmap: an oracle by the same author cannot catch the same misreading). Two readings are NOT settled (roadmap DECISIONS (a), (b)): whether a hybrid equivalent is also a 'summary conviction offence' in (iv)/(vi) (hybrid_reading 'indictable' | 'summary'), and whether 'within / before the last N years' reads the conviction date or the offence date (anchor). A conviction leaves 'the last N years' on the day N years have elapsed since the day after it (W(d, N) below), the day-after convention of the s. 18(2) clocks. Engine cases call rehab.assess_record; tool cases call canlex_screen_history (and are skipped when the curated pairings they need are absent).",
 "_format": {
  "engine": "record: assess_record entries (n, jurisdiction, kind, class/classes, max_years, offence_date, conviction_date, completed, ...); args: today, status, hybrid_reading, anchor",
  "tool": "entries: canlex_screen_history entries; args: its other parameters; requires: as tests/data/screening_cases.json",
  "expect": "[{field: dotted path, eq|ne|in|contains}] | [{limb: '(a) vi' | '18.1 (1) solely', status, entries?, from?, until?, never?, exact?, reading?: 1-based}] | [{readings: [statuses in order]}] | [{needs: [[fact, entry], ...]}] | [{dates_differ: [earliest_deemed, ...]}] | [{text: all, contains|absent}] (tool)",
  "working": "the hand arithmetic behind the expected values"
 },
 "cases": [
  {
   "id": "h1-reading-hybrid-indictable-deemed",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "completed": "2006-03-01"},
    {"n": 2, "class": "summary-only", "completed": "2004-06-01"}],
   "args": {"today": "2026-09-12", "hybrid_reading": "indictable", "anchor": "conviction"},
   "expect": [
    {"field": "status", "eq": "deemed-rehabilitated"},
    {"field": "earliest_deemed", "eq": "2016-03-02"},
    {"field": "earliest_apply", "eq": "2011-03-01"},
    {"limb": "(a) chapeau", "status": "pass", "entries": [1]},
    {"limb": "(a) ii", "status": "pass", "from": "2016-03-02"},
    {"limb": "(a) v", "status": "pass"},
    {"limb": "(a) vi", "status": "pass"}],
   "working": "H1 (roadmap T2.3; law-6). (a) chapeau: one indictable-equivalent conviction (#1). (ii) W(2006-03-01, 10) = 2016-03-02. (v): both convictions are before 2006-03-01 at the latest, so out of the last 10 years by 2016-03-02. (vi) reading 'indictable': only #2 is a summary conviction offence -- one is allowed. Deemed from 2016-03-02. s. 17: 2006-03-01 + 5 = 2011-03-01.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a) chapeau and (i)-(vii)"}, {"id": "SOR-2002-227-s17", "why": "five years after completion"}]
  },
  {
   "id": "h1-reading-hybrid-also-summary-not-deemed",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "completed": "2006-03-01"},
    {"n": 2, "class": "summary-only", "completed": "2004-06-01"}],
   "args": {"today": "2026-09-12", "hybrid_reading": "summary", "anchor": "conviction"},
   "expect": [
    {"field": "status", "eq": "eligible-to-apply"},
    {"field": "earliest_deemed", "eq": null},
    {"field": "earliest_apply", "eq": "2011-03-01"},
    {"limb": "(a) vi", "status": "fail", "entries": [1, 2]}],
   "working": "H1 on the other reading: the hybrid assault (#1) also counts as a summary conviction offence in (vi), so two such convictions are before the last 10 years -- (vi) fails and deemed rehabilitation is not available. s. 17 still gives 2011-03-01.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(vi) 'more than one offence that ... would constitute a summary conviction offence'"}, {"id": "I-2.5-s36-p2", "why": "s. 36(3)(a) deems hybrids indictable for 'subsections (1) to (2.1)' of the Act only"}]
  },
  {
   "id": "h1-both-readings-not-settled",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "completed": "2006-03-01"},
    {"n": 2, "class": "summary-only", "completed": "2004-06-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "not-settled"},
    {"readings": ["deemed-rehabilitated", "eligible-to-apply"]},
    {"field": "earliest_deemed", "eq": null},
    {"field": "earliest_apply", "eq": "2011-03-01"},
    {"limb": "(a) vi", "status": "pass", "reading": 1},
    {"limb": "(a) vi", "status": "fail", "reading": 2}],
   "working": "The hybrid question decides H1 (roadmap DECISION (a)): both readings are reported, none is picked. The anchor question does not decide it (no offence dates; every date is before 2006-03-01).",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(vi)"}]
  },
  {
   "id": "h1-through-screen-history",
   "kind": "tool",
   "entries": [
    {"offense": "simple assault", "disposition": "convicted", "state": "NY", "sentence_completed": "2006-03-01"},
    {"offense": "disorderly conduct", "disposition": "convicted", "state": "NY", "sentence_completed": "2004-06-01"}],
   "args": {"today": "2026-09-12"},
   "requires": ["pairing:assault-simple", "pairing:disorderly-conduct"],
   "expect": [
    {"field": "rehab_status", "eq": "not-settled"},
    {"field": "earliest_apply", "eq": "2011-03-01"},
    {"field": "s18", "eq": null},
    {"field": "s18_readings.0.status", "eq": "deemed-rehabilitated"},
    {"field": "s18_readings.0.earliest_deemed", "eq": "2016-03-02"},
    {"field": "s18_readings.1.status", "eq": "eligible-to-apply"},
    {"text": "all", "contains": "### Reading 1 --"},
    {"text": "all", "contains": "### Reading 2 --"},
    {"text": "all", "absent": "APPLY CONDITIONAL"}],
   "working": "H1 as the officer enters it: simple assault (assault-simple: hybrid, 5 years) and disorderly conduct (summary-only). Was APPLY CONDITIONAL with the 'if every other matter predates this one' hedge; now both readings with their limb tables.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(i)-(vii)"}]
  },
  {
   "id": "probe4-reading-hybrid-indictable-deemed-by-the-latest-date",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "offence_date": "2010-01-01", "completed": "2011-01-01"},
    {"n": 2, "class": "summary-only", "offence_date": "2012-05-01", "completed": "2012-06-01"}],
   "args": {"today": "2026-09-12", "hybrid_reading": "indictable", "anchor": "conviction"},
   "expect": [
    {"field": "status", "eq": "deemed-rehabilitated"},
    {"field": "earliest_deemed", "eq": "2022-06-02"},
    {"field": "earliest_deemed_exact", "eq": false},
    {"field": "earliest_apply", "eq": "2017-06-01"},
    {"limb": "(a) ii", "status": "pass", "from": "2021-01-02", "entries": [1]},
    {"limb": "(a) v", "status": "pass", "from": "2022-06-02", "exact": false, "entries": [2]}],
   "working": "Probe 4 (model-3). (ii) W(2011-01-01, 10) = 2021-01-02 from the DUI (#1), not from the disorderly-conduct completion. (v): #2's conviction is between 2012-05-01 and 2012-06-01, so it leaves the last 10 years between 2022-05-02 and 2022-06-02 -- the date shown is the latest (no conviction_date). Deemed from 2022-06-02 at the latest. s. 17: 2012-06-01 + 5 = 2017-06-01.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(ii), (v)"}]
  },
  {
   "id": "probe4-reading-hybrid-also-summary-not-deemed",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "offence_date": "2010-01-01", "completed": "2011-01-01"},
    {"n": 2, "class": "summary-only", "offence_date": "2012-05-01", "completed": "2012-06-01"}],
   "args": {"today": "2026-09-12", "hybrid_reading": "summary", "anchor": "conviction"},
   "expect": [
    {"field": "status", "eq": "eligible-to-apply"},
    {"field": "earliest_deemed", "eq": null},
    {"limb": "(a) vi", "status": "fail", "entries": [1, 2]}],
   "working": "(vi) with the hybrid DUI counted as a summary conviction offence: #1 and #2 are both before the last 10 years, so (vi) stops holding when the second leaves the window (by 2022-06-02), the day (v) starts holding -- the two never hold together.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(v), (vi)"}]
  },
  {
   "id": "probe4-both-readings-not-settled",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "offence_date": "2010-01-01", "completed": "2011-01-01"},
    {"n": 2, "class": "summary-only", "offence_date": "2012-05-01", "completed": "2012-06-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "not-settled"},
    {"readings": ["deemed-rehabilitated", "eligible-to-apply"]},
    {"field": "earliest_apply", "eq": "2017-06-01"}],
   "working": "The hybrid reading decides probe 4 as it decides H1.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(vi)"}]
  },
  {
   "id": "probe4-conviction-dates-given-exact",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "offence_date": "2010-01-01", "conviction_date": "2010-06-01", "completed": "2011-01-01"},
    {"n": 2, "class": "summary-only", "offence_date": "2012-05-01", "conviction_date": "2012-05-15", "completed": "2012-06-01"}],
   "args": {"today": "2026-09-12", "hybrid_reading": "indictable", "anchor": "conviction"},
   "expect": [
    {"field": "status", "eq": "deemed-rehabilitated"},
    {"field": "earliest_deemed", "eq": "2022-05-16"},
    {"field": "earliest_deemed_exact", "eq": true},
    {"limb": "(a) v", "from": "2022-05-16", "exact": true}],
   "working": "With the conviction dates: (v) W(2012-05-15, 10) = 2022-05-16, later than (ii) 2021-01-02.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(v) 'has not within the last 10 years been convicted'"}]
  },
  {
   "id": "probe4-anchor-offence-date",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "offence_date": "2010-01-01", "conviction_date": "2010-06-01", "completed": "2011-01-01"},
    {"n": 2, "class": "summary-only", "offence_date": "2012-05-01", "conviction_date": "2012-05-15", "completed": "2012-06-01"}],
   "args": {"today": "2026-09-12", "hybrid_reading": "indictable", "anchor": "offence"},
   "expect": [
    {"field": "earliest_deemed", "eq": "2022-05-02"},
    {"limb": "(a) v", "from": "2022-05-02"}],
   "working": "The other anchor (roadmap DECISION (b)): (v) read on the offence date, W(2012-05-01, 10) = 2022-05-02.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(v)"}]
  },
  {
   "id": "probe4-anchor-open-dates-differ-status-same",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "offence_date": "2010-01-01", "conviction_date": "2010-06-01", "completed": "2011-01-01"},
    {"n": 2, "class": "summary-only", "offence_date": "2012-05-01", "conviction_date": "2012-05-15", "completed": "2012-06-01"}],
   "args": {"today": "2026-09-12", "hybrid_reading": "indictable"},
   "expect": [
    {"field": "status", "eq": "deemed-rehabilitated"},
    {"field": "earliest_deemed", "eq": "2022-05-16"},
    {"dates_differ": ["2022-05-02"]}],
   "working": "Both anchors give deemed rehabilitation today, so the status is settled; the dates differ (2022-05-16 on the conviction date, 2022-05-02 on the offence date) and both are reported.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(v)"}]
  },
  {
   "id": "probe4-through-screen-history",
   "kind": "tool",
   "entries": [
    {"offense": "DUI", "disposition": "convicted", "state": "TX", "offence_date": "2010-01-01", "sentence_completed": "2011-01-01"},
    {"offense": "disorderly conduct", "disposition": "pled guilty", "state": "TX", "offence_date": "2012-05-01", "sentence_completed": "2012-06-01"}],
   "args": {"today": "2026-09-12"},
   "requires": ["pairing:dui", "pairing:disorderly-conduct"],
   "expect": [
    {"field": "rehab_status", "eq": "not-settled"},
    {"field": "earliest_apply", "eq": "2017-06-01"},
    {"field": "s18_readings.0.earliest_deemed", "eq": "2022-06-02"},
    {"text": "all", "contains": "at least 10 years have elapsed since the day after the completion of the imposed sentence | yes | #1 | from 2021-01-02 |"}],
   "working": "Probe 4 as entered: DUI 2010 (5 years at commission, hybrid) and disorderly conduct 2012. Was APPLY CONDITIONAL with the deeming clock run from the disorderly-conduct completion; now (ii) runs from the DUI and (v) from the disorderly-conduct conviction.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(ii), (v), (vi)"}]
  },
  {
   "id": "run-g-pr-no-paragraph-s17-from-latest",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "indictable-only", "max_years": 99, "offence_date": "2012-01-01", "completed": "2014-01-01"},
    {"n": 2, "class": "hybrid", "max_years": 5, "offence_date": "2016-01-01", "completed": "2017-01-01"}],
   "args": {"today": "2026-09-10", "status": "permanent-resident"},
   "expect": [
    {"field": "status", "eq": "eligible-to-apply"},
    {"field": "earliest_apply", "eq": "2022-01-01"},
    {"field": "earliest_deemed", "eq": null},
    {"field": "s17.entry", "eq": 2},
    {"field": "paragraphs", "eq": []}],
   "working": "Run G (T1.9). Two indictable-equivalent convictions: no s. 18(2) paragraph can apply ((a) allows no more than one; (b) summary only). s. 17 runs from the later conviction: 2017-01-01 + 5 = 2022-01-01.",
   "sources": [{"id": "SOR-2002-227-s17", "why": "'if the person has not been convicted of a subsequent offence'"}]
  },
  {
   "id": "run-g-through-screen-history",
   "kind": "tool",
   "entries": [
    {"offense": "robbery", "disposition": "convicted", "state": "TX", "offence_date": "2012-01-01", "sentence_completed": "2014-01-01"},
    {"offense": "simple assault", "disposition": "convicted", "state": "TX", "offence_date": "2016-01-01", "sentence_completed": "2017-01-01"}],
   "args": {"status": "permanent-resident", "today": "2026-09-10"},
   "requires": ["pairing:robbery", "pairing:assault-simple"],
   "expect": [
    {"field": "rehab_status", "eq": "eligible-to-apply"},
    {"field": "earliest_apply", "eq": "2022-01-01"},
    {"field": "s17_clock_entry", "eq": 2},
    {"field": "s18", "eq": []},
    {"text": "all", "contains": "No IRPR s. 18(2) paragraph can apply to this record"}],
   "working": "Run G through the tool.",
   "sources": [{"id": "SOR-2002-227-s17", "why": "the later conviction restarts the five years"}]
  },
  {
   "id": "vi-failure-two-old-summary-convictions",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2008-01-01", "completed": "2008-06-01"},
    {"n": 2, "class": "summary-only", "conviction_date": "2001-01-01", "completed": "2001-02-01"},
    {"n": 3, "class": "summary-only", "conviction_date": "2003-03-01", "completed": "2003-04-01"}],
   "args": {"today": "2026-09-12", "hybrid_reading": "indictable", "anchor": "conviction"},
   "expect": [
    {"field": "status", "eq": "eligible-to-apply"},
    {"field": "earliest_deemed", "eq": null},
    {"field": "earliest_apply", "eq": "2013-06-01"},
    {"limb": "(a) vi", "status": "fail", "entries": [2, 3], "until": "2013-03-02"},
    {"limb": "(a) ii", "status": "pass", "from": "2018-06-02"},
    {"limb": "(b) chapeau", "status": "pass"},
    {"limb": "(b) vi", "status": "fail", "entries": [1], "never": true}],
   "working": "(vi): two pure summary convictions (#2, #3) are before the last 10 years from W(2003-03-01, 10) = 2013-03-02 on, so (vi) held only until then; (ii) starts 2018-06-02, after (vi) stopped -- never deemed under (a). (b) cannot apply either: (b)(vi) excludes any indictable-equivalent conviction (#1). s. 17: 2008-06-01 + 5 = 2013-06-01.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(vi)"}, {"id": "SOR-2002-227-s18-p2", "why": "(b)(vi)"}]
  },
  {
   "id": "vi-failure-holds-on-both-readings",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2008-01-01", "completed": "2008-06-01"},
    {"n": 2, "class": "summary-only", "conviction_date": "2001-01-01", "completed": "2001-02-01"},
    {"n": 3, "class": "summary-only", "conviction_date": "2003-03-01", "completed": "2003-04-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "eligible-to-apply"},
    {"field": "readings", "eq": null}],
   "working": "The hybrid question does not decide this record: (vi) fails with or without #1, so no reading is reported.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(vi)"}]
  },
  {
   "id": "undated-later-conviction-date-decides-v",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "offence_date": "2005-01-01", "completed": "2006-01-01"},
    {"n": 2, "class": "summary-only", "offence_date": "2015-01-01"}],
   "args": {"today": "2026-09-12", "hybrid_reading": "indictable", "anchor": "conviction"},
   "expect": [
    {"field": "status", "eq": "undetermined"},
    {"limb": "(a) v", "status": "unknown"},
    {"needs": [["conviction_date", 2]]},
    {"field": "s17.undated", "eq": [2]}],
   "working": "#2 has no conviction or completion date: its conviction is between 2015-01-01 (the offence) and today. Convicted by 2016-09-11 it left the last 10 years (W < today) and (v) holds; convicted later it has not. The date decides -- UNKNOWN: give conviction_date. The s. 17 date is open too (s17.undated; the tool settles it).",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(v)"}, {"id": "SOR-2002-227-s17", "why": "a subsequent conviction with no completion date"}]
  },
  {
   "id": "undated-later-conviction-inside-the-window",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "offence_date": "2005-01-01", "completed": "2006-01-01"},
    {"n": 2, "class": "summary-only", "offence_date": "2019-03-01"}],
   "args": {"today": "2026-09-12", "hybrid_reading": "indictable", "anchor": "conviction"},
   "expect": [
    {"limb": "(a) v", "status": "fail", "entries": [2]},
    {"field": "earliest_deemed_exact", "eq": false},
    {"field": "s17.undated", "eq": [2]}],
   "working": "#2 was convicted on or after 2019-03-01, so it is within the last 10 years today whatever the date: (v) fails (settled). The date it leaves the window is open (from W(2019-03-01, 10) = 2029-03-02 at the earliest).",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(v)"}]
  },
  {
   "id": "undated-later-conviction-through-screen-history",
   "kind": "tool",
   "entries": [
    {"offense": "simple assault", "disposition": "convicted", "state": "NY", "offence_date": "2005-01-01", "sentence_completed": "2006-01-01"},
    {"offense": "disorderly conduct", "disposition": "convicted", "state": "NY", "offence_date": "2019-03-01"}],
   "args": {"today": "2026-09-12"},
   "requires": ["pairing:assault-simple", "pairing:disorderly-conduct"],
   "expect": [
    {"field": "rehab_status", "eq": "undetermined"},
    {"field": "earliest_apply", "eq": null},
    {"field": "earliest_deemed", "eq": null},
    {"field": "earliest_apply_not_before", "eq": "2024-03-01"},
    {"text": "all", "contains": "Give sentence_completed for #2"}],
   "working": "The undated later conviction leaves the s. 17 date open (not before 2019-03-01 + 5 = 2024-03-01) and (v) fails on it, so deemed rehabilitation is not affirmed either.",
   "sources": [{"id": "SOR-2002-227-s17", "why": "'if the person has not been convicted of a subsequent offence'"}, {"id": "SOR-2002-227-s18-p1", "why": "(a)(v)"}]
  },
  {
   "id": "canadian-hybrid-conviction-fails-iii",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "offence_date": "2008-01-01", "completed": "2009-01-01"},
    {"n": 2, "jurisdiction": "canada", "class": "hybrid", "offence_date": "2015-01-01", "completed": "2016-01-01"}],
   "args": {"today": "2026-09-12", "hybrid_reading": "indictable"},
   "expect": [
    {"field": "status", "eq": "eligible-to-apply"},
    {"field": "earliest_apply", "eq": "2021-01-01"},
    {"limb": "(a) iii", "status": "fail", "entries": [2], "never": true}],
   "working": "(iii): 'not been convicted in Canada of an indictable offence' -- on the reading that IRPA s. 36(3)(a) reaches s. 18(2), a hybrid is indictable for (iii) however it was prosecuted. s. 17 runs from the Canadian completion: 2016-01-01 + 5 = 2021-01-01. (Audit 2026-09-12: this case was first worked as 'on both readings'; the other reading is the next case.)",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(iii)"}, {"id": "I-2.5-s36-p2", "why": "s. 36(3)(a) 'even if it has been prosecuted summarily'"}]
  },
  {
   "id": "canadian-hybrid-election-open-both-readings",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "offence_date": "2008-01-01", "completed": "2009-01-01"},
    {"n": 2, "jurisdiction": "canada", "class": "hybrid", "offence_date": "2015-01-01", "completed": "2016-01-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "not-settled"},
    {"readings": ["eligible-to-apply", "undetermined"]},
    {"field": "earliest_apply", "eq": "2021-01-01"},
    {"needs": [["canada_prosecuted", 2]]},
    {"limb": "(a) iii", "status": "fail", "reading": 1},
    {"limb": "(a) iii", "status": "unknown", "reading": 2}],
   "working": "Roadmap DECISION (a), Canadian side (audit 2026-09-12). Reading 'indictable' (s. 36(3)(a) read into s. 18(2)): (iii) fails on #2. Reading 'summary' (s. 36(3)(a) governs only IRPA s. 36): the Interpretation Act applies to the Regulations 'unless a contrary intention appears', and s. 34(1)(c) says a person convicted of a hybrid offence on summary conviction is not 'convicted of an indictable offence' -- so the Crown's election decides. Entered summarily: (iii) holds; #2 is one Canadian summary conviction, out of the last 10 years by W(2016-01-01, 10) = 2026-01-02 at the latest, so (iv) holds; (ii) from W(2009-01-01, 10) = 2019-01-02; (v) and (vi) hold -- deemed. By indictment: (iii) fails. That reading is UNKNOWN: give canada_prosecuted.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(iii), (iv)"}, {"id": "I-21-s34", "why": "s. 34(1)(c)"}, {"id": "I-21-s3", "why": "'unless a contrary intention appears'"}, {"id": "I-2.5-s36-p2", "why": "s. 36(3)(a) governs 'subsections (1) to (2.1)'"}]
  },
  {
   "id": "canadian-hybrid-entered-summarily-reading-summary-deemed",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "offence_date": "2008-01-01", "completed": "2009-01-01"},
    {"n": 2, "jurisdiction": "canada", "class": "hybrid", "prosecuted": "summarily", "offence_date": "2015-01-01", "completed": "2016-01-01"}],
   "args": {"today": "2026-09-12", "hybrid_reading": "summary", "anchor": "conviction"},
   "expect": [
    {"field": "status", "eq": "deemed-rehabilitated"},
    {"field": "earliest_deemed", "eq": "2026-01-02"},
    {"field": "earliest_deemed_exact", "eq": false},
    {"limb": "(a) iii", "status": "pass"},
    {"limb": "(a) iv", "status": "pass", "entries": [2], "from": "2026-01-02", "exact": false}],
   "working": "Reading 'summary', #2 entered on summary conviction (I-21 s. 34(1)(c)): (iii) holds; (iv) one Canadian summary conviction, convicted between 2015-01-01 and 2016-01-01, leaves the last 10 years by W(2016-01-01, 10) = 2026-01-02 at the latest. Deemed from 2026-01-02 at the latest (give conviction_date to fix it).",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(iii), (iv)"}, {"id": "I-21-s34", "why": "s. 34(1)(c)"}]
  },
  {
   "id": "canadian-hybrid-entered-summarily-still-not-settled",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "offence_date": "2008-01-01", "completed": "2009-01-01"},
    {"n": 2, "jurisdiction": "canada", "class": "hybrid", "prosecuted": "summarily", "offence_date": "2015-01-01", "completed": "2016-01-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "not-settled"},
    {"readings": ["eligible-to-apply", "deemed-rehabilitated"]}],
   "working": "With the election given the fact is settled, but the reading is not: on 'indictable' (iii) still fails, on 'summary' every limb holds. Both readings are reported (roadmap DECISION (a)).",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(iii)"}, {"id": "I-21-s34", "why": "s. 34(1)(c)"}]
  },
  {
   "id": "canadian-hybrid-by-indictment-fails-iii-on-both-readings",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "offence_date": "2008-01-01", "completed": "2009-01-01"},
    {"n": 2, "jurisdiction": "canada", "class": "hybrid", "prosecuted": "indictment", "offence_date": "2015-01-01", "completed": "2016-01-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "eligible-to-apply"},
    {"field": "readings", "eq": null},
    {"field": "earliest_apply", "eq": "2021-01-01"},
    {"limb": "(a) iii", "status": "fail", "entries": [2], "never": true}],
   "working": "Prosecuted by indictment, #2 is a conviction of an indictable offence on every reading (s. 34(1)(c) does not reach it): (iii) fails, and the answer is settled. s. 17: 2016-01-01 + 5 = 2021-01-01.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(iii)"}, {"id": "I-21-s34", "why": "s. 34(1)(c) reaches only a conviction 'on summary conviction'"}]
  },
  {
   "id": "paragraph-b-canadian-hybrid-entered-summarily",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "summary-only", "offence_date": "2012-01-01", "conviction_date": "2012-06-01", "completed": "2012-06-01"},
    {"n": 2, "class": "summary-only", "offence_date": "2013-01-01", "conviction_date": "2013-06-01", "completed": "2013-06-01"},
    {"n": 3, "jurisdiction": "canada", "class": "hybrid", "prosecuted": "summarily", "offence_date": "2014-01-01", "conviction_date": "2014-03-01", "completed": "2014-03-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "not-settled"},
    {"readings": ["eligible-to-apply", "deemed-rehabilitated"]},
    {"field": "earliest_apply", "eq": "2019-03-01"},
    {"limb": "(b) ii", "status": "fail", "entries": [3], "reading": 1},
    {"limb": "(b) ii", "status": "pass", "reading": 2},
    {"limb": "(b) v", "status": "pass", "reading": 2}],
   "working": "(b)(ii) 'has not been convicted in Canada of an indictable offence': on 'indictable' #3 fails it; on 'summary' #3 was entered on summary conviction (I-21 s. 34(1)(c)), so (ii) holds and #3 is one Canadian summary conviction for (v). (i) W(2013-06-01, 5) = 2018-06-02; (iii) W(2014-03-01, 5) = 2019-03-02 -- deemed on that reading. s. 17 from #3: 2014-03-01 + 5 = 2019-03-01.",
   "sources": [{"id": "SOR-2002-227-s18-p2", "why": "(b)(i)-(v)"}, {"id": "I-21-s34", "why": "s. 34(1)(c)"}]
  },
  {
   "id": "permanent-resident-maximum-unknown-open",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": null, "completed": "2010-01-01"}],
   "args": {"today": "2026-09-12", "status": "permanent-resident"},
   "expect": [
    {"field": "status", "eq": "undetermined"},
    {"needs": [["maximum", 1]]}],
   "working": "A permanent resident is inadmissible only under s. 36(1) (a Canadian maximum of 10 years or more). With the maximum unknown that is open (audit 2026-09-12: was 'not-inadmissible-pr').",
   "sources": [{"id": "I-2.5-s36-p1", "why": "s. 36(1)(b); s. 36(2) 'A foreign national'"}]
  },
  {
   "id": "permanent-resident-unresolved-entry-open",
   "kind": "engine",
   "record": [
    {"n": 1, "completed": "2010-01-01"}],
   "args": {"today": "2026-09-12", "status": "permanent-resident"},
   "expect": [
    {"field": "status", "eq": "undetermined"},
    {"needs": [["equivalent", 1]]}],
   "working": "The equivalent of #1 is not resolved, so whether it carries a 10-year maximum is open (audit 2026-09-12: was 'not-inadmissible-pr').",
   "sources": [{"id": "I-2.5-s36-p1", "why": "s. 36(1)(b)"}]
  },
  {
   "id": "two-summary-convictions-one-occurrence-nothing-to-rehabilitate",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "summary-only", "offence_date": "2015-01-01", "completed": "2015-06-01", "occurrence": "a"},
    {"n": 2, "class": "summary-only", "offence_date": "2015-01-01", "completed": "2015-06-01", "occurrence": "a"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": null}],
   "working": "IRPA s. 36(2)(b) counts two offences only if 'not arising out of a single occurrence'; the same occurrence group means one occurrence, so there is no ground and nothing to rehabilitate (audit 2026-09-12: the engine said deemed under (b); canlex_screen_history already said so).",
   "sources": [{"id": "I-2.5-s36-p1", "why": "'not arising out of a single occurrence'"}]
  },
  {
   "id": "two-summary-convictions-occurrence-open-asked",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "summary-only", "offence_date": "2023-01-01", "completed": "2023-06-01"},
    {"n": 2, "class": "summary-only", "offence_date": "2023-01-01", "completed": "2023-06-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "not-yet"},
    {"field": "earliest_deemed", "eq": "2028-06-02"},
    {"field": "earliest_apply", "eq": "2028-06-01"},
    {"needs": [["occurrence_group", 1], ["occurrence_group", 2]]}],
   "working": "Same offence date, no occurrence group: on separate occurrences (b)(i) holds from W(2023-06-01, 5) = 2028-06-02 and s. 17 gives 2023-06-01 + 5 = 2028-06-01; on one occurrence there is no ground. The occurrence is asked.",
   "sources": [{"id": "SOR-2002-227-s18-p2", "why": "(b)(i)"}, {"id": "I-2.5-s36-p1", "why": "'not arising out of a single occurrence'"}]
  },
  {
   "id": "foreign-youth-disposition-excepted-in-v-and-flagged",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2004-01-01", "completed": "2005-01-01"},
    {"n": 2, "class": "youth", "youth_class": "summary-only", "conviction_date": "2020-01-01", "completed": "2020-01-01"}],
   "args": {"today": "2026-09-12", "hybrid_reading": "indictable", "anchor": "conviction"},
   "expect": [
    {"field": "status", "eq": "deemed-rehabilitated"},
    {"field": "earliest_deemed", "eq": "2015-01-02"},
    {"limb": "(a) v", "status": "pass"},
    {"field": "warnings.0", "contains": "foreign youth disposition"}],
   "working": "(a)(v) excepts 'an offence under the Youth Criminal Justice Act'; a foreign youth disposition within the last 10 years is read as excepted by analogy -- not literal, so the answer now says so (audit 2026-09-12). (vi) has no exception, but #2 is the only summary-type conviction. Deemed from W(2005-01-01, 10) = 2015-01-02.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(v) exception"}]
  },
  {
   "id": "canadian-single-old-summary-conviction-iv-holds",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2004-01-01", "completed": "2005-01-01"},
    {"n": 2, "jurisdiction": "canada", "class": "summary-only", "conviction_date": "2010-05-01", "completed": "2010-05-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "deemed-rehabilitated"},
    {"field": "earliest_deemed", "eq": "2020-05-02"},
    {"limb": "(a) iv", "status": "pass", "from": "2020-05-02", "entries": [2]}],
   "working": "(iv) allows one Canadian summary conviction before the last 10 years: W(2010-05-01, 10) = 2020-05-02, later than (ii) W(2005-01-01, 10) = 2015-01-02.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(iv)"}]
  },
  {
   "id": "canadian-summary-conviction-within-ten-years-iv-waits",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2004-01-01", "completed": "2005-01-01"},
    {"n": 2, "jurisdiction": "canada", "class": "summary-only", "conviction_date": "2018-05-01", "completed": "2018-05-01"}],
   "args": {"today": "2026-09-12", "anchor": "conviction"},
   "expect": [
    {"field": "status", "eq": "eligible-to-apply"},
    {"field": "earliest_deemed", "eq": "2028-05-02"},
    {"field": "earliest_apply", "eq": "2023-05-01"},
    {"limb": "(a) iv", "status": "fail", "from": "2028-05-02"}],
   "working": "(iv): the Canadian summary conviction is within the last 10 years until W(2018-05-01, 10) = 2028-05-02; deemed from then if nothing is added. s. 17 from the Canadian completion: 2023-05-01.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(iv)"}]
  },
  {
   "id": "two-canadian-summary-convictions-iv-never-and-not-solely",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "1999-06-01", "completed": "2000-01-01"},
    {"n": 2, "jurisdiction": "canada", "class": "summary-only", "offence_date": "2015-01-01", "completed": "2015-06-01"},
    {"n": 3, "jurisdiction": "canada", "class": "summary-only", "offence_date": "2016-01-01", "completed": "2016-06-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "eligible-to-apply"},
    {"field": "earliest_apply", "eq": "2021-06-01"},
    {"limb": "(a) iv", "status": "fail", "entries": [2, 3], "never": true},
    {"limb": "18.1 (1) two offences", "status": "pass"},
    {"limb": "18.1 (1) solely", "status": "fail", "entries": [1]},
    {"field": "s18_1.outcome", "eq": "not-deemed"}],
   "working": "(iv) with two Canadian summary convictions: one is within the last 10 years, or two are before them -- it never holds. s. 18.1: 'inadmissible solely on the basis of' the Canadian convictions fails, because the foreign assault (#1) is itself a ground and cannot be deemed rehabilitated on this record.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(iv)"}, {"id": "SOR-2002-227-s18.1", "why": "'inadmissible solely on the basis of'"}]
  },
  {
   "id": "two-canadian-summary-convictions-s18-1-exempt",
   "kind": "engine",
   "record": [
    {"n": 1, "jurisdiction": "canada", "class": "summary-only", "offence_date": "2015-01-01", "completed": "2015-06-01"},
    {"n": 2, "jurisdiction": "canada", "class": "summary-only", "offence_date": "2016-01-01", "completed": "2016-06-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": null},
    {"field": "s18_1.outcome", "eq": "deemed"},
    {"field": "s18_1.deemed_on", "eq": "2021-06-02"},
    {"limb": "18.1 (1) solely", "status": "pass"},
    {"limb": "18.1 (2) five years", "status": "pass", "from": "2021-06-02"}],
   "working": "s. 18.1: a foreign national, two summary-only Canadian convictions on different dates, nothing else on the record; W(2016-06-01, 5) = 2021-06-02. No foreign matter, so no s. 18(2) answer.",
   "sources": [{"id": "SOR-2002-227-s18.1", "why": "(1), (2)"}]
  },
  {
   "id": "s18-1-same-date-occurrence-open",
   "kind": "engine",
   "record": [
    {"n": 1, "jurisdiction": "canada", "class": "summary-only", "offence_date": "2015-01-01", "completed": "2015-06-01"},
    {"n": 2, "jurisdiction": "canada", "class": "summary-only", "offence_date": "2015-01-01", "completed": "2015-06-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"limb": "18.1 (1) two offences", "status": "unknown"},
    {"field": "s18_1.outcome", "eq": "open"}],
   "working": "The same offence date leaves 'not arising out of a single occurrence' (s. 36(2)(a)) open, so whether there are two offences for s. 18.1 is open (occurrence_group settles it).",
   "sources": [{"id": "I-2.5-s36-p1", "why": "'not arising out of a single occurrence'"}, {"id": "SOR-2002-227-s18.1", "why": "two or more offences"}]
  },
  {
   "id": "s18-1-permanent-resident-not-in-the-class",
   "kind": "engine",
   "record": [
    {"n": 1, "jurisdiction": "canada", "class": "summary-only", "offence_date": "2015-01-01", "completed": "2015-06-01"},
    {"n": 2, "jurisdiction": "canada", "class": "summary-only", "offence_date": "2016-01-01", "completed": "2016-06-01"}],
   "args": {"today": "2026-09-12", "status": "permanent-resident"},
   "expect": [
    {"limb": "18.1 (1) class", "status": "fail"},
    {"field": "s18_1.outcome", "eq": "not-deemed"}],
   "working": "s. 18.1(1) is 'The class of foreign nationals'.",
   "sources": [{"id": "SOR-2002-227-s18.1", "why": "'The class of foreign nationals'"}]
  },
  {
   "id": "record-suspended-canadian-conviction-open",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2004-01-01", "completed": "2005-01-01"},
    {"n": 2, "jurisdiction": "canada", "class": "hybrid", "record_suspended": true, "offence_date": "2010-01-01", "completed": "2010-06-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "undetermined"},
    {"limb": "(a) iii", "status": "unknown"},
    {"needs": [["record-suspension", 2]]}],
   "working": "Counted, the record-suspended hybrid conviction fails (iii); not counted, every limb holds from 2015-01-02. Whether it counts is not settled in CanLex, so (iii) is UNKNOWN.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(iii)"}, {"id": "I-2.5-s36-p2", "why": "s. 36(3)(b) record suspension"}]
  },
  {
   "id": "canadian-offence-mode-not-given-open",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2004-01-01", "completed": "2005-01-01"},
    {"n": 2, "jurisdiction": "canada", "conviction_date": "2008-01-01", "completed": "2008-01-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "undetermined"},
    {"needs": [["canada_offence_mode", 2]]}],
   "working": "Summary-only, the Canadian conviction is one before the last 10 years (W(2008-01-01, 10) = 2018-01-02) and (iv) holds; hybrid or indictable, (iii) fails. The mode decides.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(iii), (iv)"}]
  },
  {
   "id": "unresolved-foreign-entry-open",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2004-01-01", "completed": "2005-01-01"},
    {"n": 2, "conviction_date": "2006-01-01", "completed": "2006-02-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "undetermined"},
    {"limb": "(a) chapeau", "status": "unknown"},
    {"needs": [["equivalent", 2]]}],
   "working": "#2's equivalent is not resolved. No federal equivalent or summary-only: deemed (by 2016-01-02 at the latest). Indictable: two indictable convictions, and (a) cannot apply. The equivalent decides.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a) chapeau, (v), (vi)"}]
  },
  {
   "id": "later-conviction-with-no-federal-equivalent-ignored-by-v",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2004-01-01", "completed": "2005-01-01"},
    {"n": 2, "class": "none", "conviction_date": "2024-01-01", "completed": "2024-02-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "deemed-rehabilitated"},
    {"field": "earliest_deemed", "eq": "2015-01-02"},
    {"field": "earliest_apply", "eq": "2029-02-01"},
    {"limb": "(a) v", "status": "pass"}],
   "working": "(v) reaches only offences that 'would constitute an offence under an Act of Parliament': #2 has no federal equivalent. It still restarts s. 17 on the literal reading (2024-02-01 + 5), which is moot while deemed rehabilitation holds.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(v)"}, {"id": "SOR-2002-227-s17", "why": "subsequent offence"}]
  },
  {
   "id": "foreign-summary-conviction-within-ten-years-v-waits",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2004-01-01", "completed": "2005-01-01"},
    {"n": 2, "class": "summary-only", "conviction_date": "2018-06-01", "completed": "2018-06-01"}],
   "args": {"today": "2026-09-12", "hybrid_reading": "indictable", "anchor": "conviction"},
   "expect": [
    {"field": "status", "eq": "eligible-to-apply"},
    {"field": "earliest_deemed", "eq": "2028-06-02"},
    {"field": "earliest_apply", "eq": "2023-06-01"},
    {"limb": "(a) v", "status": "fail", "from": "2028-06-02", "entries": [2]}],
   "working": "(v): #2 is within the last 10 years until W(2018-06-01, 10) = 2028-06-02; then deemed if nothing is added. s. 17: 2018-06-01 + 5 = 2023-06-01.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(v)"}]
  },
  {
   "id": "foreign-summary-within-ten-years-readings-change-only-the-projection",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2004-01-01", "completed": "2005-01-01"},
    {"n": 2, "class": "summary-only", "conviction_date": "2018-06-01", "completed": "2018-06-01"}],
   "args": {"today": "2026-09-12", "anchor": "conviction"},
   "expect": [
    {"field": "status", "eq": "eligible-to-apply"},
    {"field": "earliest_deemed", "eq": "2028-06-02"},
    {"dates_differ": [null]}],
   "working": "Not deemed today on either hybrid reading, so the status is settled; the projection differs (2028-06-02 on 'indictable'; never on 'summary', where #1 and #2 make two summary-type convictions by the time #2 leaves the window) and is reported. The anchor is pinned to the conviction date here (no offence dates are given; see the next case).",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(v), (vi)"}]
  },
  {
   "id": "anchor-reading-decides-when-the-offence-date-is-missing",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2004-01-01", "completed": "2005-01-01"},
    {"n": 2, "jurisdiction": "canada", "class": "summary-only", "conviction_date": "2018-05-01", "completed": "2018-05-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "not-settled"},
    {"readings": ["eligible-to-apply", "undetermined"]},
    {"field": "readings.0.earliest_deemed", "eq": "2028-05-02"},
    {"field": "earliest_apply", "eq": "2023-05-01"},
    {"needs": [["offence_date", 2]]}],
   "working": "Roadmap DECISION (b). On the conviction date, (iv) holds from W(2018-05-01, 10) = 2028-05-02. On the offence date -- not given, and it can be any date before the conviction -- the Canadian offence may already be out of the last 10 years (an offence in 2016 would leave it on 2026-01-02), so that reading turns on the offence date. Both readings are reported.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(iv) 'within the last 10 years'"}]
  },
  {
   "id": "committed-act-paragraph-c-deemed",
   "kind": "engine",
   "record": [
    {"n": 1, "kind": "act", "class": "hybrid", "max_years": 5, "offence_date": "2010-01-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "deemed-rehabilitated"},
    {"field": "earliest_deemed", "eq": "2020-01-02"},
    {"field": "earliest_apply", "eq": "2015-01-01"},
    {"limb": "(c) ii", "status": "pass", "from": "2020-01-02"}],
   "working": "(c)(ii): W(2010-01-01, 10) = 2020-01-02 from the commission. s. 17(b): five years after committing the offence, 2015-01-01.",
   "sources": [{"id": "SOR-2002-227-s18-p2", "why": "(c) chapeau"}, {"id": "SOR-2002-227-s18-p3", "why": "(c)(i)-(vii)"}]
  },
  {
   "id": "committed-act-with-later-summary-conviction-c-v-waits",
   "kind": "engine",
   "record": [
    {"n": 1, "kind": "act", "class": "hybrid", "max_years": 5, "offence_date": "2010-01-01"},
    {"n": 2, "class": "summary-only", "conviction_date": "2019-01-01", "completed": "2019-01-01"}],
   "args": {"today": "2026-09-12", "anchor": "conviction"},
   "expect": [
    {"field": "status", "eq": "eligible-to-apply"},
    {"field": "earliest_deemed", "eq": "2029-01-02"},
    {"field": "earliest_apply", "eq": "2024-01-01"},
    {"field": "paragraph", "eq": "IRPR s. 18(2)(c)"},
    {"limb": "(c) v", "status": "fail", "from": "2029-01-02"}],
   "working": "The single summary conviction grounds nothing, so the matter is the act: (c). (c)(v): #2 within the last 10 years until W(2019-01-01, 10) = 2029-01-02. s. 17(b): five years after committing the offence 'if the person has not been convicted of a subsequent offence' -- #2 is one, so the five years run from its completion, 2019-01-01 + 5 = 2024-01-01 (the verification fixes of 2026-09-22, LEGAL-7; this line had said a later conviction does not move the act clock, a roadmap decision now withdrawn).",
   "sources": [{"id": "SOR-2002-227-s18-p3", "why": "(c)(v)"}]
  },
  {
   "id": "conviction-plus-committed-act-vii-fails",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2004-01-01", "completed": "2005-01-01"},
    {"n": 2, "kind": "act", "class": "hybrid", "max_years": 5, "offence_date": "2006-01-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "eligible-to-apply"},
    {"field": "earliest_apply", "eq": "2011-01-01"},
    {"limb": "(a) vii", "status": "fail", "entries": [2], "never": true},
    {"limb": "(c) vii", "status": "fail", "entries": [1], "never": true}],
   "working": "(a)(vii): an act described in s. 36(2)(c) other than the one convicted of (#2). (c)(vii): a foreign indictable-equivalent conviction (#1). s. 17: (a) five years after the completion of #1's sentence (2005-01-01 + 5 = 2010-01-01) and (b) five years 'after committing an offence' for the act #2 (2006-01-01 + 5 = 2011-01-01); both matters must have run, so 2011-01-01 (the G3 fixes of 2026-09-22, S17-1; this line had said 's. 17 from the conviction: 2010-01-01', leaving out the act's own period).",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(vii)"}, {"id": "SOR-2002-227-s18-p3", "why": "(c)(vii)"}, {"id": "SOR-2002-227-s17", "why": "(b) five years after committing an offence, for the act"}]
  },
  {
   "id": "ten-year-maximum-i-fails",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 10, "conviction_date": "2020-01-01", "completed": "2021-06-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "eligible-to-apply"},
    {"field": "earliest_deemed", "eq": null},
    {"field": "earliest_apply", "eq": "2026-06-01"},
    {"limb": "(a) i", "status": "fail", "never": true}],
   "working": "(i): a maximum of 10 years is not 'less than 10 years' -- never deemed; s. 17 from 2021-06-01.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(i)"}]
  },
  {
   "id": "permanent-resident-criminality-only",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2020-01-01", "completed": "2021-06-01"}],
   "args": {"today": "2026-09-12", "status": "permanent-resident"},
   "expect": [
    {"field": "status", "eq": "not-inadmissible-pr"}],
   "working": "s. 36(2) reaches foreign nationals only; nothing on the record is serious criminality.",
   "sources": [{"id": "I-2.5-s36-p1", "why": "'A foreign national is inadmissible on grounds of criminality'"}]
  },
  {
   "id": "youth-disposition-in-vi-open",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2004-01-01", "completed": "2005-01-01"},
    {"n": 2, "class": "summary-only", "conviction_date": "2001-01-01", "completed": "2001-01-01"},
    {"n": 3, "class": "youth", "youth_class": "summary-only", "conviction_date": "2000-01-01", "completed": "2000-01-01"}],
   "args": {"today": "2026-09-12", "hybrid_reading": "indictable", "anchor": "conviction"},
   "expect": [
    {"field": "status", "eq": "undetermined"},
    {"limb": "(a) vi", "status": "unknown"},
    {"needs": [["youth-disposition", 3]]}],
   "working": "(vi) carries no YCJA exception: counted, the youth disposition makes two summary-type convictions before the last 10 years; not counted, one. Not settled in CanLex. (v) excepts it either way.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(v) exception; (a)(vi) none"}]
  },
  {
   "id": "canadian-contravention-outside-every-limb",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2004-01-01", "completed": "2005-01-01"},
    {"n": 2, "jurisdiction": "canada", "class": "contravention", "conviction_date": "2020-01-01", "completed": "2020-01-01"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "deemed-rehabilitated"},
    {"field": "earliest_deemed", "eq": "2015-01-02"},
    {"field": "earliest_apply", "eq": "2010-01-01"}],
   "working": "A contravention is excepted from (iv) and from s. 17's 'subsequent offence'; it is outside s. 36 (s. 36(3)(e)(i)). Deemed from W(2005-01-01, 10) = 2015-01-02.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(iv) exception"}, {"id": "SOR-2002-227-s17", "why": "contravention excepted"}]
  },
  {
   "id": "leap-day-completion",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "hybrid", "max_years": 5, "conviction_date": "2015-12-01", "completed": "2016-02-28"}],
   "args": {"today": "2026-09-12"},
   "expect": [
    {"field": "status", "eq": "deemed-rehabilitated"},
    {"field": "earliest_deemed", "eq": "2026-02-28"},
    {"limb": "(a) ii", "from": "2026-02-28"}],
   "working": "The day after 2016-02-28 is 2016-02-29; ten years later has no 29 February, so the period ends on 2026-02-28 (Interpretation Act s. 28(c)).",
   "sources": [{"id": "I-21-s28", "why": "the last day of that month"}, {"id": "SOR-2002-227-s18-p1", "why": "(a)(ii)"}]
  },
  {
   "id": "two-summary-convictions-paragraph-b-deemed",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "summary-only", "offence_date": "2019-05-05", "completed": "2019-06-01"},
    {"n": 2, "class": "summary-only", "offence_date": "2021-05-05", "completed": "2021-06-01"}],
   "args": {"today": "2026-09-10"},
   "expect": [
    {"field": "status", "eq": "deemed-rehabilitated"},
    {"field": "earliest_deemed", "eq": "2026-06-02"},
    {"field": "earliest_apply", "eq": "2026-06-01"},
    {"limb": "(b) i", "status": "pass", "from": "2026-06-02", "entries": [2]}],
   "working": "(b)(i): five years since the day after the last sentence, W(2021-06-01, 5) = 2026-06-02; (b)(iv) is out of the window by then on any conviction date between the offence and the completion.",
   "sources": [{"id": "SOR-2002-227-s18-p2", "why": "(b)(i), (iv)"}]
  },
  {
   "id": "paragraph-b-canadian-conviction-within-five-years",
   "kind": "engine",
   "record": [
    {"n": 1, "class": "summary-only", "conviction_date": "2012-06-01", "completed": "2012-06-01"},
    {"n": 2, "class": "summary-only", "conviction_date": "2013-06-01", "completed": "2013-06-01"},
    {"n": 3, "jurisdiction": "canada", "class": "summary-only", "conviction_date": "2023-03-01", "completed": "2023-03-01"}],
   "args": {"today": "2026-09-12", "anchor": "conviction"},
   "expect": [
    {"field": "status", "eq": "not-yet"},
    {"field": "earliest_deemed", "eq": "2028-03-02"},
    {"field": "earliest_apply", "eq": "2028-03-01"},
    {"limb": "(b) iii", "status": "fail", "from": "2028-03-02", "entries": [3]},
    {"limb": "(b) v", "status": "pass"}],
   "working": "(b)(iii): a Canadian conviction within the last five years until W(2023-03-01, 5) = 2028-03-02. (b)(v) allows one Canadian summary conviction before the last five years. s. 17 from the Canadian completion: 2028-03-01, not yet.",
   "sources": [{"id": "SOR-2002-227-s18-p2", "why": "(b)(iii), (v)"}]
  },
  {
   "id": "s18-1-not-solely-canadian-answer-follows",
   "kind": "tool",
   "entries": [
    {"offense": "simple assault", "disposition": "convicted", "state": "TX", "offence_date": "1999-01-01", "sentence_completed": "2000-01-01"},
    {"offense": "causing a disturbance", "disposition": "convicted", "jurisdiction": "canada", "canada_max_years": 2, "canada_offence_mode": "summary-only", "canada_sentence": "fine", "offence_date": "2015-01-01", "sentence_completed": "2015-06-01"},
    {"offense": "causing a disturbance", "disposition": "convicted", "jurisdiction": "canada", "canada_max_years": 2, "canada_offence_mode": "summary-only", "canada_sentence": "fine", "offence_date": "2016-01-01", "sentence_completed": "2016-06-01"}],
   "args": {"today": "2026-09-12"},
   "requires": ["pairing:assault-simple"],
   "expect": [
    {"field": "canada_entries.0.canada_branch", "eq": "36(2)(a)-two-offences"},
    {"field": "canada_entries.1.canada_branch", "eq": "36(2)(a)-two-offences"},
    {"field": "s18_1.outcome", "eq": "not-deemed"},
    {"text": "all", "contains": "## IRPR s. 18.1 limb by limb"},
    {"text": "all", "absent": "EXEMPT -- IRPR s. 18.1"}],
   "working": "The foreign assault is a ground of its own and (a)(iv) fails on the two Canadian summary convictions, so the person is not inadmissible 'solely' on them: s. 18.1 does not apply and they engage s. 36(2)(a) (was EXEMPT with a 'check the record' condition).",
   "sources": [{"id": "SOR-2002-227-s18.1", "why": "'inadmissible solely on the basis of'"}, {"id": "SOR-2002-227-s18-p1", "why": "(a)(iv)"}]
  },
  {
   "id": "canadian-hybrid-election-through-screen-history",
   "kind": "tool",
   "entries": [
    {"offense": "simple assault", "disposition": "convicted", "state": "NY", "offence_date": "2008-01-01", "sentence_completed": "2009-01-01"},
    {"offense": "assault", "disposition": "convicted", "jurisdiction": "canada", "canada_max_years": 5, "canada_offence_mode": "hybrid", "canada_sentence": "fine", "offence_date": "2015-01-01", "sentence_completed": "2016-01-01"}],
   "args": {"today": "2026-09-12"},
   "requires": ["pairing:assault-simple"],
   "expect": [
    {"field": "rehab_status", "eq": "not-settled"},
    {"field": "earliest_apply", "eq": "2021-01-01"},
    {"field": "s18_readings.0.status", "eq": "eligible-to-apply"},
    {"field": "s18_readings.1.status", "eq": "undetermined"},
    {"needs": [["canada_prosecuted", 2]]},
    {"field": "canada_entries.0.canada_branch", "eq": "36(2)(a)"},
    {"text": "all", "contains": "give canada_prosecuted (#2)"}],
   "working": "A foreign assault 2008/2009 and a Canadian hybrid assault 2015/2016 (fine; election not given). The Canadian entry is s. 36(2)(a) whatever the election (s. 36(3)(a)). For s. 18(2)(a)(iii) the reading decides, and on the 'summary' reading the election does (I-21 s. 34(1)(c)): was ELIGIBLE TO APPLY on (iii) alone.",
   "sources": [{"id": "SOR-2002-227-s18-p1", "why": "(a)(iii)"}, {"id": "I-21-s34", "why": "s. 34(1)(c)"}]
  },
  {
   "id": "canadian-hybrid-entered-summarily-through-screen-history",
   "kind": "tool",
   "entries": [
    {"offense": "simple assault", "disposition": "convicted", "state": "NY", "offence_date": "2008-01-01", "sentence_completed": "2009-01-01"},
    {"offense": "assault", "disposition": "convicted", "jurisdiction": "canada", "canada_max_years": 5, "canada_offence_mode": "hybrid", "canada_sentence": "fine", "canada_prosecuted": "summarily", "offence_date": "2015-01-01", "sentence_completed": "2016-01-01"}],
   "args": {"today": "2026-09-12"},
   "requires": ["pairing:assault-simple"],
   "expect": [
    {"field": "rehab_status", "eq": "not-settled"},
    {"field": "s18_readings.0.status", "eq": "eligible-to-apply"},
    {"field": "s18_readings.1.status", "eq": "deemed-rehabilitated"},
    {"field": "canada_entries.0.canada_branch", "eq": "36(2)(a)"}],
   "working": "canada_prosecuted 'summarily' reaches the limbs: on the 'summary' reading every limb of (a) holds; on 'indictable' (iii) fails. It does not change the Canadian entry's own ground (s. 36(2)(a): s. 36(3)(a) deems the hybrid indictable 'even if it has been prosecuted summarily').",
   "sources": [{"id": "I-2.5-s36-p2", "why": "s. 36(3)(a)"}, {"id": "I-21-s34", "why": "s. 34(1)(c)"}]
  }
 ]
}