Implement identity graph stitching and configurable profile storage

Issue persistent signed anonymous IDs and accept cookie/token-bound events.
Resolve verified email, phone, OAuth, and namespaced third-party IDs into
transactionally merged master identities with historical event aliases.
Protect shared-device account switching, tenant isolation, and event retries.

Store sparse canonical profiles as PostgreSQL JSONB or local SQLite JSON.
Support an optional versioned Cassandra wide-column projection through a
transactional outbox, retry worker, and immediate canonical read fallback.
Document deployment settings and provide opt-in database integration tests.

Validation: 43 local tests passed; 6 external database tests skipped.
Ruff checks, formatting, and offline uv lock verification passed.
This commit is contained in:
2026-09-15 23:49:43 +08:00
parent c30a136102
commit 0fc6c68a99
27 changed files with 2993 additions and 103 deletions
+19
View File
@@ -1 +1,20 @@
# Deployment profile selection. Canonical graph always uses DATABASE_URL.
DATABASE_URL=sqlite:///.data/adcloud.db
PROFILE_BACKEND=relational
TENANT_ID=default
# Generate once per deployment; keep stable across workers/restarts.
IDENTITY_SECRET=
# Trusted backend only; never ship this value to browser/SDK builds.
SERVICE_TOKEN=
COOKIE_SECURE=false
COOKIE_SAMESITE=lax
COOKIE_MAX_AGE=31536000
CORS_ORIGINS=http://localhost:3000,http://localhost:5173,http://localhost:5174
# Used only when PROFILE_BACKEND=cassandra.
CASSANDRA_HOSTS=127.0.0.1
CASSANDRA_PORT=9042
CASSANDRA_KEYSPACE=adcloud
CASSANDRA_USERNAME=
CASSANDRA_PASSWORD=
CASSANDRA_TLS=true
CASSANDRA_CA_FILE=