Skip to content

integration-test-env: add start (brings up the stack only, no tests)#2091

Open
shrugs wants to merge 3 commits into
mainfrom
fix/integration-test-env-up-down
Open

integration-test-env: add start (brings up the stack only, no tests)#2091
shrugs wants to merge 3 commits into
mainfrom
fix/integration-test-env-up-down

Conversation

@shrugs
Copy link
Copy Markdown
Member

@shrugs shrugs commented May 11, 2026

Summary

  • split the integration-test-env orchestrator into a reusable bring-up phase (lifecycle.ts) shared by two entrypoints
  • new pnpm -F @ensnode/integration-test-env start — bring up the full stack (incl. seed) and block until Ctrl+C, so pnpm test:integration can run from another terminal
  • the previous start script is renamed to start:ci (bring up + run tests + tear down); the root test:integration:ci alias is updated to match so CI behavior is unchanged
  • new --only flag: pnpm start --only devnet,ensrainbow restricts the subset of services brought up, so you can iterate on ensindexer/ensapi locally and have the rest auto-managed + auto-cleaned. valid services: devnet (incl. ensdb + seed), ensrainbow, ensindexer (incl. wait-for-indexing), ensapi
  • ensrainbow now runs at LOG_LEVEL=error so its info/warn chatter doesn't drown out the rest of the stack output
  • Ctrl+C during start exits 0 (user-initiated shutdown is not an error)

Why

Running the integration test env manually (docker compose up devnet ensrainbow + standalone ensapi) skips the orchestrator's seedDevnet phase, so resolver/primary-name records aren't on chain and 6 resolution integration tests fail. This adds a one-shot manual path that runs the same lifecycle CI does (seed included), without coupling it to a test run.

--only exists so when iterating on ensindexer or ensapi (running them yourself in dev mode), the supporting services come up and tear down with one command instead of separate docker compose invocations.

Testing

  • pnpm -F @ensnode/integration-test-env typecheck
  • pnpm lint
  • end-to-end run of pnpm start / Ctrl+C teardown not exercised locally (existing CI flow is unchanged because start:ci is identical to the old start modulo a one-line extracted call). Worth a manual spot-check before merge.

Notes for Reviewer (Optional)

  • lifecycle.ts is a mechanical extraction of phases 1–6 from orchestrator.ts — diff is large only because of the move; the only logic change is one await waitForHealth(...) URL now uses endpoints.ensapi instead of an inline string.
  • SIGINT/SIGTERM handlers are registered at module load in lifecycle.ts so both entrypoints share them automatically.
  • --only gates each phase via a should(service) check inside bringUp. ci.ts passes no options → full stack as before.

Checklist

  • This PR does not change runtime behavior or semantics
  • This PR is low-risk and safe to review quickly

🤖 Generated with Claude Code

Splits the integration-test-env orchestrator into a reusable bring-up
phase (`lifecycle.ts`) shared by two entrypoints:

- `pnpm start` — bring up the full stack (incl. seed) and block until
  Ctrl+C, so `pnpm test:integration` can run from another terminal.
- `pnpm start:ci` — renamed from `start`; bring up + run tests + tear
  down. CI flow is unchanged via the `test:integration:ci` root alias.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shrugs shrugs requested a review from a team as a code owner May 11, 2026 20:25
Copilot AI review requested due to automatic review settings May 11, 2026 20:25
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
enskit-react-example.ensnode.io Ready Ready Preview, Comment May 11, 2026 8:44pm
3 Skipped Deployments
Project Deployment Actions Updated (UTC)
admin.ensnode.io Skipped Skipped May 11, 2026 8:44pm
ensnode.io Skipped Skipped May 11, 2026 8:44pm
ensrainbow.io Skipped Skipped May 11, 2026 8:44pm

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 11, 2026

⚠️ No Changeset found

Latest commit: b7eb383

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 11, 2026

Review Change Stack

Warning

Rate limit exceeded

@shrugs has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 41 minutes and 20 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a76beb03-b043-44d3-bb5d-74c71d41e501

📥 Commits

Reviewing files that changed from the base of the PR and between ba28a55 and b7eb383.

📒 Files selected for processing (6)
  • package.json
  • packages/integration-test-env/README.md
  • packages/integration-test-env/package.json
  • packages/integration-test-env/src/ci.ts
  • packages/integration-test-env/src/lifecycle.ts
  • packages/integration-test-env/src/start.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/integration-test-env-up-down

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

