Skip to content

test(db): add tests for datetime storage - #685

Merged
m4tx merged 1 commit into
masterfrom
chrono-storage-tests
Oct 19, 2026
Merged

m4tx merged 1 commit into
masterfrom
chrono-storage-tests

Conversation

@m4tx

@m4tx m4tx commented Oct 4, 2026

Copy link
Copy Markdown
Member

Related issue or discussion

#631

Description

This adds tests that pin the storage of datetime values in the database.

This is mostly useful for the upcoming jiff migration, to make sure after migrating to the new datetime crate, none of the values stored are changed.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / cleanup
  • Performance improvement
  • Other (describe above)

Checklist

  • I've read the contributing guide
  • Tests pass locally (just test-all)
  • Code passes clippy (just clippy)
  • Code is properly formatted (cargo fmt)
  • New tests added (regression test for bugs, coverage for new features)
  • Documentation (both code and site) updated (if applicable)

@m4tx
m4tx requested review from a team and a balanced review from Copilot October 4, 2026 16:10
@github-actions github-actions Bot added the C-lib Crate: cot (main library crate) label Oct 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Both tests rely on undefined database row ordering in positional assertions.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds SQLite regression tests that pin Chrono date/time storage formats ahead of the planned datetime-library migration.

Changes:

  • Adds models for typed and textual datetime access.
  • Tests bidirectional compatibility across fractional seconds and offsets.
File Description
cot/​tests/​db_testing/​mod.rs Registers the new test module.
cot/​tests/​db_testing/​datetime_storage.rs Adds datetime storage compatibility tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cot/tests/db_testing/datetime_storage.rs Outdated
@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

🐰 Bencher Report

Projectcot
Branchchrono-storage-tests
Testbedgithub-ubuntu-latest
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
empty_router/empty_router📈 view plot
🚷 view threshold
15,670.00 µs
(+29.04%)Baseline: 12,143.72 µs
18,504.68 µs
(84.68%)
json_api/json_api📈 view plot
🚷 view threshold
1,055.40 µs
(+4.86%)Baseline: 1,006.47 µs
1,344.65 µs
(78.49%)
nested_routers/nested_routers📈 view plot
🚷 view threshold
1,017.00 µs
(+6.96%)Baseline: 950.84 µs
1,254.48 µs
(81.07%)
single_root_route/single_root_route📈 view plot
🚷 view threshold
948.25 µs
(+4.15%)Baseline: 910.48 µs
1,210.24 µs
(78.35%)
single_root_route_burst/single_root_route_burst📈 view plot
🚷 view threshold
15,479.00 µs
(-7.67%)Baseline: 16,764.12 µs
22,169.67 µs
(69.82%)
🐰 View full continuous benchmarking report in Bencher

@m4tx
m4tx force-pushed the chrono-storage-tests branch from 2af614e to c0c123f Compare October 4, 2026 16:22
@codecov

codecov Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
rust 90.97% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@m4tx
m4tx requested a balanced review from Copilot October 4, 2026 17:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The reverse compatibility test does not detect loss or normalization of fixed offsets.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (1)

Comment thread cot/tests/db_testing/datetime_storage.rs
@m4tx
m4tx force-pushed the chrono-storage-tests branch from c0c123f to a1d950e Compare October 4, 2026 19:04
@m4tx
m4tx requested a balanced review from Copilot October 4, 2026 19:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The tests comprehensively verify SQLite datetime serialization and deserialization without introducing production changes.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@m4tx
m4tx added this pull request to stack #700 October 12, 2026 16:50
@m4tx
m4tx force-pushed the chrono-storage-tests branch from a1d950e to 014e503 Compare October 19, 2026 18:27
@m4tx
m4tx merged commit abcac9a into master Oct 19, 2026
43 of 44 checks passed
@m4tx
m4tx deleted the chrono-storage-tests branch October 19, 2026 19:17
@cotbot cotbot Bot mentioned this pull request Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-lib Crate: cot (main library crate)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants