refactor: return complete analysis results inline
This commit is contained in:
@@ -20,7 +20,7 @@ const classificationSchema = z.enum([
|
||||
"history_diverged",
|
||||
]);
|
||||
|
||||
/** Strict bounded input for canonical Evidence bundle comparison. */
|
||||
/** Strict input for canonical Evidence bundle comparison. */
|
||||
export const bundleComparisonInputSchema = z.strictObject({
|
||||
left_bundle_path: z.string().min(1).max(4_096),
|
||||
right_bundle_path: z.string().min(1).max(4_096),
|
||||
@@ -31,10 +31,7 @@ export const bundleComparisonInputSchema = z.strictObject({
|
||||
right_evidence_id: evidenceIdSchema,
|
||||
}),
|
||||
)
|
||||
.max(500)
|
||||
.default([]),
|
||||
offset: z.number().int().min(0).default(0),
|
||||
limit: z.number().int().min(1).max(500).default(100),
|
||||
});
|
||||
|
||||
const bundleChangeSchema = z.object({
|
||||
@@ -70,13 +67,7 @@ export const bundleComparisonResultSchema = z.object({
|
||||
unknowns_diverged: z.number().int().min(0),
|
||||
unresolved: z.number().int().min(0),
|
||||
}),
|
||||
changes: z.object({
|
||||
items: z.array(bundleChangeSchema).max(500),
|
||||
offset: z.number().int().min(0),
|
||||
limit: z.number().int().min(1).max(500),
|
||||
total: z.number().int().min(0),
|
||||
next_offset: z.number().int().min(0).nullable(),
|
||||
}),
|
||||
changes: z.array(bundleChangeSchema),
|
||||
limitations: z.array(z.string()),
|
||||
});
|
||||
|
||||
@@ -92,13 +83,9 @@ const MAX_ENTITIES = 100_000;
|
||||
|
||||
/** Compare canonical bundle membership and only explicitly paired observations. */
|
||||
export const compareBundles = (
|
||||
...[leftInput, rightInput, recordPairs, offset, limit]: readonly [
|
||||
unknown,
|
||||
unknown,
|
||||
readonly RecordPair[],
|
||||
number,
|
||||
number,
|
||||
]
|
||||
leftInput: unknown,
|
||||
rightInput: unknown,
|
||||
recordPairs: readonly RecordPair[] = [],
|
||||
): BundleComparisonResult => {
|
||||
const left = parseEvidenceBundle(leftInput);
|
||||
const right = parseEvidenceBundle(rightInput);
|
||||
@@ -110,7 +97,6 @@ export const compareBundles = (
|
||||
const changes = [...recordResult.changes, ...unknownResult.changes].sort(
|
||||
compareChanges,
|
||||
);
|
||||
const page = changes.slice(offset, offset + limit);
|
||||
const unresolved = changes.filter(
|
||||
({ conclusion_kind: kind }) => kind !== "observed_change",
|
||||
).length;
|
||||
@@ -128,14 +114,7 @@ export const compareBundles = (
|
||||
...unknownResult.summary,
|
||||
unresolved,
|
||||
},
|
||||
changes: {
|
||||
items: page,
|
||||
offset,
|
||||
limit,
|
||||
total: changes.length,
|
||||
next_offset:
|
||||
offset + page.length < changes.length ? offset + page.length : null,
|
||||
},
|
||||
changes,
|
||||
limitations: changes.some(({ limitations }) => limitations.length > 0)
|
||||
? [
|
||||
"One-sided membership proves only bundle inclusion or omission, not behavioral absence.",
|
||||
|
||||
Reference in New Issue
Block a user