@norskvideo/ctl-test-harness 0.1.91 → 0.1.93

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.js CHANGED
@@ -14,7 +14,7 @@
14
14
  // program SRT listener, an HLS ladder), its config-schema port remap for a
15
15
  // built template, and whatever sidecar its output points at.
16
16
  import { netReachMode, STUDIO_INTERNAL_PORT, studioBaseFrom } from "../container-net.js";
17
- import { cpuPinningArgv, ctlSupportsPublishDebugPorts, launchCpuPinning } from "../launch.js";
17
+ import { ctlSupportsPublishDebugPorts } from "../launch.js";
18
18
  import { pollUntil } from "../poll.js";
19
19
  import { launchWithPortConflictRetry, reapInstance } from "../reap.js";
20
20
  import { DemoGateFailure } from "./gates.js";
@@ -173,11 +173,6 @@ export class ProductHarness {
173
173
  const user = deps.containerUser();
174
174
  if (user)
175
175
  launchArgv.push("--container-user", user);
176
- const cores = await (deps.cpuPinning ?? launchCpuPinning)();
177
- if (cores) {
178
- launchArgv.push(...cpuPinningArgv(cores));
179
- deps.log(`pinned to this runner's cpuset: ${cores.join(",")}`);
180
- }
181
176
  if (internalOnly)
182
177
  launchArgv.push("--internal-only");
183
178
  // ctl binds a product's studio host port to 127.0.0.1. Every gate that
package/demo/run.d.ts CHANGED
@@ -93,9 +93,6 @@ export interface DemoDeps {
93
93
  * existing custom-deps consumer keeps working; absent = probe the CLI. */
94
94
  supportsPublishDebugPorts?(): Promise<boolean>;
95
95
  containerUser(): string | undefined;
96
- /** The cores to pin a launch to (the runner's cpuset on a CI box); absent =
97
- * launch.ts launchCpuPinning, undefined = unpinned. */
98
- cpuPinning?(): Promise<number[] | undefined>;
99
96
  /** Symlinks under an exported workdir whose target does not exist, as
100
97
  * `<link> -> <target>` lines. */
101
98
  brokenSymlinks(dir: string): string[];
package/demo/run.js CHANGED
@@ -33,7 +33,7 @@ import { preserveInstanceContainerLogs } from "../container-logs.js";
33
33
  import { currentInstanceNetworks, DOCKER_NETWORK_NAME, ensureRunnerOnNetwork, instanceNetworkName, isAlreadyOnNetworkError, netReachMode, } from "../container-net.js";
34
34
  import { cleanupDaemon, ctlSupportsEphemeralPorts, PROXY_PORT_FILE, requireLicenseFile, runCli, startDaemon, } from "../daemon.js";
35
35
  import { hashSlot } from "../harness-config.js";
36
- import { ctlSupportsNoPublish, ctlSupportsPublishDebugPorts, launchCpuPinning, runnerContainerUser, } from "../launch.js";
36
+ import { ctlSupportsNoPublish, ctlSupportsPublishDebugPorts, runnerContainerUser } from "../launch.js";
37
37
  import { pollUntil } from "../poll.js";
38
38
  import { nukePathAsRoot, reportForeignOwners } from "../root-nuke.js";
39
39
  import { startSrtSources } from "../source-pump.js";
@@ -304,7 +304,6 @@ export function defaultDemoDeps(cwd) {
304
304
  supportsNoPublish: ctlSupportsNoPublish,
305
305
  supportsPublishDebugPorts: ctlSupportsPublishDebugPorts,
306
306
  containerUser: runnerContainerUser,
307
- cpuPinning: launchCpuPinning,
308
307
  brokenSymlinks: findBrokenSymlinks,
309
308
  state: fileStateStore(cwd),
310
309
  hold: (abort) => new Promise((res) => {
package/launch.d.ts CHANGED
@@ -31,19 +31,3 @@ export declare function withNoPublish<T>(opts: T & {
31
31
  }): Promise<T & {
32
32
  internalOnly?: boolean;
33
33
  }>;
34
- /** The kernel's cpu list format (`0-3,8,10-11`) as core numbers. */
35
- export declare function parseCpuList(list: string): number[];
36
- /** The cores this process is restricted to, when that is fewer than the host
37
- * has online; undefined for an unrestricted process or an unreadable list. */
38
- export declare function restrictedCpus(lists: {
39
- effective: string | undefined;
40
- online: string | undefined;
41
- }): number[] | undefined;
42
- /** This process's own cpuset (cgroup v2, else v1) against the host's online cpus. */
43
- export declare function runnerCpus(): number[] | undefined;
44
- /** The cores to pin a launch to: the runner's cpuset in `direct` reach mode (a
45
- * runner container on a shared docker daemon), when the resolved ctl takes
46
- * `--cpu-pinning`. Undefined anywhere else, which launches unpinned. */
47
- export declare function launchCpuPinning(): Promise<number[] | undefined>;
48
- /** `--cpu-pinning` argv for `cores`, one flag per core as the CLI takes them. */
49
- export declare function cpuPinningArgv(cores: readonly number[] | undefined): string[];
package/launch.js CHANGED
@@ -9,7 +9,6 @@
9
9
  // This is the prevention half; @norskvideo/ctl-test-harness/daemon's
10
10
  // cleanupDaemon is the tolerance half (root-nuke on teardown). Pairing the two
11
11
  // is the harness's whole "launch clean, tear down clean" story.
12
- import { readFileSync } from "node:fs";
13
12
  import { cliCommand } from "./cli-command.js";
14
13
  import { netReachMode } from "./container-net.js";
15
14
  /** The `uid:gid` the current process runs as, for docker `--container-user`, or
@@ -44,7 +43,6 @@ export function withContainerUser(opts) {
44
43
  // spawn per process.
45
44
  const INTERNAL_ONLY_FLAG = "--internal-only";
46
45
  const PUBLISH_DEBUG_PORTS_FLAG = "--publish-debug-ports";
47
- const CPU_PINNING_FLAG = "--cpu-pinning";
48
46
  const flagSupport = new Map();
49
47
  async function probeFlagSupport(flag) {
50
48
  try {
@@ -93,64 +91,3 @@ export async function withNoPublish(opts) {
93
91
  return opts;
94
92
  return (await ctlSupportsNoPublish()) ? { ...opts, internalOnly: true } : opts;
95
93
  }
96
- // A CI runner is a container pinned to a cpuset, but on docker-outside-of-docker
97
- // the instances it launches run on the host daemon with no pin: two jobs on one
98
- // box then contend for every core, while each job's measuring browser stays on
99
- // its own few (commentary's ears went from 0 to 38 breaks a minute beside
100
- // another job). Pinning a launch to the runner's own cpuset keeps each job on
101
- // the cores it was given.
102
- /** The kernel's cpu list format (`0-3,8,10-11`) as core numbers. */
103
- export function parseCpuList(list) {
104
- const cores = [];
105
- for (const part of list.trim().split(",")) {
106
- const m = /^(\d+)(?:-(\d+))?$/.exec(part.trim());
107
- if (!m)
108
- continue;
109
- const lo = Number(m[1]);
110
- const hi = m[2] === undefined ? lo : Number(m[2]);
111
- for (let c = lo; c <= hi; c++)
112
- cores.push(c);
113
- }
114
- return cores;
115
- }
116
- /** The cores this process is restricted to, when that is fewer than the host
117
- * has online; undefined for an unrestricted process or an unreadable list. */
118
- export function restrictedCpus(lists) {
119
- if (lists.effective === undefined || lists.online === undefined)
120
- return undefined;
121
- const effective = parseCpuList(lists.effective);
122
- const online = parseCpuList(lists.online);
123
- if (effective.length === 0 || effective.length >= online.length)
124
- return undefined;
125
- return effective;
126
- }
127
- function readOr(path) {
128
- try {
129
- return readFileSync(path, "utf8");
130
- }
131
- catch {
132
- return undefined;
133
- }
134
- }
135
- /** This process's own cpuset (cgroup v2, else v1) against the host's online cpus. */
136
- export function runnerCpus() {
137
- return restrictedCpus({
138
- effective: readOr("/sys/fs/cgroup/cpuset.cpus.effective") ?? readOr("/sys/fs/cgroup/cpuset/cpuset.effective_cpus"),
139
- online: readOr("/sys/devices/system/cpu/online"),
140
- });
141
- }
142
- /** The cores to pin a launch to: the runner's cpuset in `direct` reach mode (a
143
- * runner container on a shared docker daemon), when the resolved ctl takes
144
- * `--cpu-pinning`. Undefined anywhere else, which launches unpinned. */
145
- export async function launchCpuPinning() {
146
- if (netReachMode() !== "direct")
147
- return undefined;
148
- const cores = runnerCpus();
149
- if (!cores)
150
- return undefined;
151
- return (await ctlSupportsFlag(CPU_PINNING_FLAG)) ? cores : undefined;
152
- }
153
- /** `--cpu-pinning` argv for `cores`, one flag per core as the CLI takes them. */
154
- export function cpuPinningArgv(cores) {
155
- return (cores ?? []).flatMap((c) => [CPU_PINNING_FLAG, String(c)]);
156
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norskvideo/ctl-test-harness",
3
- "version": "0.1.91",
3
+ "version": "0.1.93",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -89,9 +89,9 @@
89
89
  "devDependencies": {
90
90
  "@types/bun": "latest",
91
91
  "@types/node": "^22.10.0",
92
- "@norskvideo/norsk-studio": "1.30.0-2026-10-12-34c09bda",
93
- "@norskvideo/norsk-studio-built-ins": "1.30.0-2026-10-12-34c09bda",
94
- "@norskvideo/norsk-sdk": "1.3.1-2026-10-12-77ccf953"
92
+ "@norskvideo/norsk-studio": "1.30.0-2026-10-15-8f57d57e",
93
+ "@norskvideo/norsk-studio-built-ins": "1.30.0-2026-10-15-8f57d57e",
94
+ "@norskvideo/norsk-sdk": "1.3.1-2026-10-15-05457f88"
95
95
  },
96
96
  "peerDependenciesMeta": {
97
97
  "@norskvideo/norsk-studio": {
package/smoke.d.ts CHANGED
@@ -193,9 +193,6 @@ export interface SmokeDeps {
193
193
  * existing custom-deps consumer keeps working; absent = probe the CLI. */
194
194
  supportsPublishDebugPorts?(): Promise<boolean>;
195
195
  containerUser(): string | undefined;
196
- /** The cores to pin a launch to (the runner's cpuset on a CI box); absent =
197
- * launch.ts launchCpuPinning, undefined = unpinned. */
198
- cpuPinning?(): Promise<number[] | undefined>;
199
196
  /** Diagnostic dump for a satisfied-phase timeout, taken while the instance
200
197
  * is still up. Optional so an existing custom-deps consumer keeps working;
201
198
  * the default reads every container carrying the instance's label. */
package/smoke.js CHANGED
@@ -24,7 +24,7 @@ import { authority, ensureRunnerOnNetwork, netReachMode, resolveEndpoint, STUDIO
24
24
  import { cleanupDaemon, ctlSupportsEphemeralPorts, PROXY_PORT_FILE, requireLicenseFile, runCli, startDaemon, } from "./daemon.js";
25
25
  import { freeHostPort } from "./free-port.js";
26
26
  import { hashSlot } from "./harness-config.js";
27
- import { cpuPinningArgv, ctlSupportsNoPublish, ctlSupportsPublishDebugPorts, launchCpuPinning, runnerContainerUser, } from "./launch.js";
27
+ import { ctlSupportsNoPublish, ctlSupportsPublishDebugPorts, runnerContainerUser } from "./launch.js";
28
28
  import { pollUntil } from "./poll.js";
29
29
  import { launchWithPortConflictRetry, reapInstance } from "./reap.js";
30
30
  import { nukePathAsRoot, reportForeignOwners } from "./root-nuke.js";
@@ -85,7 +85,6 @@ export const defaultSmokeDeps = {
85
85
  supportsNoPublish: ctlSupportsNoPublish,
86
86
  supportsPublishDebugPorts: ctlSupportsPublishDebugPorts,
87
87
  containerUser: runnerContainerUser,
88
- cpuPinning: launchCpuPinning,
89
88
  diagnose: (instanceId) => dumpInstanceContainerLogs(instanceId),
90
89
  fetchProductRoute: async ({ daemonPort, product, route, storeDir }) => {
91
90
  // The daemon fronts the product proxy with the same auth guard as /api/*,
@@ -419,11 +418,6 @@ export async function runProductSmoke(slug, spec, deps = defaultSmokeDeps) {
419
418
  const user = deps.containerUser();
420
419
  if (user)
421
420
  flags.push("--container-user", user);
422
- const cores = await (deps.cpuPinning ?? launchCpuPinning)();
423
- if (cores) {
424
- flags.push(...cpuPinningArgv(cores));
425
- deps.log(`pinned to this runner's cpuset: ${cores.join(",")}`);
426
- }
427
421
  if (internalOnly)
428
422
  flags.push("--internal-only");
429
423
  // ctl binds a product's OPERATOR compose ports (STUDIO_HOST_PORT among