Repository navigation
refactor: Stage 1 → Stage 2 boundary types in asap_types::stages (#1047 P5a) - #1086
Merged
Merged
Conversation
… P5a) Move the memo types that Pass 2 hands Stage 2 out of asap-logical-asap-optimization into a new asap_types::stages module, so the Stage 2 catalog code (P5) can read Pass 2's output without a physical → logical crate edge (#1054 step 4). Moved (move only, no logic change): - pass2::memo: MemoGroupId, MemoGroup (+ parent_groups, reached_by_queries), CandidateGenerationTimeout, root_groups, queries_rooted_at - pass2::memo::candidates: CandidateMemo (+ topological_order, formerly in pass2/memo/groups.rs), CandidateForMemoGroup, OriginOfCandidateForMemoGroup - pass2::logical_memo_candidates: LogicalASAPMemoCandidates MemoGroup.parents and .queries go from pub(crate) to pub: Stage 1 builds and extends the memo in many places, so this is the smallest API; the fields' docs say later stages read them through the accessors. Stays in the logical crate: DagOfLogicalMemoGroups, check_generation_deadline, CandidatePopulationError, try_populate_pass1, Pass2RoundState and the generators and rules. All users import from asap_types::stages; no re-exports from the logical crate. asap-types gains no dependencies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1047 (step P5a) and #1054 (step 4: stage-boundary types live in
asap_types::stages).Why
P5 moves the Stage 2 catalog code from plan-selection into
asap-physical-asap-optimization. That code reads Pass 2's output, but under #1054 the Stage 2 crate may not depend on the Stage 1 crate. The Stage 1 → Stage 2 boundary types therefore have to live inasap-types.What
Move only. These items go from the logical crate to
asap_types::stages:asap_logical_asap_optimization::pass2::memo::{MemoGroupId, MemoGroup, CandidateGenerationTimeout, root_groups, queries_rooted_at}asap_types::stages::……::pass2::memo::candidates::{CandidateMemo, CandidateForMemoGroup, OriginOfCandidateForMemoGroup}(+CandidateMemo::topological_order)asap_types::stages::……::pass2::logical_memo_candidates::LogicalASAPMemoCandidatesasap_types::stages::LogicalASAPMemoCandidatesThese stay in the logical crate because they are Stage 1 internals:
DagOfLogicalMemoGroups,Pass2RoundState, the generators and rules, andPerComputationLogicalMemoCandidates.There are no compatibility re-exports, and
asap-typesgains no dependency. No logic, plan or JSON changes.How
The types move with their inherent impls; everything else is derives, which move with the types. Every user is updated (logical, plan-selection, devtools, integration-tests, docs).
MemoGroup.parentsand.queriesgo frompub(crate)topub, with a doc note that only Stage 1 maintains them. The logical crate builds and changes them in several places, and fields need less API than constructors and mutators would. Later stages read them throughparent_groups()andreached_by_queries().Key code interfaces added / modified
crates/types/src/stages/: every type here is the same as before, apart from its module path.Usage: Pass 2 (logical crate) returns
asap_types::stages::LogicalASAPMemoCandidates, and the Stage 2 catalog code reads it fromasap-types. After P5, that catalog code lives in the physical crate and needs no dependency on the logical crate. Plans are unchanged.Major algorithm changes
None.
Before / After
Before, the types passed from Stage 1 to Stage 2 were defined in the Stage 1 crate. After, they are shared types in
asap-types.Verification
At
c2f146f20(on main41c515465):clippy --workspace --all-targets -D warningsare clean.cargo tree -p asap-types --edges normal --depth 1is unchanged and contains no workspace crates.asap-types: 146 + 97 + 8 passed.asap-logical-asap-optimization: 182 + 35 passed.asap-plan-selection --lib: 344 passed.asap-planner: passed.asap-devtools,asap-integration-tests: passed; the known time-budget failures pass alone.--ignored): pass.topological_order;🤖 Generated with Claude Code