Draft: Integrate state preservation into propagation worker

What does this MR do and why?

Extends Namespaces::StatePropagationWorker to preserve a descendant's previous state when propagation overwrites it, so the descendant can be restored if the parent operation is cancelled. See ADR 003 and ADR 006.

When the worker applies a batch state update:

  • Propagating deletion_scheduled: each overwritten descendant's current state is written to namespace_details.state_metadata under preserved_states['schedule_deletion'], matching the Namespaces::Stateful::StatePreservation concern so cancel_deletion restores the prior state.
  • Propagating ancestor_inherited (restore/unarchive): preserved_states is cleared, since descendants return to the default state.
  • Preservation writes share the same transaction as the state UPDATE.
  • Writes stay bulk by grouping descendants by their current state.

Specs cover preservation on deletion_scheduled, clearing on ancestor_inherited, and correct per-descendant preserved state in a nested hierarchy.

Stacked MR

This MR is stacked on !242220 (merged) (worker), which is stacked on !241091 (merged) (StatePrecedence). Both dependency branches were rebased onto the latest master. Review and merge in order: !241091 (merged) -> !242220 (merged) -> this MR.

References

Closes #599299 (closed) Parent epic: &21922

How to set up and validate locally

bundle exec rspec spec/workers/namespaces/state_propagation_worker_spec.rb

Merge request reports

Loading
Loading