mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-20 13:52:28 +03:00
Same fix pattern #7049 already applied to `dashboard`: dropping the Commander default `20128` on `restart --port` lets `opts.port` stay undefined so `runServe()`s `opts.port ?? process.env.PORT ?? "20128"` fallback can actually reach `PORT`. 3 files, +36/-1. Thanks, @datrixlab — matching the existing precedent instead of inventing a new mechanism made this trivial to review. **Batch validation** — boarded with the other 10 PRs of your batch into one worktree cut from `release/v3.8.51`; every PR verified as an ancestor of the combined HEAD before validating. - Focused tests across all 11 PRs: **104/104 pass** on the combined tree. - Gates on the combined tree: `check-changelog-integrity` PASS, `check-complexity` PASS, `check-cognitive-complexity` PASS, `typecheck:core` PASS, `check:open-sse-typecheck` PASS. - `check-file-size` is red, but reproduces with byte-identical line counts on the pure `release/v3.8.51` tip (`open-sse/handlers/imageGeneration.ts` 3304, `open-sse/services/combo/roundRobinCombo.ts` 1221, `open-sse/utils/stream.ts` 3115). Inherited base-red, nothing added by this batch — it is also why this PR's "Fast Quality Gates" check was red.
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
/**
|
|
* `omniroute restart` declared `--port` with a Commander default of "20128", so the
|
|
* `opts.port ?? process.env.PORT` fallback in runServe() never reached PORT: a server
|
|
* started on PORT=3000 (from the shell or <DATA_DIR>/.env) came back on 20128 after a
|
|
* restart. #7049 fixed the same default on `dashboard`.
|
|
*/
|
|
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { Command } from "commander";
|
|
|
|
async function parseRestart(args: string[]) {
|
|
const { registerRestart } = await import("../../bin/cli/commands/restart.mjs");
|
|
const program = new Command().exitOverride();
|
|
registerRestart(program);
|
|
let parsed: Record<string, unknown> | undefined;
|
|
program.commands
|
|
.find((cmd) => cmd.name() === "restart")!
|
|
.action((opts: Record<string, unknown>) => {
|
|
parsed = opts;
|
|
});
|
|
await program.parseAsync(["restart", ...args], { from: "user" });
|
|
return parsed;
|
|
}
|
|
|
|
test("restart without --port leaves the port to runServe's PORT fallback", async () => {
|
|
const opts = await parseRestart([]);
|
|
assert.equal(opts?.port, undefined);
|
|
});
|
|
|
|
test("restart --port still passes the explicit port", async () => {
|
|
const opts = await parseRestart(["--port", "3000"]);
|
|
assert.equal(opts?.port, "3000");
|
|
});
|