Repository navigation
fix(web): show the webhook URL step when adding the first autoscan source - #1928
Conversation
…urce On a server with no autoscan sources, Add source → Create and continue created the source and its webhook endpoint, then reset the dialog to its first step instead of showing the URL to paste into Sonarr or Radarr. The panel rendered the add dialog in a different place in the empty layout than in the list layout, so the first source's arrival remounted the dialog and dropped its state. Render one layout with the dialog in a fixed position.
Sonarr v4 and Radarr v5+ caption the import triggers On File Import and On File Upgrade, not On Import and On Upgrade. Match their captions in the setup step, and list the same triggers in the source row hint.
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughThe autoscan admin UI updates webhook setup guidance and source-list behavior. The source panel retains loaded data after refresh errors, shows provider-specific webhook instructions, and keeps the add dialog in a shared layout. Tests cover first-source creation and the connection URL. ChangesAutoscan source setup and management
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The first-source connection details remain visible after a source refresh fails. No identified issue prevents merging after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
C1 still needs its initial validation after merge. Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
|
Right, both cases are still recorded as Not run, so there is nothing to unblock. Updated the line to |
Quick104
left a comment
There was a problem hiding this comment.
Code review of 5b44c0d found three issues, all in SourcesPanel.tsx and all inline. None is a regression from main. The fix works for the path it targets: the add dialog no longer remounts when the first source appears.
- Medium, rare: a failed sources refetch right after Create and continue still unmounts the dialog and loses the URL. Needs your call: fix it here or in a follow-up.
- Low: the row hint names a delete checkbox that exists in neither app, and it ignores the source's provider.
- Low, rare: a stale delete confirmation can reopen over Connect it.
Checked and found no problems:
- The new "On File Import" and "On File Upgrade" captions match Sonarr and Radarr on
develop. - The test's stubbed responses match the OpenAPI schemas.
- The manual's autoscan page names no trigger captions, so no manual issue is needed.
Needs your call: the Validation tasks: line. CLAUDE.md asks it to name the passed cases a change could reach. #1232 C1 is still Not run, so by that rule the line would be Validation tasks: none, with C1 noted separately as reached but not yet run. The earlier bot comment suggested the current wording, so a maintainer should settle which reading applies.
AI disclosure: claude-opus-5-5 wrote this review in Claude Code via T3 Code (/silo code-review). It is not a maintainer review.
| // The add dialog stays at one position in the tree whether or not sources | ||
| // exist. Creating the first source switches to the list; if the dialog moved | ||
| // with it, React would remount it and drop the "Connect it" step. |
There was a problem hiding this comment.
Medium, rare trigger: the Connect it step can still be lost. This comment holds only while the sources query succeeds. The sources.isError return above (line 1861) renders without {addDialog}.
After Create and continue, the create mutation invalidates the sources list. Suppose that refetch and its one retry fail, or the refetch times out (timeouts aren't retried). TanStack Query 5 then sets isError even though the cached data is still there. The panel shows "Failed to load scan sources", AddSourceDialog unmounts, and its createdWebhookReceipt state goes with it. If this happens before the webhook request resolves, that call's own onSuccess never runs. The source exists, but the admin never sees the URL. That is the bug this PR fixes, reached by another path. A reconnect refetch while the dialog is open can do the same. Window-focus refetch is off, so switching to the Sonarr tab doesn't trigger it.
Repair: take the error and loading returns only when there is no data (for example if (sources.isError && !sources.data)), or render {addDialog} in those states too, so the dialog stays mounted on every path. A test that fails the sources GET twice after the POST and expects the "Almost done — connect your service" dialog would cover it.
I traced this from the code and did not reproduce it. The early return predates this PR. Needs your call: fix it here or in a follow-up.
There was a problem hiding this comment.
Fixed in f968c57: the error replaces the panel only when no list has loaded, and a failed refetch shows a notice above the last list, so the add dialog stays mounted. A new test fails every sources read after the create and still gets the Connect it step with the URL; it fails without the change.
| Paste into Sonarr/Radarr → Settings → Connect → Webhook (On File Import, On File | ||
| Upgrade, On Rename, On Episode/Movie File Delete). |
There was a problem hiding this comment.
Low: the row hint names a delete checkbox that doesn't exist. This hint asks the admin to tick "On Episode/Movie File Delete". Sonarr's checkbox is "On Episode File Delete" and Radarr's is "On Movie File Delete", so the caption matches neither app. The hint also ignores provider, which this component already receives, so a Radarr source still gets the combined text. Nothing tests this string. This PR had to rename the same captions here and in webhookSetup.ts by hand, and the next caption change can easily miss one of them.
The delete caption was already wrong before this PR ("On File Delete"). Adding "On File Upgrade" is an improvement.
Repair: build the text from webhookSetup.ts, which already handles auto, sonarr, and radarr:
Paste into {settingsPathFor(provider)} (
{triggersFor(provider).map((t) => t.label).join(", ")}).That also needs settingsPathFor and triggersFor added to the ./webhookSetup import.
There was a problem hiding this comment.
Fixed in 82277bb: the hint is built from settingsPathFor(provider) and triggersFor(provider), so a Radarr source shows "On Movie File Delete" and the captions come from one place.
| </div> | ||
|
|
||
| {/* Delete confirmation */} | ||
| <AlertDialog |
There was a problem hiding this comment.
Low, rare trigger: a stale delete confirmation can reopen over Connect it. This dialog sits inside the non-empty branch, so it unmounts when the list empties. onOpenChange doesn't fire on unmount, so deleteTarget stays set.
Trigger: an admin opens "Delete source?" for the only source, another admin deletes that source, and a refetch returns an empty list. When the first admin adds a new source, this dialog mounts already open for the deleted source, on top of the Connect it step. Confirming sends a DELETE for an id that no longer exists and shows an error toast.
Main does the same, so this isn't a regression. The PR only changes what sits under the stale dialog.
Repair: clear deleteTarget when its source is no longer in list. Separately, rendering this AlertDialog after the conditional, next to {addDialog}, removes the fragment. It only uses component-level state.
There was a problem hiding this comment.
Fixed in f968c57: the confirmation now sits next to the add dialog outside the conditional, and it is open only while its source is still in the list.
The row hint named an "On Episode/Movie File Delete" checkbox that exists in neither app and ignored the source's provider. It now uses the same settings path and trigger captions as the Connect it step.
…fails A failed sources refetch replaced the panel with an error even though the last list was still cached, which unmounted the add dialog and lost its Connect it step. The error now replaces the panel only when nothing has loaded; otherwise a notice sits above the last list. The delete confirmation moves out of the non-empty branch and closes when its source is no longer listed, so a stale confirmation cannot reopen over a later dialog.
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
…can-sources-lean-list Carries the Silo-Server#1928 review fixes. The list here already builds the webhook hint from triggersFor and keeps the delete confirmation outside the conditional, so only the failed-refresh handling and the delete-open guard apply.
Brings in main's fix for the Autoscan tab crash on direct open (Silo-Server#1927). SourcesPanel.tsx keeps this branch's version: main's copy is Silo-Server#1928's head, which this branch already contains. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Problem
Related issue: #1230
Validation tasks: changes #1232 C1
On a server with no autoscan sources, Add source → Sonarr/Radarr Webhook → Create and continue creates the source and its webhook endpoint, then resets the dialog to its first step instead of showing Connect it with the URL to paste into Sonarr or Radarr. The admin is left without the URL or the instructions, and this is exactly the first-time setup the user manual walks through. Adding a second source works.
SourcesPanelrendered the add dialog in a different place in its empty-state layout than in its list layout. Creating the first source switches layouts, so React remounted the dialog and dropped its state.The Connect it step also named the triggers "On Import" and "On Upgrade". Sonarr v4 and Radarr v5+ caption them On File Import and On File Upgrade, so the instructions did not match the boxes the admin has to tick.
Approach
Render one layout with the dialog at a fixed position, and keep that layout with the last loaded list when a refresh of the sources fails, so the dialog is not unmounted that way either. Use the current Sonarr/Radarr captions in the setup step, and build the source row hint from the same per-provider trigger list.
Validation
gofmt,go vet,make lint-changed(0 issues), web lint, format check, build and budget, everyverify-*target and the router artifact test pass. DB-backed tests for the touched packages (autoscan,scanqueue,scanner,libraryingest,taskmanager,scantrigger,adminjob) pass against a freshly migrated database.make test-gofails only inplayback,jellycompat,transcodenode,api/handlersandapiv2tests that also fail on unmodifiedmainon this macOS host: hardware-probe tests whose fake ffmpeg is killed, transcode-session timing under full-suite load, andTestAdminResourceCapabilitiesAndScope. None of them exercise changed code.make test-webhad one failure under full-suite load (AdminUsersrow actions) that passes on its own. Linux CI is the authority for these.go vetand the tests of the packages it changes (apart fromTestAdminResourceCapabilitiesAndScopeabove); web PRs also pass the typecheck and the autoscan web tests. Every pair of the eleven PRs merges cleanly intomainin either order.Risks
None identified.
Checklist
AI Disclosure
mainat medium effort (a Claude Code review agent on claude-opus-5-5, and Codex CLI with gpt-6.1-sol and gpt-6-astra) checked correctness, React state/effect behavior and docs. No findings for this change.Note
Fix first-source webhook URL step in autoscan
SourcesPanelWebhookEndpointSectionin SourcesPanel.tsx to show the selected provider's settings path and trigger labels instead of fixed Sonarr/Radarr wording.Macroscope summarized f968c57.