Remove unused server_timestamp() from IDatabase#29
Merged
Conversation
…atabase `IDatabase.server_timestamp()` is dead API — nothing in the app called it. The only references were docstring `Example:` blocks and the database test suite; no executing caller. Write paths that store timestamps pass real `datetime` objects, which every backend already normalizes, so the sentinel path was unused (EAFP/YAGNI). Removed: the abstractmethod (interface.py), the Firestore SERVER_TIMESTAMP impl (firestore.py), the InMemory method + `_ServerTimestamp` sentinel class + its `isinstance` branches in the encode/normalize helpers (memory.py), the stale docstring examples (interface.py, dependencies.py), and the server_timestamp tests (test_memory_db.py, test_firestore_db.py). Note: the SQLite feature branch (feature/use-sqllite-instead-firestore, PR #13) carries a mirror `_ServerTimestamp` that will be dropped when that branch rebases onto this change — reviewers should merge this PR first.
awrobel-gd
approved these changes
Jul 7, 2026
mkonopelski-gd
added a commit
that referenced
this pull request
Jul 7, 2026
Integrates PR #29 (removal of the unused server_timestamp() API). Drops this branch's now-orphaned mirror copies of that dead code: - sqlite.py: _ServerTimestamp sentinel, its _encode_for_storage branch, and SqliteDatabase.server_timestamp() - db_contract.py: the shared TestServerTimestamp contract test (+ now-unused datetime import) - test_sqlite_db.py / test_memory_db.py: the TestServerTimestamp inheritors Conflict in test_memory_db.py resolved in favor of this branch's inherit-from-db_contract structure, minus the removed server_timestamp test.
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.
What
Removes the dead
IDatabase.server_timestamp()API surface across the DB layer.Why
server_timestamp()returned a sentinel that write paths could drop into a field to mean "server stamps now-UTC at write." It is dead: nothing in the app calls it. The only references were docstringExample:blocks (interface.py,dependencies.py) and the database test suite — no executing caller. Code that stores timestamps passes realdatetimeobjects, which every backend already normalizes. So the sentinel path is unused (EAFP/YAGNI).Verified before removing:
Changes
app/database/interface.py— delete theserver_timestampabstractmethod; scrub staleExample:lines referencing it.app/database/firestore.py— delete theSERVER_TIMESTAMPimpl (kept thefirestoreimport; still used elsewhere).app/database/memory.py— delete the method, the_ServerTimestampsentinel class, and the deadisinstance(value, _ServerTimestamp)branches in both_process_timestampshelpers (realdatetimepassthrough intact); drop the now-unuseddatetime/UTCimport.app/database/dependencies.py— fix theget_dbdocstring example to a plaindatetime.now(UTC).test/database/test_memory_db.py,test/database/test_firestore_db.py— delete theTestServerTimestampclasses and now-unuseddatetimeimports.Verification
uv run pytest test/database/ -q→ 45 passed, 15 skipped (firestore emulator skipped).uv run python -c "import app.database.interface, app.database.memory, app.database.firestore".server_timestamp/_ServerTimestampunderbackend/→ no matches.Merge sequencing
The SQLite feature branch (
feature/use-sqllite-instead-firestore, PR #13) carries a mirror_ServerTimestampthat will be dropped when that branch rebases onto this change. Please merge this PR first, then rebase PR #13.