Skip to main content

Module drift

Module drift 

Source
Expand description

Protocol drift detection between the AG-UI TypeScript source of truth and this repo’s Rust event types.

Why this exists: the Rust event types are a hand-written port of the upstream Zod schemas. Nothing in the compiler links the two, so upstream can add an event type and this SDK will keep building, keep passing its tests, and silently not speak the protocol any more. That is exactly how the previous community SDK fell ten event types behind without anyone noticing.

The link is this check:

  • drift-check — offline, deterministic, the CI gate. Compares the vendored baseline in xtask/baseline/ against the Rust source, read as text.
  • drift-check --upstream — additionally asks GitHub whether the baseline itself has gone stale. Needs the network, so it is a scheduled job, never the required check.
  • drift-check --refresh — re-captures the baseline. How a human accepts an upstream protocol change.

Modules§

baseline
The vendored snapshot of the upstream event surface.
fetch
Fetching the upstream source of truth.
rust_src
Extracts the event surface from crates/ag-ui/src/event/**/*.rs.
text
Small text utilities shared by the TypeScript and Rust scanners.
upstream
Extracts the AG-UI event surface from the upstream TypeScript source of truth (sdks/typescript/packages/core/src/events.ts).

Structs§

Args
BaseEventDiff 🔒
The BaseEvent comparison, which is one struct rather than one per event.
FieldDelta 🔒
The three ways one payload’s fields can disagree with the baseline’s.
FieldDiff 🔒
Freshness 🔒
What a fetch of upstream had to say about the vendored baseline.
Report 🔒
Everything the offline comparison found.

Constants§

BASELINE 🔒
Where the vendored baseline lives, relative to the repo root.
EVENT_DIR 🔒
Where the Rust event types live, relative to the repo root.
EXIT_DRIFT
EXIT_OK
Exit codes: 0 clean, 1 drift found, 2 the check itself could not run.

Functions§

check_upstream 🔒
Fetches upstream and returns the ways the baseline no longer matches it.
compare 🔒
diff_baselines 🔒
Human-readable differences between two snapshots of the upstream surface.
indent 🔒
optionality 🔒
refresh 🔒
Re-captures the vendored baseline from upstream.
render 🔒
render_delta 🔒
The field-by-field lines under a heading, shared by the per-event and the BaseEvent sections so the two read identically.
render_notes 🔒
Prints how the extractor read what upstream did not spell out.
render_upstream 🔒
repo_root 🔒
The repo root, from the compile-time location of this crate.
run
Runs the check. Err means the check could not be performed at all, which is a different thing from finding drift.
short 🔒