@norskvideo/ctl-test-harness 0.1.80 → 0.1.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/demo/harness.d.ts CHANGED
@@ -115,6 +115,8 @@ export declare class ProductHarness {
115
115
  * daemon, the dev backend and the store. Throws if the store outlives the
116
116
  * root-container nuke: a leak a runner would otherwise accumulate. */
117
117
  teardown(): Promise<void>;
118
+ private instancePortsIssued;
119
+ private nextInstancePort;
118
120
  private nextStudioHostPort;
119
121
  }
120
122
  /** The demo: a ProductHarness set up, run, held (`up`) or not (`check`), torn down. */
package/demo/harness.js CHANGED
@@ -23,6 +23,12 @@ const STUDIO_HOST_PORT_PARAM = "STUDIO_HOST_PORT";
23
23
  /** Launches after the first take studio host ports above the proxy's, inside
24
24
  * the band and below `instancePortBase`: six of them. */
25
25
  const EXTRA_STUDIO_PORTS = 6;
26
+ /** Allocated-port params come from `instancePortBase` to the band's end: ten. */
27
+ const INSTANCE_PORTS = 10;
28
+ /** A template's allocated host port: a `*_PORT` param defaulting to `auto`,
29
+ * which ctl resolves to the first free port from the template's PREFERRED
30
+ * one (probe's MOQ_PORT: 4443). */
31
+ const isAllocatedPortParam = (name, dflt) => dflt === "auto" && /_PORT$/.test(name);
26
32
  export class ProductHarness {
27
33
  spec;
28
34
  slug;
@@ -135,6 +141,24 @@ export class ProductHarness {
135
141
  else if (!internalOnly) {
136
142
  launchArgv.push("--host-ports", `${studioHostPort}:${STUDIO_INTERNAL_PORT}@studio`);
137
143
  }
144
+ // Allocated ports get a port from this run's band, not ctl's `auto`. Auto
145
+ // is "the first free port from the template's preferred one", and on a
146
+ // shared docker host every daemon prefers the same one: on 2026-10-08
147
+ // probe's guide gate lost MOQ_PORT's 4443 between ctl's free-port check
148
+ // and container start ("host port 4443 was taken between validation and
149
+ // container start") -- to another instance falling back to its own MoQ
150
+ // listener, or to the node MoQ relay, which publishes 4443 itself. The
151
+ // band is per product and below the ephemeral range (port-bands.test.ts),
152
+ // so nothing else on the host reaches for these. An internal-only launch
153
+ // publishes no host port at all, so `auto` is harmless there and stays.
154
+ if (!internalOnly) {
155
+ for (const [name, dflt] of declared) {
156
+ if (name === STUDIO_HOST_PORT_PARAM || specParams[name] !== undefined)
157
+ continue;
158
+ if (isAllocatedPortParam(name, dflt))
159
+ params.push(`${name}=${this.nextInstancePort(name)}`);
160
+ }
161
+ }
138
162
  for (const p of params)
139
163
  launchArgv.push("--param", p);
140
164
  const hardware = overrides.hardware ?? spec.launch?.hardware;
@@ -260,6 +284,14 @@ export class ProductHarness {
260
284
  throw new Error(`store ${s.storeDir} still present after the root-container nuke`);
261
285
  }
262
286
  }
287
+ instancePortsIssued = 0;
288
+ nextInstancePort(param) {
289
+ const n = this.instancePortsIssued++;
290
+ if (n >= INSTANCE_PORTS) {
291
+ throw new Error(`${param}: the band holds ${INSTANCE_PORTS} allocated instance ports and this run has used them all -- pass params.${param}`);
292
+ }
293
+ return this.ports.instancePortBase + n;
294
+ }
263
295
  nextStudioHostPort() {
264
296
  const n = this.launchedIds.length;
265
297
  if (n === 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norskvideo/ctl-test-harness",
3
- "version": "0.1.80",
3
+ "version": "0.1.82",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -85,8 +85,8 @@
85
85
  "devDependencies": {
86
86
  "@types/bun": "latest",
87
87
  "@types/node": "^22.10.0",
88
- "@norskvideo/norsk-studio": "1.30.0-2026-10-07-7a3a8a18",
89
- "@norskvideo/norsk-studio-built-ins": "1.30.0-2026-10-07-7a3a8a18",
88
+ "@norskvideo/norsk-studio": "1.30.0-2026-10-08-8f4b6c11",
89
+ "@norskvideo/norsk-studio-built-ins": "1.30.0-2026-10-08-8f4b6c11",
90
90
  "@norskvideo/norsk-sdk": "1.3.1-2026-10-07-1addca1b"
91
91
  },
92
92
  "peerDependenciesMeta": {