Skip to content

Conversation

@gagik
Copy link
Contributor

@gagik gagik commented Mar 26, 2025

Screenshot 2025-03-27 at 2 12 02 PM

8.1 supports a new 'errorAndLog' validation action. This adds this to the schema validator UI.

Checklist

  • Verify this works as expected in <8.1
  • Verify this works as expected in >= 8.1
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@github-actions github-actions bot added the feat label Mar 26, 2025
export const hasErrorAndLogValidationActionSupport = (
serverVersion: string
) => {
return semver.gte(serverVersion, '8.1.0');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sometimes it happens that the version we get from a server is malformed or missing and this will make this code throw breaking the whole tab, we should probably fallback to false in this case

Copy link
Member

@Anemy Anemy Mar 27, 2025

Choose a reason for hiding this comment

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

Ah nice catch! I forgot about that, it is an easy pitfall I could see us running into in the future (and has burned us before). We could have a separate shared util for doing this version check, maybe in compass-utils? I can create a ticket if that's something we would want. @gribnoysup

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed; would be good to abstract away the semver dependency in general as well

Copy link
Collaborator

Choose a reason for hiding this comment

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

We have this one https://jira.mongodb.org/browse/COMPASS-7129 (we wanted to reopen it, but didn't, I just moved it back to open) and yeah, having something in compass-utils would probably be sufficient as a resolution

serverVersion: string
) => {
try {
return semver.gte(serverVersion, '8.1.0-rc.0');
Copy link
Contributor Author

@gagik gagik Mar 27, 2025

Choose a reason for hiding this comment

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

seems worthwhile to do this if someone is trying the RC version for whatever reason.

not sure if we'd rather make it stricter and let it just be 8.1.0 as semver is strict about pre-releases otherwise; alternatively we can also semver.coerce(serverVersion)

@gagik gagik force-pushed the gagik/add-errorandlog branch from 61fac6a to bc40db5 Compare March 27, 2025 13:05
@gagik gagik marked this pull request as ready for review March 27, 2025 13:06
@gagik gagik changed the title feat(compass-schema-validator): add validationAction 'errorAndLog' COMPASS-8983 feat(compass-schema-validator): add validation action option for 'errorAndLog' with 8.1 COMPASS-8983 Mar 27, 2025
@gagik gagik requested a review from gribnoysup March 27, 2025 13:14
screen.queryByTestId('validation-action-error-and-log-option')
).is.null;

screen.getByTestId('validation-action-selector').click();
Copy link
Collaborator

@gribnoysup gribnoysup Mar 28, 2025

Choose a reason for hiding this comment

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

Small nit, not sure if there's some special reason to do it that way in your case or not, but if not generally speaking testing library recomments using userEvent for this because it emulates user clicks better (you can see it being done in other tests in this file)

Suggested change
screen.getByTestId('validation-action-selector').click();
userEvent.click(screen.getByTestId('validation-action-selector'))

@gagik gagik merged commit 3fb5f2f into main Mar 28, 2025
7 of 8 checks passed
@gagik gagik deleted the gagik/add-errorandlog branch March 28, 2025 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants