Commit 5782845
fix(core): refuse ISO points finer than a microsecond
`_INSTANT_BOUND` caps a fractional second at six digits and refuses a longer
one rather than truncating it, because dropping digits would store a different
instant than the author wrote. That refusal only ever governed the strict path.
An over-precise point never matches `_INSTANT_BOUND`, so `_read_iso_day` fell
through to the flexible reader, which truncated the fraction and answered with
a time of day on the very day the ISO head names. Every check that path makes
then passed: `@occurred:2026-01-01T10:00:00.1234567` and its quoted form both
indexed as `2026-01-01T10:00:00.123456Z`, re-derived identically on every
reindex, with nothing said to the author. The day check is what guards the
flexible reading, and a truncated fraction sails straight through it -- the
digits it drops were never in the answer to be checked.
Judged on the author's text in `_classify_authored_point` instead, so both
readers refuse the same token for the same reason, and for the same reason the
calendar width rule already exists: a digit run wider than the syntax allows is
a typo, not a shorthand. Six digits and fewer are untouched, so `14:00:00.5` and
`.123456` still read; the range-literal path already refused these correctly.
This also corrects an overstated claim in the classifier's own comment. It said
none of the three ISO variants can reach the flexible reader, which is false: an
`_IsoDay`'s trailing text is deliberately read by it, and that is what reads
`2026-06-10 10:00 AM`. What the classifier actually settles for good is the
calendar -- a head naming no date dies there and is never re-guessed. The
trailing is fenced by two rules, one on what the reader returned and one on what
the author wrote, and the comment now says so.
A sweep of 216 ISO-time spellings (T/t/space separators, minute and second
precision, Z/z and offset zones with and without a colon, fractions of 0/1/6/7/9
and 30 digits) reported 54 tokens whose stored instant disagreed with a literal
reading of the text. All 54 were this one defect; after the fix the sweep
reports none.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014pmKq6bqCi6Zp6BTHuZjrp
Signed-off-by: phernandez <paul@basicmachines.co>1 parent e447fd9 commit 5782845
3 files changed
Lines changed: 160 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
583 | | - | |
584 | | - | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
585 | 597 | | |
586 | 598 | | |
587 | 599 | | |
| |||
595 | 607 | | |
596 | 608 | | |
597 | 609 | | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
598 | 622 | | |
599 | 623 | | |
600 | 624 | | |
| |||
645 | 669 | | |
646 | 670 | | |
647 | 671 | | |
648 | | - | |
| 672 | + | |
649 | 673 | | |
650 | | - | |
651 | | - | |
652 | | - | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
653 | 678 | | |
654 | 679 | | |
655 | 680 | | |
| |||
690 | 715 | | |
691 | 716 | | |
692 | 717 | | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
693 | 728 | | |
694 | 729 | | |
695 | 730 | | |
| |||
794 | 829 | | |
795 | 830 | | |
796 | 831 | | |
797 | | - | |
798 | | - | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
799 | 836 | | |
800 | 837 | | |
801 | 838 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 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 | + | |
440 | 488 | | |
441 | 489 | | |
442 | 490 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
533 | 533 | | |
534 | 534 | | |
535 | 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 | + | |
536 | 603 | | |
537 | 604 | | |
538 | 605 | | |
| |||
0 commit comments