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
@@ -1,5 +1,6 @@
|
||||
import { permitsCapabilityFallback } from "./CapabilityFallback.js";
|
||||
import { addressedValueSchema } from "../domain/native/nativeInventory.js";
|
||||
import { listNamesFact } from "../domain/native/nativeOperationFacts.js";
|
||||
import { executeFact } from "./AnalysisOperationFacts.js";
|
||||
import type { AnalysisError } from "../domain/analysisErrorBase.js";
|
||||
import {
|
||||
AnalysisCancelledError,
|
||||
@@ -48,8 +49,9 @@ export const resolveXrefsName = async (
|
||||
): Promise<Result<string | null, AnalysisError>> => {
|
||||
if (signal?.aborted)
|
||||
return err(new AnalysisCancelledError(operation, { cause: signal.reason }));
|
||||
const inventory = await analysis.execute(
|
||||
"list_names",
|
||||
const inventory = await executeFact(
|
||||
analysis,
|
||||
listNamesFact,
|
||||
{},
|
||||
signal === undefined ? {} : { signal },
|
||||
);
|
||||
@@ -75,25 +77,17 @@ export const resolveXrefsName = async (
|
||||
}
|
||||
if (signal?.aborted)
|
||||
return err(new AnalysisCancelledError(operation, { cause: signal.reason }));
|
||||
if (!Array.isArray(inventory.value.result))
|
||||
return err(
|
||||
new AnalysisOutputError(
|
||||
"list_names",
|
||||
"Expected a symbol inventory array",
|
||||
),
|
||||
);
|
||||
|
||||
const addresses = new Set<string>();
|
||||
for (const [index, item] of inventory.value.result.entries()) {
|
||||
const parsed = addressedValueSchema.safeParse(item);
|
||||
if (!parsed.success || parsed.data.address.length === 0)
|
||||
for (const [index, row] of inventory.value.fact.entries()) {
|
||||
// An empty address cannot be passed back to xrefs.
|
||||
if (row.address.length === 0)
|
||||
return err(
|
||||
new AnalysisOutputError(
|
||||
"list_names",
|
||||
`Invalid symbol inventory entry at index ${index}`,
|
||||
),
|
||||
);
|
||||
if (parsed.data.value === selector) addresses.add(parsed.data.address);
|
||||
if (row.value === selector) addresses.add(row.address);
|
||||
}
|
||||
const [address] = addresses;
|
||||
if (addresses.size <= 1) return ok(address ?? null);
|
||||
|
||||
Reference in new issue
Block a user