Skip to content
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

fix: [M3-8466] - Improve validation rules for create bucket schema #10842

Merged
merged 3 commits into from
Aug 28, 2024

Conversation

jaalah-akamai
Copy link
Contributor

Description 📝

The API currently returns an error when creating buckets, incorrectly checking for 'name' instead of 'label'. While a fix for this issue is planned for the future, we can improve our validation in the interim.

Changes 🔄

  • Update schema to account for existing validation requirements

Target release date 🗓️

N/A

Preview 📷

Before After
Screenshot 2024-08-21 at 10 46 24 AM Screenshot 2024-08-27 at 3 00 11 PM

How to test 🧪

Prerequisites

  • Ensure multicluster flag is enabled

Reproduction steps

  • Try creating a bucket with a capital letter in the name
  • Observe the request silently fails

Verification steps

  • Checkout this branch
  • Follow reproduction steps
  • Observe validation is working as intended

As an Author I have considered 🤔

Check all that apply

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/Improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

@jaalah-akamai jaalah-akamai requested a review from a team as a code owner August 27, 2024 19:14
@jaalah-akamai jaalah-akamai requested review from mjac0bs and hkhalil-akamai and removed request for a team August 27, 2024 19:14
@jaalah-akamai jaalah-akamai self-assigned this Aug 27, 2024
@jaalah-akamai jaalah-akamai added Bug Fixes for regressions or bugs Object Storage deals with Object Storage labels Aug 27, 2024
Copy link

github-actions bot commented Aug 27, 2024

Coverage Report:
Base Coverage: 82.73%
Current Coverage: 82.73%

Copy link
Contributor

@hkhalil-akamai hkhalil-akamai left a comment

Choose a reason for hiding this comment

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

Looks good!

Comment on lines +12 to +13
/^[a-z0-9.-]*$/,
'Label must consist only of lowercase letters, numbers, . (period), and - (dash).'
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also check for the restriction that names cannot have adjacent periods or dashes?

The following regex could work for that: ^(?!.*[.-]{2})[a-z0-9.-]+$

Copy link
Contributor

Choose a reason for hiding this comment

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

They also can't start with anything but a letter or a number, though that's more of an edge case like the above.

image

Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

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

Definitely an improvement upon what we have now, even if we could validate further.

Comment on lines +12 to +13
/^[a-z0-9.-]*$/,
'Label must consist only of lowercase letters, numbers, . (period), and - (dash).'
Copy link
Contributor

Choose a reason for hiding this comment

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

They also can't start with anything but a letter or a number, though that's more of an edge case like the above.

image

"@linode/validation": Fixed
---

Error validation for letter casing when creating object storage bucket now correctly appears for labels. ([#10842](https://github.com/linode/manager/pull/10842))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Error validation for letter casing when creating object storage bucket now correctly appears for labels. ([#10842](https://github.com/linode/manager/pull/10842))
Lack of `label` error validation for letter casing when creating Object Storage bucket ([#10842](https://github.com/linode/manager/pull/10842))

Suggestion is based on our best practices:

For Fixed changesets, describe the bug that needed to be fixed, rather than the fix itself. (e.g. say "Missing button labels in action buttons" rather than "Make label prop required for action buttons").

Begin a changeset with a capital letter, but do not end it with a period; it's not a complete sentence.

@mjac0bs mjac0bs added the Approved Multiple approvals and ready to merge! label Aug 27, 2024
@jaalah-akamai jaalah-akamai merged commit 6c9ad93 into linode:develop Aug 28, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! Bug Fixes for regressions or bugs Object Storage deals with Object Storage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants