T-2UYF-polish-dev-auto-port-selection
Status: closed/obsoleted · Impact: low · Complexity: small
The standalone polish repo auto-selected free dev ports via
scripts/dev-port.sh + scripts/tauri-wrapper.mjs, so concurrent dev
instances never collided. The monorepo import dropped both; polish dev now
uses a fixed port (1432). Restore auto-selection so a busy 1432 or a second
instance doesn’t fail to boot.
| Location | Role today |
|---|---|
apps/legacy-polish/src-tauri/tauri.conf.json | devUrl fixed at http://localhost:1432; beforeDevCommand: bun run dev |
apps/legacy-polish/src-nuxt/nuxt.config.ts | devServer.port = `TAURI_DEV_PORT |
apps/legacy-polish/moon.yml | dev task runs cargo tauri dev with no port resolution |
Proposed
Section titled “Proposed”moon run polish:dev resolves a free base port at startup, exports
TAURI_DEV_PORT, and drives Tauri’s devUrl to match — so two instances
bind different ports and neither errors on port-in-use. Fixed 1432 stays as
the fallback when nothing is running.
Approach
Section titled “Approach”- Port the original
dev-port.shfree-port scan into the monorepo (or a small inline resolver in the moon task). - Wire it into
polish:dev: resolve the port, exportTAURI_DEV_PORT, and passcargo tauri dev --configwith a matchingdevUrl(whattauri-wrapper.mjsdid). - Keep 1432 as the default when the resolver is unavailable.
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
apps/legacy-polish/moon.yml | modify | dev resolves a free port, exports TAURI_DEV_PORT, injects --config devUrl |
apps/legacy-polish/scripts/dev-port.sh | new | free-port resolver (ported from the standalone repo) |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1: two concurrent
moon run polish:devruns bind different ports; neither fails on port-in-use. - AC-2: nuxt
devServer.portand TauridevUrlalways resolve to the same port. - AC-3: with nothing else running, dev still boots on the default port.
Out of scope
Section titled “Out of scope”- The rest of
tauri-wrapper.mjs(only port-selection is needed). - Production/build ports.
Dependencies
Section titled “Dependencies”- none (builds on the dev fix in PR #743).
Discovery context
Section titled “Discovery context”- The standalone repo’s
scripts/tauri-wrapper.mjs+dev-port.shwere “intentionally not imported” (seeapps/legacy-polish/MIGRATION.md); the gap surfaced while fixingpolish:dev(PR #743).