Repository navigation
fix(telemetry): resolve offset-naive datetime crashes in pruning, ingestion, and doctor CLI - #125
Open
markusbrand wants to merge 1 commit into
Open
markusbrand wants to merge 1 commit into
markusbrand wants to merge 1 commit into
Conversation
…estion, and doctor CLI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes runtime crashes caused by comparisons between offset-naive and offset-aware datetimes in backend telemetry logging, retention pruning, and the doctor CLI, as well as fixing a time-bomb test failure in
test_telemetry_api_routes.Key Changes
Telemetry Pruning & Logging (
backend/app/telemetry/service.py):created_at=datetime.now(timezone.utc)when instantiatingServerEventinlog_server_eventrather than relying solely on SQLite's server-side naive default in Python memory.prune_telemetry_recordswith.execution_options(synchronize_session=False)to avoid evaluating SQL deletion predicates in Python memory against session entities with disparate datetime representations.ingest_telemetry_batchandupsert_client_ping.Doctor CLI Timeline Sorting (
backend/app/cli/doctor.py):_normalize_timeline_tsto safely normalize timestamps to UTC prior to comparison inshow_traceandgenerate_llm_prompttimelines.Test Suite & OpenSpec Artifacts:
backend/tests/test_telemetry.pyto use dynamic relative UTC timestamps so test summaries are not immediately purged by 30-day retention policies.log_server_eventpruning, naive datetime ingestion, and mixed-timestamp timeline sorting.openspec/changes/fix-telemetry-datetime-timezone-handling/.Verification
./scripts/run-qa.sh):client-tauri: 21 passed, 0 failed.web: build passed.backend: 111 passed, 0 failed.docs: mkdocs build passed.