Skip to content

feat: plan maintained populations through summary lifecycles - #491

Merged
zzylol merged 2 commits into
mainfrom
feat/population-lifecycle
Oct 1, 2026
Merged

zzylol merged 2 commits into
mainfrom
feat/population-lifecycle

Conversation

@zzylol

@zzylol zzylol commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #485.

Rebuilt into the linear stack on main. New integrate: commit(s) fold in integration-branch resolutions this PR needs on top of the earlier stack: "read the population test frontier from lifecycle timing". Conflict resolutions are recorded in the messages of: "test: carry a chosen population lifecycle to physical compilation"; "docs: describe maintained populations as lifecycle-planned state".

Why

The lifecycle layer is meant to be the only source of node timing, but maintained populations were outside it: execution_timed_dag refused any plan containing MaintainPopulation (UnplannedMaintainedState), and MaintainedPopulationStrategy hard-coded the population at ingestion time.

What

  • enumerate_summary_maintenance_lifecycles now emits one deployment for each unique maintained population that does not feed a SummaryAgg. It offers the usual alternatives (Ephemeral, Prepared, Shared, ContinuouslyMaintained), each costed through the caller's existing lifecycle hooks. Unknown cost stays unknown.
  • A population that feeds a SummaryAgg is treated as that state's input and follows its timing, including when a readout also reads the population directly.
  • select and execution_timed_dag time populations the same way as summary state. A retained population runs at ingestion together with its raw input. An Ephemeral population is rebuilt from the raw source at query time.
  • The validator accepts either timing for MaintainPopulation. The structural contracts still hold: the population must read its matching raw input, and its readout must run at query time over a population that supports it. The strategy writes query time only as the initial layout.
  • No new public types. deployments and the cost hooks may now carry MaintainPopulation nodes, and the docs say so. Cost models that price every node uniformly will now also price populations.

Before this PR

For topk by(job)(1, m) built by MaintainedPopulationStrategy, enumeration returned 0 deployments, and execution_timed_dag() returned Err(UnplannedMaintainedState). The population was always at ingestion.

After this PR

The same plan enumerates 1 population deployment.

  • ContinuouslyMaintained: the timed DAG is raw@ingest → population@ingest → readout@query. The compiled candidate stores the population in precompute.
  • Ephemeral: every node runs at query time and precompute is empty.
  • Both choices return the same TopK (chosen_population_lifecycle_decides_precompute_contents).
  • With a model where retaining is cheaper, Planner's own selection still keeps the population at ingestion.
  • With DefaultCostModel (and SummaryMaintenanceCostModel, which has no population evidence), nothing about populations is selected.

Validation

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace --no-fail-fast: 1380 passed. The new lifecycle tests were first run against the base code and failed there.
  • An independent reviewer agent examined the change. Its findings are fixed in the last commit: order-dependent handling of a shared population, which had also let its own lifecycle choice be overridden, plus a missing test and stale docs.

🤖 Generated with Claude Code

zzylol added a commit that referenced this pull request Sep 30, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zzylol
zzylol force-pushed the refactor/lifecycle-only-placement branch from 69e0b0d to eb5885c Compare September 30, 2026 18:27
zzylol added a commit that referenced this pull request Sep 30, 2026
Conflicts with earlier stack changes resolved to the integration tree:
- crates/integration-tests/tests/summary_maintenance_lifecycle_e2e.rs: 51fd198 Merge #491 population lifecycle into Planner integration

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zzylol
zzylol force-pushed the feat/population-lifecycle branch from 3961d16 to d3372f5 Compare September 30, 2026 18:27
@zzylol
zzylol force-pushed the feat/population-lifecycle branch from d3372f5 to 89a2f4b Compare October 1, 2026 22:29
@zzylol
zzylol changed the base branch from refactor/lifecycle-only-placement to feat/physical-alternatives-in-planspace October 1, 2026 22:29
@zzylol
zzylol force-pushed the feat/physical-alternatives-in-planspace branch from 5ccaa44 to 45c7fc6 Compare October 1, 2026 22:48
@zzylol
zzylol force-pushed the feat/population-lifecycle branch from 89a2f4b to 5dd3d2b Compare October 1, 2026 22:48
@zzylol
zzylol changed the base branch from feat/physical-alternatives-in-planspace to main October 1, 2026 22:54
@zzylol
zzylol merged commit 8b86af4 into main Oct 1, 2026
3 of 5 checks passed
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