Merged
Conversation
1. Changed workflow to use `bash` instead of `sh` for running build-migrations.sh since it uses bash-specific features (pipefail) 2. Fixed window time checking in worker to use database time in tests, respecting fake_now setting. Also changed from local time (toTimeString) to UTC time (toISOString) to be consistent with WindowChecker.
In tests with fake time, the system time may be outside the task's window even though the fake time is inside/outside the window intentionally. Skip the early filtering optimization in tests and let ctx.step()/checkpoint() handle window checks using database time (which respects fake_now).
Move the test vs production time logic into DatabaseClient: - In production: returns new Date() directly (no DB call) - In tests: queries database to respect fake_now setting This simplifies worker.ts and TaskContext which now just call db.getCurrentTime() without environment checks.
The fetch-time window filtering was causing test failures: 1. It used local/system time which differs from fake time in tests 2. When CI runs early morning UTC (before 09:00), tasks with 09:00-17:00 windows would be filtered out before ctx.step() could test the window release behavior Window enforcement now happens solely at ctx.step()/ctx.checkpoint(), which properly uses database time (respecting fake_now in tests) and correctly handles the release/reschedule logic.
Restored the fetch-time window filtering optimization which prevents fetching tasks that are outside their execution window. Fixed the window execution tests to work with fetch-time filtering: - Tests now start with fake time INSIDE the window (10:00) - Task handlers advance fake time to OUTSIDE window before ctx.step()/checkpoint() - This properly tests the window release behavior while allowing tasks to be fetched The db.getCurrentTime() in DatabaseClient handles test vs production: - Tests: queries database for fake_now setting - Production: returns new Date() directly (no DB call)
Skip the db.getCurrentTime() call when no tasks have windows, avoiding issues with tests that don't set up the schema before starting orchestrator. This also improves performance by avoiding unnecessary DB calls.
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.
No description provided.