Repository navigation
Conversation
DeleteContext read filter["id"] and asserted id.(string) (and the same
for pk). A filter without a string id, such as {"deleted_at": nil} or
{"id": 42}, panicked. Validate with comma-ok before talking to the
client and return a clear error instead.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Lutherwaves
left a comment
There was a problem hiding this comment.
praise: Validating before NewContainer is a nice touch, and the table test covers the cases from #254. I checked that it fails on the old code.
issue (non-blocking): #254 says UpdateContext already handles this, but it only checks that the key exists, not its type. UpdateContext still does unchecked pk.(string) / id.(string) (cosmosdb.go:394,397), and CreateContext does pk.(string) (:219,222), so a non-string id/pk panics there too. Fine as a follow-up, but worth an issue so this class of bug is fully closed.
|
Thanks for your contribution! |
|
Addressed in e9b0b0f — verified just now:
Validation: These changes were prepared with AI assistance and validated by running the package tests; not personally reviewed/tested by Daniel. |
Resolve merge conflict in DeleteContext: keep the PR's validated string id (no bare type assertion) and upstream's session-token recording from DeleteItem.
|
Resolved the merge conflict with upstream main (merge commit 4cb056a). The conflict was in DeleteContext: kept this PR's validated string Disclosure: this conflict resolution was assisted by AI, reviewed against the PR's intent before pushing. |
Summary
Fixes #254.
DeleteContextreadfilter["id"]unchecked and assertedid.(string)(and the same forpk). A filter without a stringid, such as{"deleted_at": nil}or{"id": 42}, panicked.Validate with comma-ok before creating the container client, and return a clear error instead of panicking.
Test plan
go test ./storage/ -run TestCosmosDBDeleteContextRejectsMissingOrNonStringID