Skip to content

feat(workload): define canonical workload wire format - #341

Merged
zzylol merged 2 commits into
mainfrom
feat/window-workload-snapshot-wire
Sep 4, 2026
Merged

zzylol merged 2 commits into
mainfrom
feat/window-workload-snapshot-wire

Conversation

@zzylol

@zzylol zzylol commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Why

ASAPPlanner and downstream components need one wire representation for the existing canonical QueryWorkload and DataWorkload types. Copying them into a second DTO would let recurrence, time selection, accuracy, evidence freshness, and data-arrival semantics drift.

What

  • Adds Serde contracts directly to the canonical workload types; it does not introduce a separate snapshot envelope or duplicate workload model.
  • Keeps scalar newtypes such as timestamps, durations, rates, confidence, queries, and repetition intervals transparent.
  • Gives acronym-bearing languages and SQL dialects explicit stable names: promql, sql, datafusion, elastic_dsl, datafusion_sql, clickhouse_sql, and elastic_sql.
  • Rejects unknown fields on workload structs and struct-style enum variants, including nested AccuracyTarget::EpsilonDelta.
  • Adds representative strict JSON round-trip, exact wire-name, and schema-drift regression tests. The Serde contract is also usable by YAML transports.

Boundary

Deserialization establishes only the wire shape. Callers must still invoke QueryWorkload::validate before planning; semantic validation rejects invalid rates, recurrence, confidence, latency, and data-arrival combinations. Evidence freshness is intentionally time-dependent and is checked separately through Evidence::is_fresh_at(planning_time), not during deserialization or static workload validation.

This PR intentionally serializes the existing source-of-truth workload enums instead of defining new streaming or deployment enums.

Verification

  • cargo test -p asap-types workload::tests
  • cargo clippy -p asap-types --all-targets -- -D warnings
  • cargo fmt --all -- --check

This PR is independently based on #338; it is not a prerequisite of #339.

@zzylol
zzylol force-pushed the feat/cost-window-framework-selection branch from 739753e to 000fe98 Compare September 4, 2026 01:04
@zzylol
zzylol force-pushed the feat/window-workload-snapshot-wire branch from cb50219 to 522c0fe Compare September 4, 2026 01:28
@zzylol
zzylol force-pushed the feat/cost-window-framework-selection branch from 000fe98 to cb1e2e4 Compare September 4, 2026 02:26
@zzylol
zzylol force-pushed the feat/window-workload-snapshot-wire branch from 522c0fe to 9ed473b Compare September 4, 2026 02:29
@zzylol
zzylol force-pushed the feat/cost-window-framework-selection branch from cb1e2e4 to 334ac1b Compare September 4, 2026 03:13
@zzylol
zzylol force-pushed the feat/window-workload-snapshot-wire branch from 9ed473b to c92f4ac Compare September 4, 2026 03:17
@zzylol
zzylol force-pushed the feat/cost-window-framework-selection branch from 45ea342 to 1d19224 Compare September 4, 2026 03:33
@zzylol
zzylol force-pushed the feat/window-workload-snapshot-wire branch from c92f4ac to 556c6c8 Compare September 4, 2026 03:37
@zzylol
zzylol force-pushed the feat/cost-window-framework-selection branch from 1d19224 to 48c01f7 Compare September 4, 2026 04:02
@zzylol
zzylol force-pushed the feat/window-workload-snapshot-wire branch from 556c6c8 to 9949fcc Compare September 4, 2026 04:02
@zzylol zzylol changed the title feat(workload): serialize canonical planner snapshots feat(workload): define canonical workload wire format Sep 4, 2026
@zzylol
zzylol changed the base branch from feat/cost-window-framework-selection to main September 4, 2026 11:30
@zzylol
zzylol merged commit b10c8d7 into main Sep 4, 2026
3 checks passed
@zzylol
zzylol deleted the feat/window-workload-snapshot-wire branch September 7, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant