fix: credit then invoice config name#4398
Conversation
📝 WalkthroughWalkthroughThis PR standardizes the configuration field naming for the credit-then-invoice feature from snake_case to camelCase. The struct tag, default configuration key, example config, and e2e test configuration are all updated consistently to use ChangesCredit Configuration Naming
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
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 `@app/config/credits.go`:
- Line 11: The new YAML key change breaks backward compatibility; update the
config parsing so both the new field EnableCreditThenInvoice
(yaml:"enableCreditThenInvoice") and the legacy key enable_credit_then_invoice
are supported during migration: either add a second struct field (e.g.,
LegacyEnableCreditThenInvoice bool `yaml:"enable_credit_then_invoice"`) and
coalesce its value into EnableCreditThenInvoice after unmarshalling, or
implement a custom UnmarshalYAML for the config struct that reads both keys and
sets EnableCreditThenInvoice when the legacy key is present; ensure precedence
rules (explicit new key wins) and that default behavior remains unchanged when
neither key is present.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ab49f75c-7e69-4f21-b6c0-1cdd16aa558b
📒 Files selected for processing (3)
app/config/credits.goconfig.example.yamle2e/config.yaml
| type CreditsConfiguration struct { | ||
| Enabled bool `yaml:"enabled"` | ||
| EnableCreditThenInvoice bool `yaml:"enable_credit_then_invoice"` | ||
| EnableCreditThenInvoice bool `yaml:"enableCreditThenInvoice"` |
There was a problem hiding this comment.
Please keep backward compatibility for the legacy key during migration.
At Line 11 and Line 24, switching only to enableCreditThenInvoice can break existing configs still using enable_credit_then_invoice and silently change behavior (defaulting to false). Could we support both keys for at least one transition window (or add explicit migration handling)?
Also applies to: 24-24
🤖 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 `@app/config/credits.go` at line 11, The new YAML key change breaks backward
compatibility; update the config parsing so both the new field
EnableCreditThenInvoice (yaml:"enableCreditThenInvoice") and the legacy key
enable_credit_then_invoice are supported during migration: either add a second
struct field (e.g., LegacyEnableCreditThenInvoice bool
`yaml:"enable_credit_then_invoice"`) and coalesce its value into
EnableCreditThenInvoice after unmarshalling, or implement a custom UnmarshalYAML
for the config struct that reads both keys and sets EnableCreditThenInvoice when
the legacy key is present; ensure precedence rules (explicit new key wins) and
that default behavior remains unchanged when neither key is present.
Overview
We use camelCase for these variables.
Notes for reviewer
Summary by CodeRabbit
enable_credit_then_invoicetoenableCreditThenInvoice. Users must update existing configuration files to use the new key name.