From ee490460d10e7476d944c165e2bd2e13e8d57eca Mon Sep 17 00:00:00 2001 From: Kalash Gulati Date: Tue, 29 Sep 2026 13:50:34 +0530 Subject: [PATCH 01/14] Make round-robin selection deterministic during availability checks --- src/slotify/availability.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/slotify/availability.py b/src/slotify/availability.py index 3e08f9f..07d412a 100644 --- a/src/slotify/availability.py +++ b/src/slotify/availability.py @@ -331,7 +331,7 @@ def _validate_limits( "The slot does not satisfy the minimum gap between bookings." ) - def _ordered_pool_resources(self, slot: Slot) -> tuple[str, ...]: + def _ordered_pool_resources(self, slot: Slot, *, advance: bool = False) -> tuple[str, ...]: if not self.resource_pool: return () resources = list(self.resource_pool) @@ -339,7 +339,8 @@ def _ordered_pool_resources(self, slot: Slot) -> tuple[str, ...]: return tuple(resources) if self.resource_strategy == "round_robin": offset = self._resource_cursor % len(resources) - self._resource_cursor = (self._resource_cursor + 1) % len(resources) + if advance: + self._resource_cursor = (self._resource_cursor + 1) % len(resources) return tuple(resources[offset:] + resources[:offset]) def load(resource_id: str) -> int: @@ -391,7 +392,10 @@ def _check_availability( ) if self.resource_pool: - for resource_id in self._ordered_pool_resources(slot): + for resource_id in self._ordered_pool_resources( + slot, + advance=self.resource_strategy == "round_robin", + ): candidate = self._candidate(slot, resource_id=resource_id) if self.hold_store.conflicts(candidate, now=now): continue @@ -721,7 +725,10 @@ def reserve( if self.resource_pool: last_error: BookingConflictError | None = None - for resource_id in self._ordered_pool_resources(slot): + for resource_id in self._ordered_pool_resources( + slot, + advance=self.resource_strategy == "round_robin", + ): booking = self._candidate( slot, resource_id=resource_id, From b855646f3bd93f93b8895c44643efdf157b4b09a Mon Sep 17 00:00:00 2001 From: Kalash Gulati Date: Tue, 29 Sep 2026 13:50:40 +0530 Subject: [PATCH 02/14] Add regression test for round-robin availability checks --- tests/test_v040_features.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_v040_features.py b/tests/test_v040_features.py index c169001..e73657c 100644 --- a/tests/test_v040_features.py +++ b/tests/test_v040_features.py @@ -122,3 +122,25 @@ def test_invalid_resource_strategy(): resource_pool=("a", "b"), resource_strategy="random", ) + + +def test_round_robin_availability_checks_do_not_advance_selection(): + engine = AvailabilityEngine( + make_generator(), + resource_pool=("a", "b"), + resource_strategy="round_robin", + ) + slot = make_generator().generate_for_date("2026-10-05")[0] + now = datetime.fromisoformat("2026-10-04T08:00:00+05:30") + + first = engine.check_availability(slot, now=now) + second = engine.check_availability(slot, now=now) + + assert first.resource_id == "a" + assert second.resource_id == "a" + + booking = engine.reserve(slot, now=now) + assert booking.resource_id == "a" + + third = engine.check_availability(slot, now=now) + assert third.resource_id == "b" From eb131779accf071033e313d0718073a56db93347 Mon Sep 17 00:00:00 2001 From: Kalash Gulati Date: Tue, 29 Sep 2026 13:50:51 +0530 Subject: [PATCH 03/14] Clean stale references in SUPPORT.md --- SUPPORT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SUPPORT.md b/SUPPORT.md index 33dba89..e3570cd 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -11,7 +11,7 @@ For usage questions, open a GitHub issue with: - a small reproducible example - expected and actual behavior -For common patterns, start with the [documentation](https://failedengineers.github.io/Slotify/). +For common patterns, start with the [documentation](https://slotify-scheduling.ilovelabfile.in/). ## Bug reports From 37a14edb449b7be04572fea8dff52800b8df299f Mon Sep 17 00:00:00 2001 From: Kalash Gulati Date: Tue, 29 Sep 2026 13:51:06 +0530 Subject: [PATCH 04/14] Clean stale references in marketing/LAUNCH_KIT.md --- marketing/LAUNCH_KIT.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/marketing/LAUNCH_KIT.md b/marketing/LAUNCH_KIT.md index 94a6965..fba50a9 100644 --- a/marketing/LAUNCH_KIT.md +++ b/marketing/LAUNCH_KIT.md @@ -50,7 +50,7 @@ slots = generator.generate("2026-09-21", "2026-09-21") It can also handle weekly schedules, date overrides, closures, breaks, DST policies, rolling availability, capacity, buffers, booking policies, reservations, and cancellation. -Docs: https://failedengineers.github.io/Slotify/ +Docs: https://slotify-scheduling.ilovelabfile.in/ PyPI: https://pypi.org/project/slotify-scheduling/ GitHub: https://github.com/failedengineers/Slotify @@ -83,7 +83,7 @@ pip install slotify-scheduling ~~~ Project: https://github.com/failedengineers/Slotify -Docs: https://failedengineers.github.io/Slotify/ +Docs: https://slotify-scheduling.ilovelabfile.in/ I'm especially interested in feedback from people who have built appointment or resource-booking systems. From 50f073688910de35be80d9fdf876264478163af3 Mon Sep 17 00:00:00 2001 From: Kalash Gulati Date: Tue, 29 Sep 2026 13:51:10 +0530 Subject: [PATCH 05/14] Clean stale references in marketing/LAUNCH_KIT.md --- marketing/LAUNCH_KIT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/marketing/LAUNCH_KIT.md b/marketing/LAUNCH_KIT.md index fba50a9..8b57b29 100644 --- a/marketing/LAUNCH_KIT.md +++ b/marketing/LAUNCH_KIT.md @@ -45,7 +45,7 @@ generator = SlotGenerator( timezone="Asia/Kolkata", ) -slots = generator.generate("2026-09-21", "2026-09-21") +slots = generator.generate("2026-10-05", "2026-10-05") ~~~ It can also handle weekly schedules, date overrides, closures, breaks, DST policies, rolling availability, capacity, buffers, booking policies, reservations, and cancellation. From 96231e6dbf7f57ce0f2aa27b31e3d073708f2898 Mon Sep 17 00:00:00 2001 From: Kalash Gulati Date: Tue, 29 Sep 2026 13:51:14 +0530 Subject: [PATCH 06/14] Clean stale references in docs/timezones.md --- docs/timezones.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/timezones.md b/docs/timezones.md index 3c8ac45..386f2e3 100644 --- a/docs/timezones.md +++ b/docs/timezones.md @@ -84,7 +84,7 @@ from datetime import datetime slots = generator.upcoming( 7, now=datetime.fromisoformat( - "2026-09-21T08:00:00-04:00" + "2026-10-05T08:00:00-04:00" ), ) ~~~ From 3fdd77a7ff7d37bb61367ed32647b26a9b4bd735 Mon Sep 17 00:00:00 2001 From: Kalash Gulati Date: Tue, 29 Sep 2026 13:51:18 +0530 Subject: [PATCH 07/14] Clean stale references in docs/recipes.md --- docs/recipes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/recipes.md b/docs/recipes.md index b79f391..8262591 100644 --- a/docs/recipes.md +++ b/docs/recipes.md @@ -18,7 +18,7 @@ engine = AvailabilityEngine( capacity=1, ) -available = engine.available_slots("2026-09-21") +available = engine.available_slots("2026-10-21") if available: booking = engine.reserve(available[0]) From ca20f64e35f1319268efcfc3b19668546c74a995 Mon Sep 17 00:00:00 2001 From: Kalash Gulati Date: Tue, 29 Sep 2026 13:51:23 +0530 Subject: [PATCH 08/14] Clean stale references in docs/migration.md --- docs/migration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/migration.md b/docs/migration.md index 9527fbc..66d2292 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -1,4 +1,4 @@ -# Migrating to v0.2.0 +# Migrating to v0.4.0 Version 0.2.0 adds booking features while keeping the core slot-generation model. From f12dc30cec63e6f643a32c68aa776766667d399f Mon Sep 17 00:00:00 2001 From: Kalash Gulati Date: Tue, 29 Sep 2026 13:51:28 +0530 Subject: [PATCH 09/14] Clean stale references in docs/migration.md --- docs/migration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/migration.md b/docs/migration.md index 66d2292..0736667 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -1,6 +1,6 @@ # Migrating to v0.4.0 -Version 0.2.0 adds booking features while keeping the core slot-generation model. +Version 0.4.0 builds on the booking model with temporary holds, resource-pool allocation strategies, and clearer application-facing APIs. ## Existing slot generation From c88d37796adc1ce265a4ed2344cfa58d7f3dc70d Mon Sep 17 00:00:00 2001 From: Kalash Gulati Date: Tue, 29 Sep 2026 13:51:33 +0530 Subject: [PATCH 10/14] Clean stale references in docs/migration.md From 50cae26a30cd6bd4678fcfc158f5c4b66d292557 Mon Sep 17 00:00:00 2001 From: Kalash Gulati Date: Tue, 29 Sep 2026 13:51:36 +0530 Subject: [PATCH 11/14] Clean stale references in docs/migration.md --- docs/migration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/migration.md b/docs/migration.md index 0736667..a7891e5 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -62,6 +62,6 @@ InMemoryBookingStore remains useful for tests and simple single-process services python -c "import slotify; print(slotify.__version__)" ~~~ -Expected: 0.2.0. +Expected: 0.4.0. See the Changelog for release details. From d2614614c7355db47f20d130edb4e009049d7d10 Mon Sep 17 00:00:00 2001 From: Kalash Gulati Date: Tue, 29 Sep 2026 13:51:45 +0530 Subject: [PATCH 12/14] Refresh README examples and documentation links --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ee78993..acefaba 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ generator = SlotGenerator( timezone="Asia/Kolkata", ) -slots = generator.generate("2026-09-21", "2026-09-21") +slots = generator.generate("2026-10-05", "2026-10-05") for slot in slots: print(slot.start, "->", slot.end) @@ -104,7 +104,7 @@ generator = SlotGenerator( schedule = Schedule( weekly={"monday": [("09:00", "17:00")]}, overrides={ - "2026-09-21": [("13:00", "18:00")], + "2026-10-05": [("13:00", "18:00")], "2026-09-28": [], }, closed_dates=["2026-10-02"], @@ -154,7 +154,7 @@ from datetime import datetime slots = generator.upcoming( 7, - now=datetime.fromisoformat("2026-09-21T08:00:00+05:30"), + now=datetime.fromisoformat("2026-10-05T08:00:00+05:30"), ) ~~~ @@ -182,7 +182,7 @@ engine = AvailabilityEngine( capacity=1, ) -available = engine.available_slots("2026-09-21") +available = engine.available_slots("2026-10-05") if available: booking = engine.reserve(available[0]) @@ -281,7 +281,7 @@ def available_slots(request, provider_id): provider = Provider.objects.get(pk=provider_id) engine = get_provider_engine(provider) - slots = engine.available_slots("2026-09-21") + slots = engine.available_slots("2026-10-05") return JsonResponse({ "provider_id": provider.pk, From 0e35527b1316f72d0177c386f460fc129ceb8e25 Mon Sep 17 00:00:00 2001 From: Kalash Gulati Date: Tue, 29 Sep 2026 13:52:08 +0530 Subject: [PATCH 13/14] Refresh getting-started dates From 4610f696b8a7e336c8fe6303b38a6f35216dcc86 Mon Sep 17 00:00:00 2001 From: Kalash Gulati Date: Tue, 29 Sep 2026 13:53:17 +0530 Subject: [PATCH 14/14] Keep availability checks read-only for round-robin --- src/slotify/availability.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/slotify/availability.py b/src/slotify/availability.py index 07d412a..35447d9 100644 --- a/src/slotify/availability.py +++ b/src/slotify/availability.py @@ -392,10 +392,7 @@ def _check_availability( ) if self.resource_pool: - for resource_id in self._ordered_pool_resources( - slot, - advance=self.resource_strategy == "round_robin", - ): + for resource_id in self._ordered_pool_resources(slot): candidate = self._candidate(slot, resource_id=resource_id) if self.hold_store.conflicts(candidate, now=now): continue