[Fix] freestyle-mock honors $PORT, drop server.listen string-patch#1432
[Fix] freestyle-mock honors $PORT, drop server.listen string-patch#1432BilalG1 wants to merge 3 commits into
Conversation
The multi-worker freestyle-mock rewrite (#1430) hardcoded `server.listen(8080)`, which collides with qstash inside the emulator container (supervisord sets `PORT=8180` for freestyle-mock). The local- emulator Dockerfile previously patched this via a string-replace, but the new source no longer matches the literal pattern, so qstash failed with `address already in use: 127.0.0.1:8080` and the backend never came up. Make the source respect `process.env.PORT` directly and remove the brittle replace.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThe PR makes the freestyle-mock server's listening port configurable via ChangesFreestyle-mock port configuration and emulator setup
Backend seeding timeout adjustment
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThis fix makes the freestyle-mock server honour
Confidence Score: 4/5Safe to merge — directly fixes the port collision that caused the emulator smoke test to fail. The core fix is correct and targeted: the source now reads The Important Files Changed
Sequence DiagramsequenceDiagram
participant S as supervisord
participant FM as freestyle-mock (server.mjs)
participant QS as qstash
Note over S: Reads PORT=8180 from supervisord.conf
S->>FM: "spawn with PORT=8180"
FM->>FM: "const PORT = process.env.PORT || 8080 → 8180"
FM->>FM: server.listen(8180)
Note over FM: Binds :8180 ✓
S->>QS: spawn (no PORT override)
QS->>QS: server.listen(8080)
Note over QS: Binds :8080 ✓ (no collision)
|
42a2a56 to
456a93c
Compare
Under cross-arch arm64 TCG in the qemu-emulator-build CI job, the deleteMany + createMany batch for ~1500-2000 event rows has been observed to take 40-50s, exceeding the previously-set 30s Prisma interactive-transaction ceiling (run 25835455849 hit 44.7s). The transaction uses deterministic IDs and is idempotent, so a looser bound has no correctness downside; it only kicks in on the slow TCG path.
456a93c to
358df4e
Compare
Under cross-arch arm64 TCG in the qemu-emulator-build CI job, a query in runBulldozerPaymentsInit/paginatedIngress exceeds the 120s server-side statement_timeout, returning Postgres error 57014 (P2010 from Prisma). KVM/native production runs the same query in well under a second; the looser bound only kicks in on the slow emulated path.
Summary
The multi-worker freestyle-mock rewrite (#1430) hardcoded
server.listen(8080), which collides with qstash inside the local-emulator container. Supervisord setsPORT=8180for freestyle-mock specifically to avoid this clash, but the new source ignoresprocess.env.PORT.The local-emulator Dockerfile previously bridged this with a
server.replace('server.listen(8080)', ...)string-patch on the embedded source. The new code isserver.listen(8080, () => { ... })— the literal'server.listen(8080)'substring no longer matches, so the replace silently no-ops and freestyle-mock binds 8080. qstash then can't start (address already in use: 127.0.0.1:8080→ FATAL), the backend (which depends on qstash) never comes up, and the emulator smoke test times out.Observed in this run:
Changes
docker/dependencies/freestyle-mock/Dockerfile:server.listen(PORT)wherePORT = process.env.PORT || 8080, plus the startup log reflects the actual port.docker/local-emulator/Dockerfile: drop the now-redundant string-replace for the listen call. The two remaining replaces (fs/promisesimport + node_modules symlink) are unrelated and kept.Test plan
PORT=8180is honored by freestyle-mock and qstash binds 8080 cleanly.Summary by CodeRabbit