Inspiration

A public dataset can remain syntactically valid while every downstream update silently stops. Real publisher histories show the same operational pattern: fields are renamed, record granularity changes, columns disappear and policy changes alter what a row means. I built DriftPatch to close that gap without giving a probabilistic planner unrestricted production authority.

What it does

DriftPatch lets an operator upload the previously working source, its current version, the pipeline configuration and data contract. It carries that incident to one safe terminal state without step-by-step steering: activate a verified typed repair, confirm that configuration still works, or escalate without mutation.

The product accepts CSV and JSON in every baseline/current combination. Its repair language can compose field retargeting, format, delimiter, record path, lossless casts, date parsers, boolean vocabularies, joins and splits. Malformed, ambiguous, unsupported or out-of-limit input is rejected before model cost.

How it works

Admission first proves that the submitted baseline satisfies its own contract. It reserves transactional quota, writes the raw bundle to private Cloud Storage and creates a named Cloud Task. Tasks and traces carry only an object generation, digest, structural profile and opaque identity.

An internal Cloud Run worker runs a verifier-guided Google ADK workflow with Gemini 3.5 Flash. Deterministic inspection—not the model—creates the authorized candidate catalogue. The planner may select only opaque candidate identifiers. Model Armor screens both planner input and output. A failed candidate receives a minimal counterexample for another bounded round; deterministic search over the same catalogue provides a terminating fallback.

A separate result controller reloads the exact bundle generation, verifies its SHA-256, rebuilds the catalogue and proves the unique shortest repair over every record. It alone may atomically write the active configuration, previous version, rollback snapshot and terminal receipt to Firestore. Ambiguous programs, stale baselines, expired execution leases and safety-screen failures escalate.

Why this is agentic

DriftPatch owns the incident from admission to a terminal configuration receipt. It acts in the background through Cloud Tasks and Scheduler rather than waiting in a chat loop.

Autonomy is deliberately separated from authority. Gemini contributes semantic judgment where rules alone are brittle, but it receives no tools, raw rows, Firestore capability or free-form mutation channel. Deterministic contracts decide whether anything changes.

Google Cloud architecture

The dedicated europe-west1 project uses four least-privilege Cloud Run identities: public, admission, worker and result. Cloud Tasks serializes worker execution through OIDC. Cloud Scheduler watches a curated private source and reconciles expired custom work with distinct OIDC identities. Firestore owns claims and atomic receipts. Cloud Storage holds ephemeral source bundles. Model Armor screens the planner. Vertex AI serves Gemini 3.5 Flash, Gemini 3.5 Flash-Lite, Gemini 3.6 Flash and gemini-embedding-001 in separately bounded roles. Cloud Trace records the ADK workflow with prompt and response content disabled. Artifact Registry, Cloud Build and Terraform make releases immutable and reproducible.

Every service scales to zero and is capped at one instance; the worker and queue run one job at a time. A project-only €10 gross-usage alert tracks spend before credits without being misrepresented as a hard cap.

Validation

The frozen custom corpus covers CSV→CSV, CSV→JSON, JSON→CSV and JSON→JSON, unchanged input, every atomic repair family, one-to-six-step compositions and safe dispositions for ambiguity, duplicate keys and unsupported changes. A separate provenance corpus preserves dated, hash-bound revisions from the Italian Civil Protection Department, Johns Hopkins CSSE, openZH and New Zealand's Ministry of Health under their published licences. The untouched nine-case agent holdout scores 9/9 on the deterministic decision gate and 5.0/5.0 on a trace-grounded response rubric. The integrated run uses 10 model calls versus 19 at baseline; Gemini 3.6 Flash resolves 2/2 verifier retries. On separate frozen holdouts, embedding hints achieve 100% precision at 75% coverage, while Flash-Lite reaches 92.3% raw precision and 100% effective precision/recall behind the deterministic gate.

Property tests cover row and object-key order invariance. Security tests cover malformed UTF-8/JSON/CSV, size and depth limits, injection text, bundle integrity, quota races, retries and lease expiry. The production gate also exercises the complete matrix through the public domain and verifies the Firestore receipt, rollback hash, Cloud trace and deletion of each terminal bundle.

This evidence applies to the published repair language. DriftPatch does not claim universal data transformation.

Challenges and lessons

The hardest problem was not generating a plausible patch; it was proving that a patch remains safe across retries, concurrent deliveries and an independently changing baseline. Structured model output only guarantees shape. DriftPatch therefore makes the result controller reconstruct all authority from immutable evidence and accept only a unique shortest terminal program.

Raw data isolation created another systems problem: accepted work must survive a Cloud Run restart, but putting source rows in sessions, tasks, traces or Firestore would broaden exposure. Generation-bound Cloud Storage references preserve durability while keeping model context and audit records content-free.

What is next

New repair operations will enter the DSL only with explicit contract semantics, counterexamples and untouched holdout evidence. The same architecture can then serve contract owners for additional publishers without turning the worker into an unrestricted code agent.

Built with

Google Agent Development Kit, Gemini 3.5 Flash, Gemini 3.5 Flash-Lite, Gemini 3.6 Flash, gemini-embedding-001, Vertex AI, Model Armor, Cloud Run, Cloud Tasks, Cloud Scheduler, Firestore, Cloud Storage, Cloud Trace, Artifact Registry, Cloud Build, Terraform, FastAPI, React and Cloudflare.

Built With

Share this project:

Updates

Submission history