Spaces:
Sleeping
Sleeping
Commit History
-
Bump v2.0 effective date 2026-07-07 -> 2026-07-08 (full 30-day notice)
Tengo Gzirishvili +1: Claude Opus 4.8The user notice now goes out 2026-06-08, so move the effective date one day to 2026-07-08 to keep the >=30-day advance-notice commitment exact. Updates the aggregation gate constant in both aggregate.py and outcomes.py (the functional gate), the in-app policy-notice banner, and the dating in code/migration comments. Legal docs, emails, and the landing privacy/terms pages updated in their respective trees. Tests: 315 passing (gate tests track the constant symbolically). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>a0ee590 -
Security hardening: RLS-as-user, rate limiting, headers, PII + endpoint cleanup
Tengo Gzirishvili +1: Claude Opus 4.8Defense-in-depth pass so a single mistake or leak can't expose user data: - RLS enforcement: per-user reads/writes now run AS THE USER (anon apikey + the requester's verified JWT) so Postgres RLS enforces row isolation — a forgotten user_id=eq. filter can no longer leak another user's rows. New _user_pgrst_headers() with graceful fallback to the service key when SUPABASE_ANON_KEY is unset (reversible rollout). Background workers and the genuine cross-user aggregates keep the service key. - user_id chokepoint: reject any JWT whose `sub` isn't a UUID (closes PostgREST filter-injection via a crafted sub at the single entry point). - Rate limiting: in-process per-(client,rule) sliding window on /api/* with 429 + Retry-After; bounded memory, fail-open, env escape hatch. - Security headers: X-Content-Type-Options, Referrer-Policy, Permissions-Policy, HSTS, and CSP frame-ancestors allowlisting turingdna.com (iframe-safe). - PII minimization: store only a /24-anonymized IP + s…702b153
-
feat: richer DE aggregate — substitution × ESM ΔLL bin (opt-in, gated)
Tengo Gzirishvili +1: Claude Opus 4.8aggregate.py: keys can carry an ESM-confidence bin → (wt, mut, bin); bin_ll() buckets the wild-type-marginal ΔLL (lo/mid/hi). build_priors gains an optional ll_maps arg (per-library {label: ΔLL}); apply_global_prior is bin-aware, matching each pool mutation's OWN ΔLL bin (free at blend time) and falling back to the unbinned key. Fully backward compatible — no ll_maps ⇒ plain (wt,mut) keys, so existing behavior + tests are unchanged. +4 tests (binning, split-by-ll, blend, serialize). server.py: DE rebuild accepts an opt-in `esm_bins` flag that recomputes ΔLL per library (WT from libraries.wt_protein) — guarded, never runs pre-gate, degrades to unbinned on any ESM failure. auth.py: lib-aware grouping + get_library_wt. Suite 285. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>21b1923 -
feat: unified outcomes framework — tool-agnostic capture + aggregate + calibrate
Tengo Gzirishvili +1: Claude Opus 4.8The platform-wide version of the DE flywheel so the moat isn't DE-only. One tool-tagged layer any tool plugs into via a ToolSpec; privacy/gating identical for all. - dee/core/outcomes.py: generic engine (ToolSpec registry, within-design standardize, k-anonymity, EFFECTIVE_DATE gate, Prior with blend/serialize). DE registered as first consumer, delegating to the proven aggregate.py — verified DE-through-framework == aggregate.py exactly. - migration 0009_outcomes.sql: generic public.outcomes (tool-tagged, owner RLS, TTL) + public.outcome_priors (tool, feature_key; service-role; CHECK n_users>=3). Leaves the live DE tables (de_outcomes/mutation_priors) untouched. - auth.py: save/list_outcomes, list_all_outcomes_grouped(tool), get/replace_outcome_priors(tool). - server.py: POST /api/outcomes, GET /api/outcomes/<tool>/<design_id>, admin GET /api/admin/priors/<tool> + POST /api/admin/rebuild-priors/<tool> (date-gated). 8 new tests (genericity via synthetic spec, k-anon, gate, …674bee6 -
feat: cross-user aggregate prior (the data moat) — built, run gated to 2026-07-07
Tengo Gzirishvili +1: Claude Opus 4.8Pools wet-lab outcomes ACROSS users into a de-identified substitution-effect prior that nudges round-1 designs. Aggregated-only per the v2.0 policy; nothing attributable to a person. - dee/core/aggregate.py: pool by amino-acid substitution TYPE (positions are protein-specific, so only type generalizes); standardize within each library before pooling (no assay scale/raw value survives); k-anonymity floor of >=3 DISTINCT users; execution gated to EFFECTIVE_DATE (2026-07-07). Folds in via apply_global_prior (additive, same as the per-user surrogate). numpy-only. - migration 0008_mutation_priors.sql: server-only table (RLS, no policies), CHECK(n_users>=3) k-anon guard at the DB layer too. (USER must run it.) - auth.py: list_all_de_outcomes_grouped (the only cross-user read; service-role, pulls just mutations+value), get/replace_mutation_priors. - server.py: admin-token-gated GET /api/admin/mutation-priors + POST /api/admin/rebuild-priors (date-gated → 423 before effective da…3317015
-
Learning flywheel v1: Directed-Evolution active-learning loop (DBTL)
Tengo Gzirishvili +1: Claude Opus 4.8The first durable-moat feature: TuringDNA learns from a researcher's wet-lab results to design a smarter next round, on data no competitor has. Scoped to Directed Evolution (the only tool with quantitative per-variant fitness). Surrogate (dee/core/active_learning.py): additive ridge over single-site effects with the ESM-2 ΔLL as the prior — y ≈ b + w_prior·ΣΔLL + Σβ_m. Fit closed-form in numpy (no sklearn/scipy needed) on the user's measured variants; β shrinks unseen mutations to the prior; an exploration bonus rewards under-tested positions. Plugs straight into the existing additive SA: round 2 re-runs evolve() with per-mutation score = w_prior·ΔLL + β + κ·uncertainty. Numpy-tested: measured data overrides a misleading prior (Spearman 0.77), 0 labels → pure prior, <4 → honest fallback. Backend: migration 0007_de_outcomes.sql (USER RUNS IT); auth.py save/list/cleanup_de_outcomes; /api/de/outcomes (POST/GET) + /api/de/round2 (score WT → fit surrogate → evolve adjusted pool → assemble…26914b4
-
Retention 90→45 days + live auto-delete countdown in the saved hub
Tengo Gzirishvili +1: Claude Opus 4.8- TTL: FREE_LIBRARY_TTL_DAYS default 90 → 45 (one constant; applies to all four per-user tables — libraries, crispr_designs, plasmids, primer_analyses — for newly saved items). Updated all "90 day(s)" copy across the engine (auth.js trial modal, docs, members-only modal, saved-hub subtitle) and the 0006 migration comment. - Saved hub: each row now shows a live "44d 23:59:58 left" countdown to auto-deletion, ticking every second while the panel is open (interval cleared on close). <24h flags urgent; null expires_at (future pro plans) shows "kept". All four list endpoints already return expires_at. Mobile: the countdown + download wrap below the label, no overflow. Verified live in preview: countdown decrements, urgent state, "kept" state, timer stops on close, zero console errors. Bump cache-busters to v=20260605-ttl. (Landing privacy page retention 90→45 edited too — manual Hostinger upload.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>94b29e6 -
Unified "My designs" hub: save every tool, not just CRISPR
Tengo Gzirishvili +1: Claude Opus 4.8"My designs" was CRISPR-only; plasmids lived in a separate list and primer/ evolution results couldn't be saved. Now it's one hub with a section per tool. Backend: - migration 0006_primer_analyses.sql (user runs it) — per-user table mirroring crispr_designs (owner-only RLS, 90-day expires_at). - auth.py: save/list/get/delete_primer_analysis (+ lazy cleanup); list_libraries and library_csv_url (signed, owner-checked) reusing the existing public.libraries + Storage bucket from DE auto-save. - server.py: /api/primers/{save,analyses,analyses/<id> GET+DELETE} and per-user /api/library + /api/library/<id>/download — all sign-in gated + owner-guarded. Frontend: - New #savedModal unified hub (Plasmids · CRISPR · Primer sets · Evolution libraries); each tool registers a reopen fn on window.TDSaved. navMyDesigns, the CRISPR "My designs" button, and the Plasmid "My plasmids" button all open it. - Primer Analysis gains a Save button; evolution libraries list with Download CSV (sign…1ee54b6
-
Plasmid Studio (M1+M2): import/annotate/map + restriction/digest + library
Tengo Gzirishvili +1: Claude Opus 4.8New "Plasmid" tool — a Benchling/SnapGene-style plasmid design studio, built on primitives we already had (Biopython GenBank I/O + 1,088 REBASE enzymes, ORF detection, Supabase per-user save). Sign-in gated like CRISPR / the Primer Picker; per-user library from day one. Core (dee/core/plasmid.py, fully unit-tested): - parse_plasmid: GenBank / FASTA / raw DNA → one normalized model {name, sequence, topology, gc, length, features[]}. - auto_annotate: ORF detection + curated motif library (T7/T3/SP6/M13/lac/His) when a record has no features; GenBank features kept as-is. - build_genbank / build_fasta export. - restriction_analysis: per-enzyme cut sites over the common set (or any), circular-aware, classified single/double/multi/non-cutters. - digest: combined cut positions → fragment sizes (circular wraps the origin). API (server.py, sign-in gated): /api/plasmid/import, /restriction, /digest, /export, plus the library: /save, /library (list), /library/<id> (get/delete). auth.py: s…be23b1b
-
CRISPR M4: save & revisit designs (per-user, 90-day TTL)
Tengo Gzirishvili +1: Claude Opus 4.8Per-user saved guide sets in public.crispr_designs (migration 0004, run in Supabase). Designs are small JSON → stored as a JSONB row, no Storage upload (unlike libraries). Backend (auth.py): save_crispr_design (synchronous insert, returns id), list_crispr_designs (metadata, newest first), get_crispr_design (full row, server-side user_id ownership), cleanup_expired_crispr_designs_async (lazy expiry sweep piggybacked on save). Free TTL = 90 days (FREE_LIBRARY_TTL_DAYS); pro = forever (has_pro_plan → NULL expires_at). Design id is UUID-validated before going into the REST filter. Endpoints (sign-in gated): POST /api/crispr/save, GET /api/crispr/designs, GET /api/crispr/designs/<id>. Missing-table is reported gracefully ("saved designs aren't enabled yet") so a pre-migration deploy never hard-errors. Frontend: "Save design" + "My designs" in the results header; a saved- designs modal lists past designs (label · mode · guide count · date) and reopens one — restoring its mode/editor/organ…1c7c498
-
Verify ES256 JWTs via Supabase JWKS (project migrated off HS256)
Tengo Gzirishvili +1: Claude Opus 4.7Diagnostic confirmed (via /api/whoami): this Supabase project signs access tokens with ES256 using an asymmetric key, not HS256 against the Legacy JWT Secret. Result: every signed-in user was failing verification and getting treated as anonymous → CRISPR 403 → "session out of sync" modal on every click. What this commit ships: 1. requirements.txt — adds PyJWT[crypto]>=2.8.0 (~6 MB), brings in the cryptography backend needed for ECDSA + JWKS support. 2. auth.py — keeps the legacy HS256 path intact (Supabase anon + service_role keys are still HS256, and projects that haven't migrated still need it). Adds two new functions: _verify_jwt_jwks(token, alg) — uses PyJWT.PyJWKClient against <project>/auth/v1/.well-known/jwks.json Cached, refreshes on kid miss. _verify_jwt_any(token) — reads the JWT header's `alg` and dispatches to HS25…e377126
-
Library TTL: 90-day expiry for free tier + lazy cleanup on /api/run
Verified signature82232b4
-
Audit sweep: signin redirects, honest footer, runBtn defensive type, JWT refresh fix
Verified signature1723bf9 -
Save libraries to Supabase Storage on run completion + plan helpers
Verified signaturebfbeacc -
Trial timer: 5-min anonymous window + in-engine sign-in modal
Verified signaturebfa71a2