fix(weave): call_end_v2 UPDATE on primary key, fix no-op - #7074
Conversation
|
Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=c3070831e15c568d7f57bdf0f1e3fe1ec8823c50 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
e126df8 to
8eb305e
Compare
8eb305e to
a4ca9b0
Compare
a4ca9b0 to
a6dd205
Compare
…t no-op call_end_v2 on a calls_complete project ran a lightweight UPDATE keyed on the client-supplied started_at. A wrong/omitted started_at matched zero rows, leaving the call permanently unfinished while the endpoint returned 200. Fast path: weave_client sends the correct started_at, so confirm the row with a full primary-key (project_id, started_at, id) point lookup, then UPDATE on the same key. Only when the client value is missing or wrong do we fall back to a (project_id, id) lookup to recover the real started_at, and raise NotFoundError if the start truly doesn't exist. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
a6dd205 to
8053abc
Compare
jwlee64
left a comment
There was a problem hiding this comment.
Why were the started_ats mismatching in the first place, It seems like that would be a fair assumption.
But i guess with the 404 we can surface how often this happens more in our alerting
@jwlee64 |
Jira: https://coreweave.atlassian.net/browse/WB-35267
Summary
call_end_v2on a calls_complete project runs a lightweight UPDATE keyed on the clientstarted_at; a wrong/omitted value matched 0 rows, leaving the call permanently unfinished while the endpoint returned 200.(project_id, started_at, id); fallback recovers the realstarted_atby(project_id, id)and raisesNotFoundError(404) if the start is truly absent.Performance
The extra read only runs on the eager
call/end-> calls_complete path (_update_call_end_in_calls_complete). Last 7d in prod: that path fired 2,486 times vs ~135k v2calls/completewrites -> ~1.8% of (calls/complete + call/end) hits, ~0.04% of all ~6.9M call ends. Added cost is one PK point lookup before the existing UPDATE. Local benchmark (1M-row single-project calls_complete clone, CH 26.3):Testing
clickhouse-backed regression test: mismatched started_at still finishes, unknown id raises NotFoundError.