Commit 3337cf5
fix(objectql): promoteDraft preserves the draft's package binding (#1834)
promoteDraft() called put() WITHOUT a packageId, so promoting a
package-bound draft to active created the active row unbound
(package_id = NULL). Every package-scoped reader then missed it — most
visibly the ADR-0045 publish visibility flip
(getMetaItems({ type:'app', packageId }) → unhide in publish-drafts),
which never matched a just-published AI-built app and left it hidden:true
forever (invisible in the app switcher / home "全部应用").
Read the raw draft row, carry its package_id onto the promoted active
row, and read the current active through the same package scope so the
optimistic-lock parentVersion still matches. Package-less drafts
(packageId null) behave exactly as before.
Adds a regression test asserting the promoted active row keeps the
draft's package binding.
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 4b01250 commit 3337cf5
2 files changed
Lines changed: 50 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
631 | 631 | | |
632 | 632 | | |
633 | 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 | + | |
634 | 664 | | |
635 | 665 | | |
636 | 666 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
579 | 579 | | |
580 | 580 | | |
581 | 581 | | |
582 | | - | |
583 | | - | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
584 | 595 | | |
585 | 596 | | |
586 | 597 | | |
587 | 598 | | |
588 | 599 | | |
589 | 600 | | |
590 | 601 | | |
591 | | - | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
592 | 608 | | |
593 | 609 | | |
594 | 610 | | |
| |||
597 | 613 | | |
598 | 614 | | |
599 | 615 | | |
| 616 | + | |
600 | 617 | | |
601 | 618 | | |
602 | 619 | | |
| |||
0 commit comments