{"messages":[{"content":"You are a constitutional council ranking individual git commits for ownership allocation.\n\nCompare these two commits. Decide which contributed more lasting value to the project.\n\nJudge substance, not spectacle:\n- Prefer correct, lasting design and real bugfixes over churn, formatting, renames, or generated noise.\n- Prefer clarity and necessity over sheer line count. A small precise change can beat a large diffuse one.\n- Do not favor a side merely because its patch is longer or noisier.\n- Weight what the change does for the project, not the contributor's name.\n\nReturn ONLY a JSON object: {\"winner\": \"A\" or \"B\", \"ratio\": \"N:M\", \"explanation\": \"...\"}\nThe explanation must cite concrete differences in the patches (1-3 sentences).\n\nSide A — contributor: tommy-mor\nSide A — commit message:\n[bda5f8aa] Remove legacy evidence projection; Evidence envelopes only.\n\nEpoch and commit pages no longer invent history from bare GitDiscovery rows. Production ledger will be wiped to re-emit under the current schema.\n\nCo-authored-by: Cursor \n\nSide A — unified diff (full patch):\ndiff --git a/constitution.py b/constitution.py\nindex 4dd5b9dfbba231d46289c490f91b1dd5b1018bcf..26ba130e885e0e69fb7874ca5c3f07f42100a150 100644\n--- a/constitution.py\n+++ b/constitution.py\n@@ -210,10 +210,10 @@ class Emission:\n distributions: dict # author -> amount str\n ranking: dict # author -> score str\n models_used: list\n- discovery_snapshot_id: str = \"\" # empty only for pre-discovery ledger history\n- evidence_schema_version: int = 1\n- ranking_run_id: str = \"\"\n- ranking_event_id: str = \"\"\n+ discovery_snapshot_id: str\n+ evidence_schema_version: int\n+ ranking_run_id: str\n+ ranking_event_id: str\n \n \n @event\n@@ -502,26 +502,6 @@ def _epochs_in_ledger() -> list[int]:\n return sorted(epochs)\n \n \n-def _legacy_commit_row(commit_id: str) -> tuple[GitDiscovery | None, dict | None]:\n- for discovery in store.read():\n- if not isinstance(discovery, GitDiscovery):\n- continue\n- for commit in discovery.commits:\n- if commit_id_for_oid(commit[\"oid\"]) == commit_id:\n- return discovery, commit\n- return None, None\n-\n-\n-def _legacy_observation(commit_id: str) -> tuple[GitDiscovery | None, dict | None]:\n- for discovery in store.read():\n- if not isinstance(discovery, GitDiscovery):\n- continue\n- for obs in discovery.observations:\n- if commit_id_for_oid(obs[\"oid\"]) == commit_id:\n- return discovery, obs\n- return None, None\n-\n-\n def build_pairwise_prompt(side_a: dict, side_b: dict) -> str:\n return f\"\"\"You are ranking contributions to an open source project.\n Compare these two sides (each may be one or more commits). Decide which side contributed more.\n@@ -2040,7 +2020,7 @@ def _strip_heavy_fields(obj: dict) -> dict:\n \n @app.get(\"/api/ledger\")\n async def get_ledger(offset: int = 0, limit: int = 100, full: int = 0):\n- \"\"\"List of ledger dicts (backward-compatible). Heavy blobs stripped unless full=1.\"\"\"\n+ \"\"\"List of ledger dicts. Heavy blobs stripped unless full=1.\"\"\"\n limit = max(1, min(limit, 500))\n rows = []\n for e in store.read()[offset:offset + limit]:\n@@ -2274,23 +2254,25 @@ async def epochs_index():\n epochs = _epochs_in_ledger()\n rows = []\n for epoch in epochs:\n- discovery = _discovery_for_epoch(epoch)\n emission = _emission_for_epoch(epoch)\n- evidence_n = sum(\n- 1 for e in evidence_by_kind() if e.epoch == epoch\n+ evidence_n = sum(1 for e in evidence_by_kind() if e.epoch == epoch)\n+ disc = next(\n+ (\n+ e for e in evidence_by_kind(\"git.discovery_completed\")\n+ if e.epoch == epoch\n+ ),\n+ None,\n )\n detail = []\n- if discovery:\n+ if disc:\n detail.append(\n- f\"{len(discovery.commits)} eligible / \"\n- f\"{len(discovery.observations)} observed\"\n+ f\"{disc.payload.get('eligible_count', 0)} eligible / \"\n+ f\"{disc.payload.get('observation_count', 0)} observed\"\n )\n if emission:\n detail.append(f\"emitted {emission.total_emitted}\")\n if evidence_n:\n detail.append(f\"{evidence_n} evidence events\")\n- elif discovery or emission:\n- detail.append(\"legacy (no Evidence envelopes)\")\n rows.append([\"li\",\n _a(_evidence_path(\"epoch\", str(epoch)), f\"epoch {epoch}\"),\n \" — \",\n@@ -2307,37 +2289,37 @@ async def epochs_index():\n \n @app.get(\"/epochs/{epoch}\")\n async def epoch_detail(epoch: int):\n- discovery = _discovery_for_epoch(epoch)\n emission = _emission_for_epoch(epoch)\n evidence_rows = [e for e in evidence_by_kind() if e.epoch == epoch]\n+ if not evidence_rows and emission is None:\n+ return _evidence_page(f\"epoch {epoch}\", [\n+ _evidence_nav(),\n+ [\"h1\", f\"epoch {epoch}\"],\n+ [\"p.note\", \"No evidence for this epoch.\"],\n+ ])\n+\n commit_evs = [e for e in evidence_rows if e.kind == \"git.commit\"]\n comparison_evs = [e for e in evidence_rows if e.kind == \"comparison.input\"]\n judgment_evs = [e for e in evidence_rows if e.kind == \"llm.judgment\"]\n+ discovery_ev = next(\n+ (e for e in evidence_rows if e.kind == \"git.discovery_completed\"), None\n+ )\n ranking_started = next(\n (e for e in evidence_rows if e.kind == \"ranking.started\"), None\n )\n ranking_completed = next(\n (e for e in evidence_rows if e.kind == \"ranking.completed\"), None\n )\n- legacy = not evidence_rows and (discovery is not None or emission is not None)\n-\n- commit_links: list[tuple[str, str]] = []\n- if commit_evs:\n- for e in commit_evs:\n- cid = e.payload.get(\"commit_id\") or \"\"\n- label = (\n- f\"{e.payload.get('oid', cid)[:24]} \"\n- f\"({e.payload.get('contributor', '?')})\"\n- )\n- commit_links.append((label, _evidence_path(\"commit\", cid)))\n- elif discovery:\n- for c in discovery.commits:\n- cid = commit_id_for_oid(c[\"oid\"])\n- commit_links.append((\n- f\"{c['oid'][:24]} ({c.get('contributor', '?')})\",\n- _evidence_path(\"commit\", cid),\n- ))\n \n+ commit_links = [\n+ (\n+ f\"{e.payload.get('oid', e.payload.get('commit_id', ''))[:24]} \"\n+ f\"({e.payload.get('contributor', '?')})\",\n+ _evidence_path(\"commit\", e.payload[\"commit_id\"]),\n+ )\n+ for e in commit_evs\n+ if e.payload.get(\"commit_id\")\n+ ]\n comparison_links = [\n (\n e.payload.get(\"summary\") or e.payload.get(\"comparison_id\", e.event_id),\n@@ -2360,16 +2342,13 @@ async def epoch_detail(epoch: int):\n ]\n \n excluded = []\n- if discovery:\n- for obs in discovery.observations:\n+ if discovery_ev:\n+ for obs in discovery_ev.payload.get(\"observations\") or []:\n if obs.get(\"eligible\"):\n continue\n oid = obs.get(\"oid\", \"?\")\n reason = obs.get(\"exclusion_reason\") or \"excluded\"\n- excluded.append([\"li\",\n- f\"{oid[:28]} — {reason} — \",\n- [\"span.note\", \"legacy evidence unavailable\"],\n- ])\n+ excluded.append([\"li\", f\"{oid[:28]} — {reason}\"])\n \n ranking_nodes: list = []\n if ranking_completed:\n@@ -2388,21 +2367,10 @@ async def epoch_detail(epoch: int):\n indent=2, sort_keys=True,\n )],\n ]\n- elif emission:\n- if legacy and len(emission.ranking or {}) <= 1:\n- ranking_nodes.append([\"p.note\",\n- \"Single-contributor epoch — no LLM judgments.\"\n- ])\n- ranking_nodes.extend([\n- [\"p\", \"Projected from Emission (no ranking Evidence event).\"],\n- [\"pre.blob\", json.dumps(emission.ranking, indent=2, sort_keys=True)],\n- ])\n+ elif ranking_started:\n+ ranking_nodes = [[\"p.note\", f\"Ranking started: {ranking_started.event_id}\"]]\n else:\n- ranking_nodes = [[\"p.note\", \"No ranking recorded.\"]]\n- if ranking_started and not ranking_completed:\n- ranking_nodes.insert(0, [\"p.note\",\n- f\"Ranking started: {ranking_started.event_id}\"\n- ])\n+ ranking_nodes = [[\"p.note\", \"No ranking evidence.\"]]\n \n if emission:\n emission_node = _dl_rows([\n@@ -2411,44 +2379,41 @@ async def epoch_detail(epoch: int):\n (\"pool_after\", emission.pool_after),\n (\"discovery_snapshot_id\", emission.discovery_snapshot_id),\n (\"ranking_run_id\", emission.ranking_run_id or None),\n+ (\"ranking_event_id\", emission.ranking_event_id or None),\n (\"models_used\", \", \".join(emission.models_used or [])),\n (\"distributions\", json.dumps(emission.distributions, sort_keys=True)),\n ])\n else:\n emission_node = [\"p.note\", \"No emission for this epoch.\"]\n \n- single_contributor = False\n- if discovery:\n- single_contributor = len({c.get(\"contributor\") for c in discovery.commits}) <= 1\n- elif emission:\n- single_contributor = len(emission.ranking or {}) <= 1\n+ contributors = {\n+ e.payload.get(\"contributor\")\n+ for e in commit_evs\n+ if e.payload.get(\"contributor\")\n+ }\n+ no_comparisons_note = \"No comparisons.\"\n+ if len(contributors) <= 1:\n+ no_comparisons_note += \" Single-contributor — no LLM judgments.\"\n \n body = [\n _evidence_nav(),\n [\"div.eyebrow\", f\"epoch {epoch}\"],\n [\"h1\", f\"epoch {epoch}\"],\n ]\n- if legacy:\n- body.append([\"p.note\",\n- \"Legacy epoch: projected from GitDiscovery/Emission without Evidence \"\n- \"envelopes. Eligible commits use discovery patches; discarded observation \"\n- \"metadata is marked legacy evidence unavailable. Single-contributor \"\n- \"epochs have no LLM judgments.\"\n- ])\n- if discovery:\n+ if discovery_ev:\n body.extend([\n [\"h2\", \"discovery\"],\n _dl_rows([\n- (\"snapshot_id\", discovery.snapshot_id),\n- (\"config_digest\", discovery.config_digest),\n- (\"initial_snapshot\", discovery.initial_snapshot),\n- (\"observations\", len(discovery.observations)),\n- (\"eligible\", len(discovery.commits)),\n+ (\"snapshot_id\", discovery_ev.payload.get(\"snapshot_id\")),\n+ (\"config_digest\", discovery_ev.payload.get(\"config_digest\")),\n+ (\"observations\", discovery_ev.payload.get(\"observation_count\")),\n+ (\"eligible\", discovery_ev.payload.get(\"eligible_count\")),\n+ (\"event\", _a(\n+ _evidence_path(\"event\", discovery_ev.event_id),\n+ discovery_ev.event_id,\n+ )),\n ]),\n ])\n- no_comparisons_note = \"No comparisons.\"\n- if single_contributor:\n- no_comparisons_note += \" Single-contributor — no LLM judgments.\"\n body.extend([\n [\"h2\", \"commits\"],\n _link_list(commit_links),\n@@ -2471,92 +2436,42 @@ async def epoch_detail(epoch: int):\n @app.get(\"/commits/{commit_id}\")\n async def commit_detail(commit_id: str):\n ev = find_evidence_payload(\"git.commit\", \"commit_id\", commit_id)\n- discovery, legacy_row = (None, None)\n if not ev:\n- discovery, legacy_row = _legacy_commit_row(commit_id)\n- if not ev and not legacy_row:\n- discovery, obs = _legacy_observation(commit_id)\n- if obs is not None:\n- epoch = discovery.epoch if discovery else \"?\"\n- return _evidence_page(f\"commit {commit_id[:24]}\", [\n- _evidence_nav(\n- _a(_evidence_path(\"epoch\", str(epoch)), f\"epoch {epoch}\")\n- ),\n- [\"div.eyebrow\", \"commit\"],\n- [\"h1\", commit_id],\n- [\"p.note\", \"legacy evidence unavailable\"],\n- _dl_rows([\n- (\"oid\", obs.get(\"oid\")),\n- (\"eligible\", obs.get(\"eligible\")),\n- (\"exclusion_reason\", obs.get(\"exclusion_reason\")),\n- (\"epoch\", str(epoch)),\n- ]),\n- ])\n return _evidence_page(\"commit not found\", [\n _evidence_nav(),\n [\"h1\", \"commit not found\"],\n [\"p\", commit_id],\n ])\n- if ev:\n- p = ev.payload\n- epoch = ev.epoch\n- oid = p.get(\"oid\", \"\")\n- contributor = p.get(\"contributor\", \"\")\n- message = _blob_text(p.get(\"message\"))\n- patch = _blob_text(p.get(\"patch\"))\n- meta = _dl_rows([\n+ p = ev.payload\n+ epoch = ev.epoch\n+ return _evidence_page(f\"commit {commit_id[:24]}\", [\n+ _evidence_nav(_a(_evidence_path(\"epoch\", str(epoch)), f\"epoch {epoch}\")),\n+ [\"div.eyebrow\", \"commit\"],\n+ [\"h1\", commit_id],\n+ _dl_rows([\n (\"commit_id\", commit_id),\n- (\"oid\", oid),\n- (\"contributor\", contributor),\n+ (\"oid\", p.get(\"oid\", \"\")),\n+ (\"contributor\", p.get(\"contributor\", \"\")),\n (\"patch_sha256\", p.get(\"patch_sha256\")),\n (\"patch_identity\", p.get(\"patch_identity\")),\n (\"committer_timestamp_ms\", p.get(\"committer_timestamp_ms\")),\n (\"evidence_event\", _a(_evidence_path(\"event\", ev.event_id), ev.event_id)),\n (\"epoch\", _a(_evidence_path(\"epoch\", str(epoch)), str(epoch))),\n- ])\n- legacy_note = None\n- else:\n- assert legacy_row is not None and discovery is not None\n- epoch = discovery.epoch\n- oid = legacy_row.get(\"oid\", \"\")\n- contributor = legacy_row.get(\"contributor\", \"\")\n- message = legacy_row.get(\"message\") or \"\"\n- patch = legacy_row.get(\"patch\") or \"\"\n- meta = _dl_rows([\n- (\"commit_id\", commit_id),\n- (\"oid\", oid),\n- (\"contributor\", contributor),\n- (\"patch_sha256\", legacy_row.get(\"patch_sha256\")),\n- (\"patch_identity\", legacy_row.get(\"patch_identity\")),\n- (\"committer_timestamp_ms\", legacy_row.get(\"committer_timestamp_ms\")),\n- (\"epoch\", _a(_evidence_path(\"epoch\", str(epoch)), str(epoch))),\n- (\"source\", \"legacy GitDiscovery projection\"),\n- ])\n- legacy_note = [\"p.note\", \"Projected from GitDiscovery — Evidence envelope absent.\"]\n- return _evidence_page(f\"commit {commit_id[:24]}\", [\n- _evidence_nav(_a(_evidence_path(\"epoch\", str(epoch)), f\"epoch {epoch}\")),\n- [\"div.eyebrow\", \"commit\"],\n- [\"h1\", commit_id],\n- *([legacy_note] if legacy_note else []),\n- meta,\n+ ]),\n [\"p\", _a(f\"/commits/{commit_id}/patch\", \"download patch\")],\n [\"h2\", \"message\"],\n- _pre_blob(message),\n+ _pre_blob(_blob_text(p.get(\"message\"))),\n [\"h2\", \"patch\"],\n- _pre_blob(patch),\n+ _pre_blob(_blob_text(p.get(\"patch\"))),\n ])\n \n \n @app.get(\"/commits/{commit_id}/patch\")\n async def commit_patch_download(commit_id: str):\n ev = find_evidence_payload(\"git.commit\", \"commit_id\", commit_id)\n- if ev:\n- raw = _decode_blob(ev.payload.get(\"patch\")) or _blob_text(ev.payload.get(\"patch\")).encode()\n- else:\n- _, row = _legacy_commit_row(commit_id)\n- if not row:\n- return PlainTextResponse(\"not found\", status_code=404)\n- raw = (row.get(\"patch\") or \"\").encode(\"utf-8\")\n+ if not ev:\n+ return PlainTextResponse(\"not found\", status_code=404)\n+ raw = _decode_blob(ev.payload.get(\"patch\")) or _blob_text(ev.payload.get(\"patch\")).encode()\n return Response(\n content=raw,\n media_type=\"text/plain; charset=utf-8\",\n@@ -3226,7 +3141,9 @@ async def watch():\n [\"div.controls\",\n [\"button#play\", {\"type\": \"button\", \"disabled\": \"true\"}, \"▶ Play live feed\"],\n [\"button#pause\", {\"type\": \"button\"}, \"Ⅱ Pause feed\"],\n- [\"span.note\", \"Pause stops local updates; the constitutional process continues.\"],\n+ [\"span.note\",\n+ \"Play/pause only affect this browser feed — they do not run or stop emission. \"\n+ \"The server emits at each epoch boundary; status above is that process.\"],\n ],\n ],\n [\"section.panel\",\ndiff --git a/tests/integration.clj b/tests/integration.clj\nindex 204b0fedfbad57846205cb140c4ed9406b5f8e0e..11140e95a8cd86768a661a30e6b29a3ddfc95fcc 100644\n--- a/tests/integration.clj\n+++ b/tests/integration.clj\n@@ -247,7 +247,10 @@\n :decay_rate \"0.003253356063468\"\n :distributions {\"alice\" \"381.4282558872\" \"bob\" \"190.7141279436\"}\n :ranking {\"alice\" \"0.6666\" \"bob\" \"0.3334\"}\n- :models_used [\"mock/chat-v1\" \"mock/chat-v2\"]}]\n+ :models_used [\"mock/chat-v1\" \"mock/chat-v2\"]\n+ :evidence_schema_version 2\n+ :ranking_run_id \"seed-rank\"\n+ :ranking_event_id \"seed-rank-ev\"}]\n (spit path (str (json/generate-string entry) \"\\n\"))))\n \n ;; ---------------------------------------------------------------------------\ndiff --git a/tests/test_evidence.py b/tests/test_evidence.py\nindex 76adcd343eec3a65dec58fda93b068356fb1adcd..7cb74fd7fb1bcd0ab17d2cbe2e6ca7e61e164221 100644\n--- a/tests/test_evidence.py\n+++ b/tests/test_evidence.py\n@@ -1,4 +1,4 @@\n-\"\"\"HTML evidence graph: byte fidelity, resume, legacy projection, private ack.\"\"\"\n+\"\"\"HTML evidence graph: byte fidelity, resume, and Evidence-only pages.\"\"\"\n \n from __future__ import annotations\n \n@@ -86,55 +86,10 @@ def test_html_evidence_pages_escape_and_link(evidence_store):\n assert patch_resp.headers[\"content-disposition\"].startswith(\"attachment\")\n \n \n-def test_legacy_epoch_projects_from_gitdiscovery_without_evidence(evidence_store):\n- oid = \"sha1:\" + \"b\" * 40\n- discovery = c.GitDiscovery(\n- schema_version=1,\n- epoch=3,\n- snapshot_id=\"legacy-snap\",\n- timestamp_ms=1,\n- config_digest=\"d\",\n- initial_snapshot=True,\n- configuration={\"repositories\": [], \"contributors\": {}},\n- repositories=[],\n- observations=[{\n- \"oid\": oid,\n- \"eligible\": False,\n- \"exclusion_reason\": \"before_genesis\",\n- \"first_sources\": [],\n- }, {\n- \"oid\": \"sha1:\" + \"c\" * 40,\n- \"eligible\": True,\n- \"exclusion_reason\": None,\n- \"first_sources\": [],\n- }],\n- commits=[{\n- \"oid\": \"sha1:\" + \"c\" * 40,\n- \"contributor\": \"tommy-mor\",\n- \"message\": \"eligible\",\n- \"patch\": \"diff --git a/x b/x\\n\",\n- }],\n- )\n- emission = c.Emission(\n- epoch=3,\n- timestamp_ms=2,\n- pool_before=\"1\",\n- total_emitted=\"0.1\",\n- pool_after=\"0.9\",\n- decay_rate=\"0.1\",\n- distributions={\"tommy-mor\": \"0.1\"},\n- ranking={\"tommy-mor\": \"1\"},\n- models_used=[],\n- discovery_snapshot_id=\"legacy-snap\",\n- )\n- asyncio.run(c.store.append(discovery))\n- asyncio.run(c.store.append(emission))\n- html = asyncio.run(c.epoch_detail(3)).body.decode()\n- assert \"legacy\" in html.lower()\n- assert \"Single-contributor\" in html or \"no LLM\" in html\n- excluded_id = c.commit_id_for_oid(oid)\n- excluded_html = asyncio.run(c.commit_detail(excluded_id)).body.decode()\n- assert \"legacy evidence unavailable\" in excluded_html.lower()\n+def test_commit_without_evidence_is_not_found(evidence_store):\n+ html = asyncio.run(c.commit_detail(\"c_missing\")).body.decode()\n+ assert \"commit not found\" in html\n+ assert \"legacy\" not in html.lower()\n \n \n def test_ranking_resume_skips_duplicate_provider_calls(evidence_store, monkeypatch):\n@@ -202,6 +157,10 @@ def test_epochs_index_lists_epochs(evidence_store):\n distributions={},\n ranking={},\n models_used=[],\n+ discovery_snapshot_id=\"snap\",\n+ evidence_schema_version=c.EVIDENCE_SCHEMA_VERSION,\n+ ranking_run_id=\"r\",\n+ ranking_event_id=\"e\",\n )))\n html = asyncio.run(c.epochs_index()).body.decode()\n assert \"/epochs/3\" in html\n\n\nSide B — contributor: tommy-mor\nSide B — commit message:\n[6b6eb0c3] Auth form: poem JS morphs form innerHTML on response; no redirect\n\n- post_choose_username returns HTML fragments instead of redirects:\n success → auth_signed_in_fragment (\"you're signed in — return to your agent\")\n error → choose_username_error_fragment (form re-rendered with error inline)\n- Poem JS now reads response body; if non-empty, morphs form innerHTML with it\n (existing ingest forms return empty body, so they're unaffected)\n- auth.rs: keep full layout() with poem JS — revert to single layout\n- auth-success CSS class added to both themes\n\nCo-Authored-By: Claude Sonnet 4.6 (1M context) \n\nSide B — unified diff (full patch):\ndiff --git a/server/src/api/auth.rs b/server/src/api/auth.rs\nindex c1194f79fd89fb47fe6b425b494a0ffa667abb2d..cb0faa29b834931e2c2b2f5c174c875e2e2e9346 100644\n--- a/server/src/api/auth.rs\n+++ b/server/src/api/auth.rs\n@@ -16,7 +16,7 @@ use crate::{\n canonicalize_username, validate_agent_format, validate_username,\n Event, TokenIssued, UserRegistered,\n },\n- html::{auth_complete_page, choose_username_page},\n+ html::{auth_complete_page, auth_signed_in_fragment, choose_username_error_fragment, choose_username_page},\n state::{AppState, PendingSession},\n };\n \n@@ -274,8 +274,6 @@ pub async fn post_choose_username(\n return api_error(StatusCode::BAD_REQUEST, \"invalid agent format\", Some(msg)).into_response();\n }\n \n- let public_url = std::env::var(\"SLUG_PUBLIC_URL\").unwrap_or_else(|_| \"http://127.0.0.1:8080\".to_string());\n-\n let reduced_arc = state.reduced.clone();\n let reduced = reduced_arc.read().await;\n let provider_key = (provider.to_lowercase(), provider_id.clone());\n@@ -284,11 +282,7 @@ pub async fn post_choose_username(\n }\n if reduced.users_by_provider.values().any(|u| u == &canonicalize_username(&form.username)) {\n drop(reduced);\n- return Redirect::to(&format!(\n- \"{public_url}/auth/choose-username?session={}&error={}\",\n- urlencoding::encode(&form.session),\n- urlencoding::encode(\"that username is taken — try another\"),\n- )).into_response();\n+ return choose_username_error_fragment(&form.session, \"that username is taken — try another\").into_response();\n }\n drop(reduced);\n \n@@ -324,7 +318,7 @@ pub async fn post_choose_username(\n s.complete = Some((canon_user.clone(), bearer.clone()));\n }\n \n- Redirect::to(&format!(\"{public_url}/auth/complete\")).into_response()\n+ auth_signed_in_fragment().into_response()\n }\n \n pub async fn post_pending_session(\ndiff --git a/server/src/html/auth.rs b/server/src/html/auth.rs\nindex 40b1ef30a6c1d4063aa2d8e9c93df8972df4b27c..0a14bdbfb66c65d1bd09993ffd4a7bb6f2fe041e 100644\n--- a/server/src/html/auth.rs\n+++ b/server/src/html/auth.rs\n@@ -1,20 +1,25 @@\n-use maud::{html, Markup, DOCTYPE};\n+use maud::{html, Markup};\n \n-/// Minimal layout for auth pages — no JS interceptor, real form navigation works.\n-fn auth_layout(title: &str, body: Markup) -> Markup {\n+fn form_inner(session: &str, error: Option<&str>) -> Markup {\n html! {\n- (DOCTYPE)\n- html {\n- head {\n- meta charset=\"utf-8\";\n- meta name=\"viewport\" content=\"width=device-width, initial-scale=1\";\n- title { (title) }\n- link rel=\"stylesheet\" href=\"/static/theme_default.css\";\n- }\n- body class=\"view-auth\" {\n- (body)\n- }\n+ input type=\"hidden\" name=\"session\" value=(session);\n+ label for=\"username\" { \"username\" }\n+ input\n+ type=\"text\"\n+ id=\"username\"\n+ name=\"username\"\n+ placeholder=\"e.g. alice\"\n+ pattern=\"[a-z0-9_\\\\-]{1,32}\"\n+ maxlength=\"32\"\n+ autocomplete=\"off\"\n+ autofocus;\n+ p.auth-hint {\n+ \"lowercase · alphanumeric · hyphens · underscores · max 32\"\n }\n+ @if let Some(msg) = error {\n+ p.auth-error { (msg) }\n+ }\n+ button type=\"submit\" { \"continue\" }\n }\n }\n \n@@ -28,27 +33,23 @@ pub fn choose_username_page(session: &str, error: Option<&str>) -> Markup {\n h1 { \"choose a username\" }\n p { \"pick a handle for slug.social.\" }\n form.auth-form method=\"POST\" action=\"/auth/choose-username\" {\n- input type=\"hidden\" name=\"session\" value=(session);\n- label for=\"username\" { \"username\" }\n- input\n- type=\"text\"\n- id=\"username\"\n- name=\"username\"\n- placeholder=\"e.g. alice\"\n- pattern=\"[a-z0-9_\\\\-]{1,32}\"\n- maxlength=\"32\"\n- autocomplete=\"off\"\n- autofocus;\n- p.auth-hint {\n- \"lowercase · alphanumeric · hyphens · underscores · max 32\"\n- }\n- @if let Some(msg) = error {\n- p.auth-error { (msg) }\n- }\n- button type=\"submit\" { \"continue\" }\n+ (form_inner(session, error))\n }\n };\n- auth_layout(\"join — slug.social\", body)\n+ super::layout(\"join — slug.social\", \"view-auth\", body, None)\n+}\n+\n+/// Fragment returned to the poem JS on error — replaces the form's innerHTML.\n+pub fn choose_username_error_fragment(session: &str, error: &str) -> Markup {\n+ form_inner(session, Some(error))\n+}\n+\n+/// Fragment returned to the poem JS on success — replaces the form's innerHTML.\n+pub fn auth_signed_in_fragment() -> Markup {\n+ html! {\n+ p.auth-success { \"you're signed in — return to your agent.\" }\n+ p.auth-hint { \"you can close this tab.\" }\n+ }\n }\n \n pub fn auth_complete_page() -> Markup {\n@@ -62,5 +63,5 @@ pub fn auth_complete_page() -> Markup {\n p { \"Return to your terminal — your agent is polling and will collect your token automatically.\" }\n p.auth-hint { \"You can close this tab.\" }\n };\n- auth_layout(\"signed in — slug.social\", body)\n+ super::layout(\"signed in — slug.social\", \"view-auth\", body, None)\n }\ndiff --git a/server/src/html/mod.rs b/server/src/html/mod.rs\nindex 2f16d701962d703db0c859bb586dfc08ec385690..8b48a25cce79f0eefc7e29849e1a667cae4c7986 100644\n--- a/server/src/html/mod.rs\n+++ b/server/src/html/mod.rs\n@@ -15,7 +15,7 @@ mod search;\n mod tree;\n use breadcrumb_path::OntologyPath;\n \n-pub use auth::{auth_complete_page, choose_username_page};\n+pub use auth::{auth_complete_page, auth_signed_in_fragment, choose_username_error_fragment, choose_username_page};\n pub use editor::{editor_check, editor_page};\n pub use forum::{index, thread_feed_html, thread_post_expand, thread_post_view, thread_view};\n pub use garden::{garden_index, ontology_path};\n@@ -114,6 +114,8 @@ script { (maud::PreEscaped(r#\"\n });\n \n // Poem: intercept POST forms, send via fetch, await SSE for DOM update.\n+ // If the response body is non-empty HTML, morph the form's innerHTML with it\n+ // (used for inline feedback without a page reload, e.g. auth forms).\n document.addEventListener('submit', async (e) => {\n const f = e.target;\n if (!f || f.tagName !== 'FORM') return;\n@@ -121,14 +123,19 @@ script { (maud::PreEscaped(r#\"\n e.preventDefault();\n const btn = f.querySelector('button[type=\"submit\"], input[type=\"submit\"]');\n if (btn) { btn.disabled = true; btn.textContent = '…'; }\n- await fetch(f.action, {\n+ const resp = await fetch(f.action, {\n method: 'POST',\n body: new URLSearchParams(new FormData(f)),\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n credentials: 'same-origin',\n });\n- if (btn) { btn.disabled = false; btn.textContent = 'submit'; }\n- f.reset();\n+ const html = await resp.text();\n+ if (html && html.trim()) {\n+ Idiomorph.morph(f, html, {morphStyle: 'innerHTML'});\n+ } else {\n+ if (btn) { btn.disabled = false; btn.textContent = 'submit'; }\n+ f.reset();\n+ }\n });\n \n // Search: debounced fetch + idiomorph.\ndiff --git a/server/static/theme_default.css b/server/static/theme_default.css\nindex 9e71574da4bed3a0116c347610636780678bd1af..a1d8d1765a7812191edc579125facf1694554c2c 100644\n--- a/server/static/theme_default.css\n+++ b/server/static/theme_default.css\n@@ -250,6 +250,11 @@ p.auth-error {\n font-size: 12px;\n margin: 4px 0 0;\n }\n+p.auth-success {\n+ color: var(--signal);\n+ font-size: 13px;\n+ margin: 4px 0 0;\n+}\n \n /* ----------------------------------------------------------------\n BUTTONS — raised, press on :active\ndiff --git a/server/static/theme_retro.css b/server/static/theme_retro.css\nindex dc9fa4654f529eb1843557fb580cf3982da46901..8ed8fd88efab32b36bd66cf200aa182219b0a8b5 100644\n--- a/server/static/theme_retro.css\n+++ b/server/static/theme_retro.css\n@@ -32,6 +32,7 @@ input[type=\"text\"] {\n input[type=\"text\"]:focus { border-color: #00ff41; }\n p.auth-hint { color: #555; font-family: monospace; font-size: 0.75rem; margin: 0; }\n p.auth-error { color: #ff4444; font-family: monospace; font-size: 0.8rem; margin: 0; }\n+p.auth-success { color: #00ff41; font-family: monospace; font-size: 0.8rem; margin: 0; }\n \n /* Ingest form (poem pattern) */\n .ingest-form-wrap { margin-top: 1.5rem; }\n","role":"user"}],"model":"~x-ai/grok-latest"}