mirror of
https://github.com/morluto/rea
synced 2026-10-27 22:45:19 -04:00
99d2d7ad22
Share bounded ELF section-name decoding across native and note readers; retain read-only ranges and coverage reasons when names are unknown. Preserve ELF symbol-version bytes, dyld-bound method uncertainty, partial gRPC-Web trailers, and per-parent model identity checks. Compare GPU signatures as bytes and require a PTX module header. Share selected-path errno classification across EVM and BEAM. Validation: 397 shared-parser tests passed (one existing skip), 5 MCP schema tests passed, 14 EVM error-mapping tests passed, and 23 protobuf CLI/MCP matrix cases passed across focused runs. Build, typecheck/lint, docs, formatting, and 2134-file discovery passed. Full EVM provider workflow remains locally unverified on Darwin arm64; format controls are synthetic. Fixes #6738 Fixes #6737 Fixes #6745 Fixes #6740 Fixes #6749 Fixes #6747 Fixes #6739
79 lines
2.9 KiB
TypeScript
79 lines
2.9 KiB
TypeScript
import { writeFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
import { expect, it } from "vitest";
|
|
|
|
import { inspectAnalysisView } from "../../../src/application/analysisView/AnalysisViewService.js";
|
|
import { createModelArtifactService } from "../../../src/composition/model.js";
|
|
import { createEvidence } from "../../../src/domain/evidence.js";
|
|
import { freezeJsonSnapshot } from "../../../src/domain/immutableJson.js";
|
|
import { ggufFixture } from "../../fixtures/model/model.js";
|
|
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
|
|
|
it("checks each model parent subject independently of cached declarations", async () => {
|
|
const root = await createTestTempDirectory("rea-model-view-identity-");
|
|
const path = join(root, "selected.gguf");
|
|
await writeFile(path, ggufFixture().bytes);
|
|
const service = createModelArtifactService();
|
|
try {
|
|
const inspected = await service.inspect({
|
|
path,
|
|
hash: "full",
|
|
detail: "complete",
|
|
});
|
|
if (!inspected.ok) throw inspected.error;
|
|
const original = inspected.value;
|
|
if (original.subject === null) throw new Error("Missing full-file subject");
|
|
const report = freezeJsonSnapshot(original.normalized_result);
|
|
const parent = (name: string, targetPath: string, digest: string) =>
|
|
createEvidence(
|
|
{ path: targetPath, sha256: digest, format: "file" },
|
|
original.provider,
|
|
{
|
|
operation: original.operation,
|
|
parameters: { path, hash: "full", fixture: name },
|
|
result: report,
|
|
confidence: "observed",
|
|
limitations: original.limitations,
|
|
},
|
|
);
|
|
const digest = original.subject.digest.sha256;
|
|
const valid = parent("valid", path, digest);
|
|
const conflicting = [
|
|
parent("wrong-path", join(root, "other.gguf"), digest),
|
|
parent("wrong-digest", path, "00".repeat(32)),
|
|
];
|
|
const project = (record: typeof valid) =>
|
|
inspectAnalysisView(
|
|
{
|
|
source: {
|
|
kind: "retained-evidence",
|
|
evidence_id: record.evidence_id,
|
|
},
|
|
view: { kind: "summary" },
|
|
},
|
|
(id) => (id === record.evidence_id ? record : undefined),
|
|
);
|
|
for (const record of conflicting)
|
|
expect(record.normalized_result).toBe(report);
|
|
for (const phase of ["cold", "warm"]) {
|
|
for (const record of conflicting) {
|
|
expect(await project(record), phase).toMatchObject({
|
|
ok: false,
|
|
error: {
|
|
_tag: "AnalysisInputError",
|
|
issues: [{ path: ["source", "subject"], reason: "invalid_value" }],
|
|
},
|
|
});
|
|
}
|
|
const projected = await project(valid);
|
|
if (!projected.ok) throw projected.error;
|
|
expect(projected.value.subject).toEqual(original.subject);
|
|
expect(projected.value.normalized_result).toMatchObject({
|
|
artifact: { path, sha256: digest },
|
|
});
|
|
}
|
|
} finally {
|
|
await service.close();
|
|
}
|
|
});
|