AIN-291 W1 · 0033 training_runs table + ainfera_labs role#93
Merged
Conversation
…033) Charter A2 / Disc #12-bounded migration. Two additive things: 1. CREATE TABLE public.training_runs — one row per L14.2 daily training tick. Captures judge outcomes, policy_version_from→to, promotion verdict, per-cell deltas, replay-gate result, and ruleset_hash. 2. CREATE ROLE ainfera_labs LOGIN (no password set here; founder sets PASSWORD via Doppler-injected ALTER ROLE). Least-priv grants: - INSERT on training_runs (+ sequence USAGE) - SELECT on routing_outcomes, inferences, models, providers, agents - column-level UPDATE on routing_outcomes (judge_score, judge_model, judge_rationale, judge_labeled_at, judge_status, reward) — AIN-290 columns only - column-level UPDATE on tenant_routing_policies (active_policy, active_policy_version) — AIN-296 columns only - REVOKE DELETE on every table Verified via `alembic upgrade 20260528_0032:20260528_0033 --sql`: DDL renders cleanly; `alembic heads` shows `20260528_0033 (head)`. Disc #12 still binds: no edits to scoring, candidate-set, settlement, auth, key prefix, or hard-delete rules. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
AIN-291 [Labs] Define Ainfera Labs (full-cloud) + create ainfera-ai/research
Operationalizes the Spark-drop lock (AIN-284 / L7) into a concrete offline learning substrate, and creates the public research surface. Canonical: PrincipleLabs = the offline brain. NOT on the live request path. Online gateway serves traffic in ms + captures Substrate map (full cloud, no GPU box)
Repo split (moat-safe)
Acceptance
Gate (blocks any Labs output)Flywheel not turning: This ticket = the frame. Those tickets in order = the fill. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Additive migration. CREATE TABLE training_runs + CREATE ROLE ainfera_labs (LOGIN, no password set — founder sets via ALTER ROLE from Doppler). Least-priv grants: SELECT on routing_outcomes/inferences/models/providers/agents; column-level UPDATE on judge_* + reward (AIN-290 cols); UPDATE on active_policy/active_policy_version; INSERT on training_runs; REVOKE DELETE everywhere.
alembic upgrade 0032:0033 --sqlrenders cleanly. Disc #12 untouched.🤖 Generated with Claude Code
Note
Medium Risk
New DB role can update judge labels and tenant routing policy versions (promotion path); scope is narrow and DELETE is revoked, but misconfiguration or compromised labs credentials could affect routing behavior.
Overview
Adds Alembic revision 20260528_0033 with two additive database changes for offline routing training (L14.2).
Introduces
public.training_runs: one row per training tick (daily/manual/shadow), recording judge model, outcomes judged, policy version before/after, promotion flag and reason, replay-gate result, per-cell JSON, deltas, and optional ruleset hash—with indexes onrun_atand(promoted, run_at).Creates
ainfera_labsas aLOGINrole (password not set in migration; founder sets via Doppler). Grants SELECT onrouting_outcomes,inferences,models,providers,agents; INSERT/SELECT ontraining_runs(plus sequence usage when present); column-level UPDATE on AIN-290 judge fields onrouting_outcomesand onactive_policy/active_policy_versionontenant_routing_policies; and REVOKE DELETE on all public tables. Downgrade drops the role (with owned-object cleanup) then the table.No application code changes; charter-scoped additive schema and privileges only.
Reviewed by Cursor Bugbot for commit bc108aa. Bugbot is set up for automated code reviews on this repo. Configure here.