fix(ic): end IC sessions on encode, not on queue - #199
Conversation
IC's /sessions/{id}/complete moves a session CLASSIFYING → EXPORT, which
is terminal, and IC's lookup() treats EXPORT as not resumable — so
/ic/start stages a fresh session for that page. Manual IC called it from
"queue page", so a page queued but never encoded (back to the project,
or simply never pressing "encode batch") silently lost every correction
made in it.
Queueing now only records {image, sessionId}; handleEncodeBatch is the
one place a session is completed, building each buildEncodePair() pair
there. The GameraXML snapshot is therefore taken after any edits made to
a page following its queueing, and the same deferral covers IC's
in-iframe auto-export path, which already delegates completion to the
host.
Also surface queue/encode errors in the header — they were written to
state but rendered only in the panel that replaces the iframe, so a
failure looked like a no-op click.
|
Warning Review limit reached
Next review available in: 30 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
In manual IC, queueing a page called
POST /api/ic/{session_id}/complete, which moves the IC sessionCLASSIFYING → EXPORT. That state is terminal, and IC'slookup()deliberately treats anEXPORTsession as not resumable — so/ic/startstaged a fresh session next time the page was opened. A page queued but never encoded (back to the project, or simply never pressing "encode batch") therefore lost every correction made in it.Queueing now only records
{image, sessionId}locally, andhandleEncodeBatchis the one place a session is completed: it finalises each queued session, builds itsbuildEncodePair()pair, then hands the batch to the encoder. Up to that point every session stays editable and resumable, so abandoning the step costs nothing. A side effect worth having — the GameraXML snapshot is now taken after any edits made to a page following its queueing. The same deferral covers IC's in-iframe "queue page"/auto-export path (ic:auto-export), which already delegates completion to the host.Also in here: queue/encode errors are now shown in the header. They were written to state but rendered only in the panel that replaces the iframe, so a failure looked like a no-op click — which matters more now that one click finalises N sessions. On failure the queue is left intact, and since IC allows re-export from
EXPORT, pressing the button again retries the whole queue rather than dropping the pages that already worked.Not addressed: the queue list itself is still component-local state, so leaving the view drops the checkmarks. The sessions behind them now survive and resume with their corrections intact, so re-queueing is a click — lifting the queue into
AppRouterstate would close that too, if we want it.Verified with
tsc -band prettier;eslinton the touched file reports only two pre-existingreact-hooks/set-state-in-effecterrors on untouched effects (that rule already fires 48 times acrosssrc). There's no test runner inlanding-page, and I didn't bring the six-process stack up, so this is statically checked rather than exercised end to end.Closes #198