+The command rebuilds the run-summary projection used by Waterline list and dashboard views, the `workflow_run_waits` projection used by selected-run wait detail, the `workflow_run_timeline_entries` projection used by selected-run history detail, the `workflow_run_timer_entries` projection used by selected-run timer detail, and the `workflow_run_lineage_entries` projection used by selected-run parent/child and continue-as-new detail. Use `--run-id=...` or `--instance-id=...` to scope a repair, `--missing` to skip summaries that already exist, `--prune-stale` to remove summaries whose run row no longer exists, `--dry-run` to inspect the affected rows first, and `--json` for deployment checks. `--needs-rebuild` also treats legacy timer projection rows with `workflow_run_timer_entries.schema_version = 0` as stale, so the rebuild pass upgrades older pre-`row_status` timer snapshots onto the current stored schema before Waterline detail or history export reports them as aligned. `--needs-rebuild` also detects schema-outdated run summaries — rows whose `projection_schema_version` is `NULL` or lower than the current build's projector schema version. This covers the mixed-fleet upgrade case where older workers projected summaries without newer derived fields such as `namespace`, `search_attributes`, or `liveness_state`. After deploying a new package version across all workers, run `workflow:v2:rebuild-projections --needs-rebuild` to bring all schema-outdated summaries to the current projector schema. Re-projection is idempotent: running it on an already-current row produces the same output. If the app overrides `workflows.v2.run_model`, `workflows.v2.run_summary_model`, `workflows.v2.run_wait_model`, `workflows.v2.run_timeline_entry_model`, `workflows.v2.run_timer_entry_model`, or `workflows.v2.run_lineage_entry_model`, the command uses those same configured models so the repair target matches Waterline's `operator_metrics.projections.run_summaries` health signal and selected-run detail payloads. The same support boundary applies on the core runtime path and reads too: `WorkflowStub` reservation/load/start plus workflow-task execution, current-run resolution, selected-run detail, Waterline detail, and history export honor the configured `instance_model`, `run_model`, `task_model`, `history_event_model`, and projection-model classes instead of silently falling back to the package defaults.
0 commit comments