Skip to content

Commit c371930

Browse files
matt-aitkenclaude
andcommitted
ci(unit-tests-webapp): set REDIS_HOST/REDIS_PORT to satisfy marqs eager-init env check
Background. webapp's `app/v3/marqs/index.server.ts` and the related `app/v3/services/taskRunConcurrencyTracker.server.ts` build their clients via `singleton(name, getValue)` — and `singleton` evaluates `getValue()` eagerly, so the Redis env check (`if (!env.REDIS_HOST || !env.REDIS_PORT) throw …`) fires at module load. Why this PR triggers it. The slim-AuthenticatedEnvironment refactor plus the new `personalAccessToken.server.ts → rbac.server.ts` import chain extended triggerTask.test.ts's transitive import graph through `auth.server.ts → emailAuth.server.tsx → email.server.ts → commonWorker.server.ts`, which in turn loads marqs-using V1 services, ultimately reaching `marqs/index.server.ts` and the tracker. Locally this stayed hidden because `.env` provides REDIS_HOST=127.0.0.1; in CI shards 1/2/4/5/6/7 the throw blew up triggerTask.test.ts at module load, taking the rest of the shard with it via vitest's fail-fast. Why a CI env injection rather than touching code. The proper fix — deferring the Redis singletons in marqs/* and tracker — sits in V1 no-touch territory (CLAUDE.md: "marqs/ directory: never modify"), and the rest of the offending chain (commonWorker → V1 services) is a fundamental webapp coupling we don't want to tackle from a PR scoped to RBAC refactoring. The placeholder values match the existing pattern for DATABASE_URL / DIRECT_URL / CLICKHOUSE_URL — they just need to be truthy so the singleton's env check passes. ioredis is lazy-connect, so no real Redis daemon is contacted (and unit tests don't invoke any tracker / marqs methods that would force a connection). Verified locally: `REDIS_HOST=127.0.0.1 REDIS_PORT=6379 pnpm vitest run test/engine/triggerTask.test.ts` passes 8/8. The architectural mess (any test reaching apiAuth → commonWorker pulls REDIS-required modules) deserves its own follow-up — see TODO once the right scope is identified. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3290f57 commit c371930

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

.github/workflows/unit-tests-webapp.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ jobs:
105105
ENCRYPTION_KEY: "dummy-encryption-keeeey-32-bytes"
106106
DEPLOY_REGISTRY_HOST: "docker.io"
107107
CLICKHOUSE_URL: "http://default:password@localhost:8123"
108+
# marqs/index.server.ts and taskRunConcurrencyTracker.server.ts
109+
# eager-init Redis-backed singletons at module load and throw if
110+
# these are unset. CI doesn't run a real Redis (testcontainers
111+
# provision them per-test on demand); the values just need to be
112+
# truthy so the singleton's env check passes. ioredis lazy-connects,
113+
# so no real connection is attempted unless a test calls into the
114+
# tracker / marqs (which the unit tests don't).
115+
REDIS_HOST: "127.0.0.1"
116+
REDIS_PORT: "6379"
117+
REDIS_TLS_DISABLED: "true"
108118

109119
- name: Gather all reports
110120
if: ${{ !cancelled() }}

0 commit comments

Comments
 (0)