Skip to content

feat(torrents): support new share limit parameters#1872

Open
martylukyy wants to merge 9 commits into
developfrom
feat/support-new-share-limit-params
Open

feat(torrents): support new share limit parameters#1872
martylukyy wants to merge 9 commits into
developfrom
feat/support-new-share-limit-params

Conversation

@martylukyy
Copy link
Copy Markdown
Contributor

@martylukyy martylukyy commented May 11, 2026

This PR adds support for the new share limit parameters in qBittorrent 5.2.0+

Summary by CodeRabbit

  • New Features

    • Advanced share-limit controls for qBittorrent 5.2+: choose action when limits are reached (pause, remove, remove+content, enable super seeding) and matching mode (any vs all). Available in automations, share-limit dialogs (desktop & mobile), and bulk share-limit actions; shown only for supported instances.
  • Documentation

    • Updated compatibility matrix and feature docs to describe these new settings and behavior.

Review Change Stack

@martylukyy martylukyy requested a review from s0up4200 May 11, 2026 12:46
@martylukyy martylukyy self-assigned this May 11, 2026
@martylukyy martylukyy added enhancement New feature or request web backend go Pull requests that update go code torrent qbit-native-feature area/backend Backend changes area/frontend Frontend changes labels May 11, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 11, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds qBittorrent 5.2+ per-torrent share-limit action and matching-mode support and threads capability and fields through client capability detection, API/OpenAPI, sync manager, automation processing/service, frontend types/hooks/UI, dependency, and documentation.

Changes

Share Limit Action & Mode Feature

