Skip to content

fix(contrail): run sync from compiled dist, not ts-node src#581

Merged
tompscanlan merged 1 commit into
mainfrom
fix/contrail-sync-use-compiled-js
May 15, 2026
Merged

fix(contrail): run sync from compiled dist, not ts-node src#581
tompscanlan merged 1 commit into
mainfrom
fix/contrail-sync-use-compiled-js

Conversation

@tompscanlan

Copy link
Copy Markdown
Contributor

Summary

  • The production Docker image only ships dist/; src/ is removed in the release stage (except src/mail/mail-templates).
  • The contrail-sync CronJob (suspended; manually triggered today during Phase 1 dev validation) calls npm run contrail:sync, which was ts-node ./src/contrail/sync.ts — fails immediately with Cannot find module './sync.ts'.
  • Switch the npm script to node dist/contrail/sync.js. sync.ts uses only relative imports, so tsconfig-paths isn't needed.
  • contrail:smoke stays on ts-node (developer-local tool, not run in-cluster).

Why this wasn't caught in #580

  • feat(contrail): add /xrpc/net.openmeet.event + rsvp endpoints (additive) #580's local smoke gate ran the script from a developer machine where both src/ and ts-node exist, so the bug was invisible.
  • migration:run:prod and seed:run:prod share the same shape but are run from developer hosts (see CLAUDE.md), so they aren't exercised in-cluster.
  • contrail-sync is the first script of this shape that actually runs as a Kubernetes Job.

Test plan

  • CI green on this branch.
  • After merge + image rebuild, manually trigger the suspended contrail-sync CronJob in dev:
    kubectl create job --from=cronjob/contrail-sync contrail-sync-manual -n dev
  • Logs show === Contrail sync (schema=contrail) === followed by Discovery + Backfill output.
  • After completion, curl 'https://api-dev.openmeet.net/xrpc/net.openmeet.event.listRecords?sort=rsvpsCount&limit=3' returns real records (was empty before).

The production Docker image only ships dist/; src/ is removed in the
release stage (except mail templates). The CronJob's `npm run
contrail:sync` was invoking `ts-node ./src/contrail/sync.ts`, which
fails immediately in-cluster with "Cannot find module './sync.ts'".

Switch the npm script to `node dist/contrail/sync.js`. sync.ts only uses
relative imports (no NestJS path aliases), so tsconfig-paths isn't
needed. The smoke command stays on ts-node because it's a developer
tool run against local TypeScript.

Surfaced when manually triggering the suspended contrail-sync CronJob
during Phase 1 dev validation.
@tompscanlan tompscanlan merged commit 49c35a4 into main May 15, 2026
4 checks passed
@tompscanlan tompscanlan deleted the fix/contrail-sync-use-compiled-js branch May 15, 2026 02:56
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