Skip to content

fix: repair trend lab scans and dark-theme loading state - #67

Merged
devhims merged 3 commits into
mainfrom
fix/trend-lab-empty-topic
Sep 21, 2026
Merged

devhims merged 3 commits into
mainfrom
fix/trend-lab-empty-topic

Conversation

@devhims

@devhims devhims commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Summary

Three Trend Lab fixes in the dashboard.

Scans always failed with a connection error. The scan requested AI insights that nothing in web/ renders, because /providers/:provider/trends treats any insights value other than deterministic as "run the model". Measured against the live API:

request time
cold cache, insights on (what the dashboard sent) 50.1s
warm cache, insights on 28.0s
warm cache, deterministic 7.0s
cold cache, deterministic 23.2s

The client aborted at 20s, so the response never arrived. The scan now sends insights=deterministic, which also drops the operation from 25 to 15 credits. The Trend Lab's AI section is unaffected: it comes from the separate /v1/trends/plan button, which builds its payload from report fields, not from report.insights.

A cold eight-video sample still needs about 23s through the processor container, so the scan gets its own 60s budget. The global 15s request timeout is unchanged.

The loading card rendered white in the dark theme. globals.css keeps a legacy layer with hardcoded #fff, and a later workbench layer rebinds those selectors to theme tokens. .trend-loading and .trend-refresh-status were never migrated, so they kept a white background while --ink went light, leaving "Building a fresh topic sample…" almost unreadable. Both now use the same --color-dashboard-surface / --color-dashboard-rule / ink tokens as .trend-empty and .trend-card, and the status spinner ring is tokenized to the accent.

The topic input was prefilled with AI agents, so switching to the tab looked like a search was already staged. It starts empty and the existing placeholder carries the hint. The submit handler already trims and bails on an empty topic. The AI agents quick-scan preset is untouched, since that one is an explicit click.

Not included

A cold scan returns fewer videos than requested. researchTrendTopic fans out 6 candidates at a time, which is 12 concurrent container calls, and the processor sheds the excess: a fresh topic came back with 5 of 8 videos plus This YouTube processor is at capacity. warnings. That needs a platform change and is separate work.

Testing

  • npx tsc --noEmit in web/ passes.
  • Reproduced the timeout and verified the deterministic response shape against the live API with video2ctx api GET: videos, hashtags, titlePatterns, durationMix, summary, and confidence are all present, insights absent.

the topic field was seeded with 'AI agents', so switching to the trend lab tab looked like a pending search. start it empty and let the existing placeholder carry the hint. the submit handler already ignores an empty topic.
@vercel

vercel Bot commented Sep 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
video2ctx-web Ready Ready Preview Sep 21, 2026 9:53pm UTC

the scan asked for AI insights the dashboard never renders. that model call took about 21s of a 50s cold request against a 20s client budget, so every scan aborted with a connection error. request deterministic insights instead, which also drops the call from 25 to 15 credits, and give the scan a 60s budget since a cold eight-video sample still needs about 23s through the processor container.

trend-loading and trend-refresh-status were left behind in the legacy css layer with a hardcoded white background, so the loading card rendered white with near-invisible ink in the dark theme. bind them to the dashboard surface, rule and ink tokens like trend-empty and trend-card already are, and tokenize the status spinner ring.
@devhims devhims changed the title fix: start trend lab topic input empty fix: repair trend lab scans and dark-theme loading state Sep 21, 2026
main now owns request deadlines: #69 moved the api helper into web/lib/platform-request.ts and removed every client timeout, so the 60s trend scan budget this branch added is gone and the scan waits for the API outcome instead.

kept from this branch: insights=deterministic, which stops the scan paying about 21s and 10 credits for an AI block the dashboard never renders, the dark-theme tokens for the loading and refresh cards, and the empty topic input.
@devhims

devhims commented Sep 21, 2026

Copy link
Copy Markdown
Owner Author

Reconciled with #69, which landed first and moved request handling into web/lib/platform-request.ts with every client deadline removed ("The API owns operation deadlines").

The 60s trend scan budget this PR proposed is dropped. The scan now waits for the API outcome, so a 65s scan finishes instead of failing at an arbitrary client cutoff, and a real API timeout surfaces as the API stated it.

What remains here is the work #69 does not cover:

  • insights=deterministic on the scan, which stops it paying ~21s and 10 credits for an AI block nothing in web/ renders
  • dashboard theme tokens for .trend-loading and .trend-refresh-status, which were left in the legacy CSS layer with a hardcoded white background
  • the empty topic input

Merged main in rather than rebasing, so no already-pushed commit was rewritten. tsc --noEmit and the 54 web tests pass on the merge.

@devhims
devhims added this pull request to stack #72 September 21, 2026 22:00
@devhims
devhims merged commit e33880d into main Sep 21, 2026
7 checks passed
@devhims
devhims deleted the fix/trend-lab-empty-topic branch September 21, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant