Skip to content

Conversation

@wolf31o2
Copy link
Member

@wolf31o2 wolf31o2 commented Dec 7, 2025

Summary by cubic

Fixed CLI parsing so non-profiling args are preserved when handling --cpuprofile and --memprofile before Cobra init. Rebuilds os.Args with the program name and filtered args to prevent commands and options from being dropped.

Written for commit 24d2bbf. Summary will update automatically on new commits.

Summary by CodeRabbit

  • Refactor
    • Enhanced argument processing to properly handle profiling options during startup.

✏️ Tip: You can customize this high-level summary in your review settings.

Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
@wolf31o2 wolf31o2 requested a review from a team as a code owner December 7, 2025 16:05
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 7, 2025

📝 Walkthrough

Walkthrough

The change modifies argument processing in cmd/dingo/main.go to extract profiling-related flags (--cpuprofile and --memprofile) from the command-line arguments before passing them to Cobra. The code filters os.Args to separate profiling arguments from regular arguments, rebuilds os.Args with the program name followed by non-profiling arguments, and defers profiling flag handling until after argument parsing completes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Verify the filtering logic correctly identifies all profiling flag variations (both long and short forms if applicable)
  • Ensure os.Args[0] (program name) is properly preserved during reconstruction
  • Confirm that the deferred profiling flag processing still executes at the appropriate lifecycle point
  • Test edge cases: missing profiling arguments, profiling flags without values, mixing profiling and non-profiling arguments

Pre-merge checks and finishing touches

✅ Passed checks (2 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: fixing how non-profiling arguments are preserved by extracting profiling flags before Cobra initialization.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/profiling-args

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.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Copy link
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: 0

🧹 Nitpick comments (1)
cmd/dingo/main.go (1)

169-175: Consider reusing the global programName constant or renaming the local variable

The reconstruction of os.Args with the original program name is sound and nil‑safe. However, the local programName variable both duplicates the literal "dingo" and shadows the package‑level const programName. To reduce duplication and potential confusion, consider either:

  • Initializing from the global constant and only overriding from os.Args[0] when present, or
  • Renaming the local (e.g., exeName) to avoid shadowing.

This keeps intent clearer without changing behavior.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f39a0c4 and 24d2bbf.

📒 Files selected for processing (1)
  • cmd/dingo/main.go (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Analyze (go)
  • GitHub Check: nilaway
  • GitHub Check: go-test (1.25.x, ubuntu-latest)
  • GitHub Check: go-test (1.24.x, macos-latest)
  • GitHub Check: go-test (1.25.x, windows-latest)
  • GitHub Check: go-test (1.25.x, macos-latest)
  • GitHub Check: go-test (1.24.x, ubuntu-latest)
  • GitHub Check: go-test (1.24.x, windows-latest)
  • GitHub Check: lint
  • GitHub Check: docker (ubuntu-latest, amd64)
🔇 Additional comments (1)
cmd/dingo/main.go (1)

144-167: Profiling flag filtering and arg preservation look correct

The loop now cleanly strips only the --cpuprofile / --memprofile flags (both --flag=value and --flag value forms) while preserving all other arguments and their order in newArgs. This aligns with the PR objective to keep non‑profiling args intact and avoids leaking profiling flags to Cobra.

@wolf31o2 wolf31o2 merged commit 4473dcc into main Dec 8, 2025
16 of 20 checks passed
@wolf31o2 wolf31o2 deleted the fix/profiling-args branch December 8, 2025 16:06
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.

3 participants