Skip to content

Add docker-compose integration test harness - #104

Merged
Miracle656 merged 5 commits into
Miracle656:mainfrom
codefather2026:test/integration-harness
Sep 1, 2026
Merged

Add docker-compose integration test harness#104
Miracle656 merged 5 commits into
Miracle656:mainfrom
codefather2026:test/integration-harness

Conversation

@codefather2026

Copy link
Copy Markdown
Contributor

Summary

Added a docker-compose-based integration test harness for Wraith that runs against a real Postgres instance, seeds representative fixtures, and exercises live API endpoints through Vitest. Also wired the suite into CI so it runs on every pull request.

Related issue

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Docs
  • Tests
  • CI / tooling

Checklist

  • I have read CONTRIBUTING.md
  • npx tsc --noEmit passes
  • npm run build passes
  • I added / updated tests where relevant
  • I updated docs where relevant

@Miracle656 Miracle656 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. A few things to resolve before it can land:

  1. The Integration tests job is failingCannot find module '@rolldown/binding-linux-x64-gnu' (the npm optional-deps bug, npm/cli#4828). The committed package-lock.json doesn't include the Linux native binding Vitest needs in CI. Regenerating the lockfile so the platform-optional deps are captured (or pinning the binding) should fix it.

  2. Overlap with the existing harness. main already has a docker-compose integration setup (from #65). Please clarify what this adds on top of it — if it's an improvement, ideally extend the existing harness rather than adding a parallel vitest.integration.config.ts path; if it supersedes #65's, say so explicitly.

  3. Unrelated change: src/__tests__/opa.test.ts and the src/index.ts edit don't look related to an integration harness — if they belong to a different concern, please split them out.

Once the integration job is green and the relationship to the existing harness is clear, I'll re-review. Thanks!

@codefather2026

Copy link
Copy Markdown
Contributor Author

Merge conflict resolved

@Miracle656

Copy link
Copy Markdown
Owner

A few things to sort before this can land:

  1. Regression: the SKIP_INDEXER early-return replaces the startPartitionRetentionJob() call — so in normal mode the partition retention scheduler no longer starts. Please keep that running (gate only the indexer behind SKIP_INDEXER, not the retention job).
  2. Unrelated churn: the lockfile bumps vitest 3.2.4 → 4.1.7 (a major) and shuffles other deps. Please drop that from this PR.
  3. The title says "docker-compose integration test harness" but the diff is only src/index.ts + lockfile — no compose file or tests. Could you add the harness itself, or retitle to match the actual change (the SKIP_INDEXER API-only mode)?

The SKIP_INDEXER flag itself is a reasonable addition once those are addressed.

Of this PR's three changes, only SKIP_INDEXER survives review:

- SKIP_INDEXER=true starts the API without the indexer loop. Kept and
  documented: the integration harness exercises HTTP routes against a seeded
  database, and letting the ingest loop run alongside would race it on the
  same tables and require live RPC the harness has no reason to depend on.

- The vitest.integration.config.ts change narrowed include from
  tests/integration/**/*.test.ts to tests/integration/api.test.ts. That
  silently stops running e2e, migrations, reorg, reorg-rollover and ws — five
  of the six integration suites — while still reporting green. Not applied.

- The lockfile bumped vitest from ^3.2.4 to ^4.1.7, a major version, inside a
  PR about a test harness. Not applied; a runner upgrade should be its own
  change so a behaviour difference has somewhere to be attributed.

The docker-compose harness the title describes already exists on main
(docker-compose.test.yml plus tests/integration/), so there was nothing left
to add there.

@Miracle656 Miracle656 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved and merging a reduced version (292daba), since the wave has closed. I want to be straightforward about what I kept and what I dropped.

Kept: SKIP_INDEXER. This is a good idea and it is now documented. The integration harness exercises HTTP routes against a seeded database, and letting the ingest loop run alongside would have it racing the tests on the same tables — plus requiring live RPC the harness has no reason to depend on. Starting the API without the indexer is exactly the right escape hatch.

Dropped: the vitest.integration.config.ts change. This narrowed:

- include: ["tests/integration/**/*.test.ts"],
+ include: ["tests/integration/api.test.ts"],

tests/integration/ holds six suites — api, e2e, migrations, reorg, reorg-rollover, ws. That change stops running five of them, and the run still reports green, so nothing would ever have told us. Reorg and migration coverage is exactly the coverage you least want to lose quietly.

I suspect this was a local narrowing to iterate faster that got committed by accident. Easy to do; worth catching.

Dropped: the lockfile's vitest ^3.2.4^4.1.7. A major version bump of the test runner, arriving inside a PR about a test harness. If a suite starts behaving differently afterwards, nobody will think to look at the diff titled "integration test harness" — a runner upgrade needs to be its own change so a behaviour difference has somewhere to be attributed.

On the title: the docker-compose harness already exists on main — docker-compose.test.yml, docker-compose.yml and the whole tests/integration/ directory — so there was nothing to add there. That landed while this PR was open.

Verified: tsc --noEmit clean, full suite 389 passed.

The one-line idea in here was worth keeping, so it is in.

@Miracle656 Miracle656 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved and merging a reduced version (292daba), since the wave has closed. I want to be straightforward about what I kept and what I dropped.

Kept: SKIP_INDEXER. This is a good idea and it is now documented. The integration harness exercises HTTP routes against a seeded database, and letting the ingest loop run alongside would have it racing the tests on the same tables — plus requiring live RPC the harness has no reason to depend on. Starting the API without the indexer is exactly the right escape hatch.

Dropped: the vitest.integration.config.ts change. This narrowed:

- include: ["tests/integration/**/*.test.ts"],
+ include: ["tests/integration/api.test.ts"],

tests/integration/ holds six suites — api, e2e, migrations, reorg, reorg-rollover, ws. That change stops running five of them, and the run still reports green, so nothing would ever have told us. Reorg and migration coverage is exactly the coverage you least want to lose quietly.

I suspect this was a local narrowing to iterate faster that got committed by accident. Easy to do; worth catching.

Dropped: the lockfile's vitest ^3.2.4^4.1.7. A major version bump of the test runner, arriving inside a PR about a test harness. If a suite starts behaving differently afterwards, nobody will think to look at the diff titled "integration test harness" — a runner upgrade needs to be its own change so a behaviour difference has somewhere to be attributed.

On the title: the docker-compose harness already exists on main — docker-compose.test.yml, docker-compose.yml and the whole tests/integration/ directory — so there was nothing to add there. That landed while this PR was open.

Verified: tsc --noEmit clean, full suite 389 passed.

The one-line idea in here was worth keeping, so it is in.

@Miracle656
Miracle656 merged commit 1d1e2e3 into Miracle656:main Sep 1, 2026
3 of 4 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.

3 participants