You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stage 1: remove Pass 2's production imports of Pass 1 #1191
After #1096 PR 1, Stage 1's Pass 1 no longer imports Pass 2 in production code, and a test enforces it. Pass 2 still imports Pass 1, so the two passes are not independent modules.
Remaining Pass 2 → Pass 1 production dependencies
PerComputationCandidateError (pass1/per_computation_candidates.rs) is in effect Stage 1's shared error type: pass2/asap_aware_cse.rs returns it from 6 functions, pass2/memo/enumeration.rs wraps it, and its TooManyCandidates variant is produced only by Pass 2. It is public API (re-exported from lib.rs).
pass2/asap_aware_cse.rs uses the Pass 1 helpers exact_accumulator and partitions_over.
Proposed change
Give Pass 2 its own error type, or move the shared error into a Stage 1 module both passes use (decide on the public name).
Move exact_accumulator and partitions_over into a shared module.
Extend the import-direction test to forbid pass2 → pass1 in production code too.
Test modules may keep using the other pass to build fixtures.
Add a private CseError { Structure(#[from] SchemaDerivationError), Unsupported(&'static str), TooManyCandidates{..} } in pass2/asap_aware_cse.rs, replacing PerComputationCandidateError in Pass 2. No code matches its variants: callers only stringify it, drop the candidate, or call .ok().
Remove TooManyCandidates from the public PerComputationCandidateError (only Pass 2 produces it).
Pass2RuleError is unchanged. It is fatal and public, while most helper errors only drop one candidate.
Helpers
Add a new crate-private src/ir_construction.rs holding partitions_over, column_ref and exact_family. Both passes import from it.
rolled_up builds its Sum/Min/Max SummaryAgg inline (reads the value column, no item, UnknownOrSigned), keeping the check that the column resolves. Pass 2 no longer calls exact_accumulator, which would otherwise pull ~300 lines of Pass 1 logic and its error type into a shared module.
Layering test
One helper walks a pass's directory recursively and matches pass1:: / pass2:: in production lines (not a bare pass1, which Pass 2's entry uses as a parameter name).
New pass2_does_not_import_pass1, confirmed to fail on the current code first.
Coverage
No new tests beyond the layering test, unless no existing test covers a Sum or Min/Max rolled_up.
Activity
refactor(stage1): move Pass 1's memo population into pass1; forbid pa…
refactor(stage1): one same_family, boundary_ptrs/nodes_within helpers…
milindsrivastava1997 commentedon Nov 4, 2026
Agreed scope
CseError { Structure(#[from] SchemaDerivationError), Unsupported(&'static str), TooManyCandidates{..} }inpass2/asap_aware_cse.rs, replacingPerComputationCandidateErrorin Pass 2. No code matches its variants: callers only stringify it, drop the candidate, or call.ok().TooManyCandidatesfrom the publicPerComputationCandidateError(only Pass 2 produces it).ErrorBuildingLogicalASAPDagsFromChosenCandidates::RecomposewrapsSchemaDerivationErrordirectly.Pass2RuleErroris unchanged. It is fatal and public, while most helper errors only drop one candidate.src/ir_construction.rsholdingpartitions_over,column_refandexact_family. Both passes import from it.rolled_upbuilds its Sum/Min/MaxSummaryAgginline (reads the value column, no item,UnknownOrSigned), keeping the check that the column resolves. Pass 2 no longer callsexact_accumulator, which would otherwise pull ~300 lines of Pass 1 logic and its error type into a shared module.pass1::/pass2::in production lines (not a barepass1, which Pass 2's entry uses as a parameter name).pass2_does_not_import_pass1, confirmed to fail on the current code first.rolled_up.refactor(stage1): remove Pass 2's production imports of Pass 1 (#1191)
refactor(types): move Stage 1's shared IR helpers into asap-types (#1191
refactor(stage1): remove Pass 2's production imports of Pass 1 (#1191) (