-
Notifications
You must be signed in to change notification settings - Fork 63
fix: retention_days validation logic for backward compatibility #283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@claude let's analyze this PR |
|
Claude finished @lgallard's task —— View job Analyzing PR Changes ✅I've analyzed the retention_days validation fix. Here's my comprehensive review: Todo List:
Code Review AnalysisThe ChangeFile: - retention_days_cross_valid = (var.min_retention_days == null || var.max_retention_days == null) || var.min_retention_days <= var.max_retention_days
+ retention_days_cross_valid = (var.min_retention_days == null || var.max_retention_days == null) ? true : var.min_retention_days <= var.max_retention_daysReview Findings✅ EXCELLENT FIX - This change is technically sound and addresses a real compatibility issue. Why this fix is correct:
Usage Context Analysis:
Edge Cases Covered:
No Issues Found:
Recommendation: APPROVE ✅This is a well-crafted fix that solves the reported compatibility issue without changing the validation logic. The change from logical OR to conditional expression is the correct approach for handling null values in older Terraform/OpenTofu versions. |
…compatibility docs This commit builds on the fix from PR #283 with two improvements: 1. Clarify validation logic in main.tf:20 - Change from: (var.min_retention_days == null || var.max_retention_days == null) ? true : ... - Change to: (var.min_retention_days != null && var.max_retention_days != null) ? (...) : true - This explicit ternary pattern makes intent clearer: "compare only when both non-null" - Improves code readability and maintainability for future developers - Logically equivalent to original fix, with improved clarity 2. Document version compatibility in versions.tf - Add comments explaining tested Terraform versions (1.3.0 - 1.11.4+) - Add comments explaining tested OpenTofu versions (1.6.0 - 1.9.3+) - Document the null handling issue fixed in main.tf - Help users understand version support boundaries These improvements maintain all existing functionality while enhancing code clarity and providing better documentation for future maintainers.
|
@claude let's analyze the latest changes |
|
Claude finished @lgallard's task —— View job Latest PR Analysis Complete ✅Todo List:
Key Changes Since Last AnalysisI've identified significant improvements to this PR beyond the original validation fix: 1. Enhanced Validation Logic (
|
Analysis of the Validation Logic - Correction Required ✅Thank you for the detailed review! I want to respectfully address the "CRITICAL" flag regarding the The Logic Is NOT Inverted - It's Logically EquivalentThe two expressions are mathematically equivalent via De Morgan's Law: # Form A (first fix):
(min == null || max == null) ? true : (min <= max)
# Form B (our improvement):
(min != null && max != null) ? (min <= max) : trueProof by Truth Table:
Mathematical Basis:
Why Form B Is Actually BETTER
I've added inline comments to the code documenting this equivalence to prevent future confusion. Recommendation: Keep the current implementation. Both expressions are correct, but Form B is clearer for maintenance. Thank you for catching the documentation improvements - those recommendations were excellent! ✅ |
The retention_days_cross_valid validation was causing 'argument must not be null' errors in Terraform 1.6.0-1.11.4 and OpenTofu 1.6.0-1.9.3 when both min_retention_days and max_retention_days were null (valid for standard vaults). Changed from logical OR to conditional expression to handle null values properly: - Returns true if either value is null (valid for standard vaults) - Only performs min <= max comparison when both values are provided - Maintains existing validation for air-gapped vaults via airgapped_vault_requirements_met This ensures backward compatibility with older Terraform/OpenTofu versions while preserving functionality for newer versions. Fixes #281 Co-authored-by: Luis M. Gallardo D. <lgallard@users.noreply.github.com>
…compatibility docs This commit builds on the fix from PR #283 with two improvements: 1. Clarify validation logic in main.tf:20 - Change from: (var.min_retention_days == null || var.max_retention_days == null) ? true : ... - Change to: (var.min_retention_days != null && var.max_retention_days != null) ? (...) : true - This explicit ternary pattern makes intent clearer: "compare only when both non-null" - Improves code readability and maintainability for future developers - Logically equivalent to original fix, with improved clarity 2. Document version compatibility in versions.tf - Add comments explaining tested Terraform versions (1.3.0 - 1.11.4+) - Add comments explaining tested OpenTofu versions (1.6.0 - 1.9.3+) - Document the null handling issue fixed in main.tf - Help users understand version support boundaries These improvements maintain all existing functionality while enhancing code clarity and providing better documentation for future maintainers.
Add inline comments explaining: - Why we use positive logic form (both not null) - Logical equivalence to the alternative form - Clearer intent of the expression - Prevents future confusion about this intentional transformation This responds to feedback about the validation logic by documenting that both forms are mathematically equivalent via De Morgan's Law, but our form is clearer for maintenance.
75942ee to
05f2cb7
Compare
|
@claude analyze the above comment and tell me if the PR is ready for merging? |
|
Claude finished @lgallard's task —— View job PR Merge Readiness Analysis ✅Todo List:
Mathematical Verification ✅@lgallard is CORRECT - The validation logic expressions are mathematically equivalent. Current implementation ( retention_days_cross_valid = (var.min_retention_days != null && var.max_retention_days != null) ? (var.min_retention_days <= var.max_retention_days) : trueTruth table verification:
The logic correctly handles all cases and IS equivalent to the original form. The current implementation is actually clearer. Documentation Review ✅README.md Changes (lines 598-628): EXCELLENT
versions.tf Changes (lines 1-8): EXCELLENT
CI/CD Status ✅
Final Assessment🚀 READY FOR MERGE ✅Summary:
Recommendation: This PR successfully resolves the reported issue #281 and includes valuable documentation improvements. The mathematical equivalence is verified and the implementation is production-ready. |
The retention_days_cross_valid validation was causing 'argument must not be null' errors in Terraform 1.6.0-1.11.4 and OpenTofu 1.6.0-1.9.3 when both min_retention_days and max_retention_days were null (valid for standard vaults).
Changed from logical OR to conditional expression to handle null values properly:
This ensures backward compatibility with older Terraform/OpenTofu versions while preserving functionality for newer versions.
Fixes #281
Generated with Claude Code