Commit ef5e72d
A `treatAsHistorical` import writes with `preserveAudit` (#3493), keeping the
original `updated_at`/`updated_by` and business `readonly` fields instead of
stamping-now / stripping them. Its undo route restored the captured pre-import
snapshot with a plain write context, so the audit auto-stamp re-wrote
`updated_at`/`updated_by` to "now" — silently corrupting the very timeline the
historical import had preserved.
The undo write context now mirrors the import's own: it carries `preserveAudit`
iff the job row is flagged `treat_as_historical`, so restoring `u.before`
re-writes the snapshotted audit/timestamp values verbatim. A normal import's
undo is unchanged (default stamp/strip).
Adds two regression tests in import-job-integration.test.ts asserting the undo
write context carries preserveAudit iff the import was historical.
Claude-Session: https://claude.ai/code/session_01B5rdfBKjkbcoEif4KUV6xE
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6163393 commit ef5e72d
3 files changed
Lines changed: 94 additions & 1 deletion
File tree
- .changeset
- packages/rest/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
387 | 388 | | |
388 | 389 | | |
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 | + | |
390 | 453 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4049 | 4049 | | |
4050 | 4050 | | |
4051 | 4051 | | |
4052 | | - | |
| 4052 | + | |
| 4053 | + | |
| 4054 | + | |
| 4055 | + | |
| 4056 | + | |
| 4057 | + | |
| 4058 | + | |
| 4059 | + | |
| 4060 | + | |
| 4061 | + | |
| 4062 | + | |
| 4063 | + | |
| 4064 | + | |
| 4065 | + | |
4053 | 4066 | | |
4054 | 4067 | | |
4055 | 4068 | | |
| |||
0 commit comments