The file no longer orchestrates — lifecycle.ts does. ci.ts is now the
CI entrypoint that wires bringUp + runIntegrationTests + cleanup.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel vercel Bot temporarily deployed to Preview – ensrainbow.io May 11, 2026 20:28 Inactive
@vercel vercel Bot temporarily deployed to Preview – admin.ensnode.io May 11, 2026 20:28 Inactive
@vercel vercel Bot temporarily deployed to Preview – ensnode.io May 11, 2026 20:28 Inactive
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the integration test environment orchestrator into a shared lifecycle module so the stack bring-up (including devnet seeding) can be reused by both CI and a new manual “bring up and wait” workflow.

Changes:

  • Extracts stack bring-up/cleanup/test execution logic into src/lifecycle.ts shared by both entrypoints.
  • Adds a new start entrypoint that brings up the full stack and blocks until Ctrl+C, and renames the prior behavior to start:ci.
  • Updates root test:integration:ci to call the new start:ci script to keep CI behavior consistent.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/integration-test-env/src/start.ts New manual entrypoint to bring up the stack and wait (no tests).
packages/integration-test-env/src/orchestrator.ts Simplified CI entrypoint now delegating to lifecycle.ts.
packages/integration-test-env/src/lifecycle.ts New shared bring-up/cleanup/signal-handling and integration test runner.
packages/integration-test-env/README.md Documents the split between manual start and CI start:ci flows.
packages/integration-test-env/package.json Renames start behavior and adds start:ci script.
package.json Updates test:integration:ci to call start:ci.
Comments suppressed due to low confidence (2)

packages/integration-test-env/src/lifecycle.ts:245

  • The JSDoc for bringUp() says it "runs cleanup() and rethrows" on failure, but bringUp() doesn't wrap its phases in a try/catch/finally and doesn't call cleanup() itself (callers do). Please update the comment to match the actual behavior, or add error-handling inside bringUp() if that's the intended contract.
    packages/integration-test-env/src/lifecycle.ts:117
  • handleShutdown() always exits with code 1 after SIGINT/SIGTERM. For the new manual pnpm start flow (Ctrl+C as a normal teardown), this will report failure to the shell/CI wrappers. Consider exiting 0 for SIGINT (or when CI is not set), and reserve exit code 1 for actual failures/forced termination.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +39 to +43
Brings up the full stack and blocks until Ctrl+C. The required ports must be available (8545, 8000, 3223, 42069, 4334). Once it's up, run integration tests from another terminal:

```sh
pnpm test:integration
```
Comment on lines 8 to 12
"scripts": {
"start": "CI=1 tsx src/orchestrator.ts",
"start": "tsx src/start.ts",
"start:ci": "CI=1 tsx src/ci.ts",
"typecheck": "tsc --noEmit"
},
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 11, 2026

Greptile Summary

This PR splits the integration test orchestrator into a shared lifecycle.ts module consumed by two entrypoints: ci.ts (the existing bring-up → test → teardown CI pipeline) and a new start.ts (bring-up only, then block until Ctrl+C for manual iteration). A new --only CLI flag lets developers spin up a subset of services while running the rest themselves.

  • lifecycle.ts is a mechanical rename+extraction of orchestrator.ts; the only semantic change is the SIGINT/SIGTERM handler now exits 0 instead of 1.
  • bringUp() wraps each phase in if (should(svc)) guards, and the new parseOnly() validates the comma-separated --only value at parse time.
  • Root test:integration:ci updated to invoke start:ci instead of start, keeping CI behaviour identical to before.

Confidence Score: 5/5

Safe to merge — the CI path is functionally identical to the old orchestrator.ts, and the new manual start.ts is an additive convenience tool.

The diff is almost entirely a mechanical extraction: bringUp() is the old main() body wrapped in if (should(svc)) guards, runIntegrationTests() is the last block of the old main(), and ci.ts re-assembles them in the same order. The one logic change (SIGINT handler exits 0 instead of 1) is intentional and documented. No new runtime paths are exercised by CI.

No files require special attention; the most nuanced code is in lifecycle.ts, but it is a faithful extraction of the previously reviewed orchestrator logic.

Important Files Changed

