You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
9. When the single-instance limit is relaxed in the future, no
188
194
schema migration SHALL be required.
189
195
196
+
### Fresh Provision Admission
197
+
198
+
1. Before a fresh personal or organization-context provision invokes an
199
+
instance Durable Object or any infra provider operation, the KiloClaw
200
+
Worker MUST persist a provision reservation for the requesting user and
201
+
context.
202
+
2. A provision reservation MUST remain coordination metadata only. It MUST
203
+
NOT be stored as an instance record, routed as an active instance, treated
204
+
as billing access, or reported as completed onboarding.
205
+
3. A provision reservation MUST assign one candidate instance identifier.
206
+
An admitted attempt MUST carry that identifier through Durable Object
207
+
routing, instance record insertion, subscription bootstrap, and routing
208
+
registry publication; runtime MUST NOT silently choose a replacement
209
+
identifier during that attempt.
210
+
4. While an admitted fresh attempt is in progress or its provider-side
211
+
outcome requires reconciliation, another fresh attempt for the same user
212
+
and context MUST NOT execute provider creation work. The system MUST fail
213
+
closed or report a retryable conflict rather than risk duplicate
214
+
infrastructure.
215
+
5. Before performing provider creation under an admitted reservation, the
216
+
Worker MUST reconcile authoritative active-instance state for the same
217
+
user/context. Existing active state MUST prevent another fresh provision
218
+
even if a routing index entry is absent or stale.
219
+
6. If a provision attempt fails after provider resources may have been
220
+
created, its reservation MUST remain blocked or marked for reconciliation
221
+
until cleanup or canonical recovery has been confirmed. An expired request
222
+
or lease alone MUST NOT authorize another fresh attempt.
223
+
7. A completed instance that is intentionally destroyed MAY later be
224
+
reprovisioned when no active instance remains in the context, subject to
225
+
subscription successor-transfer and entitlement rules.
226
+
8. Reservation storage and admission enforcement MUST remain application/
227
+
Worker-layer behavior; they MUST NOT introduce a schema-level constraint
228
+
that prevents future multi-instance product behavior.
229
+
190
230
### Operational Instance Markers
191
231
192
232
Instance records MAY store operational lifecycle markers that do not
@@ -287,10 +327,12 @@ MUST be enforced only after the existing data model has been brought
287
327
into the desired state (rules 1–6 satisfied, early-bird backfill
288
328
complete).
289
329
290
-
19. A Cloudflare Worker Durable Object and a infra provider base resource MUST both exist
330
+
19. A Cloudflare Worker Durable Object and an infra provider base resource MUST both exist
291
331
before an instance record is created in `kiloclaw_instance`.
292
332
Infrastructure MUST be provisioned first; the record is a
293
-
reflection of existing infrastructure, not a reservation.
333
+
reflection of existing infrastructure, not a reservation. A
334
+
provision reservation created under Fresh Provision Admission is
335
+
coordination metadata and does not violate this creation order.
294
336
20. If either infrastructure component fails to provision, the system
295
337
MUST NOT create an instance record. Cleanup of any partially
296
338
provisioned infrastructure is the responsibility of the
@@ -350,6 +392,11 @@ not yet enforced in the current codebase:
350
392
across all services that mutate subscription records. Some
351
393
subscription-creation paths may already write change-log entries;
352
394
complete cross-service coverage remains the intended invariant.
395
+
4. Fresh Provision Admission SHOULD be implemented in the Registry-backed
396
+
Worker admission flow before the existing web advisory lock is removed.
397
+
(Currently, web requests use transitional PostgreSQL advisory-lock
398
+
coordination that is being replaced because it is unsafe through
399
+
transaction-pooled production connections.)
353
400
354
401
## Changelog
355
402
@@ -358,6 +405,12 @@ not yet enforced in the current codebase:
358
405
- Defined enforced personal Stripe Early Fraud Warnings as exceptional immediate cancellation/suspension mutations that retain instance history, write system-attributed change logs, and preserve the seven-day destruction grace.
359
406
- Excluded organization-owned warnings from automatic organization-managed instance or subscription mutation.
0 commit comments