Add immutable builder-based SDK configuration#22
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughImmutable Lombok Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Poem
🚥 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)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
docs/plans/2026-04-10-sdk-configuration-design.md (1)
18-18: Optional: Minor hyphenation style.The static analysis flagged "rarely-changed" — compound modifiers with adverbs ending in "-ly" typically don't require hyphenation ("rarely changed URL"). This is a trivial style nit and entirely optional to address.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/plans/2026-04-10-sdk-configuration-design.md` at line 18, In the "Environment selection" table row that currently reads "Simple, flexible; enum wrapper adds little value for a rarely-changed URL", remove the unnecessary hyphen and change "rarely-changed URL" to "rarely changed URL" so the phrase is unhyphenated; update that cell text accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@docs/plans/2026-04-10-sdk-configuration-design.md`:
- Line 18: In the "Environment selection" table row that currently reads
"Simple, flexible; enum wrapper adds little value for a rarely-changed URL",
remove the unnecessary hyphen and change "rarely-changed URL" to "rarely changed
URL" so the phrase is unhyphenated; update that cell text accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 131166f6-c215-47d7-abfa-95d75c3da02a
📒 Files selected for processing (3)
docs/plans/2026-04-10-sdk-configuration-design.mdsrc/main/java/ee/bitweb/montonio/sdk/MontonioSdkConfiguration.javasrc/test/java/ee/bitweb/montonio/sdk/MontonioSdkConfigurationTest.java
Fix hyphenation style nit in design doc: "rarely-changed" → "rarely changed". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Re: multi-merchant credential support — This was intentionally scoped out during design. Consumers who need multiple merchants simply create multiple Re: docstring coverage — The project currently has no Javadoc on any class (including the exception hierarchy merged in #21). Adding docstrings is out of scope for this configuration PR. Happy to address project-wide in a separate issue if desired. |
Remove custom builder class — let Lombok's generated build() handle @Builder.Default values. Validation moves to a package-private all-args constructor that Lombok's builder calls directly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reject explicit nulls for baseUrl, connectTimeout, requestTimeout, and tokenExpirationTime — prevents callers from overriding @Builder.Default values with null. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/main/java/ee/bitweb/montonio/sdk/MontonioSdkConfiguration.java`:
- Around line 48-55: In MontonioSdkConfiguration, after the existing null checks
for connectTimeout, requestTimeout, and tokenExpirationTime, add validation to
reject negative durations by calling duration.isNegative() on each
(connectTimeout, requestTimeout, tokenExpirationTime) and throw
MontonioValidationException with the same field name and a message like "must
not be negative" when true; ensure these checks are placed immediately after the
corresponding null checks so invalid negative Duration.ofSeconds(-1) values fail
fast during configuration.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5fe450e8-56e6-4491-890e-2d1788c23124
📒 Files selected for processing (2)
src/main/java/ee/bitweb/montonio/sdk/MontonioSdkConfiguration.javasrc/test/java/ee/bitweb/montonio/sdk/MontonioSdkConfigurationTest.java
Fail fast on negative connectTimeout, requestTimeout, and tokenExpirationTime instead of deferring the error to the HTTP/auth layer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
MontonioSdkConfigurationinto an immutable, builder-constructed configuration object with credentials (accessKey,secretKey), HTTP timeouts (connectTimeout,requestTimeout), token expiration, and environment URL constantsaccessKey,secretKey) at build time viaMontonioValidationException@Getter/@SetterPOJO with Lombok@Builder+@Getter(immutable after construction)Closes #10
Test plan
accessKey/secretKeythrowsMontonioValidationExceptionaccessKey/secretKeythrowsMontonioValidationException🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes / Validation
Tests
Documentation