Commit 60dc132
fix(temporal): audit set_valid_to closes with an entity_history snapshot (#373)
set_valid_to enforced tighten-only semantics but wrote no entity_history
snapshot, so a close was invisible to transaction-time reconstruction:
as_of/bitemporal_at at a tx instant BEFORE the close reported the close
anyway (the live row's valid_to was the only record and unversioned),
and the #372 audited-re-assert snapshot then conflated the close into
the whole pre-extension recorded window.
Mirror the #371/#372 audited stamp in set_valid_to: an effective
close/tighten snapshots the pre-change row (invalidated = now with the
anti-zero-width bump, superseded_by = self), advances the live row's
recorded_at, links supersedes, and pins a still-NULL valid_from to the
old effective opening so pre-v9 rows don't shift. The tighten-only
guards are untouched; a no-op call (earlier stored close kept) writes
no snapshot. mimir_supersede funnels through set_valid_to and inherits
the audit for free.
The verbatim snapshot INSERT shared with remember_impl is factored into
snapshot_live_row_to_history.
Tests: set_valid_to_close_is_audited_and_noop_is_not (exactly one
snapshot; bitemporal_at at a pre-close tx instant reconstructs the fact
OPEN, current knowledge shows the close; same-value and would-extend
no-ops add nothing) and supersede_close_inherits_the_audit_snapshot.
254 passed, 2 ignored; temporal gate 100% (20/20).
Closes #373
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 3a7db84 commit 60dc132
3 files changed
Lines changed: 215 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1848 | 1848 | | |
1849 | 1849 | | |
1850 | 1850 | | |
1851 | | - | |
1852 | | - | |
1853 | | - | |
1854 | | - | |
1855 | | - | |
1856 | | - | |
1857 | | - | |
1858 | | - | |
1859 | | - | |
1860 | | - | |
1861 | | - | |
1862 | | - | |
1863 | | - | |
1864 | | - | |
1865 | | - | |
1866 | | - | |
1867 | | - | |
| 1851 | + | |
1868 | 1852 | | |
1869 | 1853 | | |
1870 | 1854 | | |
| |||
3614 | 3598 | | |
3615 | 3599 | | |
3616 | 3600 | | |
| 3601 | + | |
| 3602 | + | |
| 3603 | + | |
| 3604 | + | |
| 3605 | + | |
| 3606 | + | |
| 3607 | + | |
| 3608 | + | |
| 3609 | + | |
| 3610 | + | |
| 3611 | + | |
| 3612 | + | |
| 3613 | + | |
| 3614 | + | |
| 3615 | + | |
| 3616 | + | |
| 3617 | + | |
| 3618 | + | |
| 3619 | + | |
| 3620 | + | |
| 3621 | + | |
| 3622 | + | |
| 3623 | + | |
| 3624 | + | |
| 3625 | + | |
| 3626 | + | |
| 3627 | + | |
| 3628 | + | |
| 3629 | + | |
| 3630 | + | |
| 3631 | + | |
| 3632 | + | |
| 3633 | + | |
3617 | 3634 | | |
3618 | 3635 | | |
3619 | 3636 | | |
3620 | | - | |
| 3637 | + | |
3621 | 3638 | | |
3622 | 3639 | | |
3623 | 3640 | | |
| |||
3628 | 3645 | | |
3629 | 3646 | | |
3630 | 3647 | | |
| 3648 | + | |
| 3649 | + | |
| 3650 | + | |
| 3651 | + | |
| 3652 | + | |
| 3653 | + | |
3631 | 3654 | | |
3632 | 3655 | | |
3633 | 3656 | | |
3634 | 3657 | | |
3635 | | - | |
| 3658 | + | |
3636 | 3659 | | |
3637 | | - | |
| 3660 | + | |
| 3661 | + | |
3638 | 3662 | | |
3639 | 3663 | | |
3640 | | - | |
| 3664 | + | |
3641 | 3665 | | |
3642 | 3666 | | |
3643 | 3667 | | |
| |||
3649 | 3673 | | |
3650 | 3674 | | |
3651 | 3675 | | |
3652 | | - | |
| 3676 | + | |
3653 | 3677 | | |
3654 | 3678 | | |
3655 | 3679 | | |
3656 | | - | |
3657 | | - | |
3658 | | - | |
| 3680 | + | |
| 3681 | + | |
| 3682 | + | |
| 3683 | + | |
| 3684 | + | |
| 3685 | + | |
| 3686 | + | |
| 3687 | + | |
| 3688 | + | |
| 3689 | + | |
| 3690 | + | |
| 3691 | + | |
| 3692 | + | |
| 3693 | + | |
| 3694 | + | |
| 3695 | + | |
| 3696 | + | |
| 3697 | + | |
| 3698 | + | |
| 3699 | + | |
3659 | 3700 | | |
| 3701 | + | |
3660 | 3702 | | |
3661 | 3703 | | |
3662 | 3704 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3228 | 3228 | | |
3229 | 3229 | | |
3230 | 3230 | | |
| 3231 | + | |
| 3232 | + | |
| 3233 | + | |
| 3234 | + | |
| 3235 | + | |
| 3236 | + | |
| 3237 | + | |
| 3238 | + | |
| 3239 | + | |
| 3240 | + | |
| 3241 | + | |
| 3242 | + | |
| 3243 | + | |
| 3244 | + | |
| 3245 | + | |
| 3246 | + | |
| 3247 | + | |
| 3248 | + | |
| 3249 | + | |
| 3250 | + | |
| 3251 | + | |
| 3252 | + | |
| 3253 | + | |
| 3254 | + | |
| 3255 | + | |
| 3256 | + | |
| 3257 | + | |
| 3258 | + | |
| 3259 | + | |
| 3260 | + | |
| 3261 | + | |
| 3262 | + | |
| 3263 | + | |
| 3264 | + | |
| 3265 | + | |
| 3266 | + | |
| 3267 | + | |
| 3268 | + | |
| 3269 | + | |
| 3270 | + | |
| 3271 | + | |
| 3272 | + | |
| 3273 | + | |
| 3274 | + | |
| 3275 | + | |
| 3276 | + | |
| 3277 | + | |
| 3278 | + | |
| 3279 | + | |
| 3280 | + | |
| 3281 | + | |
| 3282 | + | |
| 3283 | + | |
| 3284 | + | |
| 3285 | + | |
| 3286 | + | |
| 3287 | + | |
| 3288 | + | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
| 3297 | + | |
| 3298 | + | |
| 3299 | + | |
| 3300 | + | |
| 3301 | + | |
| 3302 | + | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
| 3324 | + | |
| 3325 | + | |
| 3326 | + | |
| 3327 | + | |
| 3328 | + | |
| 3329 | + | |
| 3330 | + | |
| 3331 | + | |
| 3332 | + | |
| 3333 | + | |
| 3334 | + | |
| 3335 | + | |
| 3336 | + | |
| 3337 | + | |
| 3338 | + | |
| 3339 | + | |
| 3340 | + | |
| 3341 | + | |
| 3342 | + | |
| 3343 | + | |
| 3344 | + | |
| 3345 | + | |
| 3346 | + | |
| 3347 | + | |
| 3348 | + | |
| 3349 | + | |
| 3350 | + | |
| 3351 | + | |
| 3352 | + | |
| 3353 | + | |
| 3354 | + | |
| 3355 | + | |
| 3356 | + | |
| 3357 | + | |
| 3358 | + | |
| 3359 | + | |
| 3360 | + | |
| 3361 | + | |
| 3362 | + | |
| 3363 | + | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
| 3367 | + | |
| 3368 | + | |
| 3369 | + | |
| 3370 | + | |
| 3371 | + | |
3231 | 3372 | | |
3232 | 3373 | | |
3233 | 3374 | | |
| |||
0 commit comments