Repository navigation
Fixed SQLite automation wait deadlines - #32151
Draft
JoaoMarcos44 wants to merge 2 commits into
Draft
JoaoMarcos44 wants to merge 2 commits into
JoaoMarcos44 wants to merge 2 commits into
Conversation
ref TryGhost#32140 The regression selected a future step with the original writer and poller. The generated migration support and formatter allow the fixture to cover existing data and capture the failing repository interaction.
ref TryGhost#32140 The real SQLite writer/poller deadline regression and 101 existing repository cases pass (104 tests).
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
Contributor
|
It looks like this PR contains a migration 👀 General requirements
Schema changes
Data changes
|
This branch has not been deployed
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.
fixes #32140
Summary
SQLite can select an automation wait before its deadline when new repository 2 writes bind Date objects as INTEGER epoch milliseconds and the existing poller compares ready_at with a TEXT datetime cutoff. SQLite sorts numeric storage classes before TEXT, so even a future integer timestamp can pass the due-time predicate. Mixed representations also make ready_at ordering incorrect.
This change keeps stored values and the poller's due-time cutoff in one comparable SQLite text representation, and normalizes existing integer dates. MySQL keeps its existing Date bindings.
Implementation and rationale
The legacy writer still stores ready_at as a whole-second UTC text value. That representation remains comparable to the SQLite millisecond cutoff: a same-second value without a fractional suffix sorts before the cutoff with its fractional suffix, consistent with the legacy writer's second-level precision. The new repository writer and migrated data preserve milliseconds.
Files changed
No table schema or client/API contract changes are introduced.
Verification
The regression test uses in-memory SQLite configured through Ghost's real database helper. At a frozen time of 2026-10-21 12:00:00.500 UTC, it verifies that a due .499 step is returned and a future .501 step is excluded, alongside a legacy due step.
A RED run retained the formatter and migration support but used the original repository 2 writer and original legacy poller. The integration assertion failed: the returned IDs included future-step, proving the original writer-to-poller defect. Both supporting migration cases passed.
With the proposed repository changes, the focused GREEN run passed 104 tests across two files: three SQLite integration cases and 101 existing repository unit tests. The temporary sandbox configuration ran:
The integration cases verify conversion of old integer values with millisecond precision, idempotent rerun, the non-SQLite no-op guard, and repository 2 writer-to-legacy-poller deadline selection. The MySQL branch was represented by a mocked non-SQLite guard, not a live MySQL connection.
Scope and limits
This patch addresses a private experimental automations data-layer path on SQLite. It does not claim end-to-end behavior for a running Ghost service or browser behavior, and it does not establish that MySQL has this storage-class failure. The migration touches only the five integer-backed run and step date columns listed above; lock/start/finish timestamps remain outside its scope.
Infographic
Architecture, problem, solution and generation report.
Preserved evidence and reproducibility
Focused commands, exit codes and captured output are pinned to a documentation commit. Historical investigation records are separately labeled; their source revisions and runtimes should not be confused with the current-base regression runs. The
validation/filenames above refer to this archive, which remains available after the local sandbox is deleted.The validation report records the environment adjustments, shared RED commands, hook warning, combined checks and unresolved gates.
Final verification and remaining gates
pnpm checkwas attempted on the combined source/test worktree and exited 130. Formatting passed on 7,110 files and Oxlint passed. Nx then reported 30 successful tasks, 33 failures and four skipped tasks. Several lint scripts failed because Windowscmddid not interpret the quoted regex/Unix commands; Shade also failed with RolldownINVALID_OPTION/ missingoptions.input. That build failure remains unresolved and was not established as a clean-base failure. The chained full test stage was not reached. No full monorepo success is claimed.A separate combined regression run passed 239 Core tests across eight files; the two combined navigation files passed three tests. These are additional focused runs, not a full suite and not distinct-test totals to add to the individual PR counts.
Commit hooks remained enabled. The nonblocking changeset reminder encountered
ERR_PNPM_FROZEN_LOCKFILE_WITH_OUTDATED_LOCKFILEin its temporary checkout; that reminder is not counted as a passing versioning check. The successful GitHub labeling action is metadata automation. CodeRabbit skipped draft review in the captured historical snapshot; that historical status is not review approval. Product build/test CI remains unverified, and merge approval is not established. The user requested a ready-for-review transition, but GitHub denied themarkPullRequestReadyForReviewpermission for accountJoaoMarcos44on this transition; the associated PR remains a draft due to this platform permission constraint and requires maintainer intervention. The concrete correction and focused results are available for review.C1 additionally requires migration review. The checklist-posting job succeeded; its unchecked boxes do not establish staging performance, full up/down migrator lifecycle safety or reviewer sign-off. Only fixture-level repeatable
up()conversion was exercised. The migration uses the irreversible helper. No staging/production database or live MySQL was used.The temporary SQLite validation config can be copied into
ghost/.c1-vitest.config.tsto reproduce the focused command above without the MySQL-backed project. The migration was initialized with the canonical repository generator using Git Bash for the Windowsgit describequoting workaround. A migration lint failure onforiteration was corrected with five explicit awaited updates; hooks were kept enabled and the 104-test run passed again after that correction.