mirror of
https://github.com/block/buzz.git
synced 2026-12-01 13:42:45 +00:00
fix(models): curate Databricks alias-aware labels for 5 missing endpoints (#6360)
Curates Databricks model labels through prefix-stripping aliasing and materializes exact records for five endpoints missing from the Databricks catalog. **Alias-aware label resolution** (Databricks v2) - Strip workspace-specific prefixes (`goose-`, `team-x-`, etc.) before exact-record lookup so any prefixed alias resolves to its canonical label without enumerating every alias variant. - Return `None` for uncurated ids instead of falling back to a raw string; callers control the fallback display. **New exact records — label-only (Anthropic Messages route, axes from family rules)** - `databricks-claude-fable-5` → "Claude Fable 5" (materialized from `anthropic-adaptive-xhigh-fable-5`) - `databricks-claude-opus-4-8` → "Claude Opus 4.8" (materialized from `anthropic-adaptive-xhigh-opus-4-8`) - `databricks-claude-opus-5` → "Claude Opus 5" (materialized from `anthropic-adaptive-xhigh-opus-5`) - `databricks-claude-sonnet-5` → "Claude Sonnet 5" (materialized from `anthropic-adaptive-xhigh-sonnet-5`) **New capability-bearing record — Kimi K3 (MLflow Chat route)** - `databricks-kimi-k3` → "Kimi K3" with axes from models.dev Moonshot catalog: reasoning toggle + effort `[low, high, max]`, no default; `_reconciliation_doc` records the source and reconciliation policy. **Corpus and tests** - 6 new normative-corpus vectors (canonical + one `goose-*` alias per new id); executable vector count updated to 113 in both Rust and TS gates. - Rust and TS label tests extended to cover all 3 new canonical ids and their aliases via the prefix stripper. - Sentinel variable fix in discovery-provider test to prevent false failure in Databricks dev environments where `BUZZ_AGENT_PROVIDER` is set. --------- Signed-off-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz> Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
This commit is contained in:
@@ -60,12 +60,59 @@ test("resolveAgentCardModelLabel — non-inherited agent with a blank resolved m
|
||||
// Databricks registry integration
|
||||
import { formatAgentModelLabel } from "./formatAgentModelLabel.ts";
|
||||
|
||||
test("formatAgentModelLabel — Databricks aliases reuse canonical labels", () => {
|
||||
assert.equal(
|
||||
formatAgentModelLabel("goose-gpt-5-6-sol", "databricks_v2"),
|
||||
"GPT-5.6 Sol",
|
||||
);
|
||||
assert.equal(
|
||||
formatAgentModelLabel("goose-claude-fable-5", "databricks_v2"),
|
||||
"Claude Fable 5",
|
||||
);
|
||||
assert.equal(
|
||||
formatAgentModelLabel("goose-claude-opus-4-8", "databricks_v2"),
|
||||
"Claude Opus 4.8",
|
||||
);
|
||||
assert.equal(
|
||||
formatAgentModelLabel("goose-claude-opus-5", "databricks_v2"),
|
||||
"Claude Opus 5",
|
||||
);
|
||||
assert.equal(
|
||||
formatAgentModelLabel("goose-claude-sonnet-5", "databricks_v2"),
|
||||
"Claude Sonnet 5",
|
||||
);
|
||||
assert.equal(
|
||||
formatAgentModelLabel("goose-kimi-k3", "databricks_v2"),
|
||||
"Kimi K3",
|
||||
);
|
||||
});
|
||||
|
||||
test("resolveModelLabel — Databricks alias labels stay provider-scoped", () => {
|
||||
assert.equal(
|
||||
resolveModelLabel("goose-gpt-5-6-sol", null, "openai"),
|
||||
"goose-gpt-5-6-sol",
|
||||
);
|
||||
});
|
||||
|
||||
test("formatAgentModelLabel — bare family IDs remain raw", () => {
|
||||
assert.equal(formatAgentModelLabel("gpt-5"), "gpt-5");
|
||||
});
|
||||
|
||||
test("formatAgentModelLabel — known Databricks managed ID returns curated name", () => {
|
||||
assert.equal(formatAgentModelLabel("databricks-gpt-5-5"), "GPT-5.5");
|
||||
assert.equal(
|
||||
formatAgentModelLabel("databricks-claude-opus-4-7"),
|
||||
"Claude Opus 4.7",
|
||||
);
|
||||
assert.equal(
|
||||
formatAgentModelLabel("databricks-claude-opus-5"),
|
||||
"Claude Opus 5",
|
||||
);
|
||||
assert.equal(
|
||||
formatAgentModelLabel("databricks-claude-sonnet-5"),
|
||||
"Claude Sonnet 5",
|
||||
);
|
||||
assert.equal(formatAgentModelLabel("databricks-kimi-k3"), "Kimi K3");
|
||||
});
|
||||
|
||||
test("formatAgentModelLabel — unknown custom Databricks ID returns raw ID unchanged", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
canonicalizeProvider,
|
||||
DATABRICKS_MODEL_NAMES,
|
||||
databricksRegistryLabel,
|
||||
resolveModelCapabilities,
|
||||
} from "../ui/modelCapabilities";
|
||||
|
||||
@@ -19,20 +19,22 @@ export { canonicalizeProvider };
|
||||
* discovery contract (`{id, name: id}`) and any harness/version skew that
|
||||
* echoes the id as the name.
|
||||
* 2. Registry lookup by id:
|
||||
* - `provider` supplied → provider-qualified exact record only. On a miss
|
||||
* the raw id is returned; the unscoped `DATABRICKS_MODEL_NAMES` map is
|
||||
* NOT consulted, so a Databricks endpoint id never leaks a curated label
|
||||
* - `provider` supplied → Databricks v2 uses alias-aware exact records;
|
||||
* every other provider uses provider-qualified exact records. On a miss
|
||||
* the raw id is returned; the providerless registry tier is NOT
|
||||
* consulted, so a Databricks endpoint id never leaks a curated label
|
||||
* through an anthropic/openai provider context (the P3-B contract).
|
||||
* - `provider` absent → unscoped `DATABRICKS_MODEL_NAMES` map, for
|
||||
* legacy/inherited ids with no provider on hand.
|
||||
* - `provider` absent → alias-aware lookup over `databricks_v2` exact
|
||||
* records, for legacy/inherited ids with no provider on hand.
|
||||
* 3. Raw id unchanged.
|
||||
*
|
||||
* Returns the empty string when both id and discoveredName are blank; use
|
||||
* `formatAgentModelLabel` when a null/empty id should render "Auto".
|
||||
*
|
||||
* `resolveModelCapabilities` canonicalizes the provider internally, so callers
|
||||
* pass the raw provider id. Only exact records carry a `registryLabel`, so a
|
||||
* family/prefix hit yields `null` and correctly falls back to the raw id.
|
||||
* `resolveModelCapabilities` canonicalizes the provider internally. The
|
||||
* providerless registry lookup applies the same family-token stripping and
|
||||
* unique-match guard as buzz-agent discovery; only unique exact-record aliases
|
||||
* get a label.
|
||||
*/
|
||||
export function resolveModelLabel(
|
||||
id: string,
|
||||
@@ -46,15 +48,16 @@ export function resolveModelLabel(
|
||||
if (trimmedName && trimmedName !== trimmedId) return trimmedName;
|
||||
if (!trimmedId) return "";
|
||||
if (provider?.trim()) {
|
||||
// Provider-qualified exact-record tier (provider-scoped, no unscoped fallback).
|
||||
const registryLabel = resolveModelCapabilities(
|
||||
provider,
|
||||
trimmedId,
|
||||
).registryLabel;
|
||||
// Provider-qualified exact-record tier (provider-scoped, no providerless fallback).
|
||||
const canonicalProvider = canonicalizeProvider(provider);
|
||||
const registryLabel =
|
||||
canonicalProvider === "databricks_v2"
|
||||
? databricksRegistryLabel(trimmedId)
|
||||
: resolveModelCapabilities(provider, trimmedId).registryLabel;
|
||||
return registryLabel ?? trimmedId;
|
||||
}
|
||||
// Providerless path: unscoped registry map for legacy/inherited ids.
|
||||
return DATABRICKS_MODEL_NAMES.get(trimmedId) ?? trimmedId;
|
||||
// Providerless path: alias-aware lookup for legacy/inherited ids.
|
||||
return databricksRegistryLabel(trimmedId) ?? trimmedId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -358,15 +358,48 @@ export function resolveModelCapabilities(
|
||||
export const DATABRICKS_V2_KNOWN_MODELS: ReadonlyArray<string> =
|
||||
MANIFEST.databricks_v2_known_models;
|
||||
|
||||
/**
|
||||
* Databricks endpoint-id → display-name registry, derived at runtime from the
|
||||
* manifest's `databricks_v2` exact records (the only exact records that carry a
|
||||
* `registry_label`). Feeds the providerless registry tier of
|
||||
* `resolveModelLabel`. Derived, not hand-listed — the manifest stays the single
|
||||
* source of truth, so there is no second table to keep in sync.
|
||||
*/
|
||||
export const DATABRICKS_MODEL_NAMES: ReadonlyMap<string, string> = new Map(
|
||||
MANIFEST.exact_records
|
||||
.filter((rec) => rec.provider === "databricks_v2")
|
||||
.map((rec) => [rec.raw_model_id, rec.registry_label] as const),
|
||||
);
|
||||
export type RegistryLabelRecord = {
|
||||
readonly provider: string;
|
||||
readonly raw_model_id: string;
|
||||
readonly registry_label: string;
|
||||
};
|
||||
|
||||
export function databricksRegistryLabelForRecords(
|
||||
rawModelId: string,
|
||||
records: ReadonlyArray<RegistryLabelRecord>,
|
||||
familyTokens: ReadonlyArray<string>,
|
||||
): string | null {
|
||||
if (!rawModelId.trim()) return null;
|
||||
|
||||
const idLower = rawModelId.toLowerCase();
|
||||
const exact = records.find(
|
||||
(rec) =>
|
||||
rec.provider === "databricks_v2" &&
|
||||
rec.raw_model_id.toLowerCase() === idLower,
|
||||
);
|
||||
if (exact) return exact.registry_label;
|
||||
|
||||
const strippedQuery = stripCatalogPrefix(idLower, familyTokens);
|
||||
if (strippedQuery === idLower) return null;
|
||||
let matchingRecord: RegistryLabelRecord | null = null;
|
||||
for (const rec of records) {
|
||||
if (rec.provider !== "databricks_v2") continue;
|
||||
const strippedRecord = stripCatalogPrefix(
|
||||
rec.raw_model_id.toLowerCase(),
|
||||
familyTokens,
|
||||
);
|
||||
if (strippedRecord === strippedQuery) {
|
||||
if (matchingRecord) return null;
|
||||
matchingRecord = rec;
|
||||
}
|
||||
}
|
||||
return matchingRecord?.registry_label ?? null;
|
||||
}
|
||||
|
||||
export function databricksRegistryLabel(rawModelId: string): string | null {
|
||||
return databricksRegistryLabelForRecords(
|
||||
rawModelId,
|
||||
MANIFEST.exact_records,
|
||||
MANIFEST.family_tokens,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { fileURLToPath } from "node:url";
|
||||
import test from "node:test";
|
||||
|
||||
import {
|
||||
databricksRegistryLabelForRecords,
|
||||
ManifestSchema,
|
||||
resolveModelCapabilities,
|
||||
} from "./modelCapabilities.ts";
|
||||
@@ -23,10 +24,43 @@ const corpus = JSON.parse(readFileSync(fileURLToPath(corpusUrl), "utf8"));
|
||||
// (`_group`) are skipped. Mirrors the Rust corpus filter.
|
||||
const executable = corpus.filter((entry) => entry.expect != null);
|
||||
|
||||
test("corpus has exactly 103 executable vectors", () => {
|
||||
test("corpus has exactly 113 executable vectors", () => {
|
||||
// Locks the vector count so a silent corpus edit can't quietly drop coverage;
|
||||
// must equal the gate in the Rust suite (model_capabilities.rs).
|
||||
assert.equal(executable.length, 103);
|
||||
assert.equal(executable.length, 113);
|
||||
});
|
||||
|
||||
test("registry label aliases refuse an unprefixed query", () => {
|
||||
const records = [
|
||||
{
|
||||
provider: "databricks_v2",
|
||||
raw_model_id: "databricks-gpt-5",
|
||||
registry_label: "GPT-5",
|
||||
},
|
||||
];
|
||||
assert.equal(
|
||||
databricksRegistryLabelForRecords("gpt-5", records, ["gpt-"]),
|
||||
null,
|
||||
);
|
||||
});
|
||||
|
||||
test("registry label aliases refuse ambiguous stripped record keys", () => {
|
||||
const records = [
|
||||
{
|
||||
provider: "databricks_v2",
|
||||
raw_model_id: "databricks-gpt-5-6",
|
||||
registry_label: "Databricks GPT-5.6",
|
||||
},
|
||||
{
|
||||
provider: "databricks_v2",
|
||||
raw_model_id: "partner-gpt-5-6",
|
||||
registry_label: "Partner GPT-5.6",
|
||||
},
|
||||
];
|
||||
assert.equal(
|
||||
databricksRegistryLabelForRecords("goose-gpt-5-6", records, ["gpt-"]),
|
||||
null,
|
||||
);
|
||||
});
|
||||
|
||||
test("every executable corpus vector resolves to its expected six-axis profile", () => {
|
||||
|
||||
Reference in New Issue
Block a user