Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1fb12ba
test(testcontainers): add local timing harness, docs, and TESTCONTAIN…
nicktrn Jun 5, 2026
b972bed
perf(testcontainers): force-kill teardown + worker-scope clickhouse/r…
nicktrn Jun 5, 2026
fb205de
test(run-engine): make ttl consumer waits event-driven instead of fix…
nicktrn Jun 5, 2026
afd3398
perf(testcontainers): worker-scope containerTest (compose pg/redis/cl…
nicktrn Jun 5, 2026
a6ddc85
perf(testcontainers): scope minio + tails; carve out replicationConta…
nicktrn Jun 5, 2026
7a150fa
test(webapp): move logical-replication suites to replicationContainer…
nicktrn Jun 5, 2026
f9b5c57
test(run-engine): make waitpoints waits event-driven (fix the origina…
nicktrn Jun 6, 2026
c536b9c
test(testcontainers): add opt-in CI-resource-limit mode for local fla…
nicktrn Jun 6, 2026
454b5c7
perf(testcontainers): replicationContainerTest only needs per-test po…
nicktrn Jun 6, 2026
82bd4fa
fix(testcontainers): per-test redis for background-worker tests + fas…
nicktrn Jun 6, 2026
273f1be
perf(ci): duration-weighted shard sequencer + reshard internal->12 pa…
nicktrn Jun 6, 2026
30be056
test(webapp): split runsReplicationService into 6 files (per-test-pg …
nicktrn Jun 6, 2026
a0c5c6f
test: update test-timings for 6-way runsReplicationService split
nicktrn Jun 6, 2026
b07889f
test(webapp): isolate redis for streamBatchItems to fix 30s seal-time…
nicktrn Jun 6, 2026
d639dc5
perf(ci): split runsRepository 2->4 + webapp 8->10 shards (makespan ~…
nicktrn Jun 6, 2026
bc29649
docs(testcontainers): document fixture choice + shard timings workflow
nicktrn Jun 6, 2026
683fe41
test(webapp): split runsReplicationService part5 + real measured shar…
nicktrn Jun 6, 2026
b816dee
chore: prettier-format split test files + testcontainers package
nicktrn Jun 6, 2026
88ecb95
fix(testcontainers): author shard sequencer as CJS so config loads on…
nicktrn Jun 6, 2026
4d76aa2
fix(testcontainers): create template_db explicitly + throw on failed …
nicktrn Jun 6, 2026
da87dc3
test(testcontainers): address review - drop clones, validate env, fai…
nicktrn Jun 6, 2026
b5aac0c
perf(testcontainers): offset shard bins per package so heavy files do…
nicktrn Jun 6, 2026
3f5ac08
ci: retry docker pull in unit-test pre-pull (transient registry timeo…
nicktrn Jun 6, 2026
8ac6ad4
test(schedule-engine): split scheduleEngine.test.ts so its two heavy …
nicktrn Jun 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions .github/workflows/unit-tests-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
# one flaky shard shouldn't cancel its siblings - lets us re-run only the failed shard
fail-fast: false
matrix:
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8]
shardTotal: [8]
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
shardTotal: [12]
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
SHARD_INDEX: ${{ matrix.shardIndex }}
Expand Down Expand Up @@ -83,12 +83,22 @@ jobs:
- name: 🐳 Pre-pull testcontainer images
if: ${{ env.DOCKERHUB_USERNAME }}
run: |
# Retry each pull - DockerHub registry timeouts are a recurring transient CI flake.
pull() {
for attempt in 1 2 3; do
docker pull "$1" && return 0
echo "::warning::docker pull $1 failed (attempt ${attempt}/3); retrying in 10s"
sleep 10
done
echo "::error::docker pull $1 failed after 3 attempts"
return 1
}
echo "Pre-pulling Docker images with authenticated session..."
docker pull postgres:14
docker pull clickhouse/clickhouse-server:25.4-alpine
docker pull redis:7.2
docker pull testcontainers/ryuk:0.14.0
docker pull electricsql/electric:1.2.4
pull postgres:14
pull clickhouse/clickhouse-server:25.4-alpine
pull redis:7.2
pull testcontainers/ryuk:0.14.0
pull electricsql/electric:1.2.4
echo "Image pre-pull complete"

- name: 📥 Download deps
Expand Down
26 changes: 19 additions & 7 deletions .github/workflows/unit-tests-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ jobs:
name: "🧪 Unit Tests: Packages"
runs-on: ubuntu-latest
strategy:
# one flaky shard shouldn't cancel its siblings - lets us re-run only the failed shard
fail-fast: false
matrix:
shardIndex: [1]
shardTotal: [1]
shardIndex: [1, 2, 3]
shardTotal: [3]
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
SHARD_INDEX: ${{ matrix.shardIndex }}
Expand Down Expand Up @@ -81,12 +83,22 @@ jobs:
- name: 🐳 Pre-pull testcontainer images
if: ${{ env.DOCKERHUB_USERNAME }}
run: |
# Retry each pull - DockerHub registry timeouts are a recurring transient CI flake.
pull() {
for attempt in 1 2 3; do
docker pull "$1" && return 0
echo "::warning::docker pull $1 failed (attempt ${attempt}/3); retrying in 10s"
sleep 10
done
echo "::error::docker pull $1 failed after 3 attempts"
return 1
}
echo "Pre-pulling Docker images with authenticated session..."
docker pull postgres:14
docker pull clickhouse/clickhouse-server:25.4-alpine
docker pull redis:7.2
docker pull testcontainers/ryuk:0.14.0
docker pull electricsql/electric:1.2.4
pull postgres:14
pull clickhouse/clickhouse-server:25.4-alpine
pull redis:7.2
pull testcontainers/ryuk:0.14.0
pull electricsql/electric:1.2.4
echo "Image pre-pull complete"

- name: 📥 Download deps
Expand Down
26 changes: 18 additions & 8 deletions .github/workflows/unit-tests-webapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
# one flaky shard shouldn't cancel its siblings - lets us re-run only the failed shard
fail-fast: false
matrix:
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8]
shardTotal: [8]
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
shardTotal: [10]
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
SHARD_INDEX: ${{ matrix.shardIndex }}
Expand Down Expand Up @@ -83,13 +83,23 @@ jobs:
- name: 🐳 Pre-pull testcontainer images
if: ${{ env.DOCKERHUB_USERNAME }}
run: |
# Retry each pull - DockerHub registry timeouts are a recurring transient CI flake.
pull() {
for attempt in 1 2 3; do
docker pull "$1" && return 0
echo "::warning::docker pull $1 failed (attempt ${attempt}/3); retrying in 10s"
sleep 10
done
echo "::error::docker pull $1 failed after 3 attempts"
return 1
}
echo "Pre-pulling Docker images with authenticated session..."
docker pull postgres:14
docker pull clickhouse/clickhouse-server:25.4-alpine
docker pull redis:7.2
docker pull testcontainers/ryuk:0.14.0
docker pull electricsql/electric:1.2.4
docker pull minio/minio:latest
pull postgres:14
pull clickhouse/clickhouse-server:25.4-alpine
pull redis:7.2
pull testcontainers/ryuk:0.14.0
pull electricsql/electric:1.2.4
pull minio/minio:latest
echo "Image pre-pull complete"

- name: 📥 Download deps
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,6 @@ apps/**/public/build
.mcp.log
.mcp.json
.cursor/debug.log
ailogger-output.log
ailogger-output.log
# per-package vitest timing capture (transient; merged into root test-timings.json)
.vitest-timing.json
15 changes: 9 additions & 6 deletions apps/webapp/test/engine/streamBatchItems.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ vi.mock("~/services/platform.v3.server", async (importOriginal) => {

import { RunEngine } from "@internal/run-engine";
import { setupAuthenticatedEnvironment } from "@internal/run-engine/tests";
import { containerTest } from "@internal/testcontainers";
// Per-test redis (isolated): each test spins up its own RunEngine and runs batch work, which leaves
// background activity on redis that outlives the test - sharing a worker redis across the 16 cases
// here caused cross-test interference and 30s seal-timeout flakes. Same carve-out as the run-engine
// batch tests.
import { containerTestWithIsolatedRedis as containerTest } from "@internal/testcontainers";
import { trace } from "@opentelemetry/api";
import { PrismaClient } from "@trigger.dev/database";
import { BatchId } from "@trigger.dev/core/v3/isomorphic";
Expand Down Expand Up @@ -1584,10 +1588,7 @@ describe("createNdjsonParserStream", () => {
const parser = createNdjsonParserStream(1024);
const results = await collectStream(stream.pipeThrough(parser));

expect(results).toEqual([
{ payload: "line1\nline2\nline3" },
{ payload: "no newlines" },
]);
expect(results).toEqual([{ payload: "line1\nline2\nline3" }, { payload: "no newlines" }]);
});

it("should skip empty lines", async () => {
Expand Down Expand Up @@ -1888,7 +1889,9 @@ describe("extractIndexAndTask", () => {
});

it("should not match nested keys", () => {
const bytes = encoder.encode('{"nested":{"index":999,"task":"inner"},"index":5,"task":"outer"}');
const bytes = encoder.encode(
'{"nested":{"index":999,"task":"inner"},"index":5,"task":"outer"}'
);
const result = extractIndexAndTask(bytes);
expect(result.index).toBe(5);
expect(result.task).toBe("outer");
Expand Down
4 changes: 2 additions & 2 deletions apps/webapp/test/runsBackfiller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ vi.mock("~/db.server", () => ({
}));

import { ClickHouse } from "@internal/clickhouse";
import { containerTest } from "@internal/testcontainers";
import { replicationContainerTest } from "@internal/testcontainers";
import { z } from "zod";
import { RunsBackfillerService } from "~/services/runsBackfiller.server";
import { RunsReplicationService } from "~/services/runsReplicationService.server";
Expand All @@ -17,7 +17,7 @@ import { TestReplicationClickhouseFactory } from "./utils/testReplicationClickho
vi.setConfig({ testTimeout: 60_000 });

describe("RunsBackfillerService", () => {
containerTest(
replicationContainerTest(
"should backfill completed runs to clickhouse",
async ({ clickhouseContainer, redisOptions, postgresContainer, prisma }) => {
const clickhouse = new ClickHouse({
Expand Down
4 changes: 2 additions & 2 deletions apps/webapp/test/runsReplicationBenchmark.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClickHouse } from "@internal/clickhouse";
import { containerTest } from "@internal/testcontainers";
import { replicationContainerTest } from "@internal/testcontainers";
import { fork, type ChildProcess } from "node:child_process";
import { performance, PerformanceObserver } from "node:perf_hooks";
import { setTimeout } from "node:timers/promises";
Expand Down Expand Up @@ -501,7 +501,7 @@ function compareBenchmarks(baseline: BenchmarkResult, comparison: BenchmarkResul
}

describe("RunsReplicationService Benchmark", () => {
containerTest.skipIf(process.env.BENCHMARKS_ENABLED !== "1")(
replicationContainerTest.skipIf(process.env.BENCHMARKS_ENABLED !== "1")(
"should benchmark error fingerprinting performance impact",
async ({ clickhouseContainer, redisOptions, postgresContainer, prisma }) => {
// Enable replica identity for TaskRun table
Expand Down
Loading