core, offline: stamp action-log and offline-queue times from an injected wall clock - #842
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…ted wall clock IModelHolder::recordIfAttached and SqliteOfflineQueue read std::chrono::system_clock directly, so neither LogEntry::timestampMs nor the queue's enqueued_at column could be pinned in a test. Both now read a core::platform::WallClockRef: attachActionLog takes one as an optional third parameter, and SqliteOfflineQueue's constructor as its last. Both default to the system clock, so existing callers are unchanged. Part of #807 (the wall-clock row). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Yaraslaut
force-pushed
the
core/inject-wall-clock
branch
from
September 29, 2026 13:02
c5190e9 to
c1f3a17
Compare
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.
Partially addresses #807 (the wall-clock row).
What
Two places stamped a wall-clock time straight from
std::chrono::system_clock::now(), so no test could pin it:IModelHolder::recordIfAttached→LogEntry::timestampMsSqliteOfflineQueue→ theenqueued_atcolumnBoth now read a
core::platform::WallClockRef, from core-cpp v0.5.0:IModelHolder::attachActionLog(log, contextKey, wallClock = defaultSystemWallClock())SqliteOfflineQueue(..., busyTimeout, wallClock = defaultSystemWallClock())Both default to the system clock, so existing callers are unchanged. The clock is borrowed, not owned, and
WallClockRefrefuses a temporary at compile time. Specs (journal.md,offline.md) andCHANGELOG.mdare updated.Not in this PR: folding the global
DateTime::now()override andsession::Clockinto the same seam. Those are the rest of #807's clock row.Verification
Debug build on macOS (Apple clang,
-Weverything), withMORPH_BUILD_OFFLINE_SQLITE=ONandMORPH_BUILD_EXAMPLES=OFF:morph_tests:test cases: 1661 | 1660 passed | 1 failed as expected.morph_offline_sqlite_tests:test cases: 30 | 29 passed | 1 failed. The failure is not from this PR:masterfails the same way here (assertions: 135 | 134 passed | 1 failed). The directory-fsync test compares"/private/var/folders/.../T" == "/var/folders/.../T", a macOS/var→/private/varsymlink mismatch in the test itself.system_clock::now(), both new tests fail (1 failedeach). They pass again once the change is restored.Not verified locally: the WebAssembly build and the Doxygen
doctarget.core/platform/Clock.hppis already included unconditionally bytimeout_scheduler.hpp, so I expect it to compile under wasm, but I haven't built it.🤖 Generated with Claude Code