Skip to content

chore: unblock local development without paid/private credentials#1543

Open
ketanwani wants to merge 2 commits intoopengovsg:develop-v2from
ketanwani:chore/local-dev-setup
Open

chore: unblock local development without paid/private credentials#1543
ketanwani wants to merge 2 commits intoopengovsg:develop-v2from
ketanwani:chore/local-dev-setup

Conversation

@ketanwani
Copy link
Copy Markdown

Summary

This PR makes it possible to run Plumber locally without needing paid or private credentials that are unavailable to most contributors.

  • Replace @taskforcesh/bullmq-pro with free bullmq + compat shim — the Pro package requires a paid licence and a private registry token (NPM_TASKFORCESH_TOKEN). A drop-in shim at src/lib/bullmq-pro-compat.ts re-exports free bullmq classes/types under the same names. Pro-only features (group concurrency, rate limiting, pause/resume) are stubbed as no-ops — acceptable for local dev.
  • Guard instrumentation.ts against placeholder Pair Rome credentialsLangfuseSpanProcessor crashed at startup when PAIR_ROME_* keys were set to .... Tracing is now skipped silently when keys are unconfigured.
  • Guard launch-darkly.ts against placeholder SDK key — the LD client crashed at startup with a ... key. All flag evaluations now return their fallback values when unconfigured, and init() was moved inside getClient() so the SDK is never contacted at module load time.
  • Fix db script for WindowsDOTENV_CONFIG_PATH=.env knex is Unix-only syntax; replaced with just knex since dotenv/config is already imported via app.ts.

Production impact

None. All guards are keyed on the literal string '...' which only appears in .env placeholder files, never in real deployments.

Test plan

  • npm run -w backend lint passes
  • npm run -w backend test:unit — 1485 tests pass (2 pre-existing failures unrelated to these changes)
  • Backend starts up locally with placeholder .env values without crashing
  • OTP login flow works in local dev (OTP printed to terminal)

🤖 Generated with Claude Code

ketanwani and others added 2 commits April 12, 2026 14:15
## Problem

The BullMQ Pro package (@taskforcesh/bullmq-pro) requires a paid licence
and a private registry token (NPM_TASKFORCESH_TOKEN). This blocks local
development for contributors who don't have access to the token.

## Solution

Introduce a compatibility shim at packages/backend/src/lib/bullmq-pro-compat.ts
that re-exports the free bullmq package using the same class and type names
as the Pro package. All Pro-only features that are not needed for local dev
are stubbed as no-ops.

## Architecture

```
Production (with @taskforcesh/bullmq-pro)
─────────────────────────────────────────
  queues / workers / helpers
       │
       ▼
  @taskforcesh/bullmq-pro
  ├── QueuePro       (group pause/resume, concurrency, rate-limit)
  ├── WorkerPro      (rateLimitGroup, group-aware processing)
  ├── JobPro         (attemptsStarted, group opts)
  └── GroupStatus    (Waiting / Paused / Running)

Local development (free bullmq + compat shim)
─────────────────────────────────────────────
  queues / workers / helpers
       │
       ▼ (same import path: @/lib/bullmq-pro-compat)
  bullmq-pro-compat.ts
  ├── QueuePro      extends Queue   + stub group methods (no-op)
  ├── WorkerPro     extends Worker  + stub rateLimitGroup (no-op)
  ├── JobPro        = Job           + optional Pro fields
  └── GroupStatus   enum stub
       │
       ▼
  bullmq (free, MIT)
```

Stubbed Pro features (acceptable trade-offs for local dev):
- Group concurrency / rate-limit config silently ignored
- rateLimitGroup() is a no-op — RetriableErrors fall through to normal retry
- pauseGroup / resumeGroup / setGroupConcurrency are no-ops
- getGroupsByStatus() always returns []

## Files changed

- packages/backend/src/lib/bullmq-pro-compat.ts  [NEW] compat shim
- packages/backend/package.json                   @taskforcesh/bullmq-pro → bullmq
- .npmrc                                           remove private registry config
- packages/types/index.d.ts                        inline Pro types (no longer from Pro pkg)
- packages/backend/src/queues/*                    update imports → @/lib/bullmq-pro-compat
- packages/backend/src/workers/*                   update imports → @/lib/bullmq-pro-compat
- packages/backend/src/helpers/*                   update imports → @/lib/bullmq-pro-compat
- packages/backend/src/services/*                  update imports → @/lib/bullmq-pro-compat
- packages/backend/src/graphql/admin/*             update imports → @/lib/bullmq-pro-compat
- packages/backend/src/helpers/package.json        fix Windows-incompatible db script

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…r credentials

Prevents backend crash on startup when PAIR_ROME_* and LAUNCH_DARKLY_SDK_KEY
are set to placeholder values ('...') in .env during local development.

- instrumentation.ts: skip LangfuseSpanProcessor/NodeSDK init if any Pair
  Rome key is missing or still a placeholder — tracing silently disabled
- launch-darkly.ts: skip LD client init if SDK key is missing or placeholder
  — all flag evaluations return their fallback values; moved init() call
  inside getClient() so the SDK is never contacted at module load time

Production behaviour is unchanged: real deployments never have '...' values.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ketanwani ketanwani requested a review from a team as a code owner April 12, 2026 12:00
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.

1 participant