Skip to content

Stop sending hashed search queries to legacy /v1/events#464

Merged
rainxchzed merged 1 commit intomainfrom
chore/drop-legacy-query-hash
Apr 28, 2026
Merged

Stop sending hashed search queries to legacy /v1/events#464
rainxchzed merged 1 commit intomainfrom
chore/drop-legacy-query-hash

Conversation

@rainxchzed
Copy link
Copy Markdown
Member

@rainxchzed rainxchzed commented Apr 28, 2026

Summary

Drops the queryHash field from the legacy /v1/events telemetry pipeline.

recordSearchPerformed was sending hashQuery(query) — a SHA-256 of the lowercased+trimmed query truncated to 16 hex chars — every time a user submitted a search and had the legacy "Help improve search" toggle enabled. For low-entropy inputs (repo names, app names, English words) a 16-hex SHA-256 prefix is rainbow-table-trivial; effectively the query.

This PR removes that field at the client. The backend column can stay (older clients still write it); newer clients omit it. The signal that survives is result_count — the count-only ranking-miss tracker stays intact.

Changes

  • TelemetryRepository.recordSearchPerformed(query, resultCount)recordSearchPerformed(resultCount)
  • TelemetryRepositoryImpl: drop the hashQuery import and the queryHash argument to enqueue(...); same signature change.
  • EventRequest: drop the queryHash field (it had no other producers after this change).
  • core/data/utils/QueryHash.kt: deleted — only caller was the legacy recordSearchPerformed.
  • SearchViewModel: updated to the new signature.

Test plan

  • ./gradlew :composeApp:compileKotlinJvm :composeApp:compileDebugKotlinAndroid (will run in CI)
  • Manual: with legacy "Help improve search" toggle enabled, run a search and confirm the request body to /v1/events no longer contains a queryHash field. Backend continues to accept (the field is String? = null server-side).

Notes

  • SearchRepositoryImpl still hashes the query for local cache key construction — that hash never leaves the device. Untouched.
  • Cherry-picked from the (now-closed) E6 PR E6: client-side product telemetry foundation #462 commit ea71b5ed. No other E6 work is included.

Summary by CodeRabbit

  • Refactor
    • Simplified telemetry data collection for search functionality by removing query-related information from event payloads.
    • Updated search performance tracking to record only result counts.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0f0d4029-cc67-43e3-b26a-1bd35f6d43a6

📥 Commits

Reviewing files that changed from the base of the PR and between 83f3f97 and e5fa57f.

📒 Files selected for processing (5)
  • core/data/src/commonMain/kotlin/zed/rainxch/core/data/dto/EventRequest.kt
  • core/data/src/commonMain/kotlin/zed/rainxch/core/data/repository/TelemetryRepositoryImpl.kt
  • core/data/src/commonMain/kotlin/zed/rainxch/core/data/utils/QueryHash.kt
  • core/domain/src/commonMain/kotlin/zed/rainxch/core/domain/repository/TelemetryRepository.kt
  • feature/search/presentation/src/commonMain/kotlin/zed/rainxch/search/presentation/SearchViewModel.kt
💤 Files with no reviewable changes (3)
  • core/data/src/commonMain/kotlin/zed/rainxch/core/data/utils/QueryHash.kt
  • feature/search/presentation/src/commonMain/kotlin/zed/rainxch/search/presentation/SearchViewModel.kt
  • core/data/src/commonMain/kotlin/zed/rainxch/core/data/dto/EventRequest.kt

Walkthrough

The changes remove query-derived data from the telemetry system. The queryHash field is removed from the EventRequest DTO, the hashQuery utility function is deleted, the recordSearchPerformed method signature is simplified to only accept resultCount, and all telemetry calls are updated accordingly.

Changes

Cohort / File(s) Summary
Telemetry Data Model
core/data/src/commonMain/kotlin/zed/rainxch/core/data/dto/EventRequest.kt
Removed optional queryHash field from EventRequest DTO.
Query Hash Utility Removal
core/data/src/commonMain/kotlin/zed/rainxch/core/data/utils/QueryHash.kt
Deleted hashQuery() function that computed SHA-256 hashes of normalized search queries.
Telemetry Repository
core/domain/src/commonMain/kotlin/zed/rainxch/core/domain/repository/TelemetryRepository.kt, core/data/src/commonMain/kotlin/zed/rainxch/core/data/repository/TelemetryRepositoryImpl.kt
Updated recordSearchPerformed() method signature to remove query parameter; implementation no longer enqueues query hashes and includes explanatory comment.
Search Feature
feature/search/presentation/src/commonMain/kotlin/zed/rainxch/search/presentation/SearchViewModel.kt
Updated telemetry call to record only resultCount without passing the search query.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Once hashed with SHA-256 might,
The queries danced in telemetry's light,
Now simplified, clean and lean—
Just counts remain, keeping the scene! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: removing hashed search query data from the legacy telemetry endpoint.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/drop-legacy-query-hash

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 and usage tips.

@rainxchzed rainxchzed merged commit 376d4e7 into main Apr 28, 2026
1 check passed
@rainxchzed rainxchzed deleted the chore/drop-legacy-query-hash branch April 28, 2026 13:03
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