Free, open-source AI video generator for Mac. Run LTX-2.5 and MiniMax H3 (Hailuo) locally on Apple Silicon: text-to-video and image-to-video with sound, lip-sync, character LoRA training, songs from lyrics (YuE2) and image editing (Qwen-Image-Edit). One-click install via Pinokio. Offline: no cloud, no API key, no NVIDIA GPU.
Python ai-filmmakingai-videoai-video-generatorapple-siliconhailuoimage-to-videolip-synclocal-ailora-trainingltx-2ltx-2-5ltx-videomacosminimax-h3mlxmusic-generationoffline-aipinokiotext-to-videovideo-generation
release(v4.9.7): fleet telemetry blind spots filled — job origin, feature use, update behaviour; stats page counts packs
mrbizarrob7863ddbe08d
diff --git a/README.md b/README.mdindex 6c08b9c..ebc5cee 100644--- a/README.md+++ b/README.md@@ -13,7 +13,7 @@</p>-> **Current release: v4.9.6.** One fix: deleting a Hailuo H3 clip from the Outputs gallery now takes its audio track and stage cache with it (`<name>.wav`, `<name>_source.wav`, `<name>.stage_a.npz`) instead of leaving them piling up in mlx_outputs (#77). Includes v4.9.5: character training re-trains for real (the preprocessing cache reused old captions after a trigger change — #62) and a finished H3 clip survives a shutdown-time crash (#76). Full notes on the [releases page](https://github.com/mrbizarro/phosphene/releases).+> **Current release: v4.9.7.** Better anonymous fleet telemetry, no new behaviour for you: renders now report which surface queued them (form, Batch, Storyboard, Characters, Image Studio, Retry), a handful of feature-use counts (Storyboard planning, the Editor, CivitAI, the sample character, a training start), whether the update pop-up was answered, and when the queue paused itself — all closed vocabularies, no text, same install id, same Settings toggle to turn it off (see docs/ANALYTICS.md). Also: the stats page shows complete weight-pack downloads instead of a per-file total. Includes v4.9.6 (H3 clips take their sidecars to Trash, #77). Full notes on the [releases page](https://github.com/mrbizarro/phosphene/releases).## Overviewdiff --git a/VERSION b/VERSIONindex edf342d..89faebe 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-4.9.6+4.9.7diff --git a/docs/ANALYTICS.md b/docs/ANALYTICS.mdindex 64a00c0..b56708f 100644--- a/docs/ANALYTICS.md+++ b/docs/ANALYTICS.md@@ -197,6 +197,7 @@ including image and training jobs.| `character_used` | bool | `true` | A cast character drove this render || `audio_mode` | string | `"joint"` | `joint` / `none` (external audio replaces the generated track) / `a2v_dub` / `h3_native` || `first_render` | bool | `true` | Present once per install, on its first successful render ever — the activation funnel without a join |+| `source` | string | `"storyboard"` | v4.9.7 — which surface queued the job. **Closed vocabulary**: `form`, `batch`, `storyboard`, `characters`, `image_studio`, `retry`, `api`, `unknown`. Makes "how much of the rendering is Storyboard" a one-click breakdown |### `render_failed`@@ -249,6 +250,50 @@ Neither are **refusals** — those get their own event, next.> `other` to drop again, and a small, permanent drop in `download_failed`. All> three are this change.+### `feature_used` (v4.9.7)++The surfaces render events cannot see. One event per action, no free text.++| prop | type | example | why |+|---|---|---|---|+| `feature` | string | `"storyboard_plan"` | **Closed vocabulary**: `storyboard_plan`, `storyboard_export`, `editor_open`, `editor_export`, `civitai_download`, `sample_character`, `train_start`, `enhance_prompt`. Unknown names are dropped locally, never sent |+| `detail` | string | `"nle"` | Optional, lowercase `[a-z0-9_.-]` only, ≤32 chars — a sub-choice within the feature |+| `version` | string | `"4.9.7"` | As on `app_boot` |++### `app_updated` (v4.9.7)++Sent once at the first boot after the running version changed. Answers "did people move to the new release" without a per-install join across `app_boot` rows.++| prop | type | example | why |+|---|---|---|---|+| `from_version` | string | `"4.9.5"` | The version the previous boot ran (kept locally in settings) |+| `to_version` | string | `"4.9.7"` | The version now running |++### `update_prompt` (v4.9.7)++How the update pop-up and banner are answered — the only way to know whether the "please update" surfaces work.++| prop | type | example | why |+|---|---|---|---|+| `action` | string | `"later"` | **Closed vocabulary**: `shown`, `update_now`, `later` (the pop-up), `banner_update`, `banner_later` (the banner), `restart_needed` (the "Restart to finish update" pill, once per page load) |+| `version` | string | `"4.9.5"` | The version that was prompted |++### `broadcast_seen` (v4.9.7)++One event when a developer broadcast (`BROADCAST.json`) is acknowledged. No text — which message is derivable from the date.++### `queue_paused_breaker` (v4.9.7)++The queue paused itself after three identical failures in a row.++| prop | type | example | why |+|---|---|---|---|+| `n_failed` | int | `3` | The streak length when it fired |+| `queued` | int | `12` | Jobs left waiting |+| `error_class` | string | `"model_missing"` | The same closed taxonomy as `render_failed` |++The browser reports `update_prompt`, `broadcast_seen` and the Editor's two `feature_used` values through **one** route, `POST /analytics/ui`, which allowlists every (event, value) pair and answers 400 to anything else. Everything else is emitted server-side.+### `render_refused`Once per job the panel **declined on purpose**. Same fields as@@ -541,3 +586,90 @@ To watch it live, tail the local log while you render:```shtail -f state/usage-log.jsonl```++## Fleet dashboard tiles (HogQL)++The queries behind the **Phosphene Fleet** dashboard's tiles, kept here so the board can be rebuilt (PostHog → New insight → SQL → paste → Add to dashboard). Each is a one-click breakdown; none joins across installs.++**Activation — installs vs first renders per day (14d)**++```sql+select toDate(timestamp) as day, countIf(event='app_installed') as installs, countIf(event='render_completed' and toString(properties.first_render)='true') as first_renders+from events where timestamp > now() - interval 14 day group by day order by day+```++**Versions in use — active installs by version (7d)**++```sql+select properties.version as version, count(distinct distinct_id) as installs+from events where timestamp > now() - interval 7 day and event='app_boot' group by version order by installs desc+```++**Failure rate by version (7d)**++```sql+select properties.version as version, countIf(event='render_completed') as ok, countIf(event='render_failed') as failed, round(100*failed/greatest(ok+failed,1),1) as fail_pct+from events where timestamp > now() - interval 7 day group by version having ok+failed >= 10 order by version+```++**Why renders fail — error class (7d)**++```sql+select properties.error_class as class, count() as events, count(distinct distinct_id) as installs+from events where event='render_failed' and timestamp > now() - interval 7 day group by class order by events desc+```++**Where we said no — refusals (7d)**++```sql+select properties.refusal as reason, count() as events, count(distinct distinct_id) as installs+from events where event='render_refused' and timestamp > now() - interval 7 day group by reason order by events desc+```++**Where renders come from — source (7d)**++```sql+select properties.source as source, count() as renders, count(distinct distinct_id) as installs+from events where event in ('render_completed','render_failed') and timestamp > now() - interval 7 day group by source order by renders desc+```++**Feature use (7d)**++```sql+select properties.feature as feature, count() as uses, count(distinct distinct_id) as installs+from events where event='feature_used' and timestamp > now() - interval 7 day group by feature order by uses desc+```++**Update prompt — how people answer it (7d)**++```sql+select properties.action as action, count() as events, count(distinct distinct_id) as installs+from events where event='update_prompt' and timestamp > now() - interval 7 day group by action order by events desc+```++**Updates landed per day (14d)**++```sql+select toDate(timestamp) as day, count(distinct distinct_id) as installs_updated+from events where event='app_updated' and timestamp > now() - interval 14 day group by day order by day+```++**Hardware mix of active installs (7d)**++```sql+select multiIf(toFloat(properties.ram_gb) <= 16, '≤16 GB', toFloat(properties.ram_gb) <= 24, '24 GB', toFloat(properties.ram_gb) <= 36, '32–36 GB', toFloat(properties.ram_gb) <= 64, '48–64 GB', '96 GB+') as ram, count(distinct distinct_id) as installs+from events where event='app_boot' and timestamp > now() - interval 7 day group by ram order by installs desc+```++**Renders per active install (7d)**++```sql+select bucket, count() as installs from (select distinct_id, multiIf(c=0,'0', c<=2,'1–2', c<=10,'3–10', c<=50,'11–50','50+') as bucket from (select distinct_id, countIf(event='render_completed') as c from events where timestamp > now() - interval 7 day group by distinct_id)) group by bucket order by bucket+```++**Queue breaker fires (14d)**++```sql+select toDate(timestamp) as day, count() as fires, count(distinct distinct_id) as installs+from events where event='queue_paused_breaker' and timestamp > now() - interval 14 day group by day order by day+```diff --git a/docs/STATE.md b/docs/STATE.mdindex 43a841f..ed851fd 100644--- a/docs/STATE.md+++ b/docs/STATE.md@@ -117,6 +117,20 @@> update (EditAnything → LTX 2.5 v2.0); `/loras/guide` wrote a real guide> (6.5 s).+> **📈 2026-09-05 — v4.9.7: the fleet picture gets its blind spots filled (analytics only).**+> `source` on every render event; `feature_used` (storyboard_plan/export,+> editor_open/export, civitai_download, sample_character, train_start);+> `app_updated`; `update_prompt` (shown/later/update_now/banner_*/+> restart_needed); `broadcast_seen`; `queue_paused_breaker`. One browser+> route `POST /analytics/ui` with a strict allowlist. Validated offline on a+> scratch panel; 59 analytics tests. The 12 HogQL tile queries for the+> PostHog "Phosphene Fleet" board are in docs/ANALYTICS.md — the panel's+> query key lacks `insight:write`/`dashboard:write`, so adding them to the+> board needs a scoped key (owner) or a paste per tile. Stats page: weights+> release shows complete pack downloads (~1.2K), not the 84K per-file sum.+> NOTE: promoted by cherry-pick onto origin/main — dev/beta also carry the+> other window's unreleased UX batch + Director (835b2c5, 14592a8…).+> **🩹 2026-09-05 — v4.9.6: H3 sidecars follow the clip to Trash (#77).**> `post_output_delete._expand_for_media` now collects `<stem>.wav`,> `<stem>_source.wav`, `<stem>.stage_a.npz` (+ bare `.stage_a`). Validated ondiff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.pyindex 64efc88..a3f872d 100644--- a/mlx_ltx_panel.py+++ b/mlx_ltx_panel.py@@ -11858,6 +11858,9 @@ _ANALYTICS_EVENTS = ("render_refused","pack_state_change","star_prompt",+ # v4.9.7+ "feature_used", "app_updated", "update_prompt", "broadcast_seen",+ "queue_paused_breaker",)@@ -11925,6 +11928,15 @@ def _analytics_boot() -> None:"ram_gb": int(round(SYSTEM_RAM_GB)),})_settings_set_internal(analytics_install_reported=True)+ # v4.9.7: an explicit update event — "did people move" without a+ # per-install join across boots. Stored version is local only.+ _prev_ver = str(get_settings().get("analytics_last_version") or "")+ if _prev_ver and _prev_ver != running_version():+ _analytics_capture("app_updated", {+ "from_version": _prev_ver, "to_version": running_version(),+ })+ if _prev_ver != running_version():+ _settings_set_internal(analytics_last_version=running_version())_analytics_capture("app_boot", {"version": running_version(),"os_version": _analytics_os_version(),@@ -12008,6 +12020,42 @@ def _analytics_wall_sec_bucket(seconds):return int(edge)+_ANALYTICS_SOURCES = ("form", "batch", "storyboard", "characters",+ "image_studio", "retry", "api", "unknown")+++def _analytics_source(p: dict, job: dict | None = None) -> str:+ """Which surface queued this job — a closed vocabulary, never free text."""+ raw = str((p or {}).get("source") or "").strip().lower()+ if raw == "panel.image_studio":+ raw = "image_studio"+ if raw in _ANALYTICS_SOURCES:+ return raw+ if (job or {}).get("retry_of"):+ return "retry"+ if (p or {}).get("board_id") or (p or {}).get("sb_board_id"):+ return "storyboard"+ return "form" if not raw else "unknown"+++_ANALYTICS_FEATURES = ("storyboard_plan", "storyboard_export", "editor_open",+ "editor_export", "civitai_download", "sample_character",+ "train_start", "enhance_prompt")+++def _analytics_feature(feature: str, detail: str = "") -> None:+ """`feature_used` for the surfaces render events cannot see (Storyboard+ planning, the Editor, CivitAI, the sample character, a training start).+ Closed vocabulary on both fields; unknown names are dropped, not sent."""+ if feature not in _ANALYTICS_FEATURES:+ return+ props = {"feature": feature, "version": running_version()}+ detail = re.sub(r"[^a-z0-9_.-]", "", str(detail or "").lower())[:32]+ if detail:+ props["detail"] = detail+ _analytics_capture("feature_used", props)++def _analytics_canvas_class(width: int, height: int) -> str:"""Coarse canvas grouping by megapixels — the percentile dimension."""try:@@ -12336,6 +12384,10 @@ def _analytics_render_event(job: dict) -> None:"lora_count": len(p.get("loras") or []),"lora_kinds": _analytics_lora_kinds(p),"character_used": bool(p.get("character_id")),+ # Where the job came from (v4.9.7): the render form, a Batch,+ # Storyboard's "Render all", the Characters pane, the Image+ # Studio, a Retry. Closed vocabulary — see _analytics_source.+ "source": _analytics_source(p, job),"audio_mode": _analytics_audio_mode(p, engine, mode),}# wall_sec_bucket only when the wall clock is known — a None would@@ -15673,6 +15725,7 @@ def _sb_plan_thread(board_id: str, brief: dict, previous: dict | None) -> None:def _sb_enqueue(job_form: dict) -> str:"""Enqueue one shot exactly the way /queue/add does. No private path."""job = make_job(job_form)+ job["params"]["source"] = "storyboard"with QUEUE_COND:STATE["queue"].append(job)QUEUE_COND.notify_all()@@ -23605,6 +23658,12 @@ def worker_loop() -> None:_CONSEC_FAIL.update(sig=_sig, n=1)if _CONSEC_FAIL["n"] >= 3 and STATE["queue"] and not STATE["paused"]:STATE["paused"] = True+ _analytics_capture("queue_paused_breaker", {+ "n_failed": int(_CONSEC_FAIL["n"]),+ "queued": len(STATE["queue"]),+ "error_class": _analytics_error_class(job.get("error")),+ "version": running_version(),+ })push(f"Paused the queue: {_CONSEC_FAIL['n']} renders in a row failed "f"with the same problem, and {len(STATE['queue'])} more are "f"waiting. Fix the cause above (Settings → Models for a "@@ -25139,6 +25198,9 @@ class Handler(BaseHTTPRequestHandler):with _SB_LOCK:_SB_PLANNERS.pop("-pending-", None)_SB_PLANNERS.setdefault(bid, {"cancelled": False})+ # Counted only once every refusal above has passed — the planner is+ # about to run, so this is a plan that happened (v4.9.7).+ _analytics_feature("storyboard_plan")th = threading.Thread(target=_sb_plan_thread, daemon=True, name=f"phos-sb-plan-{bid}",args=(bid, {"concept": concept, "n_shots": shots_n,@@ -25530,6 +25592,7 @@ class Handler(BaseHTTPRequestHandler):# ---- export / housekeeping -----------------------------------if action == "export":+ _analytics_feature("storyboard_export")board = load(f("id", ""))# Opt-in, and only from an explicit request. Absent these the# export is byte-for-byte the one that shipped: whole clips,diff --git a/panel/routes_characters.py b/panel/routes_characters.pyindex 05a836d..f9036ea 100644--- a/panel/routes_characters.py+++ b/panel/routes_characters.py@@ -51,6 +51,7 @@ def get_styles(h, parsed) -> None:# /characters/download-sample/status until status == done|error.@post("/characters/download-sample")def post_characters_download_sample(h, path, qs, ctype) -> None:+ P._analytics_feature("sample_character")if P._sample_character_present():h._json({"ok": True, "status": "done", "already": True,"character_id": P.SAMPLE_CHARACTER["trigger"]})diff --git a/panel/routes_loras.py b/panel/routes_loras.pyindex a369de0..36ab074 100644--- a/panel/routes_loras.py+++ b/panel/routes_loras.py@@ -378,6 +378,7 @@ def post_loras_rename(h, path, qs, ctype) -> None:@post("/civitai/download")def post_civitai_download(h, path, qs, ctype) -> None:+ P._analytics_feature("civitai_download")_rb = h._read_form_body()if _rb is None:returndiff --git a/panel/routes_meta.py b/panel/routes_meta.pyindex 57599c0..622985c 100644--- a/panel/routes_meta.py+++ b/panel/routes_meta.py@@ -212,6 +212,40 @@ def post_version_check(h, path, qs, ctype) -> None:h._json({"ok": False, "error": str(exc)}, 500)+@post("/analytics/ui")+def post_analytics_ui(h, path, qs, ctype) -> None:+ """The browser's ONLY analytics channel (v4.9.7): a strict allowlist of+ (event, props) shapes the page may report — how the update pop-up was+ answered, a broadcast being seen, the Editor being opened/exported.+ Anything outside the allowlist is dropped with 400; nothing here is+ free text and nothing reaches the network when analytics is off."""+ _rb = h._read_form_body()+ if _rb is None:+ return+ body, form = _rb+ def _f(k):+ v = form.get(k, [""])+ return (v[0] if isinstance(v, list) else v) or ""+ event = str(_f("event")).strip()+ if event == "update_prompt":+ action = str(_f("action")).strip()+ if action not in ("shown", "later", "update_now", "banner_update",+ "banner_later", "restart_needed"):+ h._json({"ok": False, "error": "unknown action"}, 400); return+ P._analytics_capture("update_prompt", {+ "action": action, "version": P.running_version()})+ elif event == "broadcast_seen":+ P._analytics_capture("broadcast_seen", {"version": P.running_version()})+ elif event == "feature_used":+ feature = str(_f("feature")).strip()+ if feature not in ("editor_open", "editor_export", "enhance_prompt"):+ h._json({"ok": False, "error": "unknown feature"}, 400); return+ P._analytics_feature(feature, _f("detail"))+ else:+ h._json({"ok": False, "error": "unknown event"}, 400); return+ h._json({"ok": True})++@post("/version/pull")def post_version_pull(h, path, qs, ctype) -> None:# The "magic button" path — when the pill is in the behinddiff --git a/panel/routes_queue.py b/panel/routes_queue.pyindex 82b5a75..e0a1c0a 100644--- a/panel/routes_queue.py+++ b/panel/routes_queue.py@@ -329,6 +329,7 @@ def post_queue_retry(h, path, qs, ctype) -> None:"error": None,}new_job["params"]["open_when_done"] = False+ new_job["params"]["source"] = "retry"with P.QUEUE_COND:P.STATE["queue"].append(new_job)P.QUEUE_COND.notify_all()diff --git a/panel/routes_train.py b/panel/routes_train.pyindex 5c6d874..d998de8 100644--- a/panel/routes_train.py+++ b/panel/routes_train.py@@ -169,6 +169,7 @@ def get_train_file(h, parsed) -> None:# ====== Train Character — start training (enqueue a mode='train' job)@post("/train/start")def post_train_start(h, path, qs, ctype) -> None:+ P._analytics_feature("train_start")_rb = h._read_form_body()if _rb is None:returndiff --git a/panel_assets/stats.html b/panel_assets/stats.htmlindex 44de822..af4c508 100644--- a/panel_assets/stats.html+++ b/panel_assets/stats.html@@ -2717,17 +2717,26 @@const sec = $('#sec-releases');if (!tl || !tl.length) { sec.hidden = true; return; }sec.hidden = false;- const max = Math.max(1, ...tl.map(r => r.total_downloads || 0));+ // A weights pack is ~90 files per install; its raw file total is not+ // comparable with a code release. Chart and show the number of+ // complete pack downloads (median per-file count) for those rows, and+ // keep the raw file total in the tooltip.+ const shown = r => (String(r.tag || '').startsWith('weights-') && r.pack_downloads != null)+ ? r.pack_downloads : (r.total_downloads || 0);+ const max = Math.max(1, ...tl.map(shown));const body = $('#releases-table tbody');body.innerHTML = tl.map(r => {- const w = Math.max(2, ((r.total_downloads || 0) / max) * 100);+ const isPack = String(r.tag || '').startsWith('weights-') && r.pack_downloads != null;+ const w = Math.max(2, (shown(r) / max) * 100);const when = r.published_at ? new Date(r.published_at) : null;const whenStr = (when && Number.isFinite(when.getTime()))? when.toISOString().slice(0, 10) : '—';return `<tr><td><code>${escapeHtml(r.tag || '—')}</code></td><td class="mono" style="color:var(--muted)">${escapeHtml(whenStr)}</td>- <td class="num" title="${escapeAttr(fmt(r.total_downloads))}">${escapeHtml(fmtShort(r.total_downloads || 0))}</td>+ <td class="num" title="${escapeAttr(isPack+ ? `≈${fmt(r.pack_downloads)} complete downloads of the base pack (median per file). Per pack: ${Object.entries(r.packs || {}).map(([k, v]) => `${k} ≈${fmt(v)}`).join(', ') || '—'}. ${fmt(r.asset_count)} files, ${fmt(r.total_downloads)} file downloads in total — each install fetches every file of its pack.`+ : fmt(r.total_downloads))}">${escapeHtml(isPack ? `≈${fmtShort(r.pack_downloads)} packs` : fmtShort(r.total_downloads || 0))}</td><td class="num" style="width:30%"><span class="row-bar gradient" style="width:100%"><i style="--w:${w}%"></i></span></td>diff --git a/scripts/fetch_repo_stats.py b/scripts/fetch_repo_stats.pyindex 0aca420..c06f67d 100644--- a/scripts/fetch_repo_stats.py+++ b/scripts/fetch_repo_stats.py@@ -552,15 +552,38 @@ def fetch_release_timeline(repo: str) -> list[dict]:tag = rel.get("tag_name", "?")published = (rel.get("published_at") or rel.get("created_at") or "")total = 0+ counts: list[int] = []+ by_pack: dict[str, list[int]] = {}for a in rel.get("assets") or []:try:- total += int(a.get("download_count", 0))+ n = int(a.get("download_count", 0))except (TypeError, ValueError):continue+ total += n+ counts.append(n)+ # Pack files are named <pack>__<file>; a release can carry+ # several packs (q4_25, q8_25, gemma4_25) with different reach.+ name = str(a.get("name") or "")+ if "__" in name:+ by_pack.setdefault(name.split("__", 1)[0], []).append(n)+ # A weight pack is ~40 files per install, so its "downloads" is+ # ~40× the number of installs that fetched it (84.4K read as a crowd+ # using the weights without the app — it was ~1,000 installs). The+ # median per-file count within ONE pack is that pack's complete+ # downloads (big shards run higher: interrupted fetches resume them).+ packs = {}+ for pk, ns in by_pack.items():+ ns.sort()+ packs[pk] = ns[len(ns) // 2]+ pack_downloads = max(packs.values()) if packs else (+ sorted(counts)[len(counts) // 2] if counts else 0)out.append({"tag": tag,"published_at": published,"total_downloads": total,+ "asset_count": len(counts),+ "pack_downloads": pack_downloads,+ "packs": packs,})# GitHub returns newest-first; sort oldest-first for charting.out.sort(key=lambda r: r.get("published_at") or "")diff --git a/scripts/test_analytics_dryrun.py b/scripts/test_analytics_dryrun.pyindex db00119..3efab1b 100644--- a/scripts/test_analytics_dryrun.py+++ b/scripts/test_analytics_dryrun.py@@ -42,6 +42,7 @@ import tempfileimport threadingimport timeimport unittest+import unittest.mockimport urllib.requestfrom pathlib import Path@@ -494,7 +495,7 @@ class TestEventSchemas(AnalyticsTestCase):"version", "chip_family", "ram_gb", "os_version", "canvas_class","steps", "accel", "temporal_mode", "upscale", "upscale_method","schedule_preset", "chain_windows", "chain_prompts_used",- "lora_count", "lora_kinds", "character_used", "audio_mode",+ "lora_count", "lora_kinds", "character_used", "source", "audio_mode",}def test_render_completed_fields(self):@@ -971,6 +972,14 @@ class TestReceiverDirectives(AnalyticsTestCase):# straight from the /star-click handler, so it is captured directly# here with the same closed vocabulary that handler coerces `via` to.P._analytics_capture("star_prompt", {"via": "link"})+ # v4.9.7 events, fired the way their call sites fire them.+ P._analytics_feature("editor_open", "")+ P._analytics_capture("app_updated", {"from_version": "4.9.5", "to_version": "4.9.7"})+ P._analytics_capture("update_prompt", {"action": "later", "version": "4.9.7"})+ P._analytics_capture("broadcast_seen", {"version": "4.9.7"})+ P._analytics_capture("queue_paused_breaker", {"n_failed": 3, "queued": 2,+ "error_class": "model_missing",+ "version": "4.9.7"})# A refusal: the panel declining on purpose. Fired here for the same# reason as the rest — its payload has to carry the receiver# directives too, and it is the newest way to get an event out.@@ -1169,3 +1178,40 @@ def main() -> int:if __name__ == "__main__":sys.exit(main())+++class SourceAndFeatureVocabularies(unittest.TestCase):+ """v4.9.7: the job-origin field and feature events are closed sets."""++ def test_source_normalises_to_the_closed_set(self):+ self.assertEqual(P._analytics_source({}, {}), "form")+ self.assertEqual(P._analytics_source({"source": "panel.image_studio"}, {}), "image_studio")+ self.assertEqual(P._analytics_source({"source": "characters"}, {}), "characters")+ self.assertEqual(P._analytics_source({"source": "storyboard"}, {}), "storyboard")+ self.assertEqual(P._analytics_source({"source": "retry"}, {}), "retry")+ self.assertEqual(P._analytics_source({"board_id": "b1"}, {}), "storyboard")+ self.assertEqual(P._analytics_source({"source": "/Users/x/secret"}, {}), "unknown")+ for v in P._ANALYTICS_SOURCES:+ self.assertRegex(v, r"^[a-z_]+$")++ def test_feature_event_drops_unknown_names_and_scrubs_detail(self):+ sent = []+ with unittest.mock.patch.object(P, "_analytics_capture", lambda e, pr=None: sent.append((e, pr))):+ P._analytics_feature("not_a_feature", "x")+ P._analytics_feature("editor_export", "NLE Premiere/../etc")+ self.assertEqual(len(sent), 1)+ ev, props = sent[0]+ self.assertEqual(ev, "feature_used")+ self.assertEqual(props["feature"], "editor_export")+ self.assertEqual(props["detail"], "nlepremiere..etc")+ self.assertNotIn("/", props["detail"])++ def test_render_event_carries_source(self):+ job = {"status": "done", "elapsed_sec": 30,+ "params": {"engine": "ltx", "mode": "t2v", "source": "storyboard",+ "width": 768, "height": 432, "frames": 49, "quality": "balanced"}}+ sent = []+ with unittest.mock.patch.object(P, "_analytics_capture", lambda e, pr=None: sent.append((e, pr))):+ P._analytics_render_event(job)+ self.assertTrue(sent, "no event")+ self.assertEqual(sent[-1][1].get("source"), "storyboard")diff --git a/webapp/js/editor.js b/webapp/js/editor.jsindex 81ef6f7..7a5a268 100644--- a/webapp/js/editor.js+++ b/webapp/js/editor.js@@ -2308,6 +2308,7 @@ async function edShowPicker() {// The one door, from anywhere: the rail's step 3, a board row, the picker.function edOpenBoard(id) {+ try { _uiEvent('feature_used', {feature: 'editor_open'}); } catch (_) {}if (!id) return;if (typeof workflowSwitch === 'function') workflowSwitch('editor');sbeOpen(id);@@ -7486,6 +7487,7 @@ async function sbeRenderFilm() {// EXPORT FOR AN NLE — the film as a project the next room can open// ---------------------------------------------------------------------------async function sbeExportNle() {+ try { _uiEvent('feature_used', {feature: 'editor_export'}); } catch (_) {}if (!SBE.open || !SBE.id) return;// Same rule as the render: the project is written from the saved file.if (SBE.dirty && !(await sbeSave(true))) {diff --git a/webapp/js/health.js b/webapp/js/health.jsindex b1689d2..658c41a 100644--- a/webapp/js/health.js+++ b/webapp/js/health.js@@ -89,6 +89,7 @@ function renderVersionPill() {// Without this the 2026-08-14 incident repeats: newer code on disk,// stale code in memory, and nothing anywhere saying so.if (s.stale_process) {+ if (!window._staleReported) { window._staleReported = true; _uiEvent('update_prompt', {action: 'restart_needed'}); }pill.classList.add('pill-restart');pill.innerHTML = '<svg class="ph" aria-hidden="true" style="margin-right:4px;vertical-align:-2px"><use href="#ph-arrow-clockwise-bold"/></svg>Restart to finish update';// Name BOTH builds, each with its SHA. Most fixes land without a VERSION@@ -200,6 +201,16 @@ function _phModalClose() {window._phModalOpen = false;}+// The page's one analytics channel (v4.9.7): a closed set of (event, props)+// the server allowlists — how the update pop-up was answered, a broadcast+// seen, the Editor opened/exported. Fire-and-forget; never throws.+function _uiEvent(event, props) {+ try {+ const fd = new URLSearchParams(Object.assign({event}, props || {}));+ fetch('/analytics/ui', {method: 'POST', body: fd, keepalive: true}).catch(() => {});+ } catch (_) {}+}+function _maybeShowUpdateModal(st) {if (window._updModalShownThisLoad || window._phModalOpen) return;if (!st || st.error || st.suppress_reason || !st.checked_ts) return;@@ -207,6 +218,7 @@ function _maybeShowUpdateModal(st) {const remote = st.remote_version || st.remote_short || 'a new version';const local = st.local_version || st.local_short || 'your build';window._updModalShownThisLoad = true;+ _uiEvent('update_prompt', {action: 'shown'});_phModalShow({kicker: 'Update available',title: `Phosphene ${remote} is out — you're on ${local}`,@@ -216,12 +228,14 @@ function _maybeShowUpdateModal(st) {primaryLabel: 'Update now',secondaryLabel: 'Later',onPrimary: () => {+ _uiEvent('update_prompt', {action: 'update_now'});const go = document.getElementById('ubUpdate');if (go) { go.disabled = true; go.textContent = 'Updating…'; }versionDoPull({skipConfirm: true});},// Later = this page load only. The banner (per-version dismissal)// remains as the quieter in-session reminder.+ onSecondary: () => { _uiEvent('update_prompt', {action: 'later'}); },});}@@ -239,6 +253,7 @@ function _maybeShowBroadcastModal(st) {body: b.body || '',primaryLabel: 'Got it',onPrimary: () => {+ _uiEvent('broadcast_seen', {});const ids = seen.concat([b.id]).slice(-50);window._ubStarSettings = Object.assign(window._ubStarSettings || {},{broadcast_seen_ids: ids});@@ -326,6 +341,7 @@ async function _ubSaveSetting(patch) {function _ubWire() {const go = document.getElementById('ubUpdate');if (go) go.onclick = () => {+ _uiEvent('update_prompt', {action: 'banner_update'});go.disabled = true;go.textContent = 'Updating…';// Straight to the pull, with no confirm: this button already said what it@@ -334,6 +350,7 @@ function _ubWire() {};const later = document.getElementById('ubLater');if (later) later.onclick = () => {+ _uiEvent('update_prompt', {action: 'banner_later'});const s = _versionState || {};_ubSaveSetting({update_banner_dismissed: String(s.remote_version || s.remote_short || '')});const el = document.getElementById('updateBanner');@@ -761,5 +778,5 @@ setInterval(refreshVersionPill, 5 * 60 * 1000);// Inline handlers in the markup and the other files resolve these through// the global scope; everything NOT listed here is private to this module.Object.assign(globalThis, {- renderVersionPill, updateHealthChip, versionPillClick,+ renderVersionPill, updateHealthChip, versionPillClick, _uiEvent,});