mirror of
https://github.com/morluto/rea.git
synced 2026-11-03 13:26:10 +00:00
refactor(analysis-view): unify request and source ownership
This commit is contained in:
1 parent
6b7aa124ed
commit
b7f8bbb49f
25 files changed
+342
-352
No files matched your search
@@ -15,12 +15,12 @@ it("pages individual function facts without transferring an entire ambiguous ali
|
||||
});
|
||||
if (!matched.ok) throw matched.error;
|
||||
const source = { kind: "inline", evidence: matched.value.evidence };
|
||||
const view = (query: unknown) => {
|
||||
const result = inspectAnalysisView({ source, view: query });
|
||||
const view = async (query: unknown) => {
|
||||
const result = await inspectAnalysisView({ source, view: query });
|
||||
if (!result.ok) throw result.error;
|
||||
return analysisViewResultSchema.parse(result.value.normalized_result);
|
||||
};
|
||||
const groups = view({
|
||||
const groups = await view({
|
||||
kind: "function-matches",
|
||||
collection: "matches",
|
||||
fields: ["basis"],
|
||||
@@ -36,7 +36,7 @@ it("pages individual function facts without transferring an entire ambiguous ali
|
||||
if (groups.kind !== "function-matches") throw new Error("Wrong view");
|
||||
expect(groups.items[0]).not.toHaveProperty("left");
|
||||
const member = `${matched.value.sources[0]!.evidence_id}/123`;
|
||||
const functions = view({
|
||||
const functions = await view({
|
||||
kind: "function-matches",
|
||||
collection: "functions",
|
||||
function_ids: [member],
|
||||
@@ -60,7 +60,7 @@ it("pages individual function facts without transferring an entire ambiguous ali
|
||||
});
|
||||
expect(JSON.stringify(functions).length).toBeLessThan(6000);
|
||||
expect(
|
||||
view({
|
||||
await view({
|
||||
kind: "function-matches",
|
||||
collection: "functions",
|
||||
names: [],
|
||||
@@ -68,7 +68,7 @@ it("pages individual function facts without transferring an entire ambiguous ali
|
||||
}),
|
||||
).toMatchObject({ coverage: { total: 0 } });
|
||||
expect(
|
||||
view({
|
||||
await view({
|
||||
kind: "function-matches",
|
||||
collection: "functions",
|
||||
names: ["same"],
|
||||
@@ -77,7 +77,7 @@ it("pages individual function facts without transferring an entire ambiguous ali
|
||||
}),
|
||||
).toMatchObject({ coverage: { total: 500, next_offset: 1 } });
|
||||
expect(
|
||||
view({
|
||||
await view({
|
||||
kind: "function-matches",
|
||||
collection: "functions",
|
||||
sides: ["right"],
|
||||
@@ -88,9 +88,13 @@ it("pages individual function facts without transferring an entire ambiguous ali
|
||||
coverage: { examined: 1, total: 500, exhausted: true, next_offset: null },
|
||||
});
|
||||
expect(
|
||||
view({ kind: "function-matches", collection: "functions", states: [] }),
|
||||
await view({
|
||||
kind: "function-matches",
|
||||
collection: "functions",
|
||||
states: [],
|
||||
}),
|
||||
).toMatchObject({ coverage: { total: 0, exhausted: true } });
|
||||
expect(view({ kind: "summary" })).toMatchObject({
|
||||
expect(await view({ kind: "summary" })).toMatchObject({
|
||||
summary: {
|
||||
scope: "provider-observed-inputs",
|
||||
summary: { unresolved: 1 },
|
||||
|
||||
Reference in new issue
Block a user