mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 19:23:24 +00:00
* feat(javascript): page retained feature traces through analysis views A bidirectional trace_application_feature result can exceed one MCP response, and inspect_analysis_view refused trace parents as unsupported, so the only recovery was exporting the whole session. - Add a shared feature-trace view owner: a summary with the trace's identity, producer counts and coverage, and pages of paths, nodes, edges, seed_matches and native_handoffs in retained order with exact filters. Node rows are compact unless observations are requested. Page coverage never upgrades trace coverage. - Accept an optional MCP view on trace_application_feature that retains the complete trace before returning the selected facts; the CLI keeps complete JSON and reads saved traces with inspect-analysis-view. - Offer a ready-to-call first paths page when a retained complete trace exceeds the MCP response budget. - Share the distinct authority/state/confidence basis helper with module references. Fixes #8296 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(javascript): name the retained parent when a selected view overflows Review follow-up for the feature-trace views. - Share one delivery owner between trace_application_feature and compare_source_to_bundle: stage the selected view against the completed parent, keep the established contract that a cancelled request commits no session facts, then commit sources and the parent. - A selected view that exceeds the response budget now references the retained parent and offers the same selection at half its limit, instead of naming the view record, which cannot be a view parent. - Cover two native handoffs paged one at a time, the oversized selected page, and cancellation after the trace completes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(javascript): bind feature-trace pages to their collection rows Advertise each feature-trace page with exactly its own row schema, so a paths page cannot validate with node, edge, seed-match or handoff rows. The native-trace view in #8533 received the same review finding; the two sibling views now share one strict page contract. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(javascript): mix valid rows from another collection into a trace page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
65 lines
2.1 KiB
TypeScript
65 lines
2.1 KiB
TypeScript
import { z } from "zod";
|
|
import { prefixedDigestSchema } from "../digests.js";
|
|
import {
|
|
applicationGraphEvidenceSchema,
|
|
applicationNodeIdentitySchema,
|
|
} from "../javascript/javascriptApplicationEvidenceSchemas.js";
|
|
|
|
const moduleKindSchema = z.enum([
|
|
"javascript-asset",
|
|
"javascript-module",
|
|
"source-module",
|
|
]);
|
|
|
|
/** Exact filters over retained owner facts; paths are not filesystem lookups. */
|
|
export const javascriptModuleReferencesRequestSchema = z.strictObject({
|
|
kind: z.literal("javascript"),
|
|
collection: z.literal("modules"),
|
|
projection: z.literal("references"),
|
|
where: z
|
|
.strictObject({
|
|
path: z.string().nullable().optional(),
|
|
kind: moduleKindSchema.optional(),
|
|
})
|
|
.default({}),
|
|
offset: z.int().nonnegative().default(0),
|
|
limit: z.int().positive().default(64),
|
|
});
|
|
|
|
/** Unique support states, without promoting mixed observations to one fact. */
|
|
export const javascriptFactBasisSchema = z.strictObject({
|
|
authority: applicationGraphEvidenceSchema.shape.authority,
|
|
state: applicationGraphEvidenceSchema.shape.state,
|
|
confidence: applicationGraphEvidenceSchema.shape.confidence,
|
|
});
|
|
|
|
type JavaScriptFactBasis = z.infer<typeof javascriptFactBasisSchema>;
|
|
|
|
/** Distinct support states in first-observed order; mixed support stays mixed. */
|
|
export const javascriptFactBasis = (
|
|
evidence: Iterable<JavaScriptFactBasis>,
|
|
): JavaScriptFactBasis[] => {
|
|
const support = new Map<string, JavaScriptFactBasis>();
|
|
for (const { authority, state, confidence } of evidence)
|
|
support.set(`${authority}:${state}:${confidence}`, {
|
|
authority,
|
|
state,
|
|
confidence,
|
|
});
|
|
return [...support.values()];
|
|
};
|
|
|
|
/** Reusable facts rather than task-specific dependency interpretations. */
|
|
export const javascriptModuleReferenceSchema = z.strictObject({
|
|
node_id: prefixedDigestSchema("jag_node"),
|
|
kind: moduleKindSchema,
|
|
path: z.string().nullable(),
|
|
identity: applicationNodeIdentitySchema,
|
|
retained_source_range_count: z.int().nonnegative(),
|
|
basis: z.array(javascriptFactBasisSchema).min(1),
|
|
});
|
|
|
|
export type JavaScriptModuleReference = z.infer<
|
|
typeof javascriptModuleReferenceSchema
|
|
>;
|