Skip to content

Add logging and remove validation with developer profile querying #488

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

Merged
merged 5 commits into from
Jul 29, 2025

Conversation

shruti0085
Copy link
Contributor

@shruti0085 shruti0085 commented Jul 28, 2025

Description of changes:
There is not sufficient logging around the developer profile fetching logic in the login flow. This change adds more logging. In addition, unnecessary restrictive validation checks on the stored and returned Q developer profiles has been removed as we want to rely on the backend to give us valid results. Only validation to check the shape of the stored value is now used, if it is incorrect, we expect further calls to the backend to fail with an appropriate message.
Related issue: #485
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

@bryceitoc9 bryceitoc9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit in removing some of the validity checking.

Comment on lines 170 to 180
private boolean isValidAccountId(final String accountId) {
return accountId != null && accountId.matches("^\\d{12}$");
return StringUtils.isNotBlank(accountId);
}

private boolean isValidArn(final String arn) {
return arn != null && arn.matches("^arn:aws:codewhisperer:[a-z]{2}-[a-z]+-\\d:\\d{12}:profile/[A-Z0-9]+$");
return StringUtils.isNotBlank(arn);
}

private boolean isValidRegion(final String region) {
return region != null && region
.matches("^[a-z]{2}-(central|north|south|east|west|northeast|southeast|northwest|southwest)-(\\d)$");
return StringUtils.isNotBlank(region);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why drop these validations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the other IDEs do it and clients are not expected to. We expect validation to happen on the backend side where an incorrect value should fail with an appropriate message. Also the validity checking was too regex heavy which was leading to invalid states happening on the Eclipse side.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it's fine to not have these check, in most scenarios, users won't touch / modify the cached file (also that's what we expect). We just need to ensure serialize/de-serialize work fine then it should be good enough.

public final String getRegion() {
return identityDetails.region();
return identityDetails != null ? identityDetails.region() : null;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shruti0085 shruti0085 merged commit a8b39ac into main Jul 29, 2025
1 check passed
@shruti0085 shruti0085 deleted the shruti0085/devProfileLogs branch July 29, 2025 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants