Commit bcea363
`duplicatePackage` and `reassignOrphanedMetadata` scanned `sys_metadata` with a
strict `organization_id` equality, which matches no row whose column is NULL, so
an org-scoped caller could not see any row recorded env-wide. Both scans now
accept org-scoped or env-wide rows — the same `$or` the rest of this family
carries.
These two sites were filed UNVERIFIED, so step one was a reachability
measurement on a real engine, not an edit. Both halves came back live: each has
one production caller forwarding `resolveActiveOrganizationId`, and env-wide
rows in that table are ordinary — a `saveMetaItem` naming no package at all
still succeeds today and lands `package_id = null, organization_id = null`,
which is exactly the orphan the scan could not see.
Both symptoms were worse than projected:
- `duplicatePackage` answered `{success: true, copiedCount: 1, failedCount: 0}`
over a mixed-scope source — and because the rename map is built only from the
rows the scan returns, a copied view kept pointing at the SOURCE package's
object: a duplicate silently wired back to the base it was cloned from.
- Widening the scan alone was not a fix. `object` is `allowOrgOverride=false`,
so stamping the request's org onto a copy is refused with `NOT_OVERRIDABLE`.
An object therefore cannot exist org-scoped, so every object row is env-wide
and an org-scoped `duplicatePackage` could never copy one — ADR-0070 D4's
"duplicate base" could not duplicate what a base is mostly made of whenever
an org was active. Each copy now lands in the scope of the row it came from,
the same rule #7559 gave `revertCommit`.
- `reassignOrphanedMetadata` left env-wide orphans at `package_id = null` and
reported success. Finding orphans is its entire purpose, and ADR-0070 D5
makes the unit explicitly the ENVIRONMENT, so the strict equality made it
inert for an org-scoped caller in the deployment it was designed for.
The no-org branch is deliberately NOT narrowed on either site, and both doors
are pinned as they stand. Whether the orphan door should be as wide as it is
remains #7780's open product question, which is not decided here.
Pinned on a real ObjectQL over a real SqlDriver in `packages/runtime` (12
cases). Reverse verification predicted 5 red and measured 5 failed | 7 passed.
Fixes #7819
Claude-Session: https://claude.ai/code/session_01DPXtEEaejmVQDY7GPUWv4z
Co-authored-by: Claude <noreply@anthropic.com>
1 parent b313fde commit bcea363
3 files changed
Lines changed: 740 additions & 4 deletions
File tree
- .changeset
- packages
- metadata-protocol/src
- runtime/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 | + | |
| 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 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11789 | 11789 | | |
11790 | 11790 | | |
11791 | 11791 | | |
11792 | | - | |
11793 | | - | |
| 11792 | + | |
| 11793 | + | |
| 11794 | + | |
| 11795 | + | |
| 11796 | + | |
| 11797 | + | |
| 11798 | + | |
| 11799 | + | |
| 11800 | + | |
| 11801 | + | |
| 11802 | + | |
| 11803 | + | |
| 11804 | + | |
| 11805 | + | |
| 11806 | + | |
| 11807 | + | |
| 11808 | + | |
| 11809 | + | |
| 11810 | + | |
| 11811 | + | |
| 11812 | + | |
| 11813 | + | |
| 11814 | + | |
| 11815 | + | |
| 11816 | + | |
| 11817 | + | |
| 11818 | + | |
| 11819 | + | |
| 11820 | + | |
| 11821 | + | |
| 11822 | + | |
| 11823 | + | |
| 11824 | + | |
| 11825 | + | |
| 11826 | + | |
| 11827 | + | |
| 11828 | + | |
| 11829 | + | |
| 11830 | + | |
| 11831 | + | |
| 11832 | + | |
| 11833 | + | |
| 11834 | + | |
| 11835 | + | |
| 11836 | + | |
| 11837 | + | |
| 11838 | + | |
| 11839 | + | |
| 11840 | + | |
| 11841 | + | |
| 11842 | + | |
| 11843 | + | |
| 11844 | + | |
| 11845 | + | |
| 11846 | + | |
| 11847 | + | |
| 11848 | + | |
| 11849 | + | |
| 11850 | + | |
| 11851 | + | |
| 11852 | + | |
11794 | 11853 | | |
11795 | 11854 | | |
11796 | 11855 | | |
| |||
11932 | 11991 | | |
11933 | 11992 | | |
11934 | 11993 | | |
| 11994 | + | |
| 11995 | + | |
| 11996 | + | |
| 11997 | + | |
| 11998 | + | |
| 11999 | + | |
| 12000 | + | |
| 12001 | + | |
| 12002 | + | |
| 12003 | + | |
| 12004 | + | |
| 12005 | + | |
| 12006 | + | |
| 12007 | + | |
| 12008 | + | |
| 12009 | + | |
| 12010 | + | |
| 12011 | + | |
| 12012 | + | |
| 12013 | + | |
| 12014 | + | |
| 12015 | + | |
| 12016 | + | |
| 12017 | + | |
| 12018 | + | |
| 12019 | + | |
| 12020 | + | |
| 12021 | + | |
| 12022 | + | |
| 12023 | + | |
11935 | 12024 | | |
11936 | 12025 | | |
11937 | 12026 | | |
11938 | 12027 | | |
11939 | 12028 | | |
11940 | 12029 | | |
11941 | 12030 | | |
11942 | | - | |
| 12031 | + | |
11943 | 12032 | | |
11944 | 12033 | | |
11945 | 12034 | | |
| |||
11978 | 12067 | | |
11979 | 12068 | | |
11980 | 12069 | | |
11981 | | - | |
| 12070 | + | |
| 12071 | + | |
| 12072 | + | |
| 12073 | + | |
| 12074 | + | |
| 12075 | + | |
| 12076 | + | |
| 12077 | + | |
| 12078 | + | |
| 12079 | + | |
| 12080 | + | |
| 12081 | + | |
| 12082 | + | |
| 12083 | + | |
| 12084 | + | |
| 12085 | + | |
| 12086 | + | |
| 12087 | + | |
| 12088 | + | |
| 12089 | + | |
| 12090 | + | |
| 12091 | + | |
| 12092 | + | |
| 12093 | + | |
| 12094 | + | |
| 12095 | + | |
| 12096 | + | |
| 12097 | + | |
| 12098 | + | |
| 12099 | + | |
| 12100 | + | |
| 12101 | + | |
| 12102 | + | |
| 12103 | + | |
| 12104 | + | |
| 12105 | + | |
| 12106 | + | |
| 12107 | + | |
| 12108 | + | |
11982 | 12109 | | |
11983 | 12110 | | |
11984 | 12111 | | |
| |||
0 commit comments