Repository navigation
Commit 51c3493
authored
Fix todos update silently clearing completion subscribers (#540)
* Fix todos update silently clearing completion subscribers (#538)
The BC3 todos PUT has replace semantics: any field omitted from the body
is cleared. Neither branch of todos update included
completion_subscriber_ids, so every update wiped the todo's "When done,
notify" list. The #412/#413 read-modify-write merge couldn't preserve it
because the SDK's Todo model drops completion_subscribers in
todoFromGenerated (basecamp/basecamp-sdk#355) — the merge had nothing to
carry forward.
Preservation now works via a raw GET of the flat /todos/{id}.json route
(which serves the field the SDK model drops), feeding the current
subscriber ids into both the typed-merge and raw-clear PUT paths. The
read fails closed: an HTTP error, malformed JSON, or a response missing
the completion_subscribers key aborts the command before any PUT rather
than risking a silent clear. The helper is commented as temporary and
goes away once the SDK round-trips the field.
Alongside the fix, subscribers become directly editable:
- todos create/update --notify-on-completion <names or ids> sets them
(comma-separated, with people-name tab completion)
- todos update --no-notify-on-completion clears them (by omission —
explicit intent skips the preservation read entirely)
Unit tests cover preservation in both branches, the flat-route
assertion, explicit set/clear bypassing the read, the fail-closed
matrix (missing key / malformed JSON / HTTP 500 in each branch), flag
conflicts, and the create body. A live smoke test exercises the full
sequence: create with subscriber, title-only update preserves, --no-due
preserves, --no-notify-on-completion clears.
.surface gains the three new flag records by hand (verified identical
to fresh generation); a full regeneration is deferred because the
snapshot has unrelated drift since #499 changed the generator script.
* Use completion-subscriber wording in --notify-on-completion errors
--notify-on-completion resolved people through resolveAssigneeIDs, so
failures surfaced as assignee errors ("No valid assignees provided",
"Assignee ID must be a positive number") — misleading for a flag that
sets completion subscribers.
Parameterize the resolver with a role label: resolvePersonRoleID(s)
carry the wording, and resolveAssigneeID(s) stay as assignee-labeled
wrappers so existing call sites and messages are unchanged. The
subscriber call sites now go through resolveCompletionSubscriberIDs.
Tests cover both subscriber-worded messages and assert no PUT occurs
on resolution failure.
* Test the name-resolution failure path for --notify-on-completion
The subscriber-wording tests covered the numeric-validation and
empty-list errors but not the ResolvePerson miss, so the "failed to
resolve completion subscriber" formatting was only exercised indirectly.
The update mock now matches the flat preservation route exactly
(/todos/999.json) instead of any .json GET, and serves /people routes an
empty directory so name resolution deterministically misses. New subtest
asserts the subscriber-worded resolve error and that no PUT occurs. The
explicit set/clear tests tighten their no-preservation-read assertions
to the exact route.
* Address review: SDK error conversion + exact mock route match
The preservation read's GET error now runs through convertSDKError
before wrapping, so structured codes/hints (rate limit, circuit
breaker) survive with the subscriber-specific context — matching every
other raw Account() call site.
The update mock's preservation branch now matches the account-scoped
flat route exactly (/99999/todos/999.json) instead of by suffix, so a
bucket-scoped GET can never satisfy it.
* Reject missing or invalid subscriber ids in the preservation read
A completion_subscribers element without a positive id would have put a
zero into completion_subscriber_ids and reached the PUT, slipping past
the fail-closed contract. The preservation read now errors on any
non-positive id, and the fail-closed test matrix covers the case.1 parent 6ec1a07 commit 51c3493
6 files changed
Lines changed: 402 additions & 12 deletions
File tree
- e2e/smoke
- internal/commands
- skills/basecamp
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13091 | 13091 | | |
13092 | 13092 | | |
13093 | 13093 | | |
| 13094 | + | |
13094 | 13095 | | |
13095 | 13096 | | |
13096 | 13097 | | |
| |||
13359 | 13360 | | |
13360 | 13361 | | |
13361 | 13362 | | |
| 13363 | + | |
13362 | 13364 | | |
13363 | 13365 | | |
13364 | 13366 | | |
| 13367 | + | |
13365 | 13368 | | |
13366 | 13369 | | |
13367 | 13370 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 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 | + | |
141 | 190 | | |
142 | 191 | | |
143 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
350 | 357 | | |
351 | 358 | | |
352 | | - | |
| 359 | + | |
353 | 360 | | |
354 | 361 | | |
355 | 362 | | |
356 | 363 | | |
357 | | - | |
| 364 | + | |
358 | 365 | | |
359 | 366 | | |
360 | 367 | | |
361 | 368 | | |
362 | 369 | | |
363 | | - | |
| 370 | + | |
364 | 371 | | |
365 | 372 | | |
366 | 373 | | |
367 | 374 | | |
368 | 375 | | |
369 | 376 | | |
370 | | - | |
| 377 | + | |
371 | 378 | | |
372 | 379 | | |
373 | 380 | | |
| |||
2460 | 2467 | | |
2461 | 2468 | | |
2462 | 2469 | | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
2463 | 2476 | | |
2464 | 2477 | | |
2465 | 2478 | | |
| |||
2469 | 2482 | | |
2470 | 2483 | | |
2471 | 2484 | | |
2472 | | - | |
| 2485 | + | |
2473 | 2486 | | |
2474 | 2487 | | |
2475 | 2488 | | |
2476 | 2489 | | |
2477 | 2490 | | |
2478 | 2491 | | |
2479 | 2492 | | |
2480 | | - | |
| 2493 | + | |
2481 | 2494 | | |
2482 | 2495 | | |
2483 | 2496 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
766 | 766 | | |
767 | 767 | | |
768 | 768 | | |
| 769 | + | |
769 | 770 | | |
770 | 771 | | |
771 | 772 | | |
| |||
881 | 882 | | |
882 | 883 | | |
883 | 884 | | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
884 | 892 | | |
885 | 893 | | |
886 | 894 | | |
| |||
925 | 933 | | |
926 | 934 | | |
927 | 935 | | |
| 936 | + | |
928 | 937 | | |
929 | 938 | | |
930 | 939 | | |
931 | 940 | | |
932 | 941 | | |
933 | 942 | | |
934 | 943 | | |
| 944 | + | |
935 | 945 | | |
936 | 946 | | |
937 | 947 | | |
| |||
946 | 956 | | |
947 | 957 | | |
948 | 958 | | |
| 959 | + | |
| 960 | + | |
949 | 961 | | |
950 | 962 | | |
951 | 963 | | |
| |||
961 | 973 | | |
962 | 974 | | |
963 | 975 | | |
964 | | - | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
965 | 981 | | |
966 | 982 | | |
967 | 983 | | |
| |||
977 | 993 | | |
978 | 994 | | |
979 | 995 | | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
980 | 999 | | |
981 | 1000 | | |
982 | 1001 | | |
983 | 1002 | | |
984 | 1003 | | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
985 | 1007 | | |
986 | 1008 | | |
987 | 1009 | | |
| |||
999 | 1021 | | |
1000 | 1022 | | |
1001 | 1023 | | |
| 1024 | + | |
1002 | 1025 | | |
1003 | 1026 | | |
1004 | 1027 | | |
1005 | | - | |
| 1028 | + | |
1006 | 1029 | | |
1007 | | - | |
| 1030 | + | |
1008 | 1031 | | |
1009 | 1032 | | |
1010 | 1033 | | |
| |||
1100 | 1123 | | |
1101 | 1124 | | |
1102 | 1125 | | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
1103 | 1146 | | |
1104 | 1147 | | |
1105 | 1148 | | |
| |||
1166 | 1209 | | |
1167 | 1210 | | |
1168 | 1211 | | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
1169 | 1231 | | |
1170 | 1232 | | |
1171 | 1233 | | |
| |||
1205 | 1267 | | |
1206 | 1268 | | |
1207 | 1269 | | |
| 1270 | + | |
| 1271 | + | |
1208 | 1272 | | |
1209 | | - | |
| 1273 | + | |
1210 | 1274 | | |
1211 | 1275 | | |
1212 | 1276 | | |
| 1277 | + | |
1213 | 1278 | | |
1214 | 1279 | | |
1215 | 1280 | | |
1216 | 1281 | | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
1217 | 1325 | | |
1218 | 1326 | | |
1219 | 1327 | | |
| |||
0 commit comments