Skip to content

fix(logstore): repair racy has_object waits and stale payload count in tests - #6176

Open
kohlivrinda wants to merge 1 commit into
08-14-feat_routing_session_observability_log_columns_filters_and_the_sessions_configuration_uifrom
08-14-fix_logstore_repair_racy_has_object_waits_and_stale_payload_count_in_tests
Open

fix(logstore): repair racy has_object waits and stale payload count in tests#6176
kohlivrinda wants to merge 1 commit into
08-14-feat_routing_session_observability_log_columns_filters_and_the_sessions_configuration_uifrom
08-14-fix_logstore_repair_racy_has_object_waits_and_stale_payload_count_in_tests

Conversation

@kohlivrinda

@kohlivrinda kohlivrinda commented Aug 14, 2026

Copy link
Copy Markdown
Member

Summary

Test helpers that waited for object uploads were using objStore.Len() as a proxy for upload completion, but processUpload commits the has_object flag to the database only after the object Put succeeds. This meant tests could proceed before the row's has_object flag was set, causing flaky assertions that depend on hydration state.

Changes

  • Replaced waitForUploads(t, func() bool { return objStore.Len() == N }) calls with waitForOffload(t, inner, id) (for regular logs) and the new waitForMCPOffload(t, inner, id) (for MCP tool logs), both of which poll the database row's has_object flag directly rather than counting objects in the store.
  • Added waitForMCPOffload helper that uses FindMCPToolLog to check HasObject, mirroring the existing waitForOffload helper for standard log entries.
  • Fixed the TestHybrid_ContentHiddenBatchMixed test to wait for the visible row's has_object flag before asserting hydration behavior.
  • Updated the TestExtractPayload_RoundTrip assertion to account for six identity snapshot fields (provider, model, status, timestamp, selected_key_id, selected_key_name) that ExtractPayload always includes in the payload map, changing the expected count from len(payloadFields)+1 to len(payloadFields)+7.

Type of change

  • Bug fix

Affected areas

  • Core (Go)

How to test

go test ./framework/logstore/...

All previously flaky tests should now pass consistently without race conditions between the upload goroutine committing has_object and test assertions reading hydration state.

Breaking changes

  • No

Security considerations

None.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4951c163-5390-4376-9051-eb3e04375e00

📥 Commits

Reviewing files that changed from the base of the PR and between c40319c and 9e59e07.

📒 Files selected for processing (3)
  • framework/logstore/contenthidden_test.go
  • framework/logstore/hybrid_test.go
  • framework/logstore/payload_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • framework/logstore/payload_test.go
  • framework/logstore/contenthidden_test.go
  • framework/logstore/hybrid_test.go

📝 Walkthrough

Summary by CodeRabbit

  • Tests
    • Improved synchronization for content hiding and log hydration scenarios.
    • Updated hybrid log tests to verify completed database offloading across logs, responses, attachments, and speech input.
    • Expanded payload round-trip coverage to include identity snapshot details such as provider, model, status, timestamp, and selected key information.

Walkthrough

The 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.

Changes

Logstore test synchronization

Layer / File(s) Summary
Offload state polling
framework/logstore/hybrid_test.go
Adds MCP offload polling and retains database-backed log-store handles where synchronization requires them.
Hybrid scenario synchronization
framework/logstore/hybrid_test.go
Updates standard logs, MCP logs, responses, attachments, speech input, and failure scenarios to wait for persisted offload state.
Content and payload assertions
framework/logstore/contenthidden_test.go, framework/logstore/payload_test.go
Waits for the visible row’s offload flag and expects six identity snapshot fields in the payload size assertion.

Estimated code review effort: 2 (Simple) | ~15 minutes

Merge Risk: ⚪ Minimal · up to 9e59e

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: madhuvod, akshaydeo

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main fixes: racy has_object waits and the stale payload count in logstore tests.
Description check ✅ Passed The description covers the purpose, changes, testing command, affected area, breaking changes, security, and checklist status.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 08-14-fix_logstore_repair_racy_has_object_waits_and_stale_payload_count_in_tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@kohlivrinda
kohlivrinda force-pushed the 08-14-fix_logstore_repair_racy_has_object_waits_and_stale_payload_count_in_tests branch from 5e1a7b5 to ae7ae82 Compare August 15, 2026 09:20
@kohlivrinda
kohlivrinda force-pushed the 08-14-feat_routing_session_observability_log_columns_filters_and_the_sessions_configuration_ui branch 2 times, most recently from 645f463 to c02ddb7 Compare August 15, 2026 09:51
@kohlivrinda
kohlivrinda force-pushed the 08-14-fix_logstore_repair_racy_has_object_waits_and_stale_payload_count_in_tests branch from ae7ae82 to 28c6329 Compare August 15, 2026 09:51
@kohlivrinda
kohlivrinda force-pushed the 08-14-feat_routing_session_observability_log_columns_filters_and_the_sessions_configuration_ui branch from c02ddb7 to be0cae2 Compare August 15, 2026 10:42
@kohlivrinda
kohlivrinda force-pushed the 08-14-fix_logstore_repair_racy_has_object_waits_and_stale_payload_count_in_tests branch 2 times, most recently from b077331 to ac9aaa5 Compare August 15, 2026 11:26
@kohlivrinda
kohlivrinda force-pushed the 08-14-feat_routing_session_observability_log_columns_filters_and_the_sessions_configuration_ui branch from be0cae2 to ff47460 Compare August 15, 2026 11:26
@Madhuvod
Madhuvod force-pushed the 08-14-feat_routing_session_observability_log_columns_filters_and_the_sessions_configuration_ui branch from ff47460 to c40319c Compare August 15, 2026 18:47
@Madhuvod
Madhuvod force-pushed the 08-14-fix_logstore_repair_racy_has_object_waits_and_stale_payload_count_in_tests branch from ac9aaa5 to 9e59e07 Compare August 15, 2026 18:47
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

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.

@coderabbitai
coderabbitai Bot requested review from Madhuvod and akshaydeo August 15, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant