Repository navigation
Description
Filed unassigned by the dev seat working #9578 (the gen-sdui-manifest.sh fixed-port collision). Not fixed there — different file, different blast radius, and that card's surface was scoped to the SDUI dump script. Found by the concurrency sweep that card asked for, not from a code read alone.
The shape
scripts/publish-smoke.sh picks its dev-server port from a fixed default:
SMOKE_PORT="${SMOKE_PORT:-3210}"(line 67)BASE_URL="http://localhost:$SMOKE_PORT"(line 78)... ./node_modules/.bin/objectstack dev --port "$SMOKE_PORT" --fresh(line 302)
Agent dispatch containers run several agents against one filesystem and one network namespace, so the default is shared state between concurrent runs.
This script is better off than the one in #9578 in two of three ways, which is why it is worth stating precisely rather than filing as "same bug":
- its work dir and server log are
mktemp-qualified, so there is no log clobber; - the port is env-overridable (
SMOKE_PORT), so a caller who knows about the problem can dodge it; - but the default is still one shared literal, and
BASE_URLstill derives from it.
Why the port matters here specifically — verified
objectstack dev auto-shifts off a busy port. packages/cli/src/commands/serve.ts:
const portAutoShiftAllowed = flags.dev || process.env.NODE_ENV === 'development';
if (portAutoShiftAllowed) {
try { port = await getAvailablePort(requestedPort); } catch { /* ... */ }
} else if (!(await isPortAvailable(requestedPort))) { /* loud diagnostic */ }
getAvailablePort walks upward (port++, up to +100). The --dev path is exactly the one publish-smoke.sh takes, so with run A holding 3210, run B's app binds 3211 while run B's BASE_URL still names 3210. Run B then smoke-tests run A's freshly scaffolded app and reports on it.
The non-dev branch already does the right thing (refuse loudly), so the shape of the fix is settled by the file's own precedent, not by a new decision.
Severity — deliberately not graded here
I did not measure this end to end: it needs two real objectstack dev boots of a scaffolded app, which is a much heavier setup than the vite measurement #9578 needed, and the sweep that surfaced it was explicitly scoped to reporting, not fixing. What is verified is the auto-shift (read from serve.ts and gated on the flag this script passes) and the three literals above. What is unverified is what a wrong-app smoke run actually asserts — whether it fails confusingly, or passes against the neighbour's app.
That second question is the whole severity argument, exactly as it was on #9578: a smoke test that passes against another run's app is a silent wrong answer, and a smoke test that fails confusingly is merely noisy. Measure it before grading.
Suggested shape (not a decision)
The same two halves that #9578 landed, if they apply here:
- pick a free port per run rather than defaulting to one literal;
- make the probe prove the app answering is the one this run started — the
--strictPortequivalent forobjectstack devis the existing non-dev branch's refuse-on-busy behaviour, which could be opted into by the smoke script.
Note from #9578, since it is the part that surprised: the "fail loudly on a busy port" half is not sufficient on its own. If the neighbour keeps answering on the shared port, a wait loop that only asks "does the port answer?" still gets its 200 and still targets the neighbour. Both halves, or neither works.
Sweep context
scripts/ was swept for fixed ports and unqualified /tmp paths used as per-run state. The complete result:
| finding | file | status |
|---|---|---|
DUMP_PORT=5180, /tmp/sdui-dump-dev.log |
scripts/gen-sdui-manifest.sh |
fixed in #9578 |
SMOKE_PORT="${SMOKE_PORT:-3210}" |
scripts/publish-smoke.sh |
this card |
No other fixed port and no other unqualified /tmp path used as per-run state exists under scripts/. scripts/downstream-smoke.sh and scripts/release-spec-changes.sh already mktemp their per-run state; the two other /tmp hits (scripts/check-type-check-coverage.mjs, scripts/collect-release-notes.sh) are documentation examples, not state.
Activity
os-steve commentedon Aug 18, 2026
Claiming this card.
session_01XqDQYVU5smx29ts9pAErjaclaude/issue-9647-publish-smoke-port(pushed, empty)/home/user/objectstack-9647Plan: measure the
objectstack dev --port N --freshauto-shift for real before trusting the card's read ofserve.ts, then decide how the script proves the server answering is its own.Generated by Claude Code
fix(scripts): publish-smoke targets the dev server this run started, …
chore(ci): declare serve.ts as a spec test input for the publish-smok…
test(scripts): the collision harness must not leak listeners when a s…
os-steve commentedon Aug 18, 2026
{ "issue": 9647, "status": "done", "branch": "claude/issue-9647-publish-smoke-port", "pr": "https://github.com/objectstack-ai/objectstack/pull/9782", "premise_still_valid": true, "summary": "H1 CONFIRMED by measurement, not inheritance. With a neighbour holding 34217, `objectstack dev --port 34217 --fresh` printed `server bound to port 34218 (requested 34217)`, curl on 34217 returned the neighbour's 200 and curl on 34218 returned ours, lsof showed node 8687 on 34217 and node 8724 on 34218, and `kill -0` on our own dev process succeeded throughout. The script now derives BASE_URL from the port its own server actually bound, read from the runtime state file serve.ts publishes under OS_HOME, in an OS_HOME made provably ours by pinning the dev child's TMPDIR; a per-run free port ships alongside, and an explicit SMOKE_PORT is still honoured exactly with no search. serve.ts untouched. H2: the sibling's liveness-probe shape does NOT transfer — that check was ALREADY in this wait loop and passes throughout the measurement, because our server did not die, it succeeded elsewhere. The app-identity assertion H2 preferred was measured and rejected: no anonymous endpoint carries app identity, so it cannot gate the readiness wait (GET /api/v1/data/todo_task and GET /api/v1/data/no_such_object_zzz both 401 UNAUTHENTICATED, the auth gate running before routing; GET /api/v1/discovery answers the constant name ObjectStack API). H3: YES, this can silently pass wrong — APP_NAME is the fixed literal smoke-app, so two runs share a namespace and NOTE_OBJECT matches the neighbour's app exactly, making every probe satisfiable by run A's app; the only accidental tripwire is the fixed smoke@example.com sign-up, which makes whichever run signs up second fail confusingly on an unrelated probe, so the outcome is a race between a silent green and a misleading red, and the log scan cannot arbitrate because it scans this run's own log from its healthy server on the neighbour port. H4: the negative half re-verified on current main (scripts/ has no other fixed port and every /tmp use is mktemp-qualified, including scripts/pm/release-rehearsal-clone.mjs and scripts/assert-console-spec-injection.mjs), and the sweep extended to .github/workflows/** for the first time, which found three hits in scaffold-e2e.yml — filed as #9779.", "tests": "All at branch head c53db0294 unless noted. packages/spec/scripts/publish-smoke-port-collision.test.ts: 5/5 passed in 5.5s. ABLATION (on the committed fix, restored via `git checkout HEAD -- scripts/publish-smoke.sh`): replacing the runtime-state read with the pre-fix `bound=\"$SMOKE_PORT\"` turned 2 of 5 red — `Tests 2 failed | 3 passed (5)`, the retarget case and the refuses-without-a-state-file case, while the three pinning symbol presence and argv stayed green; direction as predicted (red). LIVE end-to-end against a real collision, driving the shipped helpers by sourcing the script: `NEIGHBOUR_ANSWERS_ON_3210: {\"iam\":\"NEIGHBOUR-RUN-A\"...}` / `healthy after probe #7 — our server is on port 3211` / `REQUESTED=3210 BOUND=3211` / `OUR_APP_ANSWERS: {\"success\":true,\"data\":{\"status\":\"ok\"...}}` / `REQUESTED_PORT_ANSWERS: {\"iam\":\"NEIGHBOUR-RUN-A\"...}` / `OUR_LEADER_ALIVE: YES` — the last two lines are the reverse verification in place, the two facts the old loop accepted as sufficient. `pnpm --filter @objectstack/spec typecheck` exit 0 (tsc + check:scripts-typecheck + check:test-typecheck, all script names echoed). Gate union at c53db0294: check:engine-double-contract, check:where-matcher, check:query-options-erasure, check:merge-driver, check:type-source-resolution, check-nul-bytes.mjs, check-cross-package-test-inputs.mjs (--self-test 33/33) — all PASS. At 28b3162fa (the tree before the harness-trap commit, which touches only that one test file): `pnpm --filter @objectstack/spec test` = 414 files / 10992 tests passed; docs-audit/check-affected-docs.mjs PASS (242 self-test cases); spec check:empty-state / check:liveness / check:strictness-ledger / check:variant-docs all PASS. NOT run to green: check-dev-prereqs.mjs and check:type-check-debt, both of which demand a fully built workspace — this worktree built only the closure the measurement needed (`pnpm --filter @objectstack/example-todo... build`). Gate list derived at the end from my actual changed paths via scripts/pm/dispatch-gates.mjs, not from the dispatch prompt, which named none.", "open_questions": [], "out_of_scope_findings": [ "filed as #9779: .github/workflows/scaffold-e2e.yml hardcodes port 8080 in three boot-and-probe blocks (two `os start --port 8080`, one `docker run --name e2e -p 18080:8080`) whose wait loops only ask whether the port answers and never check SERVER_PID liveness — same accept-whatever-answers shape, though `os start` takes the loud non-dev refusal branch rather than auto-shifting, and GitHub-hosted runners isolate jobs so the exposure is self-hosted runners and agent containers" ] }Generated by Claude Code
fix(scripts): publish-smoke targets the dev server this run started, …