Skip to content

[Feature] Extending dag_export's flexibility so that users can use it without a cost model #431

Description

@Selvomega

Current State and Why It Is Unsatisfying

--post-asap without --planner-cost-json runs nothing.
dag_export.rs:1500:

let results = if let Some(document) = planner_cost.as_ref() {
    let model = ExportPlannerCostModel { document };
    run_post_asap_with_progress(&lowered_queries, progress, &model, Some(&model), ...)
} else {
    eprintln!("dag_export: --post-asap requires complete deployment-owned \
               physical-plan evidence; exporting the raw plan only");
    raw_only_post_asap_results()          // three empty Vecs
};

The gate exists because a post-ASAP export asserts a cost-ranked decision, and
dag_export owns no deployment evidence with which to defend one.

However, a user with no deployment yet still wants to see what ASAPPlanner does
with a workload — which replacements it finds, which it commits to, what the
DAG looks like — and that needs the structure to be real, not the numbers.

Proposal

  1. Behind --default-cost (mutually exclusive with --planner-cost-json), run
    the search and pass &DefaultCostModel to global_selection — the two lines
    5dbf4d9 deleted.
  2. Keep export_model as None, so every cost is CostSource::Unavailable
    with value: None. workload_cost_summary already degrades to an
    unavailable summary; the viewer renders Not estimated.
  3. Absent both flags, behavior is unchanged.
  4. Update the stderr line and tools/dag-viewer/README.md, which currently
    states that without the document --post-asap exports the raw graph only.

Why This Is Not What 5dbf4d9 Removed

That commit deleted two things:

Removed Restored?
winner_cost_annotations emitting CostAnnotation::modeled(...) from AnalyticalCostModel No
analytical.map_or(&default_model, ...) choosing which model ranks Yes

DefaultCostModel's number was never an exported cost. The old
winner_cost_annotations had two outcomes: calibrated CostUnits, or
Unavailable"structural node counts are intentionally never used as a
fallback."
The commit's real work was making the evidence document complete and
fail closed. Untouched here. The usual objection — that dag_node_count plus an
"illustrative, not measured" weight table is indistinguishable from a real
cost — does not apply to a number that is never serialized.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions