Skip to content

refactor: remove dead and test-only code, part 1 (#1046) - #1069

Merged
milindsrivastava1997 merged 2 commits into
mainfrom
1046-remove-dead-and-test-only-code-row-reference-oracle-old_docs-test-only-demand-model-batch-bridge-memo-snapshot
Oct 30, 2026
Merged

milindsrivastava1997 merged 2 commits into
mainfrom
1046-remove-dead-and-test-only-code-row-reference-oracle-old_docs-test-only-demand-model-batch-bridge-memo-snapshot

Conversation

@milindsrivastava1997

Copy link
Copy Markdown
Collaborator

Part 1 of #1046. It covers the plain deletions. The row-reference oracle, temporal::reduce and the devtools corpus helpers are in a follow-up PR.

Why

Production never reaches this code, and keeping it costs time. For example, the memo snapshot had to be re-recorded after unrelated memo changes. Removing it cuts about 4,150 lines.

What

Removed:

  • old_docs/. Nothing references it, and docs/ replaces it.
  • plan-selection/src/search/costing/demand.rs (#[cfg(test)]). Its tests never compared it against the production cost evaluator.
  • executor/src/runtime/batch_execution.rs. Production code never calls it. The one test that used it (aggregate/temporal.rs) now builds its two-node DAG directly.
  • logical-asap-optimization/src/pass2/memo/shared_producer_snapshot.rs (#[cfg(test)]). The rule tests in pass2/memo/rules/ cover the same behaviour.
  • In physical-asap-optimization: optimize_physical_asap_without_query_time_raw_scans, every_assignment_scans_raw_at_query_time and reads_raw_at_query_time, which have no callers. physical_candidate_count is now private and #[cfg(test)].
  • run_stage1_to_stage3_from_pass1, which has no callers. With it gone, the private run_with_initial_memo always received an initial memo, so it now takes DagOfLogicalMemoGroups instead of Option<_>.
  • In types: hydra_kind_for and default_hydra_params, plus their tests. Two doc comments that linked to hydra_kind_for now state the rule in prose.
  • In types: MeasuredCpu, MeasuredResources, and Measurement, which only MeasuredCpu used. Also the test that compared ModeledCpu against MeasuredCpu.
  • docs/develop_docs/offline-sketch-evidence.md, offline-sketch-evidence.schema.json and offline-comparison-evidence.schema.json. These docs described the offline benchmark evidence wire format in terms of MeasuredCpu, Measurement and MeasuredResources. They also named ResourceMeasurements and crates/asap-aware-mapping, neither of which exists anymore. Nothing in this repo produces or reads that format. This deletion is not in Remove dead and test-only code: row-reference oracle, old_docs, test-only demand model, batch bridge, memo snapshot #1046's list.

docs/design_docs/proposals/planner-layering.md no longer names the removed function. The trailing-whitespace pre-commit hook also stripped existing trailing whitespace from 27 lines of that file, so the PR includes those lines too.

How

Deletions only. The one non-deletion code change is the temporal.rs test, which now runs a source → window DAG itself instead of going through evaluate_batch. It still asserts on the same first output row.

As agreed in the planning discussion, this PR leaves the files #1047 rewrites alone: the pass2/memo/* helpers, accuracy::native_target, asap_aware_cse::*, workload_candidates, query_pruning, optimize_physical_asap and select_plan. The one exception is removing the mod shared_producer_snapshot; line in pass2/memo.rs.

Key code interfaces added / modified

Removed public items only. Nothing is added.

// crates/physical-asap-optimization/src/lib.rs
pub fn optimize_physical_asap_without_query_time_raw_scans(..)   // removed
pub fn every_assignment_scans_raw_at_query_time(..) -> bool      // removed
pub fn physical_candidate_count(..)                              // was pub; now private, #[cfg(test)]

// crates/plan-selection/src/search/pipeline.rs (re-exported from search)
pub fn run_stage1_to_stage3_from_pass1<Id>(..)                   // removed

// crates/executor/src/runtime/batch_execution.rs
pub fn evaluate_batch / evaluate_inputs / evaluate_source        // removed (whole module)

// crates/types/src/ir/schema/sketch.rs (re-exported from schema)
pub fn hydra_kind_for(..) / default_hydra_params(..)             // removed

// crates/types/src/workload/resources/
pub struct MeasuredCpu; pub type MeasuredResources;              // removed
pub struct Measurement; pub mod measurement;                     // removed

Major algorithm changes

None.

Before this PR

The workspace carried about 4,150 lines that production never reaches. Every memo change had to re-record the FNV snapshot of the whole memo.

After this PR

The code is gone, and memo changes no longer need a snapshot re-record. Behaviour is unchanged.

Evidence

Not applicable. Behaviour is unchanged; see Verification.

Verification

No new tests.

Snapshot changes

None.

Architectural decisions

  • Test-only public items that other crates' tests/ call can't be put behind #[cfg(test)]. Deciding how to handle them is split out to Decide how to hide test-only public items used across crates #1057.
  • Measurement and the evidence docs were removed together with MeasuredCpu, instead of keeping them for a format nothing in the repo uses.

Limitations and follow-up

Human review — do not complete with an agent

  • The MVP boundary is correct.
  • New conceptual layers or public interfaces are necessary.
  • The before/after description matches the intended product behavior.
  • Human reviewer:
  • Decision and rationale:

🤖 Generated with Claude Code

zzylol
zzylol previously approved these changes Oct 30, 2026
@milindsrivastava1997
milindsrivastava1997 force-pushed the 1046-remove-dead-and-test-only-code-row-reference-oracle-old_docs-test-only-demand-model-batch-bridge-memo-snapshot branch from 46f12b7 to 31f33c6 Compare October 30, 2026 00:55
milindsrivastava1997 and others added 2 commits October 29, 2026 21:31
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- executor: remove the batch_execution bridge; the temporal-window test
  that used it builds its two-node DAG.
- logical: remove the shared-producer memo snapshot.
- physical: remove the query-time raw-scan filters; test-gate
  physical_candidate_count.
- plan-selection: remove the test-only demand model and
  run_stage1_to_stage3_from_pass1; run_with_initial_memo takes the
  initial memo directly.
- types: remove hydra_kind_for, default_hydra_params, MeasuredCpu,
  MeasuredResources and Measurement, and the offline sketch evidence
  doc and schemas that described them.
- planner-layering.md: drop the removed function (the whitespace
  changes are the trailing-whitespace hook).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@milindsrivastava1997
milindsrivastava1997 force-pushed the 1046-remove-dead-and-test-only-code-row-reference-oracle-old_docs-test-only-demand-model-batch-bridge-memo-snapshot branch from 31f33c6 to bafe160 Compare October 30, 2026 01:32
@milindsrivastava1997
milindsrivastava1997 merged commit 10def6e into main Oct 30, 2026
3 checks passed
@milindsrivastava1997
milindsrivastava1997 deleted the 1046-remove-dead-and-test-only-code-row-reference-oracle-old_docs-test-only-demand-model-batch-bridge-memo-snapshot branch October 30, 2026 01:39
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.

Remove dead and test-only code: row-reference oracle, old_docs, test-only demand model, batch bridge, memo snapshot

2 participants