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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
{
  "schema_version": "offline-clone.backend-model.v1",
  "site_id": "curology",
  "status": "verified",
  "profile": "offline-benchmark",
  "database": {
    "engine": "sqlite",
    "location_policy": "runtime-data-outside-candidate",
    "concurrency_model": "wal-transactional-single-writer",
    "migration_strategy": "versioned-forward-migrations",
    "deterministic_reset": true,
    "restart_persistence": true,
    "site_isolation": "one-database-per-site",
    "proofs": [
      {
        "obligation": "data-location",
        "status": "verified",
        "evidence": ["backend/runtime.json", "clone/tests/test_smoke.py::test_healthz_reports_isolated_runtime"]
      },
      {
        "obligation": "schema-migration",
        "status": "verified",
        "evidence": ["clone/tests/test_tasks.py::test_migration_concurrency_and_payment_ownership_guards", "backend.curology_schema:migrate_v2"]
      },
      {
        "obligation": "deterministic-reset",
        "status": "verified",
        "evidence": ["clone/tests/conftest.py::reset_site"]
      },
      {
        "obligation": "restart-persistence",
        "status": "verified",
        "evidence": ["clone/tests/test_tasks.py::test_restart_persistence_and_no_card_or_remote_runtime_urls"]
      },
      {
        "obligation": "backup-restore",
        "status": "verified",
        "evidence": ["Prompt B v1 database copy reopened and forward-migrated under the current runtime"]
      },
      {
        "obligation": "concurrency",
        "status": "verified",
        "evidence": ["clone/tests/test_tasks.py::test_migration_concurrency_and_payment_ownership_guards"]
      }
    ]
  },
  "auth_semantics": {
    "account_database_scope": "site-isolated",
    "credential_storage": "salted-scrypt-hash",
    "session_storage": "opaque-cookie-digest-at-rest",
    "registration_account_creation": "after-email-verification",
    "verification_challenge_storage": "salted-hash",
    "password_reset_enumeration": "indistinguishable-public-response",
    "mail_default": "LOCAL_ONLY",
    "mail_statuses": [
      "LOCAL_ONLY",
      "SMTP_PENDING",
      "SMTP_SENT",
      "SMTP_FAILED"
    ],
    "smtp_activation": "explicit-complete-config-only",
    "smtp_delivery_ceiling": 3,
    "rejected_secret_journaling": "forbidden",
    "legacy_write_policy": "read-compatible-write-rejected"
  },
  "common_capabilities": {
    "account_registration": "account-registration",
    "account_sign_in": "account-sign-in",
    "session_lifecycle": "session-lifecycle",
    "password_recovery": "password-recovery",
    "email_delivery": "email-delivery"
  },
  "capabilities": [
    {
      "id": "account-registration",
      "label": "Verified local account registration",
      "priority": "p0",
      "category": "authentication",
      "implementation_status": "verified",
      "entities": [
        {
          "name": "pending-registration",
          "identity": "opaque pending id bound to one browser session",
          "owner_scope": "session",
          "persistence": "durable"
        },
        {
          "name": "local-account",
          "identity": "site-local account id and unique normalized email",
          "owner_scope": "account",
          "persistence": "durable"
        }
      ],
      "state_machine": {
        "kind": "challenge-lifecycle",
        "states": [
          "collecting",
          "pending-verification",
          "verified",
          "account-created",
          "expired",
          "locked"
        ],
        "transitions": [
          {
            "from": "collecting",
            "to": "pending-verification",
            "trigger": "validated registration request"
          },
          {
            "from": "pending-verification",
            "to": "verified",
            "trigger": "correct unexpired code within attempt budget"
          },
          {
            "from": "verified",
            "to": "account-created",
            "trigger": "transactional account creation and session rotation"
          },
          {
            "from": "pending-verification",
            "to": "expired",
            "trigger": "challenge expiry"
          },
          {
            "from": "pending-verification",
            "to": "locked",
            "trigger": "verification attempt budget exhausted"
          }
        ]
      },
      "server_authorities": [
        "The server normalizes identity and hashes password and code.",
        "An account is created only after successful verification.",
        "Duplicate normalized email creation is rejected transactionally."
      ],
      "external_effect": "none",
      "journey_ids": ["questionnaire-checkout", "auth-and-recovery"],
      "invariant_ids": ["server-authoritative-owner-state", "local-mail-truth", "restart-persistence"],
      "proofs": {
        "evidence": {
          "valid": ["clone/tests/test_tasks.py::test_checkout_outcomes_registration_activation_and_idempotency"],
          "invalid": ["clone/tests/test_tasks.py::test_auth_failure_duplicate_verification_and_safe_return_paths"],
          "duplicate": ["clone/tests/test_tasks.py::test_auth_failure_duplicate_verification_and_safe_return_paths"],
          "restart": ["clone/tests/test_tasks.py::test_restart_persistence_and_no_card_or_remote_runtime_urls"],
          "migration": ["clone/tests/test_tasks.py::test_migration_concurrency_and_payment_ownership_guards"],
          "concurrency": ["clone/tests/test_tasks.py::test_migration_concurrency_and_payment_ownership_guards"]
        },
        "planned": [],
        "not_applicable": [
          {"obligation": "stale", "rationale": "The generated registration challenge runtime owns expiry; the site does not add an independent clock or stale-state seam."},
          {"obligation": "foreign-owner", "rationale": "Pending registration is bound to one browser session and has no caller-selectable owner identifier."},
          {"obligation": "unauthorized-role", "rationale": "Registration has no privileged role variant in the Curology task scope."}
        ]
      }
    },
    {
      "id": "account-sign-in",
      "label": "Password-based local account sign-in",
      "priority": "p0",
      "category": "authentication",
      "implementation_status": "verified",
      "entities": [
        {
          "name": "local-account",
          "identity": "site-local account id and normalized email",
          "owner_scope": "account",
          "persistence": "durable"
        }
      ],
      "state_machine": {
        "kind": "entity-lifecycle",
        "states": [
          "signed-out",
          "identified",
          "authenticated",
          "rejected"
        ],
        "transitions": [
          {
            "from": "signed-out",
            "to": "identified",
            "trigger": "normalized email submitted"
          },
          {
            "from": "identified",
            "to": "authenticated",
            "trigger": "constant-time password verification succeeds"
          },
          {
            "from": "identified",
            "to": "rejected",
            "trigger": "credentials are invalid"
          }
        ]
      },
      "server_authorities": [
        "The server verifies salted password hashes.",
        "The server rotates the authenticated session.",
        "Client-selected fixture identity is not authentication."
      ],
      "external_effect": "none",
      "journey_ids": ["local-subscription-management", "auth-and-recovery"],
      "invariant_ids": ["server-authoritative-owner-state", "restart-persistence"],
      "proofs": {
        "evidence": {
          "valid": ["clone/tests/test_tasks.py::test_auth_failure_duplicate_verification_and_safe_return_paths"],
          "invalid": ["clone/tests/test_tasks.py::test_auth_failure_duplicate_verification_and_safe_return_paths"],
          "restart": ["clone/tests/test_tasks.py::test_restart_persistence_and_no_card_or_remote_runtime_urls"],
          "migration": ["clone/tests/test_tasks.py::test_migration_concurrency_and_payment_ownership_guards"],
          "concurrency": ["clone/tests/test_tasks.py::test_migration_concurrency_and_payment_ownership_guards"]
        },
        "planned": [],
        "not_applicable": [
          {"obligation": "duplicate", "rationale": "Sign-in is an authentication check and does not create a duplicate business entity."},
          {"obligation": "stale", "rationale": "Credentials are verified against current server state; there is no caller-supplied revision to become stale."},
          {"obligation": "foreign-owner", "rationale": "The server resolves ownership from the authenticated identity; callers cannot select another owner."},
          {"obligation": "unauthorized-role", "rationale": "The scoped local subscriber model has no privileged role variant."}
        ]
      }
    },
    {
      "id": "session-lifecycle",
      "label": "Anonymous and authenticated browser sessions",
      "priority": "p0",
      "category": "authentication",
      "implementation_status": "verified",
      "entities": [
        {
          "name": "browser-session",
          "identity": "opaque cookie token with digest persisted at rest",
          "owner_scope": "session",
          "persistence": "durable"
        }
      ],
      "state_machine": {
        "kind": "session-lifecycle",
        "states": [
          "anonymous",
          "authenticated",
          "revoked",
          "expired"
        ],
        "transitions": [
          {
            "from": "anonymous",
            "to": "authenticated",
            "trigger": "successful sign-in or registration rotates session"
          },
          {
            "from": "authenticated",
            "to": "revoked",
            "trigger": "sign-out or security reset"
          },
          {
            "from": "anonymous",
            "to": "expired",
            "trigger": "session expiry"
          },
          {
            "from": "authenticated",
            "to": "expired",
            "trigger": "session expiry"
          }
        ]
      },
      "server_authorities": [
        "Raw session tokens are never stored in the database.",
        "Ownership is resolved from the server-side session record.",
        "Sign-out revokes server-side authority before deleting the cookie."
      ],
      "external_effect": "none",
      "journey_ids": ["questionnaire-checkout", "local-subscription-management", "auth-and-recovery"],
      "invariant_ids": ["server-authoritative-owner-state", "restart-persistence", "zero-remote-runtime"],
      "proofs": {
        "evidence": {
          "valid": ["clone/tests/test_tasks.py::test_auth_failure_duplicate_verification_and_safe_return_paths"],
          "invalid": ["clone/tests/test_tasks.py::test_auth_failure_duplicate_verification_and_safe_return_paths"],
          "foreign-owner": ["clone/tests/test_tasks.py::test_permissions_cross_actor_isolation_and_local_contact"],
          "restart": ["clone/tests/test_tasks.py::test_restart_persistence_and_no_card_or_remote_runtime_urls"],
          "migration": ["clone/tests/test_tasks.py::test_migration_concurrency_and_payment_ownership_guards"],
          "concurrency": ["clone/tests/test_tasks.py::test_migration_concurrency_and_payment_ownership_guards"]
        },
        "planned": [],
        "not_applicable": [
          {"obligation": "duplicate", "rationale": "Session creation rotates or resolves an opaque token and does not expose a duplicate entity operation."},
          {"obligation": "stale", "rationale": "Expiry and revocation are enforced inside the generated session runtime rather than by caller revisions."},
          {"obligation": "unauthorized-role", "rationale": "The scoped local subscriber session has no privileged role variant."}
        ]
      }
    },
    {
      "id": "password-recovery",
      "label": "Enumeration-resistant local password recovery",
      "priority": "p0",
      "category": "authentication",
      "implementation_status": "verified",
      "entities": [
        {
          "name": "password-reset-challenge",
          "identity": "opaque reset id bound to one browser session",
          "owner_scope": "session",
          "persistence": "durable"
        },
        {
          "name": "local-account",
          "identity": "nullable concealed account binding",
          "owner_scope": "account",
          "persistence": "durable"
        }
      ],
      "state_machine": {
        "kind": "challenge-lifecycle",
        "states": [
          "requested",
          "verified",
          "consumed",
          "expired",
          "locked"
        ],
        "transitions": [
          {
            "from": "requested",
            "to": "verified",
            "trigger": "correct unexpired code within attempt budget"
          },
          {
            "from": "verified",
            "to": "consumed",
            "trigger": "password is replaced and sessions are revoked"
          },
          {
            "from": "requested",
            "to": "expired",
            "trigger": "challenge expiry"
          },
          {
            "from": "requested",
            "to": "locked",
            "trigger": "verification attempt budget exhausted"
          }
        ]
      },
      "server_authorities": [
        "Known and unknown emails receive indistinguishable public responses.",
        "Only the server binds a reset flow to an account.",
        "Password replacement revokes prior authenticated sessions."
      ],
      "external_effect": "local-only",
      "journey_ids": ["auth-and-recovery"],
      "invariant_ids": ["local-mail-truth", "server-authoritative-owner-state", "restart-persistence"],
      "proofs": {
        "evidence": {
          "valid": ["clone/tests/test_tasks.py::test_password_recovery_is_local_only_and_rotates_session"],
          "invalid": ["clone/tests/test_tasks.py::test_password_recovery_is_local_only_and_rotates_session"],
          "restart": ["clone/tests/test_tasks.py::test_restart_persistence_and_no_card_or_remote_runtime_urls"],
          "migration": ["clone/tests/test_tasks.py::test_migration_concurrency_and_payment_ownership_guards"],
          "concurrency": ["clone/tests/test_tasks.py::test_migration_concurrency_and_payment_ownership_guards"]
        },
        "planned": [],
        "not_applicable": [
          {"obligation": "duplicate", "rationale": "A reset challenge is session-bound and replacement consumes it; no duplicate business entity is created."},
          {"obligation": "stale", "rationale": "Challenge expiry is enforced by the generated auth runtime and is not a site-defined caller revision."},
          {"obligation": "foreign-owner", "rationale": "The server conceals and binds the account internally; callers cannot select another owner."},
          {"obligation": "unauthorized-role", "rationale": "Password recovery has no privileged role variant in the Curology task scope."}
        ]
      }
    },
    {
      "id": "email-delivery",
      "label": "Truthful local verification and recovery mail outbox",
      "priority": "p0",
      "category": "communication",
      "implementation_status": "verified",
      "entities": [
        {
          "name": "mail-outbox-entry",
          "identity": "site-local outbox id and purpose-bound flow id",
          "owner_scope": "system",
          "persistence": "durable"
        }
      ],
      "state_machine": {
        "kind": "delivery-lifecycle",
        "states": [
          "local-only",
          "smtp-pending",
          "smtp-sent",
          "smtp-failed"
        ],
        "transitions": [
          {
            "from": "local-only",
            "to": "smtp-pending",
            "trigger": "operator enables complete explicit SMTP configuration"
          },
          {
            "from": "smtp-pending",
            "to": "smtp-sent",
            "trigger": "SMTP transport confirms delivery handoff"
          },
          {
            "from": "smtp-pending",
            "to": "smtp-failed",
            "trigger": "delivery attempt fails or ceiling is reached"
          },
          {
            "from": "smtp-failed",
            "to": "smtp-pending",
            "trigger": "bounded idempotent retry below the delivery ceiling"
          }
        ]
      },
      "server_authorities": [
        "Offline mode records LOCAL_ONLY and never claims external delivery.",
        "SMTP is disabled unless every required setting is present.",
        "Claim, retry, and startup replay share one delivery ceiling."
      ],
      "external_effect": "local-only",
      "journey_ids": ["questionnaire-checkout", "auth-and-recovery"],
      "invariant_ids": ["local-mail-truth", "zero-remote-runtime", "restart-persistence"],
      "proofs": {
        "evidence": {
          "valid": ["clone/tests/test_tasks.py::test_checkout_outcomes_registration_activation_and_idempotency", "clone/tests/test_tasks.py::test_password_recovery_is_local_only_and_rotates_session"],
          "restart": ["clone/tests/test_tasks.py::test_restart_persistence_and_no_card_or_remote_runtime_urls"],
          "migration": ["clone/tests/test_tasks.py::test_migration_concurrency_and_payment_ownership_guards"],
          "concurrency": ["clone/tests/test_tasks.py::test_migration_concurrency_and_payment_ownership_guards"]
        },
        "planned": [],
        "not_applicable": [
          {"obligation": "invalid", "rationale": "The site does not expose a generic mail-send API; only validated registration and recovery flows create local outbox entries."},
          {"obligation": "duplicate", "rationale": "Delivery deduplication is owned by the generated outbox runtime and no site-level duplicate-send action exists."},
          {"obligation": "stale", "rationale": "The site remains LOCAL_ONLY and does not expose a caller-controlled delivery claim or revision."},
          {"obligation": "foreign-owner", "rationale": "Outbox entries are created from server-bound auth flows; callers cannot choose an owner."},
          {"obligation": "unauthorized-role", "rationale": "The local outbox has no role-gated sender surface in this task scope."}
        ]
      }
    }
  ]
}