Layer / File(s) Summary
Type Definitions & Capability Support
internal/qbittorrent/client.go, internal/models/automation.go, web/src/types/index.ts, internal/api/handlers/capabilities.go
Client gains supportsShareLimits; backend/frontend types add shareLimitAction and shareLimitsMode; capability exposed in capabilities response.
API Handlers & OpenAPI
internal/api/handlers/torrents.go, internal/web/swagger/openapi.yaml
BulkActionRequest accepts shareLimitAction/shareLimitsMode; handler forwards fields to the sync manager; OpenAPI schema updated.
Sync Manager
internal/qbittorrent/sync_manager.go
SetTorrentShareLimit signature extended to accept shareLimitAction/shareLimitsMode; derives action/mode, clears them when instance lacks support, and forwards via client.SetTorrentShareLimitCtx.
Automation Processor
internal/services/automations/processor.go
torrentDesiredState extended with shareLimitAction/shareLimitsMode; processRuleForTorrent populates them from rule conditions when present.
Automation Service
internal/services/automations/service.go
shareKey includes action and mode; keys built from state; SetTorrentShareLimit invoked with action/mode; failure logs/details include them.
Frontend Types, API & Hooks
web/src/types/index.ts, web/src/lib/api.ts, web/src/hooks/useTorrentActions.ts
Types updated; bulkAction() payload includes optional action/mode; hooks and handleSetShareLimit accept and forward these values.
Share Limit Dialogs & Workflow UI
web/src/components/torrents/TorrentDialogs.tsx, web/src/components/instances/preferences/WorkflowDialog.tsx, web/src/components/torrents/*
Dialogs/workflow add form state/props for action/mode, conditionally render selects when supportsShareLimits, and forward values via extended callbacks; mobile/table/management components wired.
Documentation & Dependency
go.mod, documentation/docs/advanced/compatibility.md, documentation/docs/features/automations.md
Bump go-qbittorrent pseudo-version; add compatibility entry and docs describing new action/mode fields and version requirements.

Sequence Diagram(s)

sequenceDiagram
  participant Frontend as Frontend UI
  participant API as Backend API Handler
  participant Service as Automation Service
  participant SyncMgr as Sync Manager
  participant QB as qBittorrent Client
  Frontend->>API: POST /instances/{id}/torrents/bulk-action (shareLimitAction, shareLimitsMode, limits)
  API->>Service: enqueue desired share-limit state
  Service->>SyncMgr: SetTorrentShareLimit(hashes, ratio, times, action, mode)
  SyncMgr->>QB: call SupportsShareLimits()
  SyncMgr->>QB: send SetTorrentShareLimit request (with action/mode if supported, else empty)
  QB->>SyncMgr: respond with result
  SyncMgr->>Service: report success/failure (includes action/mode)
  Service->>API: return aggregated result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • autobrr/qui#1481: Modifies BulkActionRequest and bulk execution plumbing overlapping with this PR's bulk-action changes.
  • autobrr/qui#1385: Related changes to automations share-limit aggregation and shareKey logic.
  • autobrr/qui#1698: Changes to automation models/processors that touch related code paths.

Suggested labels

api

Suggested reviewers

  • s0up4200
  • zze0s

Poem

🐰 I hop through settings, bright and quick,
New limits, actions — pick your trick.
Stop or remove, or super-seed,
Rules apply with matching need.
Automations hum; the torrents tick.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title directly describes the main change: adding support for new share limit parameters, which aligns with the changes across backend, frontend, documentation, and API layers.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/support-new-share-limit-params

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@martylukyy martylukyy force-pushed the feat/support-new-share-limit-params branch from 5660d68 to 4e3284d Compare May 11, 2026 12:54
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
internal/services/automations/service.go (1)

2561-2566: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Action/mode-only share-limit changes are currently skipped.

At Line 2561-Line 2564, needsUpdate only checks ratio/seeding deltas. If a rule changes only shareLimitAction or shareLimitsMode, the torrent never enters shareBatches, so Line 2749 is never called for that change.

💡 Proposed fix
-			ratioNeedsUpdate := state.ratioLimit != nil && currentRatio != ratio
-			seedingNeedsUpdate := state.seedingMinutes != nil && torrent.SeedingTimeLimit != seedMinutes
-			needsUpdate := ratioNeedsUpdate || seedingNeedsUpdate
+			ratioNeedsUpdate := state.ratioLimit != nil && currentRatio != ratio
+			seedingNeedsUpdate := state.seedingMinutes != nil && torrent.SeedingTimeLimit != seedMinutes
+			// Ensure new share semantics are applied even when numeric limits are unchanged.
+			actionNeedsUpdate := strings.TrimSpace(state.shareLimitAction) != ""
+			modeNeedsUpdate := strings.TrimSpace(state.shareLimitsMode) != ""
+			needsUpdate := ratioNeedsUpdate || seedingNeedsUpdate || actionNeedsUpdate || modeNeedsUpdate
 			if needsUpdate {
 				key := shareKey{ratio: ratio, seed: seedMinutes, inactive: inactiveMinutes, action: state.shareLimitAction, mode: state.shareLimitsMode}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/services/automations/service.go` around lines 2561 - 2566, The code
currently computes needsUpdate as only ratio or seeding changes, so changes that
only alter state.shareLimitAction or state.shareLimitsMode never enqueue
torrents into shareBatches; update the logic around needsUpdate (the block
building shareKey and appending to shareBatches) to also detect action/mode-only
changes by adding checks (e.g., actionNeedsUpdate := state.shareLimitAction !=
currentAction and modeNeedsUpdate := state.shareLimitsMode != currentMode) and
include them in the needsUpdate OR condition so shareBatches[key] is populated
when shareLimitAction or shareLimitsMode differ even if ratio/seeding are
unchanged.
internal/qbittorrent/sync_manager.go (1)

5499-5518: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Critical build error: undefined type qbt.MonitoredFolders at line 5512

The NormalizeScanDirsPreference function attempts to unmarshal scan_dirs preference into qbt.MonitoredFolders, which does not exist in the go-qbittorrent package. The web search confirms this type is not exported by go-qbittorrent. This breaks compilation of the code.

Determine the correct type for scan_dirs (likely a slice or map type that qBittorrent's API uses), or remove this function if it's not yet ready for merge.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/qbittorrent/sync_manager.go` around lines 5499 - 5518, The code
fails because qbt.MonitoredFolders does not exist; update
NormalizeScanDirsPreference to unmarshal into a concrete type the qBittorrent
API returns (e.g. map[string]string) or a generic map[string]any if uncertain:
replace the qbt.MonitoredFolders variable with var scanDirs map[string]string
(or map[string]any), unmarshal into that, and set prefs["scan_dirs"] = scanDirs;
alternatively remove the function if you don't want to normalize yet. Ensure
references to qbt.MonitoredFolders in NormalizeScanDirsPreference are removed
and tests/usage expecting the preference shape are adjusted accordingly.
web/src/components/torrents/TorrentCardsMobile.tsx (1)

119-124: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Forwarding for new share-limit parameters is currently a dead path on mobile.

onConfirm now supports shareLimitAction and shareLimitsMode, but this submit path never sends them, so mobile users can’t set the new qBittorrent 5.2+ options.

Please either (a) add dialog controls + pass these values here, or (b) remove the new callback params from this component until mobile UI supports them.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/components/torrents/TorrentCardsMobile.tsx` around lines 119 - 124,
The mobile submit path (handleSubmit) doesn't forward the new shareLimitAction
and shareLimitsMode parameters to onConfirm, so update TorrentCardsMobile.tsx by
adding component state and UI controls for shareLimitAction and shareLimitsMode
(or appropriate toggles/selects), bind them to those state values, and then
include them in the onConfirm call (e.g., onConfirm(ratioEnabled ? ratioLimit :
-1, seedingTimeEnabled ? seedingTimeLimit : -1, inactiveSeedingTimeEnabled ?
inactiveSeedingTimeLimit : -1, shareLimitActionValue, shareLimitsModeValue) ),
ensuring sensible defaults when controls are not set so mobile can configure the
new qBittorrent 5.2+ options; alternatively if you prefer not to implement the
UI yet, remove the extra parameters from the onConfirm type/signature used by
TorrentCardsMobile to keep behavior consistent.
🧹 Nitpick comments (3)
internal/models/automation.go (1)

883-889: ⚡ Quick win

Constrain new share-limit fields to allowed values (typed enum + validation).

Using *string here permits invalid values to be stored and propagated. Prefer constrained types (or explicit validation) for ShareLimitAction and ShareLimitsMode.

♻️ Proposed model typing change
 type ShareLimitsAction struct {
 	Enabled            bool           `json:"enabled"`
 	RatioLimit         *float64       `json:"ratioLimit,omitempty"`
 	SeedingTimeMinutes *int64         `json:"seedingTimeMinutes,omitempty"`
-	ShareLimitAction   *string        `json:"shareLimitAction,omitempty"`
-	ShareLimitsMode    *string        `json:"shareLimitsMode,omitempty"`
+	ShareLimitAction   *ShareLimitActionValue `json:"shareLimitAction,omitempty"`
+	ShareLimitsMode    *ShareLimitsModeValue  `json:"shareLimitsMode,omitempty"`
 	Condition          *RuleCondition `json:"condition,omitempty"`
 }
// Add near other constants/types.
type ShareLimitActionValue string
type ShareLimitsModeValue string

const (
	ShareLimitActionDefault ShareLimitActionValue = "-1"
	ShareLimitActionStop    ShareLimitActionValue = "0"
	ShareLimitActionRemove  ShareLimitActionValue = "1"
	ShareLimitActionSuper   ShareLimitActionValue = "2"
	ShareLimitActionRemoveWithContent ShareLimitActionValue = "3"

	ShareLimitsModeDefault ShareLimitsModeValue = "-1"
	ShareLimitsModeAny     ShareLimitsModeValue = "0"
	ShareLimitsModeAll     ShareLimitsModeValue = "1"
)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/models/automation.go` around lines 883 - 889, The ShareLimitsAction
struct currently uses *string for ShareLimitAction and ShareLimitsMode which
allows invalid values; change those fields to pointer types of constrained enums
(e.g., *ShareLimitActionValue and *ShareLimitsModeValue) and add the new types
and constants (ShareLimitActionValue, ShareLimitsModeValue and their allowed
consts like ShareLimitActionDefault/Stop/Remove/Super/RemoveWithContent and
ShareLimitsModeDefault/Any/All) near other model types; implement simple
validation by adding a Validate method or UnmarshalJSON on those enum types to
reject values not in the allowed set and keep the existing json tags so
marshaling/unmarshaling behavior is preserved.
internal/web/swagger/openapi.yaml (1)

1597-1602: ⚡ Quick win

Add enum constraints for the new share-limit fields in the API contract.

shareLimitAction and shareLimitsMode currently accept any string. Since valid values are explicitly defined, encode them as enums to prevent invalid payloads from clients.

♻️ Proposed OpenAPI diff
                 shareLimitAction:
                   type: string
+                  enum: ["-1", "0", "1", "2", "3"]
                   description: Action when share limits are reached (qBittorrent 5.2+). Values -1=default, 0=stop, 1=remove, 2=enable super seeding, 3=remove with content.
                 shareLimitsMode:
                   type: string
+                  enum: ["-1", "0", "1"]
                   description: Whether any or all limits must be reached (qBittorrent 5.2+). Values -1=default, 0=match any, 1=match all.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/web/swagger/openapi.yaml` around lines 1597 - 1602, The OpenAPI
schema currently allows any string for shareLimitAction and shareLimitsMode;
update the properties in internal/web/swagger/openapi.yaml to add explicit enum
constraints: for shareLimitAction (the property named shareLimitAction) set
type: string and enum: ["-1","0","1","2","3"] (matching
-1=default,0=stop,1=remove,2=enable super seeding,3=remove with content) and for
shareLimitsMode (the property named shareLimitsMode) set type: string and enum:
["-1","0","1"] (matching -1=default,0=match any,1=match all), keeping or
clarifying the existing descriptions to reflect these allowed values.
web/src/components/torrents/TorrentDialogs.tsx (1)

1586-1589: ⚡ Quick win

Consider stricter typing for the new optional parameters.

The shareLimitAction and shareLimitsMode parameters are currently typed as string, but based on the Select options (lines 1946-1950, 1966-1968), they have a finite set of valid values. Consider using union types for better type safety:

shareLimitAction?: "0" | "1" | "2" | "3"
shareLimitsMode?: "0" | "1"

This would prevent invalid values at compile time and improve IDE autocomplete.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/components/torrents/TorrentDialogs.tsx` around lines 1586 - 1589, The
onConfirm callback in TorrentDialogs.tsx currently types shareLimitAction and
shareLimitsMode as generic strings; tighten these to unions matching the select
options (e.g., shareLimitAction?: "0" | "1" | "2" | "3" and shareLimitsMode?:
"0" | "1") so callers and consumers of onConfirm (the onConfirm signature/type)
get compile-time validation and improved autocomplete; update the onConfirm
parameter types where it's declared and any related usages/props to use the new
union types.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/services/automations/service.go`:
- Around line 2754-2756: The success/dry-run aggregation omits action/mode so
different action/mode batches with identical numeric limits collide; update the
aggregation keys and details to include key.action and key.mode wherever counts
and JSON details are created/updated (e.g., the map used for limitCounts and the
detailsJSON construction that currently uses key.ratio, key.seed, key.inactive,
"count", and "type"); ensure any code paths that increment or merge entries
(references to limitCounts, detailsJSON, and the key variable) include action
and mode fields so entries are unique per action/mode combination.

In `@web/src/components/torrents/TorrentManagementBar.tsx`:
- Line 244: The ternary spacing in the assignment to variable target is
incorrect: change the expression in the target initialization that uses
separatorIndex (the line starting with const target = separatorIndex > 0? {) so
there is a space before the question mark (i.e. separatorIndex > 0 ? ...) to
comply with ESLint `@stylistic` spacing rules; locate the target declaration in
TorrentManagementBar (using the target and separatorIndex identifiers) and
update the ternary spacing accordingly.

---

Outside diff comments:
In `@internal/qbittorrent/sync_manager.go`:
- Around line 5499-5518: The code fails because qbt.MonitoredFolders does not
exist; update NormalizeScanDirsPreference to unmarshal into a concrete type the
qBittorrent API returns (e.g. map[string]string) or a generic map[string]any if
uncertain: replace the qbt.MonitoredFolders variable with var scanDirs
map[string]string (or map[string]any), unmarshal into that, and set
prefs["scan_dirs"] = scanDirs; alternatively remove the function if you don't
want to normalize yet. Ensure references to qbt.MonitoredFolders in
NormalizeScanDirsPreference are removed and tests/usage expecting the preference
shape are adjusted accordingly.

In `@internal/services/automations/service.go`:
- Around line 2561-2566: The code currently computes needsUpdate as only ratio
or seeding changes, so changes that only alter state.shareLimitAction or
state.shareLimitsMode never enqueue torrents into shareBatches; update the logic
around needsUpdate (the block building shareKey and appending to shareBatches)
to also detect action/mode-only changes by adding checks (e.g.,
actionNeedsUpdate := state.shareLimitAction != currentAction and modeNeedsUpdate
:= state.shareLimitsMode != currentMode) and include them in the needsUpdate OR
condition so shareBatches[key] is populated when shareLimitAction or
shareLimitsMode differ even if ratio/seeding are unchanged.

In `@web/src/components/torrents/TorrentCardsMobile.tsx`:
- Around line 119-124: The mobile submit path (handleSubmit) doesn't forward the
new shareLimitAction and shareLimitsMode parameters to onConfirm, so update
TorrentCardsMobile.tsx by adding component state and UI controls for
shareLimitAction and shareLimitsMode (or appropriate toggles/selects), bind them
to those state values, and then include them in the onConfirm call (e.g.,
onConfirm(ratioEnabled ? ratioLimit : -1, seedingTimeEnabled ? seedingTimeLimit
: -1, inactiveSeedingTimeEnabled ? inactiveSeedingTimeLimit : -1,
shareLimitActionValue, shareLimitsModeValue) ), ensuring sensible defaults when
controls are not set so mobile can configure the new qBittorrent 5.2+ options;
alternatively if you prefer not to implement the UI yet, remove the extra
parameters from the onConfirm type/signature used by TorrentCardsMobile to keep
behavior consistent.

---

Nitpick comments:
In `@internal/models/automation.go`:
- Around line 883-889: The ShareLimitsAction struct currently uses *string for
ShareLimitAction and ShareLimitsMode which allows invalid values; change those
fields to pointer types of constrained enums (e.g., *ShareLimitActionValue and
*ShareLimitsModeValue) and add the new types and constants
(ShareLimitActionValue, ShareLimitsModeValue and their allowed consts like
ShareLimitActionDefault/Stop/Remove/Super/RemoveWithContent and
ShareLimitsModeDefault/Any/All) near other model types; implement simple
validation by adding a Validate method or UnmarshalJSON on those enum types to
reject values not in the allowed set and keep the existing json tags so
marshaling/unmarshaling behavior is preserved.

In `@internal/web/swagger/openapi.yaml`:
- Around line 1597-1602: The OpenAPI schema currently allows any string for
shareLimitAction and shareLimitsMode; update the properties in
internal/web/swagger/openapi.yaml to add explicit enum constraints: for
shareLimitAction (the property named shareLimitAction) set type: string and
enum: ["-1","0","1","2","3"] (matching -1=default,0=stop,1=remove,2=enable super
seeding,3=remove with content) and for shareLimitsMode (the property named
shareLimitsMode) set type: string and enum: ["-1","0","1"] (matching
-1=default,0=match any,1=match all), keeping or clarifying the existing
descriptions to reflect these allowed values.

In `@web/src/components/torrents/TorrentDialogs.tsx`:
- Around line 1586-1589: The onConfirm callback in TorrentDialogs.tsx currently
types shareLimitAction and shareLimitsMode as generic strings; tighten these to
unions matching the select options (e.g., shareLimitAction?: "0" | "1" | "2" |
"3" and shareLimitsMode?: "0" | "1") so callers and consumers of onConfirm (the
onConfirm signature/type) get compile-time validation and improved autocomplete;
update the onConfirm parameter types where it's declared and any related
usages/props to use the new union types.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 827d11b6-be2a-4b73-8ed1-39eaf28ea46a

📥 Commits

Reviewing files that changed from the base of the PR and between 3c5cf3b and 5660d68.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (19)
  • documentation/docs/advanced/compatibility.md
  • documentation/docs/features/automations.md
  • go.mod
  • internal/api/handlers/capabilities.go
  • internal/api/handlers/torrents.go
  • internal/models/automation.go
  • internal/qbittorrent/client.go
  • internal/qbittorrent/sync_manager.go
  • internal/services/automations/processor.go
  • internal/services/automations/service.go
  • internal/web/swagger/openapi.yaml
  • web/src/components/instances/preferences/WorkflowDialog.tsx
  • web/src/components/torrents/TorrentCardsMobile.tsx
  • web/src/components/torrents/TorrentDialogs.tsx
  • web/src/components/torrents/TorrentManagementBar.tsx
  • web/src/components/torrents/TorrentTableOptimized.tsx
  • web/src/hooks/useTorrentActions.ts
  • web/src/lib/api.ts
  • web/src/types/index.ts

Comment thread internal/services/automations/service.go
Comment thread web/src/components/torrents/TorrentManagementBar.tsx Outdated
@martylukyy martylukyy added this to the v1.17.0 milestone May 11, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/src/hooks/useTorrentActions.ts`:
- Around line 396-397: The succeededLabel ternary is redundant and stylistically
compressed; replace it with a simpler expression using the literal "succeeded"
(e.g. succeeded.length > 0 ? `${succeeded.join(" and ")} succeeded` : "") and
ensure consistent spacing around the ? and : operators; also normalize
failedLabel spacing similarly (e.g. failed.length > 0 ? `${failed.map(r =>
r.action).join(" and ")} failed` : "tag update failed") so both labels are
readable and lint-friendly, referencing the succeededLabel and failedLabel
variables to locate the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0f23783f-cc2f-43a3-b4b3-511bd90e9404

📥 Commits

Reviewing files that changed from the base of the PR and between 5660d68 and 4e3284d.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (19)
  • documentation/docs/advanced/compatibility.md
  • documentation/docs/features/automations.md
  • go.mod
  • internal/api/handlers/capabilities.go
  • internal/api/handlers/torrents.go
  • internal/models/automation.go
  • internal/qbittorrent/client.go
  • internal/qbittorrent/sync_manager.go
  • internal/services/automations/processor.go
  • internal/services/automations/service.go
  • internal/web/swagger/openapi.yaml
  • web/src/components/instances/preferences/WorkflowDialog.tsx
  • web/src/components/torrents/TorrentCardsMobile.tsx
  • web/src/components/torrents/TorrentDialogs.tsx
  • web/src/components/torrents/TorrentManagementBar.tsx
  • web/src/components/torrents/TorrentTableOptimized.tsx
  • web/src/hooks/useTorrentActions.ts
  • web/src/lib/api.ts
  • web/src/types/index.ts
✅ Files skipped from review due to trivial changes (3)
  • documentation/docs/features/automations.md
  • documentation/docs/advanced/compatibility.md
  • web/src/lib/api.ts
🚧 Files skipped from review as they are similar to previous changes (15)
  • go.mod
  • internal/web/swagger/openapi.yaml
  • internal/models/automation.go
  • internal/api/handlers/capabilities.go
  • web/src/components/torrents/TorrentManagementBar.tsx
  • web/src/types/index.ts
  • internal/qbittorrent/sync_manager.go
  • internal/services/automations/service.go
  • internal/qbittorrent/client.go
  • web/src/components/torrents/TorrentTableOptimized.tsx
  • internal/api/handlers/torrents.go
  • web/src/components/torrents/TorrentDialogs.tsx
  • web/src/components/instances/preferences/WorkflowDialog.tsx
  • internal/services/automations/processor.go
  • web/src/components/torrents/TorrentCardsMobile.tsx

Comment thread web/src/hooks/useTorrentActions.ts Outdated
@martylukyy martylukyy force-pushed the feat/support-new-share-limit-params branch 3 times, most recently from f75b4ef to 1d22eee Compare May 11, 2026 13:11
@martylukyy martylukyy force-pushed the feat/support-new-share-limit-params branch from 1d22eee to fc8d0a9 Compare May 11, 2026 13:14
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/src/components/torrents/TorrentCardsMobile.tsx (1)

109-124: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Mobile dialog never provides the new share-limit params

Line 109 expands onConfirm, but Line 120-Line 124 still invoke it with only ratio/time values and no dialog state for shareLimitAction / shareLimitsMode. As a result, the values forwarded later are always undefined, so the new qBittorrent 5.2 options are not actually configurable from mobile.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/components/torrents/TorrentCardsMobile.tsx` around lines 109 - 124,
The mobile dialog's handleSubmit calls onConfirm without passing the new
share-limit parameters, so shareLimitAction/shareLimitsMode are always
undefined; update the component (add state hooks for shareLimitAction and
shareLimitsMode if not present) and modify handleSubmit to pass those values
(e.g., pass shareLimitAction and shareLimitsMode or their defaults) into
onConfirm along with the existing ratio/time arguments; ensure the onConfirm
signature declared at top matches and use the local state variables
(shareLimitAction, shareLimitsMode) when invoking onConfirm in handleSubmit.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@web/src/components/torrents/TorrentCardsMobile.tsx`:
- Around line 109-124: The mobile dialog's handleSubmit calls onConfirm without
passing the new share-limit parameters, so shareLimitAction/shareLimitsMode are
always undefined; update the component (add state hooks for shareLimitAction and
shareLimitsMode if not present) and modify handleSubmit to pass those values
(e.g., pass shareLimitAction and shareLimitsMode or their defaults) into
onConfirm along with the existing ratio/time arguments; ensure the onConfirm
signature declared at top matches and use the local state variables
(shareLimitAction, shareLimitsMode) when invoking onConfirm in handleSubmit.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 18081851-1ab3-453d-8457-73ef3c80d8a1

📥 Commits

Reviewing files that changed from the base of the PR and between 4e3284d and fc8d0a9.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (19)
  • documentation/docs/advanced/compatibility.md
  • documentation/docs/features/automations.md
  • go.mod
  • internal/api/handlers/capabilities.go
  • internal/api/handlers/torrents.go
  • internal/models/automation.go
  • internal/qbittorrent/client.go
  • internal/qbittorrent/sync_manager.go
  • internal/services/automations/processor.go
  • internal/services/automations/service.go
  • internal/web/swagger/openapi.yaml
  • web/src/components/instances/preferences/WorkflowDialog.tsx
  • web/src/components/torrents/TorrentCardsMobile.tsx
  • web/src/components/torrents/TorrentDialogs.tsx
  • web/src/components/torrents/TorrentManagementBar.tsx
  • web/src/components/torrents/TorrentTableOptimized.tsx
  • web/src/hooks/useTorrentActions.ts
  • web/src/lib/api.ts
  • web/src/types/index.ts
✅ Files skipped from review due to trivial changes (1)
  • documentation/docs/advanced/compatibility.md
🚧 Files skipped from review as they are similar to previous changes (17)
  • internal/models/automation.go
  • go.mod
  • internal/web/swagger/openapi.yaml
  • web/src/lib/api.ts
  • internal/qbittorrent/client.go
  • web/src/components/torrents/TorrentTableOptimized.tsx
  • web/src/hooks/useTorrentActions.ts
  • web/src/types/index.ts
  • internal/services/automations/service.go
  • internal/qbittorrent/sync_manager.go
  • web/src/components/instances/preferences/WorkflowDialog.tsx
  • web/src/components/torrents/TorrentDialogs.tsx
  • documentation/docs/features/automations.md
  • internal/api/handlers/torrents.go
  • web/src/components/torrents/TorrentManagementBar.tsx
  • internal/api/handlers/capabilities.go
  • internal/services/automations/processor.go

@martylukyy martylukyy marked this pull request as draft May 12, 2026 13:58
@martylukyy martylukyy marked this pull request as ready for review May 14, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/backend Backend changes area/frontend Frontend changes backend enhancement New feature or request go Pull requests that update go code qbit-native-feature torrent web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant