-
Notifications
You must be signed in to change notification settings - Fork 1
jira lazy load #471
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
base: main
Are you sure you want to change the base?
jira lazy load #471
Conversation
🦋 Changeset detectedLatest commit: 462974c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
👋 bytesizedroll, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
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.
Pull Request Overview
This PR implements lazy loading for JIRA clients by allowing empty tokens during client initialization and deferring token validation until API calls are made.
- Removes token validation from client constructors to allow lazy initialization
- Adds token validation in the GetIssue method with helpful error messages
- Updates test cases to reflect the new lazy loading behavior
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
jira/client.go | Implements lazy loading by removing token validation from constructors and adding it to GetIssue method |
jira/client_test.go | Updates tests to accommodate lazy initialization and adds new test cases for token validation |
jira/converter_test.go | Updates error message expectation for consistency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
@bytesizedroll i may be missing something, but user just need to setup the env var before starting up the app which is when the |
Support Lazy Initialization for JIRA Client
Summary
Modified the JIRA client to support lazy initialization, allowing the client to be created without requiring credentials to be set upfront. Token validation now occurs when making actual API calls instead of during client construction.
Motivation
Previously,
NewClientFromDomain()
would fail immediately if theJIRA_TOKEN_{DOMAIN}
environment variable was not set, causing issues when the client is initialized early (e.g., ininit()
) but never actually used.Changes
NewClient()
: AddeddomainName
parameter and removed token validation checkNewClientFromDomain()
: No longer fails whenJIRA_TOKEN_{DOMAIN}
is missingGetIssue()
: Added token validation before making API requests with helpful error messages:"JIRA token is required but not set. Please set JIRA_TOKEN_{DOMAIN} environment variable"
"JIRA token is required but not set"
Testing
All existing tests pass with updated expectations for the new error messages.