Commit a4816a7
fix(plugins): provenance stamps read
* fix(plugins): provenance stamps read `ctx.previous` and drop the dead bulk-write guard (#15302)
The three provenance-stamp `beforeUpdate` hooks — `sys_email_template`,
`sys_sharing_rule`, `sys_webhook` — carried the same two comments, and runtime
measurement falsifies both:
- "multi-row updates (no single `input.id`) are not stamped": per-row `before*`
dispatch binds `ctx.input.id` on every context, so `if (!id) return` answered
"single write" on every row of a batch and guarded nothing.
- "`previous` is not resolved before beforeUpdate hooks run": the engine binds
it before dispatching `beforeUpdate` on both write shapes, so each hook's own
`engine.find` was a second read of a row the engine had just read — one extra
read per matched row on a predicate write.
Observable behaviour is unchanged, deliberately: the same rows are stamped with
the same values, and a divergent bulk edit is still refused by the engine with
`MULTI_UPDATE_HOOK_KEY_DIVERGENCE` / 400. Declining to stamp on a predicate
write was weighed and rejected — unstamped rows are exactly the ones the next
boot's seeder clobbers.
The three fakes that drive these hooks bound no `previous`, which is what let
them model a pre-#5574 engine; they now bind it as the engine does. A new
real-engine pin per package covers per-row stamping, the divergence refusal
envelope, and the read count with a control that fires.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XpTx2tbq3pZRYAdoGt6E6Y
* test(plugins): the #15302 pin doubles hold the caller's `limit` bound (#15302)
`check:objectql-double-limit` named all three new stub drivers as NEW
limit-blind `find` doubles. §3's control passes `limit: 1`, so a blind double
would have answered it with the whole table. Bound applied after the filter and
by presence, the form the gate names.
Also renames the stub's unused `findOne` object parameter: vitest transpiles
without checking, so all three suites were green while `tsc --noEmit` (email,
webhooks) and `check:test-typecheck` (sharing) each reported TS6133.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XpTx2tbq3pZRYAdoGt6E6Y
* docs(permissions): re-anchor the system-context census after the provenance headers grew (#15302)
The three `isSystem` reads moved when the provenance-stamp headers were rewritten
(`email-template-provenance.ts:59` to `:77`, `sharing-rule-provenance.ts:47` to `:66`,
`webhook-provenance.ts:50` to `:68`) and `content/docs/permissions/system-context.mdx`
was not regenerated with them, so `check-system-context-census` reported 6 problems:
three read sites with no row, and three anchors that are no longer read sites.
This is the output of `node scripts/check-system-context-census.mjs --fix`, which
rewrote 3 anchors on 2 page lines. `--fix` REFUSED ZERO files, so this is a pure
line-number shift and not a population change. A second `--fix` run rewrites 0
anchors; the gate and its `--self-test` both exit 0.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XpTx2tbq3pZRYAdoGt6E6Y
* docs(permissions): regenerate the system-context census from the merged tree (#15302)
Step 4 of `scripts/pm/os-regen-merge.sh` for the merge of `origin/main` in
273bd0f. `content/docs/permissions/system-context.mdx` is a `merge=os-regen`
path and both sides moved it: this branch re-anchored the three provenance
stamps, and #16029 re-anchored nine other rows on main. The driver merged the
path with exit 0 and silently kept this branch's side, so main's nine
re-anchors were dropped; step 2 took main's side back and this commit is
`pnpm gen:system-context-census` re-deriving the whole page on top of it.
Both sides are present in the result: main's `object.zod.ts:1634`,
`rest-server.ts:1565` / `:1594` / `:1597` / `:5145` / `:6571` / `:6819` /
`:7250` / `:7443`, `sharing-plugin.ts:1189`, `sharing-rule-service.ts:278` /
`:503`, `domains/packages.ts:535` and `field.zod.ts:1590`, alongside this
branch's `email-template-provenance.ts:77`, `sharing-rule-provenance.ts:66`
and `webhook-provenance.ts:68`.
`--fix` REFUSED ZERO files. A second `--fix` run rewrites 0 anchors; the gate
and its `--self-test` both exit 0 on the merged tree.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XpTx2tbq3pZRYAdoGt6E6Y
* docs(permissions): regenerate the system-context census after the second main merge (#15302)
Step 4 of `scripts/pm/os-regen-merge.sh` for the merge of `origin/main` in
234b282. `content/docs/permissions/system-context.mdx` is a `merge=os-regen`
path and both sides moved it again: #16029 shortened `share-link-service.ts`,
moving row 37's five anchors, while this branch carries the three provenance
re-anchors. The driver again merged with exit 0 while keeping one side, so
step 2 took main's side back and this commit is
`pnpm gen:system-context-census` re-deriving the page on top of it.
Row 37 now reads `share-link-service.ts:459`, `:513`, `:517`, `:590`, `:620`
(from `:469`, `:523`, `:527`, `:600`, `:630`), and this branch's
`email-template-provenance.ts:77`, `sharing-rule-provenance.ts:66` and
`webhook-provenance.ts:68` are unchanged from the previous regeneration.
`--fix` REFUSED ZERO files. A second `--fix` run rewrites 0 anchors; the gate
and its `--self-test` both exit 0 on the merged tree.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XpTx2tbq3pZRYAdoGt6E6Y
---------
Co-authored-by: Claude <noreply@anthropic.com>ctx.previous and drop the dead bulk-write guard (#16035)1 parent 9b459b7 commit a4816a7
11 files changed
Lines changed: 914 additions & 90 deletions
File tree
- .changeset
- content/docs/permissions
- packages/plugins
- plugin-email/src
- plugin-sharing/src
- plugin-webhooks/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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| |||
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
73 | 81 | | |
74 | 82 | | |
75 | 83 | | |
| |||
Lines changed: 250 additions & 0 deletions
| 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 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
0 commit comments