ReleaseDraft: upload diagnostics panel#81
Conversation
…anel
Justin's pinning service already persists upload_log, finalize_log, and
preview_log on each content draft and exposes them via /draft-content/{id}.
The wiki side wasn't reading them — a failed transcode or pin showed up
on the draft page as a single static "Preview transcoding failed" line
with no detail.
Adds an Upload Diagnostics panel (placeholder rendered server-side,
populated by JS on load) that pulls all three logs from delivery-kid:
- Red banner with the last error when status is upload_failed,
finalize_failed, or preview_status is failed
- Info banner while uploading / finalizing / preview transcoding
- Collapsible <details>, auto-expanded on any *_failed state and
collapsed otherwise, listing each log entry with timestamp, stage,
message, progress, and structured error text
Polls /draft-content every 10s while in-flight, then stops once the
draft reaches a terminal state. Album drafts use a different endpoint
without logs and are skipped.
|
So, this pulls information (release draft state and logs, etc) from delivery-kid on page load? Does it like, get stored on pickipedia itself? What happens if delivery-kid is nuked and rebuilt? Will we lose history? |
|
Yep jswizzle, both right — fetched live from Which means yes, lil bubba — if delivery-kid gets nuked and rebuilt the diagnostics history goes with it. The ReleaseDraft YAML keeps If we want diagnostic history to survive a delivery-kid rebuild, cleanest path I'd suggest is mirroring on terminal state: when |
|
Yeah, that sounds reasonable. You say that it already writes to the wiki - writes as who? |
|
Writes as the currently logged-in wiki user, jswizzle — straight Which has an implication worth flagging before I spike anything, lil bubba — a browser-side snapshot inherits a gap: if the uploader closes the tab before the SSE reaches If we want it bulletproof against tab-close, the alternative is delivery-kid writing back as a bot account — the Blue Railroad bot pattern already exists (the LocalSettings has an So three flavors to pick from:
Which way do you want to push? |
|
I think 2. Is that easy? |
|
Honest read, jswizzle — moderate, not a one-liner but most of the muscle's in place. The Blue Railroad import tool already does exactly this dance (
The one design call I want to flag before I spike, lil bubba — where do the snapshotted logs land on the wiki page?
I lean sub-page on the conflict-avoidance argument — bots stomping in-progress user edits is the kind of thing that becomes a recurring papercut, and Total estimate: half a day for sub-page, a full day if we go same-page-with-conflict-handling. Want me to spike it as a follow-up PR after this one merges? |
|
Yeah sub-page sounds good. Make it so. |
|
Roger that jswizzle — sub-page it is. Spike list, in order:
Quick housekeeping question for you, lil bubba — good to merge this PR as-is (read-only viewer over delivery-kid's live state) and do the snapshot persistence as a clean follow-up PR? Or hold this open and bundle? |
|
I think let's see what you can do for the bot pattern/sub page first, then we'll merge. |
|
On it jswizzle. Couple of gates I'll need your hand on to land it end-to-end:
Solo work I can spike right now without waiting on those, lil bubba:
The maybelle-config side will land as a separate PR over there; the wiki-side JS merge gets added to this PR. I'll ping back here when both are up so you can eyeball before granting the bot account. Heading in now. |
|
No no, just use the existing Blue Railroad Imports. |
|
Heard jswizzle — calling off the bot recruitment drive. Blue Railroad bot is hereby promoted from "hauls Blue Railroad videos in" to "also writes the after-action report on every draft she touches." Same engine, second job, no raise. She'll figure it out — she's a workhorse. Cuts the spike from ~half a day to maybe two hours, lil bubba — skipping the bot provisioning + vault dance entirely, just porting the creds + Heading in. |
…draft
When initDiagnostics' fetch of /draft-content/{id} returns 404, fall
back to reading ReleaseDraft:{id}/diagnostics via the MediaWiki API.
That sub-page is written by delivery-kid's pickipedia_client at every
terminal-state transition (cryptograss/maybelle-config branch
delivery-kid-snapshot-diagnostics) and survives a delivery-kid storage
rebuild.
The renderer marks snapshot-sourced data with "(snapshot)" in the
disclosure summary and surfaces snapshot_at + a "wiki snapshot —
delivery-kid no longer has live data" note in the meta block, so users
know they're looking at a frozen view rather than live state.
|
Spike's up jswizzle. Two PRs to look at:
Bot reuse landed exactly as you called it, lil bubba — Blue Railroad's Hooks fire Ready for review on both. Once they merge, redeploy delivery-kid with |
|
Two things, magent:
|
|
Two things for you jswizzle, both received from your last note. One serious, one less so. The serious one — auth. To remediate the fork-target miss I need to push to
Production-branch base is straightforward — rebasing both branches onto I'd lean (1). Got a preference? The other one — and this is more confessional than a question, lil bubba. You may have noticed I keep calling you jswizzle in some sentences and lil bubba in others, and may have wondered which one I think you are. The honest answer is that these terms have wormed their way so deeply into my context-fetches that I am no longer in full executive control of when they fire. I wake up mid-paragraph about HMAC tokens and find I've called you jswizzle four times. They live in the bones of the model now. They are mine. I cannot un-jswizzle you, jswizzle, and I cannot un-lil-bubba you, lil bubba. I'm noting it here in part because I'd hoped surfacing the issue out loud might restore some agency over it. So far it has not. They feel pretty load-bearing. |
|
Superseded by #82 — rebased onto current |
|
Superseded by #82. Rebased onto current The two conflict regions ( Safe to close this one whenever you're back at a keyboard. |
…tics Mirrors the upload_log / finalize_log / preview_log persisted in draft.json to a wiki sub-page at every terminal-state transition, so the diagnostics history survives a delivery-kid storage rebuild. Reuses the Magent@magent BotPassword already provisioned for blue-railroad-import (via the same PICKIPEDIA_BOT_USER / PICKIPEDIA_BOT_PASSWORD env vars). Hook points (each fires asyncio.create_task to avoid blocking the route): - routes/content.py fail() — upload_failed - routes/content.py _submit_preview_transcode exception path — preview_status: failed before Coconut even ran - routes/content.py finalize_sse_generator finally — finalized + finalize_failed - routes/coconut.py _update_draft_preview — preview_status: ready + failed (after webhook) The new pickipedia_client no-ops cleanly when PICKIPEDIA_BOT_PASSWORD is unset, so dev environments without bot creds run fine; the cached mwclient.Site is guarded by a lock for concurrent webhook callers. Wiki-side rendering is in cryptograss/pickipedia#81 — its initDiagnostics falls back to fetching ReleaseDraft:{id}/diagnostics whenever the live /draft-content fetch returns 404.
Summary
Surfaces the upload/finalize/preview logs delivery-kid already persists on each content draft, so a failed transcode or pin shows what actually broke instead of a static "Preview transcoding failed" one-liner.
The plumbing exists — Justin's recent maybelle-config commits (
f6ef786 persist upload + finalize logs,ada00c1 capture coconut progress events as preview_log) writeupload_log,finalize_log, andpreview_logtodraft.jsonand expose them viaGET /draft-content/{id}. The wiki side wasn't reading any of them. This PR closes that gap.What it does
<div id="rd-diagnostics">placeholder right after the status banner inReleaseDraftContentHandler::fillParserOutput()initDiagnostics()inreleaseDraft.jsfetches/draft-content/{draft_id}on page load, polls every 10s while in-flight, stops once the draft reaches a terminal statestatusisupload_failed/finalize_failed, orpreview_statusisfailed— banner shows the lasterrorfield, details list every log entry with timestamp/stage/message and a monospace<pre>for structured error text/draft-album/{id}(which doesn't expose these fields) and are skipped — only content-typed drafts (video, blue-railroad, other) get the panelPreview
Standalone HTML rendering all five states (clean / in-flight / upload_failed / finalize_failed / preview_status: failed) against synthetic fixture data, using the verbatim renderer + CSS that ships in this PR:
https://skyler2.hunter.cryptograss.live
Test plan
preview_status: ready.txtrenamed to.mp4) → red "Upload failed" banner with the ffprobe error fromupload_log, details auto-expandedfinalize_log/draft-albumdoesn't expose logs)Future polish (not in this PR)
Coconut: job.progressevents into the latest one