Skip to content

fix(lua): replace deprecated global arg with {...} in log_debug#937

Merged
mhenrixon merged 1 commit intomainfrom
issue-877-lua-debug-arg
Mar 27, 2026
Merged

fix(lua): replace deprecated global arg with {...} in log_debug#937
mhenrixon merged 1 commit intomainfrom
issue-877-lua-debug-arg

Conversation

@mhenrixon
Copy link
Copy Markdown
Owner

@mhenrixon mhenrixon commented Mar 27, 2026

Summary

  • Lua's implicit arg table for variadic function arguments was removed in Lua 5.2+
  • Redis 7+ and Dragonfly use newer Lua versions that error on accessing the arg global
  • Changed ipairs(arg) to ipairs({...}) in log_debug, which works across all Lua versions

Closes #877

Test plan

  • Lua script tests: 240 examples, 0 failures
  • Full suite: 1050 examples, 0 failures

Summary by CodeRabbit

  • Bug Fixes
    • Improved debug logging by fixing argument handling to ensure all debug messages correctly include the passed parameters, enhancing troubleshooting capability for internal diagnostics.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 27, 2026

Warning

Rate limit exceeded

@mhenrixon has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 58 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 11 minutes and 58 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b07e678b-6ec8-4ed6-bce1-439b1937a736

📥 Commits

Reviewing files that changed from the base of the PR and between 8983b6e and 5e5bd56.

📒 Files selected for processing (1)
  • lib/sidekiq_unique_jobs/lua/shared/_common.lua
📝 Walkthrough

Walkthrough

Fixed a Lua compatibility bug where the log_debug function attempted to access a nonexistent arg table. Updated the variadic argument capture mechanism to use {...} syntax, which is compatible with Lua 5.2+.

Changes

Cohort / File(s) Summary
Lua Debug Logging Fix
lib/sidekiq_unique_jobs/lua/shared/_common.lua
Updated log_debug() to capture variadic arguments via local args = {...} and iterate over it, replacing the previous undefined arg table reference. Ensures compatibility with Lua 5.2+ where the global arg was removed.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A debug log once cried out in pain,
Seeking arg in the Lua domain,
But Lua 5.2 said "that's gone away!"
So variadic {...} saved the day! ✨

🚥 Pre-merge checks | ✅ 4
✅ 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 accurately describes the main change: replacing the deprecated global 'arg' with {...} in the log_debug function to fix Lua compatibility.
Linked Issues check ✅ Passed The PR directly addresses issue #877 by implementing the exact suggested fix: replacing ipairs(arg) with ipairs{...} in log_debug for Lua 5.2+ compatibility.
Out of Scope Changes check ✅ Passed The change is narrowly focused on fixing the specific Lua compatibility issue in log_debug; no out-of-scope modifications are present.

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


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

@mhenrixon mhenrixon self-assigned this Mar 27, 2026
@mhenrixon mhenrixon added the bug label Mar 27, 2026
The `arg` implicit table for variadic function arguments was removed in
Lua 5.2+. Redis 7+ and Dragonfly use newer Lua versions that don't
support this global, causing errors when debug_lua is enabled.

Replace `ipairs(arg)` with `ipairs({...})` which works across all Lua
versions.

Closes #877
@mhenrixon mhenrixon force-pushed the issue-877-lua-debug-arg branch from 8983b6e to 5e5bd56 Compare March 27, 2026 23:16
@mhenrixon mhenrixon enabled auto-merge (squash) March 27, 2026 23:16
@mhenrixon mhenrixon merged commit 488a551 into main Mar 27, 2026
32 checks passed
@mhenrixon mhenrixon deleted the issue-877-lua-debug-arg branch March 27, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lua debugging seems to be broken

1 participant