mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 03:33:25 +00:00
refactor(native): read retained inventory views through the operation fact contracts (#10883)
* refactor(native): read retained inventory views through the operation fact contracts * refactor(native): read matching inventories through the operation fact contracts (#10887) * refactor(native): read dispatch symbol fallbacks as lenient name facts at the port (#10889) * refactor(native): read dispatch symbol fallbacks as lenient name facts at the port * test(native): accept undeclared name-row fields in both dispatch consumers * refactor(native): read literal searches and overview counts as operation facts (#10894) * refactor(native): read literal searches and overview counts as operation facts * refactor(native): read addressed inventory rows as operation facts in every reader (#10899) * refactor(native): read addressed inventory rows as operation facts in every reader * test(native): cover xrefs name resolution through the name fact contract * test(server): pin procedure completion to the procedure inventory contract
This commit is contained in:
1 parent
f8e8dc3e7a
commit
85df21992f
15 files changed
+370
-218
No files matched your search
@@ -0,0 +1,54 @@
|
||||
import { expect, it } from "vitest";
|
||||
|
||||
import type { JsonValue } from "../domain/jsonValue.js";
|
||||
import { ok } from "../domain/result.js";
|
||||
import {
|
||||
createAnalysisExecution,
|
||||
type AnalysisOperationPort,
|
||||
} from "./AnalysisProvider.js";
|
||||
import { resolveXrefsName } from "./XrefsAddressResolution.js";
|
||||
|
||||
const names = (rows: JsonValue): AnalysisOperationPort => ({
|
||||
execute: async () =>
|
||||
ok(
|
||||
createAnalysisExecution(rows, {
|
||||
id: "fixture",
|
||||
name: "Fixture",
|
||||
version: "1",
|
||||
}),
|
||||
),
|
||||
});
|
||||
|
||||
it("resolves an exact name from rows carrying undeclared provider fields", async () => {
|
||||
expect(
|
||||
await resolveXrefsName(
|
||||
names([{ address: "0x10", value: "main", provider_rank: 1 }]),
|
||||
"main",
|
||||
),
|
||||
).toEqual({ ok: true, value: "0x10" });
|
||||
});
|
||||
|
||||
it("refuses a malformed name row with field diagnostics", async () => {
|
||||
expect(
|
||||
await resolveXrefsName(names([{ address: 16, value: "main" }]), "main"),
|
||||
).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: "AnalysisOutputError",
|
||||
operation: "list_names",
|
||||
diagnostics: { contract_issues: [{ path: [0, "address"] }] },
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("refuses a name row without an address it could pass back to xrefs", async () => {
|
||||
expect(
|
||||
await resolveXrefsName(names([{ address: "", value: "main" }]), "main"),
|
||||
).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: "AnalysisOutputError",
|
||||
reason: "Invalid symbol inventory entry at index 0",
|
||||
},
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user