test(user-settings): cover Mongo unparseable-timestamp read path#208
Closed
mauripunzueta wants to merge 1 commit into
Closed
test(user-settings): cover Mongo unparseable-timestamp read path#208mauripunzueta wants to merge 1 commit into
mauripunzueta wants to merge 1 commit into
Conversation
Add a MongoDB SettingsStore test mirroring SQLite's get_settings_tolerates_unparseable_timestamp: plant a row with a valid JSON document but a non-datetime `updated_at`, and assert get_settings still returns the document and version, exercising the timestamp fallback branch rather than failing the read. Stacked on feat/user-ui-settings (PR #151), which introduces the MongoDB SettingsStore this test targets.
Contributor
Author
|
Closing — wrong scope. This is a narrow, one-off test of the MongoDB SettingsStore (which only exists in #151), not the reusable, broadly-useful MongoDB test infrastructure that was actually requested. Superseding with a test that branches from main and helps any future code touching the MongoDB backend. Branch kept for now in case we want the parity test inside #151 later. |
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.
Summary
Adds one MongoDB
SettingsStoretest that mirrors SQLite's existingget_settings_tolerates_unparseable_timestampcoverage: it plants a row with a valid JSON document but a non-datetimeupdated_at, then assertsget_settingsstill returns the document and version — exercising the timestamp-fallback branch (get_datetime(...).map(...).unwrap_or_else(|_| Utc::now())) instead of failing the read.This closes the last cleanly, deterministically testable gap in
mongodb/user_settings.rs, bringing its error-path suite to parity with the SQLite backend. The remaining uncovered lines there are DB-error-injection.map_errarms and concurrency-race branches — the same class the PostgreSQL backend also leaves uncovered — which aren't worth fault-injection or flaky timing tests.Stacking
Once #151 merges, this PR will be retargeted to
main(and rebased), at which point it picks up full CI. Until then, as a stacked PR (base ≠ main) it does not trigger the HFS CI workflow.Test plan
cargo test -p helios-persistence --features mongodb --test mongodb_tests mongodb_integration_settings_get_tolerates_unparseable_timestamp(runs against a Mongo testcontainer, orHFS_TEST_MONGODB_URLif set; skips gracefully when neither is available).