refactor(domain): derive GPU and model coverage from the Coverage owner (#11406)

GPU discovery, AMD note, payload and kernel coverage and model header, metadata, tensor, range and storage coverage each spelled a local complete/partial enum. Every producer derives partial from the gaps it recorded, so coverage is always known; they now derive coverageStatusSchema without unknown, keeping not-requested and not-started as selection and progress states. Advertised schemas are unchanged. local-completeness-enum -9.
This commit is contained in:
morluto authored and GitHub committed 2026-11-16 03:33:20 +08:00
1 parent 897784042a
commit d1034867ff
4 files changed
+36 -22

No files matched your search

+14 -8
View File
@@ -1,11 +1,19 @@
import { z } from "zod";
import { createHash } from "node:crypto";
import { digestSchema } from "../digests.js";
import { coverageStatusSchema } from "../coverage.js";
import {
absoluteLocalPathStringSchema,
localPathStringSchema,
} from "../localPath.js";
const count = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
/**
* GPU inventories report known coverage: discovery, note and payload
* producers derive `partial` from the gaps they recorded, so they never
* report `unknown`.
*/
export const gpuCoverageSchema = coverageStatusSchema.exclude(["unknown"]);
export type GpuCoverage = z.infer<typeof gpuCoverageSchema>;
export const gpuLocationSchema = z.strictObject({
container_id: z.string().nullable(),
offset: count,
@@ -40,11 +48,9 @@ export const gpuObjectSchema = z.strictObject({
flags: z.string().regex(/^0x[0-9a-f]{8}$/u),
processor: z.string().nullable(),
header_location: gpuLocationSchema,
note_coverage: z
.enum(["complete", "partial"])
.describe(
"Complete only after all declared ELF note sections were examined within supported AMD metadata coverage; partial retains only examined facts.",
),
note_coverage: gpuCoverageSchema.describe(
"Complete only after all declared ELF note sections were examined within supported AMD metadata coverage; partial retains only examined facts.",
),
notes: z.array(
z.strictObject({
target: z.string().nullable(),
@@ -175,8 +181,8 @@ export const gpuCodeObjectsObjectSchema = z.strictObject({
discovery_scope: z.literal(
"supported-section-names-and-standalone-formats",
),
discovery: z.enum(["complete", "partial"]),
payloads: z.enum(["not-requested", "complete", "partial"]),
discovery: gpuCoverageSchema,
payloads: z.enum(["not-requested", ...gpuCoverageSchema.options]),
examined_sections: count,
unknown_section_names: count,
}),
@@ -361,7 +367,7 @@ export const gpuTargetSchema = z.strictObject({
.string()
.regex(/^(?:0|[1-9][0-9]*)$/u)
.nullable(),
kernel_coverage: z.enum(["not-requested", "complete", "partial"]),
kernel_coverage: z.enum(["not-requested", ...gpuCoverageSchema.options]),
by_kind: z.strictObject({
ptx: count,
cubin: count,