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

Bug fixes and improvements to release directives and channels commands #1983

Conversation

sfc-gh-melnacouzi
Copy link
Contributor

@sfc-gh-melnacouzi sfc-gh-melnacouzi commented Jan 10, 2025

Pre-review checklist

  • I've confirmed that instructions included in README.md are still correct after my changes in the codebase.
  • I've added or updated automated unit tests to verify correctness of my new code.
  • I've added or updated integration tests to verify correctness of my new code.
  • I've confirmed that my changes are working by executing CLI's commands manually on MacOS.
  • I've confirmed that my changes are working by executing CLI's commands manually on Windows.
  • I've confirmed that my changes are up-to-date with the target branch.
  • I've described my changes in the release notes.
  • I've described my changes in the section below.

Changes description

  • Fix messaging for errors for release channels/directives features.
  • same_identifier() replaced with unquote_identifier() check. The reason is that identifiers in SnowCLI are different than what is stored in the backend. The backend never uses quotes in its output. It uses capitalization to indicate that.

For example:

  • abc locally is the same as ABC on the server.
  • "abc" locally is the same as abc on the server but different from ABC on the server.
  • a.bc locally is the same as a.bc on the server, because it contains special characters and SnowCLI automatically quotes it.

Instead of same_identifier(local, remote_identifier), the check should change to:
unquote_identifier(local) == remote_identifier

@sfc-gh-melnacouzi sfc-gh-melnacouzi requested a review from a team as a code owner January 10, 2025 15:54
Copy link

@sfc-gh-xke sfc-gh-xke left a comment

Choose a reason for hiding this comment

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

just curious do we have test cases for quoted release directive name? I remember a quoted version name, e.g. 'verSion_1', the backend will keep the lower/upper cases. Is this the same for release directive name?

if same_identifiers(release_directive, DEFAULT_DIRECTIVE)
else f"set release directive {release_directive}"
)
if same_identifiers(release_directive, DEFAULT_DIRECTIVE):

Choose a reason for hiding this comment

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

just curious, why is it safe to use same_identifiers here instead of unquote_identifier?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

both of these values are snowCLI identifiers, so this comparison works fine. It becomes a problem if we have a backend identifier being compared with a SnowCLI/SQL identifier (which can have quotes around it).

@sfc-gh-melnacouzi
Copy link
Contributor Author

just curious do we have test cases for quoted release directive name? I remember a quoted version name, e.g. 'verSion_1', the backend will keep the lower/upper cases. Is this the same for release directive name?

test_set_release_directive_with_special_chars_in_names checks that the value is quoted when needed. A user can also provided a quoted version and this ends up on the backend as quoted. We can't verify that part in unit tests since it's a backend logic. I will add a case for this next week when I am adding the integration tests.

@sfc-gh-melnacouzi sfc-gh-melnacouzi merged commit 4ca0526 into main Jan 10, 2025
20 checks passed
@sfc-gh-melnacouzi sfc-gh-melnacouzi deleted the melnacouzi-bug-fixing-and-messaging-improvements-app-releases branch January 10, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants