Skip to main content

Freeze and Unfreeze

Summary

Freeze establishes the service’s stable reversible Payroll boundary; unfreeze reopens the run and reverses unreversed advance recoveries.

Audience

Backend and frontend developers, QA and DevOps engineers, support and security engineers, and solution architects.

Overview

Freeze establishes the service’s stable reversible Payroll boundary; unfreeze reopens the run and reverses unreversed advance recoveries.

Technical Detail

Freeze preconditions

The run must exist, not already be Frozen, have an allowed source state, and contain employee details. Existing unreversed recovery transactions block duplicate application. Each planned advance recovery must have a sufficient local balance.

Freeze effects

Run and detail states become Frozen, freeze evidence is recorded, recoveries are applied, audit/timeline records are added, and a Payroll-frozen outbox event is staged. Payslips and bank export become eligible. Recalculation is blocked.

Unfreeze effects

Only a Frozen run can be unfrozen. Unreversed recoveries receive linked reversals, balances are restored when present, freeze metadata is cleared, records become Unfrozen, and lifecycle/outbox evidence is created.

Atomicity and parity

Native lifecycle mutations are saved together through one DbContext operation. Compatibility unfreeze uses Draft rather than Unfrozen and does not share every native side effect; parity is Transitional. Snapshot immutability and external side-effect compensation beyond local recovery records Require confirmation.

Source References

  • microservices/src/payroll-service/Application/PayrollCalculationService.cs
  • microservices/src/payroll-service/Domain/PayrollEntities.cs
  • microservices/src/contracts/Events/PayrollCalculatedEvent.cs
  • microservices/src/payroll-service/Application/PayrollCompatService.cs

See Also

Keywords

  • Payroll Service
  • Freeze and Unfreeze
  • Technical architecture

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-15
  • Review cycle: Quarterly