Bind SQLite timestamp parameters as the exact stored text#78
Draft
myieye wants to merge 2 commits into
Draft
Conversation
linq2db renders DateTime/DateTimeOffset parameters truncated to milliseconds while Microsoft.Data.Sqlite stores 7-digit TEXT and SQLite's strftime rounds to the nearest millisecond, so timestamp comparisons could misclassify rows around the parameter value. In lexbox this made WhereAfter via ToLinqToDB() classify the target commit as after itself and delete it during snapshot regeneration. Binding parameters as the exact stored text makes both sides of a comparison normalize identically. linq2db comparisons remain millisecond-grained (strftime '%f' wraps both sides), so exact same-millisecond ordering still requires EF. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
myieye
added a commit
to sillsdev/languageforge-lexbox
that referenced
this pull request
Jul 7, 2026
linq2db renders timestamp parameters truncated to milliseconds while SQLite's strftime (which linq2db wraps around every timestamp comparison) rounds to the nearest millisecond, so WhereAfter via ToLinqToDB() classified targetCommit as after itself and deleted it — the PreserveAllFieldWorksCommits CI failure (~25% of runs, timezone-independent; reproducible on this branch, not on develop, because reusing Harmony's mapping schema changed how the parameter renders). sillsdev/harmony#78 fixes the parameter rendering, but linq2db comparisons stay millisecond-grained, so exact commit ordering belongs in EF regardless. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
An active test alarms when a linq2db upgrade changes the translation, unlike a skipped failing test, which never runs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
linq2db renders
DateTime/DateTimeOffsetparameters truncated to milliseconds while Microsoft.Data.Sqlite stores 7-digit TEXT and SQLite'sstrftimerounds — so timestamp comparisons via linq2db could misclassify rows. In lexbox this madeWhereAfterviaToLinqToDB()match the target commit itself and delete it during snapshot regeneration (see sillsdev/languageforge-lexbox#2391).DateTime/DateTimeOffsetparameters now bind as the exact TEXT Microsoft.Data.Sqlite writes (yyyy-MM-dd HH:mm:ss.FFFFFFF, UTC), so both sides of a comparison normalize identically.strftime('...%f')on both sides — millisecond-grained, not configurable — so same-millisecond commits compare equal. Use EF where exact ordering matters (e.g.WhereAfter);OrderByon a timestamp column is unaffected.WhereAfterself-exclusion regression test seeded with sub-millisecond timestamps ≥ 0.5ms — both fail without the fix.🤖 Generated with Claude Code