fix(logstore): repair racy has_object waits and stale payload count in tests - #6176
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe changes update logstore tests to wait for committed database offload flags before asserting hydration-related behavior. The payload round-trip test now accounts for six identity snapshot fields. ChangesLogstore test synchronization
Estimated code review effort: 2 (Simple) | ~15 minutes Merge Risk: ⚪ Minimal · up to This PR updates logstore test waits to observe database hydration state directly and corrects a stale payload-count expectation; no actionable merge-blocking risk remains after normal checks. Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
5e1a7b5 to
ae7ae82
Compare
645f463 to
c02ddb7
Compare
ae7ae82 to
28c6329
Compare
c02ddb7 to
be0cae2
Compare
b077331 to
ac9aaa5
Compare
be0cae2 to
ff47460
Compare
ff47460 to
c40319c
Compare
ac9aaa5 to
9e59e07
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |

Summary
Test helpers that waited for object uploads were using
objStore.Len()as a proxy for upload completion, butprocessUploadcommits thehas_objectflag to the database only after the objectPutsucceeds. This meant tests could proceed before the row'shas_objectflag was set, causing flaky assertions that depend on hydration state.Changes
waitForUploads(t, func() bool { return objStore.Len() == N })calls withwaitForOffload(t, inner, id)(for regular logs) and the newwaitForMCPOffload(t, inner, id)(for MCP tool logs), both of which poll the database row'shas_objectflag directly rather than counting objects in the store.waitForMCPOffloadhelper that usesFindMCPToolLogto checkHasObject, mirroring the existingwaitForOffloadhelper for standard log entries.TestHybrid_ContentHiddenBatchMixedtest to wait for the visible row'shas_objectflag before asserting hydration behavior.TestExtractPayload_RoundTripassertion to account for six identity snapshot fields (provider,model,status,timestamp,selected_key_id,selected_key_name) thatExtractPayloadalways includes in the payload map, changing the expected count fromlen(payloadFields)+1tolen(payloadFields)+7.Type of change
Affected areas
How to test
go test ./framework/logstore/...All previously flaky tests should now pass consistently without race conditions between the upload goroutine committing
has_objectand test assertions reading hydration state.Breaking changes
Security considerations
None.
Checklist
docs/contributing/README.mdand followed the guidelines