Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5b33949
feat(post-asap): model and validate execution phases
zzylol Aug 29, 2026
22e8998
refactor(post-asap): split value domain into timing and primitive
zzylol Aug 30, 2026
9db1409
refactor(post-asap): rename value domain state type
zzylol Aug 30, 2026
aa95a1a
refactor(post-asap): align module with execution data state
zzylol Aug 30, 2026
6679f97
fix(devtools): initialize DAG decision metadata
zzylol Aug 30, 2026
1b96726
refactor(post-asap): use execution data state terminology
zzylol Aug 30, 2026
fbd4cb3
feat(post-asap): compose exact operators with summary plans across ph…
zzylol Aug 26, 2026
82f03e3
refactor(ir): generalize phase-aware value operations
zzylol Aug 29, 2026
125e192
fix(cost): reuse canonical recurrence rate types
zzylol Aug 29, 2026
24c2d41
fix(export): use canonical recurrence cost rate
zzylol Aug 29, 2026
779f1d3
chore(test): defer exact composition E2E coverage
zzylol Aug 29, 2026
5ad2fee
refactor(planner): use value domains for exact composition
zzylol Aug 30, 2026
657cf3b
refactor(planner): use execution data state name
zzylol Aug 30, 2026
1bf215c
refactor(planner): use execution data state module
zzylol Aug 30, 2026
aa8353d
refactor: use execution data state terminology
zzylol Aug 30, 2026
ebe7e29
test(planner): cover exact composition end to end
zzylol Aug 29, 2026
55beb9d
test(planner): assert structured value domains
zzylol Aug 30, 2026
d9b063d
test(planner): use execution data state name
zzylol Aug 30, 2026
cc2e874
refactor: use execution data state terminology
zzylol Aug 30, 2026
d81dcc0
feat(workload): normalize query demand and data evidence
zzylol Aug 29, 2026
fb430bf
fix(workload): bind demand explicitly to plan roots
zzylol Aug 29, 2026
ad6ff07
feat(workload): plan summary state lifecycles
zzylol Aug 29, 2026
859bac0
refactor(lifecycle): use generic phase operations
zzylol Aug 29, 2026
01d101a
fix(workload): satisfy lifecycle lint
zzylol Aug 29, 2026
5749311
chore(lifecycle): defer design documentation to docs PR
zzylol Aug 29, 2026
b44a8f5
fix(lifecycle): enforce deployment legality and raw fallback
zzylol Aug 29, 2026
5adb5f1
refactor(lifecycle): use generic phase operations
zzylol Aug 29, 2026
a53e29b
feat(planner): select lifecycle-aware summary plans
zzylol Aug 29, 2026
705edeb
refactor(lifecycle): validate value domains
zzylol Aug 30, 2026
b00af7b
fix(cost): dispatch exact composition by placement
zzylol Aug 30, 2026
3771e8f
refactor(lifecycle): use execution data state name
zzylol Aug 30, 2026
c8f7c0c
refactor: use execution data state terminology
zzylol Aug 30, 2026
a8fedf2
test(planner): cover workload-to-lifecycle deployment end to end
zzylol Aug 30, 2026
312ff5a
docs(planner): document lifecycle-aware planning and costs
zzylol Aug 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions crates/asap-aware-mapping/src/accuracy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ pub struct PropagationStats {
/// of groups a `sum` folds), for `ExactSum`/`ExactExtremum`'s union
/// bound over per-input failures.
pub input_row_count: Option<u64>,
/// Fresh key-frequency distribution evidence from the data workload.
/// Built-in rules preserve it for deployment-specific accuracy models;
/// they do not assume a favorable distribution when it is absent.
pub data_distribution: Option<asap_types::workload::DataDistribution>,
/// Lower confidence bound of the kth selected TopK item, after widening
/// the interval by the sketch's own estimation error.
pub topk_selected_lower_bound: Option<f64>,
Expand Down Expand Up @@ -120,6 +124,29 @@ pub struct NoAccuracyEvidence;

impl AccuracyEvidenceProvider for NoAccuracyEvidence {}

/// Accuracy evidence backed by the normalized data workload. Freshness is
/// checked at the planning time before values reach any accuracy rule.
#[derive(Debug, Clone, Copy)]
pub struct WorkloadAccuracyEvidence<'a> {
pub data: &'a asap_types::workload::DataWorkload,
pub now_ms: u64,
}

impl AccuracyEvidenceProvider for WorkloadAccuracyEvidence<'_> {
fn propagation_stats(
&self,
_op: &CompositionOperator,
_family: &SummaryFamilyType,
_query: Option<&SketchQuery>,
) -> PropagationStats {
PropagationStats {
input_row_count: self.data.input_cardinality.value_at(self.now_ms).copied(),
data_distribution: self.data.distribution.value_at(self.now_ms).cloned(),
..PropagationStats::default()
}
}
}

/// The deployment-extensible accuracy algebra. `asap-aware-mapping` ships
/// [`DefaultAccuracyModel`]; a deployment with a proof for a composition the
/// default rejects (a registered cross-metric conversion, say) implements
Expand Down Expand Up @@ -839,6 +866,7 @@ impl AccuracyBudgetAllocator for EqualSplitAllocator {
mod tests {
use super::*;
use asap_types::post_asap::{GroupingStrategy, SketchKind};
use asap_types::workload::{DataDistribution, DataWorkload, Evidence, EvidenceSource};

fn abs(bound: f64, delta: f64) -> ResultGuarantee {
ResultGuarantee {
Expand All @@ -865,6 +893,54 @@ mod tests {
}
}

#[test]
fn workload_accuracy_evidence_uses_only_fresh_data_characteristics() {
let data = DataWorkload {
input_cardinality: Evidence {
value: Some(42),
source: EvidenceSource::Observed,
observed_at_ms: Some(1_000),
valid_for_ms: Some(500),
},
distribution: Evidence {
value: Some(DataDistribution::Bursty),
source: EvidenceSource::Observed,
observed_at_ms: Some(1_000),
valid_for_ms: Some(500),
},
..Default::default()
};
let provider = WorkloadAccuracyEvidence {
data: &data,
now_ms: 1_500,
};
let fresh = provider.propagation_stats(
&CompositionOperator::ExactSum,
&SummaryFamilyType::ExactAggregate(
asap_types::post_asap::ExactKind::Sum,
asap_types::post_asap::ExactParams::Sum,
),
None,
);
assert_eq!(fresh.input_row_count, Some(42));
assert_eq!(fresh.data_distribution, Some(DataDistribution::Bursty));

let stale = WorkloadAccuracyEvidence {
data: &data,
now_ms: 1_501,
}
.propagation_stats(
&CompositionOperator::ExactSum,
&SummaryFamilyType::ExactAggregate(
asap_types::post_asap::ExactKind::Sum,
asap_types::post_asap::ExactParams::Sum,
),
None,
);
assert_eq!(stale.input_row_count, None);
assert_eq!(stale.data_distribution, None);
}

#[test]
fn exact_child_contributes_zero_error() {
let local = abs(0.05, 0.01);
Expand Down
Loading