RC-7
Some checks failed
release-tag / release-image (push) Failing after 2m44s

This commit is contained in:
2026-08-11 16:58:07 +02:00
parent 185ccf1101
commit bcfbef390f
44 changed files with 4778 additions and 172 deletions

View File

@@ -32,6 +32,10 @@ CREATE TABLE IF NOT EXISTS tasks (
created_at INTEGER NOT NULL,
completed_at INTEGER,
winner_client_id TEXT REFERENCES clients(id),
winner_worker_client_id TEXT REFERENCES clients(id),
winner_beacon_path TEXT NOT NULL DEFAULT '',
winner_beacon_boosted_path TEXT NOT NULL DEFAULT '',
winner_beacon_round INTEGER NOT NULL DEFAULT 0,
winner_signature TEXT,
winning_guess TEXT,
artifact_status TEXT NOT NULL DEFAULT 'none' CHECK (artifact_status IN ('none','pending','generating','ready','error')),
@@ -128,3 +132,44 @@ CREATE TABLE IF NOT EXISTS artifact_api_usage (
CREATE INDEX IF NOT EXISTS artifact_api_usage_created_idx ON artifact_api_usage(created_at DESC);
CREATE INDEX IF NOT EXISTS artifact_api_usage_kind_created_idx ON artifact_api_usage(kind, created_at DESC);
CREATE INDEX IF NOT EXISTS artifact_api_usage_task_idx ON artifact_api_usage(task_id);
-- Publicly auditable Beacon Hunt draws. Each row records the externally
-- sourced drand reveal used for the weighted path/draw decision.
CREATE TABLE IF NOT EXISTS beacon_draws (
id INTEGER PRIMARY KEY AUTOINCREMENT,
task_id TEXT NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
window_end INTEGER NOT NULL,
beacon_id TEXT NOT NULL,
beacon_round INTEGER NOT NULL,
randomness TEXT NOT NULL,
signature TEXT NOT NULL DEFAULT '',
boosted_path TEXT NOT NULL,
ticket_count INTEGER NOT NULL,
selected_count INTEGER NOT NULL,
created_at INTEGER NOT NULL,
UNIQUE(task_id, window_end)
);
CREATE INDEX IF NOT EXISTS beacon_draws_task_idx ON beacon_draws(task_id, window_end DESC);
-- A hosted worker uses its own cryptographic identity/presence, while prizes can
-- be delegated to a durable customer-owned reward identity. The worker remains
-- auditable on the completed task through winner_worker_client_id.
CREATE TABLE IF NOT EXISTS identity_delegations (
worker_client_id TEXT PRIMARY KEY REFERENCES clients(id) ON DELETE CASCADE,
owner_client_id TEXT NOT NULL REFERENCES clients(id) ON DELETE CASCADE,
created_at INTEGER NOT NULL,
updated_at INTEGER NOT NULL
);
CREATE INDEX IF NOT EXISTS identity_delegations_owner_idx ON identity_delegations(owner_client_id);
-- One-shot pairing codes let a logged-in owner prove control of the reward
-- identity to Customer Service without sharing the P-256 private key. Only the
-- SHA-256 token hash is stored and codes expire quickly.
CREATE TABLE IF NOT EXISTS customer_link_tokens (
token_hash TEXT PRIMARY KEY,
client_id TEXT NOT NULL REFERENCES clients(id) ON DELETE CASCADE,
expires_at INTEGER NOT NULL,
created_at INTEGER NOT NULL
);
CREATE INDEX IF NOT EXISTS customer_link_tokens_exp_idx ON customer_link_tokens(expires_at);