Preserve fractional seconds in ISO8601 log record exports - #634
Merged
Conversation
Constraint: Preserve existing supported Python syntax and public API behavior. Confidence: high Scope-risk: narrow Tested: 260 tests passed, 38 optional tests skipped; public LogRecord JSON round-trip Not-tested: Other Python versions and operating systems.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #634 +/- ##
==========================================
+ Coverage 85.34% 85.36% +0.01%
==========================================
Files 45 45
Lines 5806 5813 +7
Branches 465 465
==========================================
+ Hits 4955 4962 +7
Misses 721 721
Partials 130 130 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
format_iso8601() renders microsecond=1 as .1, which represents 100000 microseconds. Pad the fractional part to six digits so JSON-safe LogRecord exports survive an exact timestamp round trip. Seven regression cases include zero and six-digit fractions.
Validation: Original regression: five parameter cases failed against the unmodified implementation (1/12/123/1234/12345 microseconds); see logbook-red.log. Full suite: 260 passed, 38 skipped in 5.10s (logbook-green.log). Final formatted test rerun: 9 passed. Ruff check and Ruff format checks passed on both changed files.
Manual QA: PASS: six LogRecord JSON export/import timestamps preserve exact microseconds
Limitations: macOS CPython 3.14.6, pure Python fallback; 38 optional/backend tests skipped; native Rust backend and other Python versions were not tested.
AI disclosure: OpenAI Codex generated and locally tested this patch and regression tests.