@norskvideo/ctl-dev-kit 0.2.117 → 0.2.119
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/build/ctl-shell.nix +36 -11
- package/conventions/check-drift.ts +5 -5
- package/package.json +1 -1
- package/workflow/ladder.ts +29 -5
package/build/ctl-shell.nix
CHANGED
|
@@ -9,23 +9,48 @@
|
|
|
9
9
|
# need GitHub auth in every shell and CI runner.
|
|
10
10
|
{ pkgs, biome }:
|
|
11
11
|
let
|
|
12
|
-
# Bun from its own
|
|
13
|
-
#
|
|
12
|
+
# Bun from its own pin, so ctl and every product run one Bun, and bumping
|
|
13
|
+
# it is one edit here (the dev-kit sync carries it to the products, and
|
|
14
|
+
# sets each package.json "packageManager", its image's Bun, to bunVersion)
|
|
14
15
|
# rather than moving the main nixpkgs pin, and with it Chromium and every
|
|
15
|
-
# other tool.
|
|
16
|
+
# other tool. The derivation is nixpkgs e7439b6b's (bun 1.4.2), fetched by
|
|
17
|
+
# hash so each repo shares one store path; its release zips are swapped for
|
|
18
|
+
# bunVersion's because nixpkgs-unstable has no newer Bun yet.
|
|
16
19
|
#
|
|
17
20
|
# 1.4.2: 1.3.13's node:http2 client segfaulted in its HPACK encoder
|
|
18
|
-
# (lshpack.HPACK.encode from H2FrameParser.request)
|
|
21
|
+
# (lshpack.HPACK.encode from H2FrameParser.request) -- norsk-mgr's gRPC client
|
|
19
22
|
# to the Manager, killed mid-drain and mid-migration in the nightly e2e.
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
+
# 1.4.3: 1.3.13/1.4.2's Postgres client ran a plain query inside another
|
|
24
|
+
# caller's transaction when replies arrived fragmented across TCP reads,
|
|
25
|
+
# leaving sessions idle in transaction and callers hung.
|
|
26
|
+
# That nixpkgs no longer builds x86_64-darwin, which keeps the main pin's.
|
|
27
|
+
bunVersion = "1.4.3";
|
|
23
28
|
bun =
|
|
24
29
|
if pkgs.stdenv.hostPlatform.system == "x86_64-darwin" then pkgs.bun
|
|
25
|
-
else
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
else
|
|
31
|
+
let
|
|
32
|
+
bunPkgs = import (builtins.fetchTarball {
|
|
33
|
+
url = "https://github.com/NixOS/nixpkgs/archive/e7439b6b14ad3cc35d05608ebca9bce01a25f5f8.tar.gz";
|
|
34
|
+
sha256 = "19y4py973w62z4qb7gzn0chjs67ihxy8rbjb7g71iyk8yz7z5k8z";
|
|
35
|
+
}) { inherit (pkgs.stdenv.hostPlatform) system; };
|
|
36
|
+
zip = asset: hash: bunPkgs.fetchurl {
|
|
37
|
+
url = "https://github.com/oven-sh/bun/releases/download/bun-v${bunVersion}/bun-${asset}.zip";
|
|
38
|
+
inherit hash;
|
|
39
|
+
};
|
|
40
|
+
in
|
|
41
|
+
bunPkgs.bun.overrideAttrs (_finalAttrs: prev: {
|
|
42
|
+
version = bunVersion;
|
|
43
|
+
# src reads passthru.sources, overridden below, so the version-without-src
|
|
44
|
+
# warning does not apply.
|
|
45
|
+
__intentionallyOverridingVersion = true;
|
|
46
|
+
passthru = prev.passthru // {
|
|
47
|
+
sources = {
|
|
48
|
+
"aarch64-darwin" = zip "darwin-aarch64" "sha256-gK/UwGm0am+o8+xSC+vHUKeEPkqNW5WD0prUNsAKNAM=";
|
|
49
|
+
"aarch64-linux" = zip "linux-aarch64" "sha256-76mBPaXtckI7+Ef5FujSxHwNd2rdlyNUAmp14Q2pqiE=";
|
|
50
|
+
"x86_64-linux" = zip "linux-x64-baseline" "sha256-H8LtrIQxApCeOhvh2NmALMYHHPB05n6IIx9P/g+LOXs=";
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
});
|
|
29
54
|
|
|
30
55
|
# Playwright doc-guide browser. nix-pinned headless Chromium needs a real X
|
|
31
56
|
# display on a truly headless box (page.fill silently no-ops on plain HTML
|
|
@@ -540,11 +540,11 @@ export function productLogsProblems(repoRoot: string): string[] {
|
|
|
540
540
|
];
|
|
541
541
|
}
|
|
542
542
|
|
|
543
|
-
/** The Bun the dev-kit's build/ctl-shell.nix pins:
|
|
544
|
-
*
|
|
545
|
-
*
|
|
543
|
+
/** The Bun the dev-kit's build/ctl-shell.nix pins: its
|
|
544
|
+
* `bunVersion = "X.Y.Z";` binding. The shell runs it; the product's image
|
|
545
|
+
* runs package.json's "packageManager", which must name the same. */
|
|
546
546
|
export function pinnedBunVersion(ctlShell: string): string | undefined {
|
|
547
|
-
return
|
|
547
|
+
return /\bbunVersion = "(\d+\.\d+\.\d+)";/.exec(ctlShell)?.[1];
|
|
548
548
|
}
|
|
549
549
|
|
|
550
550
|
/** package.json's "packageManager" against the shell's Bun. They drifted once
|
|
@@ -553,7 +553,7 @@ export function pinnedBunVersion(ctlShell: string): string | undefined {
|
|
|
553
553
|
export function bunVersionProblems(repoRoot: string, ctlShellCanonical: string): string[] {
|
|
554
554
|
const want = pinnedBunVersion(ctlShellCanonical);
|
|
555
555
|
if (want === undefined) {
|
|
556
|
-
return [
|
|
556
|
+
return ['@norskvideo/ctl-dev-kit build/ctl-shell.nix names no Bun version on its pin (`bunVersion = "X.Y.Z";`).'];
|
|
557
557
|
}
|
|
558
558
|
const pkgPath = join(repoRoot, "package.json");
|
|
559
559
|
if (!existsSync(pkgPath)) return [];
|
package/package.json
CHANGED
package/workflow/ladder.ts
CHANGED
|
@@ -54,11 +54,34 @@ export function isPortraitRung(rung: Pick<LadderRung, "width" | "height">): bool
|
|
|
54
54
|
return rung.height > rung.width;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
// The standard rungs and ladders are frozen, objects and arrays alike: a rung
|
|
58
|
+
// that appears in two ladders is one object, so a product mutating it in place
|
|
59
|
+
// would silently change the other ladder. A product that wants a variant
|
|
60
|
+
// builds a new rung or ladder from these instead. `rungs` stays typed as a
|
|
61
|
+
// mutable `LadderRung[]` (frozen at runtime only) so a standard ladder still
|
|
62
|
+
// assigns to a product's `Record<ItsKey, LadderPreset>`; `readonly` on the
|
|
63
|
+
// objects' properties does not get in the way of that.
|
|
64
|
+
function freezeRungs<T extends Record<string, LadderRung>>(rungs: T): { readonly [K in keyof T]: Readonly<T[K]> } {
|
|
65
|
+
for (const rung of Object.values(rungs)) Object.freeze(rung);
|
|
66
|
+
return Object.freeze(rungs);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function freezeLadders<K extends string>(
|
|
70
|
+
ladders: Record<K, LadderPreset>,
|
|
71
|
+
): { readonly [P in K]: Readonly<LadderPreset> } {
|
|
72
|
+
for (const preset of Object.values<LadderPreset>(ladders)) {
|
|
73
|
+
for (const rung of preset.rungs) Object.freeze(rung);
|
|
74
|
+
Object.freeze(preset.rungs);
|
|
75
|
+
Object.freeze(preset);
|
|
76
|
+
}
|
|
77
|
+
return Object.freeze(ladders);
|
|
78
|
+
}
|
|
79
|
+
|
|
57
80
|
/**
|
|
58
81
|
* The named rungs of the standard ladders. A rung that appears in two ladders
|
|
59
|
-
* (`abr_360`, `abr_480`) is the same rung in both.
|
|
82
|
+
* (`abr_360`, `abr_480`) is the same rung in both. Frozen.
|
|
60
83
|
*/
|
|
61
|
-
export const STANDARD_RUNGS = {
|
|
84
|
+
export const STANDARD_RUNGS = freezeRungs({
|
|
62
85
|
default: { name: "default", kbps: 2000, width: 1280, height: 720, fps: 25, bitrateMode: "abr" },
|
|
63
86
|
abr_234: { name: "abr_234", kbps: 300, width: 416, height: 234, fps: 25, bitrateMode: "abr" },
|
|
64
87
|
abr_360: { name: "abr_360", kbps: 600, width: 640, height: 360, fps: 25, bitrateMode: "abr" },
|
|
@@ -98,7 +121,7 @@ export const STANDARD_RUNGS = {
|
|
|
98
121
|
bitrateMode: "abr",
|
|
99
122
|
codec: "hevc",
|
|
100
123
|
},
|
|
101
|
-
} satisfies Record<string, LadderRung
|
|
124
|
+
} satisfies Record<string, LadderRung>);
|
|
102
125
|
|
|
103
126
|
export type StandardRungName = keyof typeof STANDARD_RUNGS;
|
|
104
127
|
|
|
@@ -110,8 +133,9 @@ const R = STANDARD_RUNGS;
|
|
|
110
133
|
/**
|
|
111
134
|
* The ladders more than one product offers, with the labels and rungs they
|
|
112
135
|
* ship today. A product spreads the ones it offers into its own catalogue.
|
|
136
|
+
* Frozen.
|
|
113
137
|
*/
|
|
114
|
-
export const STANDARD_LADDERS
|
|
138
|
+
export const STANDARD_LADDERS = freezeLadders<StandardLadderKey>({
|
|
115
139
|
single: {
|
|
116
140
|
label: "Single rung (720p25 @ 2000 kbps)",
|
|
117
141
|
rungs: [R.default],
|
|
@@ -137,4 +161,4 @@ export const STANDARD_LADDERS: Record<StandardLadderKey, LadderPreset> = {
|
|
|
137
161
|
label: "UHD HEVC (3 rungs, 720p–2160p, 3–20 Mbps)",
|
|
138
162
|
rungs: [R.hevc_3840x2160, R.hevc_1920x1080, R.hevc_1280x720],
|
|
139
163
|
},
|
|
140
|
-
};
|
|
164
|
+
});
|