Commit 65759ba
fix(plugin-sharing): render the by-id write denial through the operation-message catalog (#12976)
* fix(plugin-sharing): render the by-id write denial through the operation-message catalog
The sharing middleware's by-id write gate refused with one hardcoded English
sentence naming the object's API name and the row's opaque id. `@objectstack/rest`
ships it as the 403 body's human-readable `error` and clients show it verbatim,
so a user in a fully Chinese deployment read English prose they could not act on.
The refusal now renders through the shared Operation Message Catalog in
`@objectstack/spec/system` under the `record_write_denied` key that landed for
it — the same mechanism plugin-security's record-level denial uses, which is the
comparison the report drew. One key serves both write verbs; the verb, object
and row id move to `developerMessage`, `details` and the log.
`buildSharingMiddleware` gains an optional third argument, a lazily resolved
`II18nService.t`-compatible lookup wired by `SharingServicePlugin`, because the
i18n service is contributed by another plugin and may start later.
Not changed: who may write, the `FORBIDDEN:` prefix the REST layer classifies
403 on, and the ADR-0111 D10 delete-verb diagnostic breadcrumb.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194kbQJxUvv2yvsGRtuXpP5
* docs(skills): stop printing a refusal string the sharing gate no longer emits
`data-hooks.md` quoted the by-id write gate's message verbatim. That sentence is
now end-user copy rendered in the caller's locale, so a hook author reading the
doc would string-match prose that varies by locale. The fence names the shape
and points at the stable channel (the error's code) instead.
Token-neutral by construction: the published-bundle ratchet reads 12611 against
a ceiling of 12611 (+0), so this correction spends no context budget.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194kbQJxUvv2yvsGRtuXpP5
* Revert "docs(skills): stop printing a refusal string the sharing gate no longer emits"
This reverts commit ae4cfcc.
Not a change of mind about the edit — it is correct and necessary, and it lands
unchanged in its own PR. `skills/**` is a governed surface on the
`GOVERNED_SURFACES` register in scripts/pm/check-governed-merges.mjs, and Prime
Directive #14 judges a PR on its FILE LIST, not its description: a mixed diff is
not a proportion question, one path hit forks the whole PR and reserves the
landing for a human. Keeping the doc here would have made this branch
unmergeable by anything but a hand merge.
The doc half now rides claude/issue-12260-skills-data-hooks-prose, with the
replacement text byte-identical. The two want landing together; until the doc
one lands, data-hooks.md briefly prints a string the gate no longer emits.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194kbQJxUvv2yvsGRtuXpP5
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent b46773c commit 65759ba
5 files changed
Lines changed: 617 additions & 4 deletions
File tree
- .changeset
- packages/plugins/plugin-sharing/src
- scripts
| 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 | + | |
Lines changed: 23 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
14 | 21 | | |
15 | 22 | | |
16 | 23 | | |
| |||
52 | 59 | | |
53 | 60 | | |
54 | 61 | | |
| 62 | + | |
55 | 63 | | |
56 | 64 | | |
57 | 65 | | |
| |||
311 | 319 | | |
312 | 320 | | |
313 | 321 | | |
| 322 | + | |
| 323 | + | |
314 | 324 | | |
315 | 325 | | |
316 | 326 | | |
| |||
376 | 386 | | |
377 | 387 | | |
378 | 388 | | |
379 | | - | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
380 | 393 | | |
381 | 394 | | |
382 | 395 | | |
| |||
405 | 418 | | |
406 | 419 | | |
407 | 420 | | |
408 | | - | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
409 | 430 | | |
410 | 431 | | |
411 | 432 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
| |||
610 | 616 | | |
611 | 617 | | |
612 | 618 | | |
613 | | - | |
| 619 | + | |
614 | 620 | | |
615 | 621 | | |
616 | 622 | | |
| |||
954 | 960 | | |
955 | 961 | | |
956 | 962 | | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
957 | 1030 | | |
958 | 1031 | | |
959 | 1032 | | |
| |||
971 | 1044 | | |
972 | 1045 | | |
973 | 1046 | | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
974 | 1056 | | |
975 | 1057 | | |
976 | 1058 | | |
| |||
1116 | 1198 | | |
1117 | 1199 | | |
1118 | 1200 | | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
1119 | 1224 | | |
1120 | | - | |
| 1225 | + | |
1121 | 1226 | | |
1122 | 1227 | | |
1123 | 1228 | | |
| 1229 | + | |
| 1230 | + | |
1124 | 1231 | | |
1125 | 1232 | | |
1126 | 1233 | | |
| |||
0 commit comments