Files
Salon/docs
mohd ef60218c4c fix: make booking overlap check atomic with select_for_update
Wrap the overlap query and Booking.objects.create() in a single
transaction.atomic() block inside BookingCreateSerializer.create().
Lock the StaffProfile row with select_for_update() so concurrent
requests for the same staff slot are serialized at the DB level;
only one writer can hold the lock at a time, eliminating the race
window between validate() and save().

The early check in validate() is kept for fast user feedback in
the common non-concurrent case. The locked re-check in create()
is the correctness guarantee.

On SQLite (dev/tests) FOR UPDATE is silently ignored but writes
are still serialized. PostgreSQL (production) gets row-level locking.

Update docs/risks.md to mark the race condition as fixed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 00:27:04 +03:00
..
2026-02-28 17:41:00 +03:00
2026-02-28 17:41:00 +03:00
2026-02-28 17:41:00 +03:00
2026-02-28 17:41:00 +03:00

Documentation Index

This directory is the source of truth for product, engineering, and ops documentation. Keep it current as features change.

Start Here

  • Project overview and setup: README.md (repo root)
  • Architecture overview: docs/architecture.md
  • Active ExecPlan: docs/execplans/booking-notifications.md
  • Known risks and gaps: docs/risks.md

Documentation Standards

See docs/documentation.md for documentation goals, update triggers, and templates.

Docs Map

  • docs/architecture.md: System architecture, boundaries, and MVP async/observability decision.
  • docs/adr/: Architecture Decision Records (ADRs). New cross-cutting decisions must land here.
  • docs/execplans/: Execution plans for significant features or refactors.
  • docs/runbooks/: Operational runbooks and production checklists.
  • docs/risks.md: Tracked risks and gaps.
  • docs/templates/: Reusable templates (ADR, runbook).

Update Triggers (Quick Reference)

  • New external dependency, provider, or major flow: add an ADR in docs/adr/.
  • Change to booking/payment/auth logic: update docs/architecture.md and relevant runbook(s).
  • New operational procedure: add a runbook in docs/runbooks/.
  • Close or add a significant risk: update docs/risks.md.

Ownership And Review

  • Authors own freshness: if you touch an area, update the docs in the same PR.
  • New production flows require at least one runbook.
  • Avoid duplicating instructions; link to the single source of truth.