-
Notifications
You must be signed in to change notification settings - Fork 112
fix: UUID type backward compatibility #2509
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?
Conversation
Summary of ChangesHello @surbhigarg92, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses backward compatibility for UUID type handling by modifying how types are identified and assigned. It streamlines the type inference process in Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request addresses a backward compatibility issue with UUID types. The change in src/codec.ts correctly adjusts the type inference for UUID strings, so they are now treated as string instead of unspecified. This is a good fix. The related change in src/transaction.ts simplifies parameter encoding by removing filtering for unspecified types, which is a nice cleanup.
My main feedback is that the change in src/codec.ts will likely break an existing unit test. Please see my specific comment for details on how to update the test to align with the new behavior.
I am having trouble creating individual review comments. Click here to see my feedback.
src/codec.ts (1163-1165)
This change correctly removes the special handling for UUIDs that was causing them to be inferred as unspecified. Now they will be correctly treated as strings, which fixes the backward compatibility issue.
However, this change will likely cause the test 'should determine if the uuid value is unspecified' in test/codec.ts to fail. Please update this test to reflect the new behavior, asserting that a UUID is now inferred as a string.
For example:
it('should determine if the uuid value is a string', () => {
assert.deepStrictEqual(codec.getType(uuid.v4()), {
type: 'string',
});
});b1bcd4b to
83bfad3
Compare
This PR reverts the recent change where UUID-formatted strings were implicitly treated as unspecified (untyped). That change caused regressions for customers relying on UUID-like strings being cast as STRING. This PR restores the default behavior: UUIDs will now default to STRING, ensuring stability for existing applications.
Impact on v8.4.0 Users This change affects users who adopted v8.4.0 and relied on the automatic UUID-to-untyped inference. To correctly send a UUID parameter, you must now explicitly specify the type:
javascript
const [rows1] = await database.run({
sql: "SELECT @value",
params: { value: '550e8400-e29b-41d4-a716-446655440000' },
types: {
value: "uuid" , // Explicitly specifying the type
},
});
Temporary Opt-in Flag To temporarily retain the behavior introduced in v8.4.0 (where UUIDs are treated as unspecified), customers can set the environment variable SPANNER_ENABLE_UUID_AS_UNTYPED=true.
Note: This flag causes a deprecation warning to be emitted and will be removed in a future release.
Recommendation: Customers are strongly encouraged to explicitly specify the type as 'uuid' instead of using this flag.