Files
openclaw/test/scripts/root-package-overrides.test.ts
Andy Ye 46030f5489 Skip empty sherpa structured transcripts (#84667)
Summary:
- The PR changes sherpa-onnx CLI audio parsing so structured JSON with an empty `text` field becomes no transcript, while preserving non-empty JSON extraction and adding direct plus auto-detect regression coverage.
- Reproducibility: yes. Source inspection on current main shows empty sherpa structured JSON misses extraction ... scord voice can skip empty transcripts; I did not run a live Discord reproduction in this read-only review.

Automerge notes:
- PR branch already contained follow-up commit before automerge: Fix stale CI guardrails for sherpa transcript PR
- PR branch already contained follow-up commit before automerge: Skip empty sherpa structured transcripts

Validation:
- ClawSweeper review passed for head ac03171cfc.
- Required merge gates passed before the squash merge.

Prepared head SHA: ac03171cfc
Review: https://github.com/openclaw/openclaw/pull/84667#issuecomment-4501484167

Co-authored-by: Andy Ye <35905412+TurboTheTurtle@users.noreply.github.com>
Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com>
Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com>
Approved-by: takhoffman
Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
2026-05-21 04:23:59 +00:00

57 lines
2.1 KiB
TypeScript

import fs from "node:fs";
import path from "node:path";
import { describe, expect, it } from "vitest";
import YAML from "yaml";
type RootPackageManifest = {
dependencies?: Record<string, string>;
overrides?: Record<string, string>;
};
type PnpmWorkspaceConfig = {
overrides?: Record<string, string>;
};
function readRootManifest(): RootPackageManifest {
const manifestPath = path.resolve(process.cwd(), "package.json");
return JSON.parse(fs.readFileSync(manifestPath, "utf8")) as RootPackageManifest;
}
function readPnpmWorkspaceConfig(): PnpmWorkspaceConfig {
const workspacePath = path.resolve(process.cwd(), "pnpm-workspace.yaml");
return YAML.parse(fs.readFileSync(workspacePath, "utf8")) as PnpmWorkspaceConfig;
}
function readPackageManifest(packagePath: string): RootPackageManifest {
return JSON.parse(fs.readFileSync(packagePath, "utf8")) as RootPackageManifest;
}
describe("root package override guardrails", () => {
it("keeps Bedrock runtime ownership in the Amazon provider plugin", () => {
const manifest = readRootManifest();
const pnpmWorkspace = readPnpmWorkspaceConfig();
const packageName = "@aws-sdk/client-bedrock-runtime";
const bedrockManifest = readPackageManifest(
path.resolve(process.cwd(), "extensions", "amazon-bedrock", "package.json"),
);
const bedrockRuntimeDependency = bedrockManifest.dependencies?.[packageName];
const npmOverride = manifest.overrides?.[packageName];
const pnpmOverride = pnpmWorkspace.overrides?.[packageName];
expect(bedrockRuntimeDependency).toBeDefined();
expect(manifest.dependencies).not.toHaveProperty(packageName);
expect(npmOverride).toBeUndefined();
expect(pnpmOverride).toBe(bedrockRuntimeDependency);
});
it("pins the node-domexception alias exactly in npm and pnpm overrides", () => {
const manifest = readRootManifest();
const pnpmWorkspace = readPnpmWorkspaceConfig();
const pnpmOverride = pnpmWorkspace.overrides?.["node-domexception"];
const npmOverride = manifest.overrides?.["node-domexception"];
expect(pnpmOverride).toBe("npm:@nolyfill/domexception@1.0.28");
expect(npmOverride).toBe(pnpmOverride);
});
});