feat(geometry): opt-in retained product budget and deadline (M1-B, #7955)

Merged
LO
1mo ago
+1826-323

Refs #7955. This is M1 PR B of the CLI retained-mode plan, and it builds on the retained controller from #8169.

What it adds

  • A per-product work budget and deadline for the retained path, behind the off-by-default retained-runtime feature: ProductBudget, BudgetStart, budget_checkpoint() and budget_deadline_fired().
  • source_step() checkpoints in the analytic source walks and in capture. They let a retained product stop at its own budget instead of running unbounded.
  • This is lifted from #8147 with the inspection and census layer dropped and the API renamed away from "inspection".

Default path. Every source_step() call is under #[cfg(feature = "retained-runtime")], so the exact path compiles to what it was. There are no new non-test panics. On wasm32, BudgetStart::now() still uses std::time::Instant here; the monotonic wasm clock comes with the wasm runtime PR (E).

Tests and CI

  • rust/geometry/tests/m1_budget.rs is the feature-gated revert-oracle witness. A zero-millisecond deadline must fire and must be scoped.
  • The oracle patch is tests/evidence/m1-b-product-budget/behaviour.oracle.patch; it is reverse-applied.
  • The PR-lane retained step from #8169 runs the feature's tests and clippy.

Validation (PC fleet worker, exit 0, source unchanged), before rebasing onto the squash of #8169:

  • workspace clippy -D warnings, default and with the feature;
  • geometry and processing tests, default and with the feature;
  • revert oracle OBSERVED;
  • module-size, refwalk, ci-path-coverage and test-wiring guards.

Independently reviewed twice against the plan.

šŸ¤– Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added configurable work, memory, and time limits for retained-runtime operations.
    • Deadline expiration is reported separately from other cancellations.
  • Bug Fixes
    • Geometry traversal and source capture now check resource limits as processing proceeds.
    • Nested and interrupted budgeted operations preserve existing resource state and report resource-limit failures consistently.
    • Geometry extraction now distinguishes unsupported geometry from execution stops, preserving more specific failure information.