Filename Overview
packages/integration-test-env/src/lifecycle.ts Renamed from orchestrator.ts; phases 1–6 extracted into exported bringUp(); module-level SIGINT/SIGTERM handlers now exit 0; small URL refactor to use endpoints.ensapi
packages/integration-test-env/src/ci.ts New CI entrypoint: calls bringUp(), then runIntegrationTests() synchronously (correct—it uses execaSync), then cleanup(); error path correctly routes to .catch()
packages/integration-test-env/src/start.ts New manual entrypoint: parses --only CLI flag, calls bringUp(), prints service URLs, then blocks on a never-resolving promise until SIGINT/SIGTERM triggers lifecycle cleanup
packages/integration-test-env/package.json Added start (→ start.ts) and start:ci (→ ci.ts, with CI=1) scripts; old start script renamed to start:ci
package.json Root test:integration:ci alias updated from start → start:ci to match the rename; CI behavior unchanged

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["pnpm start"] --> S["start.ts\n(parse --only flag)"]
    B["pnpm start:ci\n(CI=1)"] --> C["ci.ts"]
    S --> BU["lifecycle.bringUp(only?)"]
    C --> BU
    BU --> P1["Phase 1: ENSDb + Devnet"]
    P1 --> P2["Phase 2: Seed Devnet"]
    P2 --> P3["Phase 3: ENSRainbow"]
    P3 --> P4["Phase 4: ENSIndexer"]
    P4 --> P5["Phase 5: Poll indexing"]
    P5 --> P6["Phase 6: ENSApi"]
    P6 -->|"start.ts"| BLOCK["Block forever"]
    BLOCK -->|"SIGINT/SIGTERM"| HS["handleShutdown() exit 0"]
    HS --> CL["cleanup()"]
    P6 -->|"ci.ts"| T["runIntegrationTests()"]
    T -->|"pass"| CL2["cleanup() exit 0"]
    T -->|"fail"| ERR["catch cleanup() exit 1"]
Loading

Reviews (2): Last reviewed commit: "fix: allow --only" | Re-trigger Greptile

Comment on lines +241 to +245
* Bring up the integration test environment: ENSDb + Devnet, seed, ENSRainbow, ENSIndexer,
* wait for indexing to complete, ENSApi. Returns once every service is healthy.
*
* On failure, runs cleanup() and rethrows.
*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 The JSDoc for bringUp() says "On failure, runs cleanup() and rethrows", but bringUp itself never calls cleanup() — it simply throws and leaves cleanup to the caller. Both ci.ts and start.ts do handle this correctly in their .catch() blocks, so runtime behaviour is fine, but the comment will mislead future readers about where cleanup responsibility sits.

Suggested change
* Bring up the integration test environment: ENSDb + Devnet, seed, ENSRainbow, ENSIndexer,
* wait for indexing to complete, ENSApi. Returns once every service is healthy.
*
* On failure, runs cleanup() and rethrows.
*/
* Bring up the integration test environment: ENSDb + Devnet, seed, ENSRainbow, ENSIndexer,
* wait for indexing to complete, ENSApi. Returns once every service is healthy.
*
* On failure, throws callers are responsible for calling cleanup().
*/

@vercel vercel Bot temporarily deployed to Preview – ensnode.io May 11, 2026 20:44 Inactive
@vercel vercel Bot temporarily deployed to Preview – ensrainbow.io May 11, 2026 20:44 Inactive
@vercel vercel Bot temporarily deployed to Preview – admin.ensnode.io May 11, 2026 20:44 Inactive
```

Works both in CI and locally — just make sure the required ports are available (8545, 8000, 3223, 42069, 4334).
Brings up the full stack and blocks until Ctrl+C. The required ports must be available (8545, 8000, 3223, 42069, 4334). Once it's up, run integration tests from another terminal:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Brings up the full stack and blocks until Ctrl+C. The required ports must be available (8545, 8000, 3223, 42069, 4334). Once it's up, run integration tests from another terminal:
Brings up the full stack and blocks until Ctrl+C. The required ports must be available (8545, 3223, 42069, 4334, 5433). Once it's up, run integration tests from another terminal:

README lists incorrect ports (includes non-existent 8000, omits PostgreSQL port 5433)

Fix on Vercel

* Note: `devnet` includes ensdb (coupled via docker-compose) and seeding. `ensindexer` includes
* waiting for indexing to reach following/completed.
*
* On failure, runs cleanup() and rethrows.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
* On failure, runs cleanup() and rethrows.
* On failure, throws callers are responsible for calling cleanup().

JSDoc for bringUp() incorrectly claims the function calls cleanup() on failure, but it doesn't—cleanup is the caller's responsibility

Fix on Vercel

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