stack/.github/workflows
BilalG1 024da3cacb
[Fix] freestyle-mock honors $PORT, drop server.listen string-patch (#1432)
## Summary

The multi-worker freestyle-mock rewrite
([#1430](https://github.com/hexclave/stack-auth/pull/1430)) hardcoded
`server.listen(8080)`, which collides with qstash inside the
local-emulator container. Supervisord sets `PORT=8180` for
freestyle-mock specifically to avoid this clash, but the new source
ignores `process.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 is `server.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](https://github.com/hexclave/stack-auth/actions/runs/25832479377):

```
smoke-test: FTL address already in use: 127.0.0.1:8080
smoke-test: WARN exited: qstash (exit status 1; not expected)
smoke-test: INFO gave up: qstash entered FATAL state, too many start retries too quickly
[603s] SMOKE TEST FAILED: backend /health?db=1 did not return 200 within 300s
```

## Changes

- `docker/dependencies/freestyle-mock/Dockerfile`: `server.listen(PORT)`
where `PORT = 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/promises` import + node_modules symlink) are unrelated and kept.

## Test plan

- [ ] QEMU emulator build workflow passes on this branch (smoke test
reaches healthy backend).
- [ ] Verify locally that supervisord's `PORT=8180` is honored by
freestyle-mock and qstash binds 8080 cleanly.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Chores**
  * Server listening port is now configurable via PORT (default 8080).
* Local emulator startup adjusted to better handle dependencies and
create a node_modules symlink for smoother local runs.
  * Seed/process transaction timeout increased to 90s for reliability.
* Local database statement timeout changed to 0 (no statement timeout).
* **CI**
  * Added step to enable and validate KVM access during emulator builds.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/hexclave/stack-auth/pull/1432)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-14 15:31:16 -07:00
..
all-good.yaml Add Claude Code GitHub Workflow (#833) 2025-08-07 18:44:49 -07:00
auto-assign.yaml Run auto-assign on draft PRs 2025-04-10 10:18:47 -07:00
auto-update.yaml Run auto-update only once per day 2025-03-12 17:10:03 -07:00
check-prisma-migrations.yaml Speed up tests (#1063) 2025-12-28 11:25:04 -08:00
db-migration-backwards-compatibility.yaml Move MCP server into a standalone apps/mcp app (#1405) 2026-05-07 15:22:44 -07:00
docker-server-build-push.yaml Email outbox backend (#1030) 2025-12-12 10:26:38 -08:00
docker-server-build-run.yaml Sign up rules (#1138) 2026-02-03 11:08:24 -08:00
e2e-api-tests-local-emulator.yaml Move MCP server into a standalone apps/mcp app (#1405) 2026-05-07 15:22:44 -07:00
e2e-api-tests.yaml Move MCP server into a standalone apps/mcp app (#1405) 2026-05-07 15:22:44 -07:00
e2e-custom-base-port-api-tests.yaml Move MCP server into a standalone apps/mcp app (#1405) 2026-05-07 15:22:44 -07:00
e2e-fallback-tests.yaml LLM MCP Flow (#1321) 2026-04-15 17:57:08 +00:00
lint-and-build.yaml LLM MCP Flow (#1321) 2026-04-15 17:57:08 +00:00
mirror-to-wdb.yaml Upgrade GitHub workflow scripts 2025-11-24 11:21:43 -08:00
npm-publish.yaml stack-cli npm publish 2026-03-13 09:26:12 -07:00
qemu-emulator-build.yaml [Fix] freestyle-mock honors $PORT, drop server.listen string-patch (#1432) 2026-05-14 15:31:16 -07:00
reviewers-assignees.yml Update review assigner script 2025-09-10 12:05:04 -07:00
setup-tests-with-custom-base-port.yaml Skip setup tests on non-dev branches 2026-04-15 10:21:26 -07:00
setup-tests.yaml Skip setup tests on non-dev branches 2026-04-15 10:21:26 -07:00
swift-sdk-publish.yaml [Fix] [Feat] Update OAuth Sign-In and Get Token Functions to Work (#1130) 2026-01-28 02:17:27 +00:00
sync-main-to-dev.yml Upgrade GitHub workflow scripts 2025-11-24 11:21:43 -08:00
table-of-contents.yaml GH Actions push trigger only on main or dev branches 2025-03-12 10:52:35 -07:00