Commit 245e0c4
fix(objectql): listDrafts surfaces env-wide drafts for a non-null org
The pending-changes list (`GET /meta/_drafts`, the Publish CTA's source)
queried `organization_id = this.organizationId AND state = 'draft'`. AI-
authored metadata is written ENV-WIDE (`organization_id IS NULL`), so under
a non-null active org (every multi-tenant / cloud request) the strict
equality dropped those drafts: the change showed in `?preview=draft` and
`publish-drafts` would promote it, but the pending-changes list returned
nothing — so the Publish CTA never appeared and the user couldn't publish
their AI-made change ("orphaned draft").
Surface both org-scoped and env-wide drafts: when the active org is
non-null, match `organization_id = org OR organization_id IS NULL`; when
null (single-env), keep the env-wide query. This mirrors how
`getMetaItems`/preview already overlays env-wide drafts.
Tests: non-null-org surfaces env-wide drafts; mixed org-scoped + env-wide
returned while other orgs' drafts excluded. Suite green (6). Mock engine
extended to evaluate `$or`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 9327cd8 commit 245e0c4
2 files changed
Lines changed: 50 additions & 8 deletions
Lines changed: 33 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
22 | 29 | | |
23 | 30 | | |
24 | | - | |
| 31 | + | |
25 | 32 | | |
26 | 33 | | |
27 | | - | |
| 34 | + | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
| |||
50 | 57 | | |
51 | 58 | | |
52 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
53 | 82 | | |
54 | 83 | | |
55 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
730 | 730 | | |
731 | 731 | | |
732 | 732 | | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
737 | 750 | | |
738 | 751 | | |
739 | 752 | | |
| |||
0 commit comments