Skip to content

test: fix the two pre-existing failures that keep API CI red - #177

Merged
clbotdev merged 3 commits into
mainfrom
fix/sequence-journey-test
Nov 2, 2026
Merged

clbotdev merged 3 commits into
mainfrom
fix/sequence-journey-test

Conversation

@clbotdev

@clbotdev clbotdev commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

main's API test job fails for two reasons that have nothing to do with each other. Both are test-only fixes; no app code changes.

1. A date-dependent sequence test (failing since 2026-11-02)
"reports an email scheduled before its delay, and still sends it" in apps/api/src/automation/sequence-journey.test.ts.

  • Enrollment stamps the contact's entry time with the faked clock (setSystemTime), but the seeded sequence and emails get updated_at from Postgres's real now().
  • The test's hard-coded start is 2026-11-02T09:00Z. Once real time passed it, the sequence looked changed after entry, so the early-send check (rightly) skipped its report.
  • Fix: subscribeAt seeds the sequence's and emails' timestamps at the faked enrollment time. Checked with start dates in 2020, today and 2030.

2. Unhandled errors from the MCP tests (since #174)
src/mcp/server.test.ts and src/mcp/parity.test.ts mocked the database as {} and imported the MCP server, which starts Better Auth. Its OAuth plugin seeds resources in the background with db.select, so each file left an unhandled db.select is not a function. The job exited 1 with every test passing.

  • Fix: those two files use the test database, as the other API tests do. src/mcp: 129 pass, no unhandled errors.

🤖 Generated with Claude Code

s3rot0n1n and others added 2 commits November 2, 2026 23:01
…y's date

Enrollment stamps a contact's entry with the faked clock, but the seeded
sequence and emails got updated_at from Postgres's real now(). Once the
hard-coded start (2026-11-02T09:00Z) passed, the early-send check saw the
sequence as changed after entry and skipped its report, so 'reports an
email scheduled before its delay' started failing. Seed those rows at the
faked time instead.

Co-Authored-By: Claude <noreply@anthropic.com>
…ckground

Both mocked the database as {} and then imported the MCP server, which
starts Better Auth. Its OAuth plugin seeds resources in the background with
db.select, so each file left an unhandled 'db.select is not a function' and
the API test job exited 1 even with every test passing. Use the test
database instead, as the other API tests do.

Co-Authored-By: Claude <noreply@anthropic.com>
@clbotdev clbotdev changed the title test(automation): fix date-dependent sequence journey test test: fix the two pre-existing failures that keep API CI red Nov 2, 2026
The async mock factory hung the conformance job, where parity.test.ts shares a
process with platform-conformance.test.ts. Build the database first and mock
it with a plain synchronous factory.

Co-Authored-By: Claude <noreply@anthropic.com>
@clbotdev
clbotdev merged commit bf8615b into main Nov 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants