-
Notifications
You must be signed in to change notification settings - Fork 21
0.2-dev Fix Version Verifier #674
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
WalkthroughThis pull request updates function signatures across authentication and server modules to include a new Changes
Sequence Diagram(s)sequenceDiagram
participant S as startAPIServer
participant RV as NewRegistryVerifier
participant CV as NewClaimValidator
S->>RV: Call NewRegistryVerifier(logger, registry, myNodeID, serverVersion)
RV->>CV: Call NewClaimValidator(logger, serverVersion)
CV-->>RV: Return ClaimValidator
RV-->>S: Return RegistryVerifier
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Update Version Compatibility Strategy in ClaimValidatorModified version compatibility checking in 📍Where to StartThe Macroscope summarized b30f18a. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
pkg/authn/claims.go
(2 hunks)pkg/authn/claims_test.go
(2 hunks)pkg/authn/verifier.go
(2 hunks)pkg/authn/verifier_test.go
(1 hunks)pkg/server/server.go
(1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
pkg/server/server.go (1)
pkg/tracing/tracing.go (1)
logger
(27-27)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Lint-Go
🔇 Additional comments (10)
pkg/authn/verifier_test.go (1)
30-30
: Properly integrated logging into the verifier creation.The addition of the
testutils.NewLog(t)
parameter correctly aligns with the updated signature ofNewRegistryVerifier
. This change consistently propagates the logger through the authentication stack.pkg/server/server.go (1)
274-274
: Properly updated verifier instantiation with logger parameter.The addition of the logger parameter to the
NewRegistryVerifier
call is correct and aligns with the updated function signature, ensuring proper logging throughout the authentication flow.pkg/authn/claims.go (3)
7-7
: Appropriate zap logger import added.The addition of the zap logging package is necessary for the new logger parameter in
NewClaimValidator
.
18-18
: Updated function signature to include logger parameter.Adding the logger parameter to
NewClaimValidator
is consistent with the overall approach of propagating logging functionality through the authentication system.
24-28
: Improved version constraint handling for compatibility.This change correctly implements the PR objective by using a caret constraint (
^major.minor
) instead of the specific version constraint. The constraint now allows all versions with the same major and minor versions (including earlier patch versions), fixing the issue where versions 0.2.0 and 0.2.1 were excluded when the verifier constraint was 0.2.2.The added log message provides valuable debug information about which constraint is being used.
pkg/authn/claims_test.go (3)
133-134
: Helpful test version declarations for increased coverage.These new version declarations provide proper setup for the additional test cases that verify the improved version constraint behavior.
161-178
: Comprehensive test coverage for version compatibility rules.The added test cases properly verify the new version constraint behavior:
future-minor-rejects-us
confirms that a future minor version is rejectedpatch-0-accepts-us
verifies that the same major and minor version with a patch of 0 is acceptedThese tests are crucial to validate that the fix performs as expected, allowing all patch versions within the same major and minor version.
179-184
: Added test case for version 0.1.0 rejection.This test case verifies that versions with a different minor number (in this case 0.1.0) are correctly rejected, ensuring the constraint logic works as intended.
pkg/authn/verifier.go (2)
6-6
: Good addition of structured logging.Adding zap logger integration provides better observability and structured logging capabilities, which is a best practice for Go services.
30-31
: LGTM - Good dependency injection pattern.Adding the logger as a parameter follows good dependency injection patterns instead of creating loggers internally.
This is the fix for 0.2-dev. There will be another PR for main. The verifier constraint on 0.2.2 was parsed as ^0.2.2 which does not allow for 0.2.0 or 0.2.1. This now parses the constraint as `^0.2` which translates to `>=0.2.0 and <0.3.0` Relates to #670. The fix to main will be closing this issue. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Enhanced backend authentication and verification processes by integrating improved logging that offers clearer traceability for version compatibility. This streamlining of version handling helps ensure smoother and more maintainable internal synchronization. - **Tests** - Expanded test coverage with new scenarios that rigorously validate version compatibility across various version increments, reinforcing robust system behavior and stability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This is the fix for 0.2-dev. There will be another PR for main.
The verifier constraint on 0.2.2 was parsed as ^0.2.2 which does not allow for 0.2.0 or 0.2.1.
This now parses the constraint as
^0.2
which translates to>=0.2.0 and <0.3.0
Relates to #670. The fix to main will be closing this issue.
Summary by CodeRabbit
Refactor
Tests