d3ro-voice/scripts/ci/lib/runtime-index-builder.test.mjs
Yun Chan ba9ef9741e fix: red-team round 3 hardening across desktop, mobile, core and server
Batch of red-team r3 fixes that were in the working tree before the
2026-09-28 design overhaul, committed as one unit with their tests.

- desktop main: STT timeouts and sidecar, voice recording store, sync
  (credentials, audio, knowledge reindex, push gates), runtime
  provisioner, update policy, AltGr keybindings, voice-command policy,
  dictionary file codec/limits, meeting transcript condensing and a
  local recording ledger so interrupted-session recovery only closes
  meetings this device recorded (a phone's live meeting is left alone).
- mobile: login CSRF via implicit token callbacks rejected, account
  deletion/retention, durable queue retention, knowledge realtime
  without unfiltered DELETE, meeting re-record failure paths, cloud STT
  client, preferences store/resync.
- core: text chunking splits long unbroken transcripts to fit, template
  field policy, dictionary limits, meeting markdown inline handling.
- server: payple webhook policy and cancellation order scope, meeting
  document generation quota, team RPC null-role guard, unified LLM
  quota in-flight accounting, knowledge chunk vector index, meeting
  re-record failure paths (migrations 20260929*).
- ci: portable/runtime feed gates, update-policy schema, Forgejo file
  delete and alias planning.

Four older tests are updated to the new contracts rather than the old
behavior: token-pair auth callbacks are rejected, knowledge realtime no
longer subscribes to DELETE, long transcript lines are split, and
meeting recovery requires the local recording ledger for empty rows.
2026-09-28 20:45:52 +09:00

48 lines
1.8 KiB
JavaScript

// node --test scripts/ci/lib/runtime-index-builder.test.mjs
import assert from "node:assert/strict";
import { test } from "node:test";
import { RUNTIME_INDEX_SCHEMA_VERSION, buildRuntimeIndex } from "./runtime-index-builder.mjs";
const SHA = "b".repeat(64);
const components = {
sidecar: {
component: "sidecar",
archive: "d3ro-runtime-sidecar.tar.gz",
sha256: SHA,
totalSize: 20,
parts: [
{ name: "d3ro-runtime-sidecar.tar.gz.001", size: 10, sha256: SHA },
{ name: "d3ro-runtime-sidecar.tar.gz.002", size: 10, sha256: SHA },
],
},
};
test("runtime index declares the build platform and arch (regression: macOS got the Windows engine)", () => {
const index = buildRuntimeIndex({
version: "1.9.0",
generatedAt: "2026-09-28T00:00:00.000Z",
platform: "win32",
arch: "x64",
partBaseUrl: "https://feed.test/runtime-1.9.0/",
components,
});
assert.equal(index.schemaVersion, RUNTIME_INDEX_SCHEMA_VERSION);
assert.equal(index.platform, "win32");
assert.equal(index.arch, "x64");
assert.equal(index.version, "1.9.0");
assert.deepEqual(
index.components.sidecar.parts.map((part) => part.url),
[
"https://feed.test/runtime-1.9.0/d3ro-runtime-sidecar.tar.gz.001",
"https://feed.test/runtime-1.9.0/d3ro-runtime-sidecar.tar.gz.002",
],
);
// 입력은 바꾸지 않는다
assert.equal("url" in components.sidecar.parts[0], false);
});
test("runtime index refuses to be built without a platform or arch", () => {
const base = { version: "1.9.0", generatedAt: "x", partBaseUrl: "https://feed.test", components };
assert.throws(() => buildRuntimeIndex({ ...base, platform: "", arch: "x64" }), /platform/);
assert.throws(() => buildRuntimeIndex({ ...base, platform: "win32", arch: undefined }), /arch/);
});