pub fn export_dataset(
corpus: &str,
service: &str,
request: Json<ExportRequest>,
actor: Actor,
pool: &State<DbPool>,
database_url: &State<DatabaseUrl>,
) -> Result<(Status, Json<JobDto>), Status>Expand description
Exports a corpus/service’s already-converted HTML into ZIP archives off the shared filesystem as
an in-process background job (no conversion is run); returns 202 Accepted + the job
handle, which agents and humans poll via GET /api/jobs/<uuid>. The agent twin of cortex export-dataset (and the future web form), over the same export_html_dataset core.
Token-gated via the Actor guard (it reads /data and writes archives server-side);
401 without a valid token, 404 if the corpus or service is unknown, 422 for an invalid
group_by or severity key (pre-flighted so a doomed export never starts).