Skip to main content

Module trajectory

Module trajectory 

Source
Expand description

Review trajectory builder.

A trajectory is the ordered decision trail for a single review run: what chunks were retrieved, what rules were applied, which LLM calls fired, what past verdicts were recalled, what the self-check kept vs dropped, and which issues were finally emitted.

The builder is deliberately additive and optional: the review pipeline threads an Option<&mut TrajectoryBuilder> through its hot path, so callers that do not need trajectory data pass None.

The JSON shape produced by into_json() is byte-compatible with the TypeScript discriminated union in difflore-cloud/src/types/trajectory.ts. When that shape changes, BOTH sides must be updated in lockstep — the saveTrajectory oRPC endpoint validates the payload with the matching Zod schema on ingress, so any drift fails the round-trip test.

Structs§

RecalledVerdict
One past verdict recalled from the review-memory store, surfaced on the cloud detail page so reviewers can see which prior decisions influenced the current run. Shape: { id, title, similarity, excerpt }. The excerpt field is truncated by callers to ~200 characters (with a trailing ) so the trajectory payload stays compact.
TrajectoryBuilder
Ordered collector for TrajectorySteps. Threaded through the review pipeline as Option<&mut TrajectoryBuilder> so absence is a no-op.

Enums§

RuleSource
Where a rules_applied step’s rules came from. Matches the TS TrajectoryRuleSource literal set exactly.
TrajectoryStep
Ordered discriminated step. Serialized with tag = "kind" so the JSON shape matches the TS union; every new variant must add a matching zod arm in difflore-cloud/src/types/trajectory.ts.