Skip to content

Parse DISABLE_DELAYED_REQUEUE_BATCHES=false as false - #856

Open
neuromanskie wants to merge 1 commit into
resque:masterfrom
neuromanskie:parse-disable-batches-env
Open

neuromanskie wants to merge 1 commit into
resque:masterfrom
neuromanskie:parse-disable-batches-env

Conversation

@neuromanskie

@neuromanskie neuromanskie commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #845.

Env used !! on the raw env string, so "false" disabled batching. The disable_delayed_requeue_batches= writer now parses strings with the same to_bool the env fallback uses, keeps native booleans, and treats nil as unset. Env passes the option through as-is.


Made by Claude Opus 5.5 in Claude Code.

Summary by CodeRabbit

  • Bug Fixes
    • The delayed requeue batches setting now correctly interprets true and false values from the environment and preserves explicit false values.
    • The command-line option continues to enable the setting, and an existing setting is preserved when no command-line or environment override is provided.

Co-authored-by: Patrick Tulskie <patricktulskie@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 272ac5de-dfe9-4693-bdc0-97f9e19ac60b
Commits

Reviewing files that changed from the base of the PR and between a4323b1 and 79dd72d.

Files selected for processing: 4
  • lib/resque/scheduler/configuration.rb
  • lib/resque/scheduler/env.rb
  • test/cli_test.rb
  • test/env_test.rb

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Walkthrough

The configuration setter now converts non-nil values to booleans and preserves nil. Environment setup passes the option through unchanged. Tests cover environment strings, the command-line flag, explicit false, and an absent override.

Changes: Delayed requeue batching configuration

Layer / File(s) Summary
Boolean assignment and regression coverage
lib/resque/scheduler/configuration.rb, lib/resque/scheduler/env.rb, test/cli_test.rb, test/env_test.rb
The setter converts non-nil values with to_bool, and environment setup passes values through unchanged. Tests cover environment values, the command-line flag, explicit false, and an absent override.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

Suggested reviewers: onyxraven, patricktulskie

Merge Risk: Minimal · up to 79dd7

The environment, CLI, explicit boolean, and fallback behaviors are correctly preserved, with no actionable merge risk identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: parsing DISABLE_DELAYED_REQUEUE_BATCHES=false as false.
Linked Issues check Passed Issue #845 is the only active direct link. Its coding requirements are met at the reviewed head.

[#845] Parse environment boolean strings before assignment:
- lib/resque/scheduler/configuration.rb: `…
Out of Scope Changes check Passed The changed files are lib/resque/scheduler/configuration.rb, lib/resque/scheduler/env.rb, test/cli_test.rb, and test/env_test.rb. Each change supports #845:
- configuration.rb: the writer now parses s…
Full details: Linked Issues check

Explanation

Issue #845 is the only active direct link. Its coding requirements are met at the reviewed head.

[#845] Parse environment boolean strings before assignment:

  • lib/resque/scheduler/configuration.rb: disable_delayed_requeue_batches= stores nil as nil. For every other value it stores to_bool(value).
  • to_bool uses the same TRUE_VALUES set as the existing verbose, quiet, and dynamic parsing.
  • Trace for each acceptance criterion:
    • DISABLE_DELAYED_REQUEUE_BATCHES=false: Cli#options copies the string "false". Env assigns it. The writer returns false.
    • DISABLE_DELAYED_REQUEUE_BATCHES=true: the writer returns true.
    • Value-less --disable-delayed-requeue-batches: OptionParser yields true. to_bool(true) returns true.
    • Explicit boolean false: to_bool(false) returns false.
    • Absent option: options.key? is false, so Env skips the assignment. The getter falls back to to_bool(environment['DISABLE_DELAYED_REQUEUE_BATCHES']).

[#845] Do not call the private helper from Env:

  • lib/resque/scheduler/env.rb: setup_scheduler_configuration assigns options[:disable_delayed_requeue_batches] directly. It does not call to_bool, and the !! coercion is removed.

[#845] Regression coverage:

  • The change summary reports parameterized tests in test/cli_test.rb for the 'false', 'true', and flag cases. It also reports a test in test/env_test.rb that checks an explicit false overrides a prior true. I did not read these test files. The PASS relies on the summary and on the code trace above.

Unverified detail: the change summary says the CLI tests cover the full path. I did not confirm that they exercise Env as well as Cli.

No non-coding requirements exist in #845. The PR #796 link is context only.

Full details: Out of Scope Changes check

Explanation

The changed files are lib/resque/scheduler/configuration.rb, lib/resque/scheduler/env.rb, test/cli_test.rb, and test/env_test.rb. Each change supports #845:

  • configuration.rb: the writer now parses string and boolean values with to_bool. This is the required parsing fix.
  • env.rb: the !! coercion is removed. The option is passed through, as #845 requires.
  • test/cli_test.rb and test/env_test.rb: these add regression tests for the #845 acceptance criteria.

lib/resque/scheduler/cli.rb is unchanged. The getter fallback is unchanged. No unrelated behavior was found in the reviewed files.

Behavior change to note: an empty DISABLE_DELAYED_REQUEUE_BATCHES now parses as false. Previously !! treated it as truthy. This follows from the required to_bool semantics and matches the existing getter fallback.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 4 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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.

Parse DISABLE_DELAYED_REQUEUE_BATCHES=false correctly during CLI setup

1 participant