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

KV store generation integer follow up (#1029) #1108

Merged
merged 6 commits into from
Feb 10, 2025
Merged

KV store generation integer follow up (#1029) #1108

merged 6 commits into from
Feb 10, 2025

Conversation

vcarvajal-sigsci
Copy link
Collaborator

@vcarvajal-sigsci vcarvajal-sigsci commented Feb 5, 2025

follow up to #1029

@@ -11,6 +11,9 @@ const { DICTIONARY_NAME, CONFIG_STORE_NAME, KV_STORE_NAME, SECRET_STORE_NAME } =
getEnv(serviceName);

function existingStoreId(stores, existingName) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

in setting up my fastly secret-store, it got into a state where it was null and throw an exception. Not sure if this is necessary or just something I encountered while trying to setup the integration tests.

Copy link
Member

Choose a reason for hiding this comment

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

Strange, it would be interesting to dig into the caller of this function, to see what that is happening and potentially resolve the issue at the root.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I ended up creating a feature request for the fastly cli and ended up checking for null during setup in c97a646

if (!JS_GetProperty(cx, opts_val, "gen", &gen_val)) {
return false;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the generation match integer comes across as a uint64_t, however I'm not converting it to uint64. I noticed some functions in spidermonkey that had a comment of it being non-standard, could/should I be using those?

Copy link
Member

Choose a reason for hiding this comment

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

Adding the support for BigInt can be useful for 64 bit integers effectively supporting gen: 1000n as well as gen: 1000 say. The BigInt functions are exactly what you want to use and there should be existing examples in the codebase for this as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I couldn't find a good example of converting a RootedBigInt and converting that to a uint64_t, so I left it as a number

Copy link
Member

@guybedford guybedford left a comment

Choose a reason for hiding this comment

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

Looks like a great start!

Would be worth adding a test for some of the error cases.

There's also the docs/documentation/kv-store documentation to update as well.

if (!JS_GetProperty(cx, opts_val, "gen", &gen_val)) {
return false;
}

Copy link
Member

Choose a reason for hiding this comment

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

Adding the support for BigInt can be useful for 64 bit integers effectively supporting gen: 1000n as well as gen: 1000 say. The BigInt functions are exactly what you want to use and there should be existing examples in the codebase for this as well.

@@ -11,6 +11,9 @@ const { DICTIONARY_NAME, CONFIG_STORE_NAME, KV_STORE_NAME, SECRET_STORE_NAME } =
getEnv(serviceName);

function existingStoreId(stores, existingName) {
Copy link
Member

Choose a reason for hiding this comment

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

Strange, it would be interesting to dig into the caller of this function, to see what that is happening and potentially resolve the issue at the root.

@vcarvajal-sigsci
Copy link
Collaborator Author

Looks like a great start!

Would be worth adding a test for some of the error cases.

There's also the docs/documentation/kv-store documentation to update as well.

Thanks I updated the related documentation, I'd appreciate your input on the wording. I'll look to add more error cases.

@guybedford
Copy link
Member

You can run npm run format to do the formatting step here.

For the other test failures, this is actually a CI issue that we don't clean up the secret stores properly. I've posted #1110.

Otherwise looks like this is good to land to me!

@vcarvajal-sigsci vcarvajal-sigsci marked this pull request as ready for review February 10, 2025 18:34
@vcarvajal-sigsci vcarvajal-sigsci merged commit 8a076da into main Feb 10, 2025
22 of 28 checks passed
@vcarvajal-sigsci vcarvajal-sigsci deleted the 1029 branch February 10, 2025 19:27
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.

2 participants