@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.
@@ -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 nixpkgs pin, so ctl and every product run one Bun, and
13
- # bumping it is one edit here (the dev-kit sync carries it to the products)
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. Fetched by hash, so each repo shares one store path.
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) — norsk-mgr's gRPC client
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
- # Keep each repo's package.json "packageManager" (its image's Bun) on the
21
- # same version. That nixpkgs no longer builds x86_64-darwin, which keeps the
22
- # main pin's.
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 (import (builtins.fetchTarball {
26
- url = "https://github.com/NixOS/nixpkgs/archive/e7439b6b14ad3cc35d05608ebca9bce01a25f5f8.tar.gz"; # bun 1.4.2
27
- sha256 = "19y4py973w62z4qb7gzn0chjs67ihxy8rbjb7g71iyk8yz7z5k8z";
28
- }) { inherit (pkgs.stdenv.hostPlatform) system; }).bun;
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: the version its pin's URL
544
- * line names (`… .tar.gz"; # bun 1.4.2`). The shell runs it; the product's
545
- * image runs package.json's "packageManager", which must name the same. */
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 /archive\/[0-9a-f]{40}\.tar\.gz"; # bun (\d+\.\d+\.\d+)/.exec(ctlShell)?.[1];
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 ["@norskvideo/ctl-dev-kit build/ctl-shell.nix names no Bun version on its pin (`# bun X.Y.Z`)."];
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norskvideo/ctl-dev-kit",
3
- "version": "0.2.117",
3
+ "version": "0.2.119",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -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: Record<StandardLadderKey, LadderPreset> = {
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
+ });