Skip to content

Result Approval Gate — Release Forecast & MEIO Results

Route: Pipelines → edit pipeline → Result Approval Gate (toggles) · Process Runner → Processes tab → Result Approvals (card) · GET/POST /api/result-approvals

The result approval gate lets a planner withhold a freshly computed forecast or MEIO (inventory) result from the rest of the pipeline until they explicitly approve it. Downstream steps then consume the planner-approved bucket instead of whatever was computed most recently. When nothing has ever been approved — including the very first time the gate is switched on — the pipeline falls back to the latest computed bucket, so planning never stalls waiting for an approval that hasn't happened yet.


Two independent gates

Gate Meaning
Forecast Column: forecast_approval_enabled.
Protects: PIPE_forecast_point_values, PIPE_series_best_methods, PIPE_causal_forecast, PIPE_maintenance_forecast, PIPE_fitted_distributions, PIPE_series_backtest_metrics, PIPE_backtest_forecast, and PIPE_series_characteristics.
Inventory (MEIO) Column: inventory_approval_enabled.
Protects: PIPE_meio_results, PIPE_meio_group_results, and PIPE_meio_zone_results.

Both default to false — a pipeline that has never touched these toggles behaves exactly as before this feature existed.

Resolution logic

flowchart TD
    G{Gate enabled?} -->|No| L["Use the latest computed bucket<br/>(unchanged behaviour)"]
    G -->|Yes| A{Any approved<br/>bucket exists?}
    A -->|Yes| AP["Use the newest APPROVED bucket"]
    A -->|No| L

The single function behind every rewired reader is utils.result_approval.consumable_archive(pipeline_id, family, table, scenario_id). It returns (archive_date, basis) where basis is gate_off, approved, or computed_fallback — the last one being the "nothing approved yet, use the latest" path.

Supply's safety-stock anchor is a special case

Supply's safety-stock read is pinned to the current planning week (planning_monday(pipeline_id)), not "latest available" — a deliberate guard against resurrecting a superseded item's pre-cutover safety stock. consumable_archive accepts an optional baseline_fn for exactly this case, so the gate-off/no-approval fallback still resolves to the pinned planning week rather than silently widening to "latest available".

What is — and isn't — gated

Every reader that feeds further automated computation was rewired: the netting forecast loaders, MEIO's backtest read, the exceptions engine (batch and single-series), the alerts threshold engine, the bad-forecast wash-loop demand source, the NPI donor-curve copy, the retirement Last-Time-Buy calculation, and supply's safety-stock anchor (with the MEIO auto-bootstrap guard re-targeted to the same anchor).

Pure display and dashboard endpoints (series detail, the aggregate-demand chart, sparklines, the Monte-Carlo distribution chart, the K-curve EOQ workbench, the overview map and KPIs, MEIO diagnostics, exception charts, the IO-network view) intentionally keep showing the latest computed bucket regardless of gate state — a review screen that only showed the approved numbers could never show the planner the fresh candidate they are deciding whether to approve.

Also intentionally ungated: PIPE_demand_corrected (an intra-step artifact), the mid-tier rollups (PIPE_forecast_netting, PIPE_indirect_demand — recomputed in-cycle from whatever the gate currently resolves to), the forecast step's own continuity inputs (surviving-backtest scoring and locked-method carry stay advisory — they read the latest values regardless of approval), and replay (forces both gates off unconditionally).

Approving, revoking, and re-running

The Result Approvals card (Process Runner → Processes tab, above the step chain) shows, per family: whether the gate is on, the latest computed date, the date actually being consumed (with its basis), the current approval, and a pending indicator when a fresh unapproved bucket exists.

  • Approve latest — releases the most recent computed bucket. Optionally check re-run downstream to immediately re-run the family's dependent steps in the background (forecast → indirect-demand, netting, eoq, meio; inventory → supply, allocation), using the same job machinery as the Process Runner's own step buttons.
  • Revoke — withdraws an approval; the pipeline falls back to the previous approved bucket, or the latest computed one if none remains.
  • Re-running an approved week auto-supersedes it. If the forecast (or MEIO) step recomputes the exact week that was approved, that approval flips to superseded automatically — the pipeline falls back to the previous approved bucket (or the latest computed one) until the planner reviews and re-approves the fresh content. Nothing is silently left pointing at content that no longer exists.

API

GET  /api/result-approvals?pipeline_id=N
POST /api/result-approvals
     { pipeline_id, family: "forecast"|"inventory", action: "approve"|"revoke",
       archive_date?, note?, cascade? }

archive_date defaults to the latest existing computed bucket when omitted. cascade: true on an approve queues the downstream re-run described above.

Partition protection

An approved bucket is content a planner has certified — it must survive every cleanup path. db.get_protected_archive_dates(...) (the approved set) guards every partition-drop-before-rewrite site for the forecast family (the best-methods writer, the maintenance- and causal-forecast writers, the forecast-point-values writer, and the forecast-family retention purge) — including two gaps found while building this feature that had no protection at all. (The frozen Scenario-Review snapshot set that once joined the protected dates was removed with the freeze concept, Dec 2026 — approved buckets are the protected partition mechanism.)

See also

  • Pipeline Configuration — the two gate columns on config_scenario_pipeline
  • Auto-Approval — the separate engine that gates supply order execution (not forecast/MEIO results)