Commit 5568026
committed
feat(migrate): gate the file-as-reference migration per deployment, not per release (#3617)
The ADR-0104 D3 wave 2 acceptance gate was written as an operations runbook —
run the backfill on the tenant, watch `verifyFileReferences` stay clean for
seven days, then flip the switch. Every clause assumes we run the tenant, we
observe it, and we flip.
ObjectStack is a development platform. Third-party deployments upgrade on their
own schedule and their data is not visible to us, so there is no observation
window of ours that anyone else's data can wait inside. A gate phrased as one is
not strict, merely unlocatable.
R4's substance is unchanged — a ledger may not be given the power to delete
bytes until it has been shown to agree with reality. What changes is who
produces the evidence: each deployment, for itself.
os migrate files-to-references # dry run: reports, writes nothing
os migrate files-to-references --apply # converts, verifies, records the flag
An apply run whose reconciliation reports zero blocking discrepancies records
`sys_migration { id: 'adr-0104-file-references', verified_at, blocking: 0 }`.
That row — never the platform version — is what may later open released-file
collection (#3459 PR-5b) and strict media value-shape enforcement (#3438); both
read the same flag through one spec-level predicate so the two gates cannot
disagree about the same fact. Not run, or not passed, leaves files retained
forever: storage cost, zero data loss. A later failing run clears the verified
state, so a database that has drifted closes its own gate.
A dry run writes nothing at all — not the conversions, and not the flag either,
even when the self-check would pass — so whether a run changed the deployment's
posture never depends on what it happened to find. The command also refuses to
run when no app metadata is loaded: an empty scan is indistinguishable from a
clean one, and this verdict authorises irreversible behaviour.
Also fixes a defect the end-to-end run surfaced: on a live kernel the engine's
read resolver expanded stored ids to their `{ id, url, … }` form before the
scan saw them, so the reconciliation reported every held reference as absent —
noisy `stale_owner` findings, and a missed `unowned_reference` would have been a
false pass of the very gate this work builds. Reads may now opt out via the
spec's `RAW_FILE_VALUES_CONTEXT_KEY`; the storage service's scan and bookkeeping
reads do.
Verified end-to-end against the showcase app on SQLite: 10 legacy values
converted and claimed, reconciliation clean, flag recorded; a dry run against
the same database left both the data and the flag untouched.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V9uWWyKq6pNPQthwCXL8ma1 parent 16adb3c commit 5568026
27 files changed
Lines changed: 1468 additions & 24 deletions
File tree
- .changeset
- content/docs/deployment
- docs/adr
- packages
- cli/src
- commands/migrate
- utils
- objectql/src
- platform-objects
- scripts
- src
- apps/translations
- system
- services/service-storage/src
- spec
- src
- data
- system
| 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 | + | |
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
517 | 517 | | |
518 | 518 | | |
519 | 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 | + | |
520 | 562 | | |
521 | 563 | | |
522 | 564 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
591 | 591 | | |
592 | 592 | | |
593 | 593 | | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
598 | 601 | | |
599 | 602 | | |
600 | 603 | | |
| |||
604 | 607 | | |
605 | 608 | | |
606 | 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 | + | |
607 | 680 | | |
608 | 681 | | |
609 | 682 | | |
610 | 683 | | |
611 | 684 | | |
612 | 685 | | |
613 | | - | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
0 commit comments