Commit 5373db8
fix(core): apply create storage check to PUT-as-create branch
The PUT create-or-replace path creates a new entity when its external_id is
not yet in the DB, via prepare_create_or_reject, which also disabled the
storage existence check. Like POST create, this could commit DB/search rows
that diverge from an existing unindexed file on disk, which the next watcher
pass would overwrite. Thread verify_storage_absent_on_create through
prepare_create_or_reject and map the resulting EntityAlreadyExistsError to a
409 conflict so local PUT-as-create matches POST create. The replace branch
(entity already exists) is unchanged.
Follow-up to the #1002 review on accepted_note_mutation_runner create.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: phernandez <paul@basicmachines.co>1 parent cae7a4b commit 5373db8
2 files changed
Lines changed: 37 additions & 1 deletion
File tree
- src/basic_memory/indexing
- tests/api/v2
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
541 | 541 | | |
542 | 542 | | |
543 | 543 | | |
| 544 | + | |
544 | 545 | | |
545 | 546 | | |
546 | 547 | | |
| |||
869 | 870 | | |
870 | 871 | | |
871 | 872 | | |
| 873 | + | |
872 | 874 | | |
873 | 875 | | |
874 | 876 | | |
875 | 877 | | |
876 | 878 | | |
877 | 879 | | |
878 | 880 | | |
879 | | - | |
| 881 | + | |
880 | 882 | | |
881 | 883 | | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
882 | 888 | | |
883 | 889 | | |
884 | 890 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
422 | 452 | | |
423 | 453 | | |
424 | 454 | | |
| |||
0 commit comments