fix: restore green contract and provider gates

This commit is contained in:
Peter Steinberger
2026-04-05 20:17:56 +01:00
parent dcd0cf9f98
commit 6424b08772
3 changed files with 31 additions and 4 deletions

View File

@@ -206,6 +206,7 @@ describe("matrixSetupAdapter", () => {
it("rejects unsupported avatar URL schemes during setup validation", () => {
const validationError = matrixSetupAdapter.validateInput?.({
cfg: {} as CoreConfig,
accountId: "ops",
input: {
homeserver: "https://matrix.example.org",

View File

@@ -15,6 +15,10 @@ type ToolWithParameters = {
parameters: unknown;
};
function optionalString(value: unknown): string | undefined {
return typeof value === "string" ? value : undefined;
}
export function normalizeStrictOpenAIJsonSchema(schema: unknown): unknown {
return normalizeStrictOpenAIJsonSchemaRecursive(normalizeToolParameterSchema(schema ?? {}));
}
@@ -131,12 +135,12 @@ export function resolvesToNativeOpenAIStrictTools(
transport: OpenAITransportKind,
): boolean {
const capabilities = resolveProviderRequestCapabilities({
provider: model.provider,
api: model.api,
baseUrl: model.baseUrl,
provider: optionalString(model.provider),
api: optionalString(model.api),
baseUrl: optionalString(model.baseUrl),
capability: "llm",
transport,
modelId: model.id,
modelId: optionalString(model.id),
compat:
model.compat && typeof model.compat === "object"
? (model.compat as { supportsStore?: boolean })

View File

@@ -17,6 +17,12 @@ const ALLOWED_EXTENSION_PATH_STRING_TESTS = new Set([
"src/scripts/test-projects.test.ts",
]);
const ALLOWED_CONTRACT_BUNDLED_PATH_HELPERS = new Set([
"src/plugins/contracts/boundary-invariants.test.ts",
"src/plugins/contracts/plugin-sdk-index.bundle.test.ts",
"src/plugins/contracts/plugin-sdk-runtime-api-guardrails.test.ts",
]);
describe("plugin contract boundary invariants", () => {
it("keeps bundled-capability-metadata confined to contract/test inventory", async () => {
const { globSync } = await import("glob");
@@ -67,4 +73,20 @@ describe("plugin contract boundary invariants", () => {
});
expect(offenders).toEqual([]);
});
it("keeps plugin contract tests off bundled path helpers unless the test is explicitly about paths", async () => {
const { globSync } = await import("glob");
const files = globSync("src/plugins/contracts/**/*.test.ts", {
cwd: REPO_ROOT,
nodir: true,
});
const offenders = files.filter((file) => {
if (ALLOWED_CONTRACT_BUNDLED_PATH_HELPERS.has(file)) {
return false;
}
const source = readFileSync(resolve(REPO_ROOT, file), "utf8");
return source.includes("test/helpers/bundled-plugin-paths");
});
expect(offenders).toEqual([]);
});
});