Expand description
Mouse-trace ingest server — receive traces from a consenting-
human harvester (Chrome extension or instrumented page) and
append them to a crate::training_corpus::TrainingCorpus-
style on-disk store.
Operators run an instance of [TraceIngestServer] inside their
Santh / wafrift / SaaS deployment; consenting users install the
captchaforge-trace-recorder browser extension (a separate
deliverable in roadmap B1.5) and POST their recorded traces here.
The server appends each trace to a per-day JSONL file.
The data feeds crate::mouse_sampler expansions: as the
corpus grows, operators bake the new traces into the bundled
sampler’s with_extra_traces() list, raising the sampler’s
diversity floor.
§What this module ships
- [
TraceIngestServer] — Tokio-based HTTP server with one endpoint:POST /v1/tracesaccepting a JSON-encodedTracePayload. Returns 201 Created on success. - On-disk persistence to
<root>/<vendor>-<YYYY-MM-DD>.jsonl. - Schema validation: rejects payloads whose step count is out of the realistic envelope (≥3 steps, ≤500 steps), whose inter-step delays are sub-millisecond (suggests synthetic), or whose total duration exceeds 60 seconds (suggests AFK).
- Privacy: server logs sample count + bytes only, never URL or anonymisation tokens. Caller is responsible for client-side anonymisation BEFORE POSTing.
§What this module does NOT ship
- The Chrome extension (separate deliverable; non-Rust).
- Authentication (operators wrap with their existing reverse proxy + auth middleware; this server is internal-network).
- Rate-limiting (same — proxy responsibility).
- HTTPS (proxy / sidecar concern).
Structs§
- Trace
Payload - One trace payload as received from a recording client.
- Trace
Step - One step in a recorded trace.
- Trace
Store - On-disk trace store.
Enums§
- Validation
Error - Why a
TracePayloadwas rejected. Each variant carries a short reason string for the response body.
Functions§
- validate
- Validate a payload against the realistic-trace envelope.