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
Entrypoints Changes in 0.34 #3953
Comments
😓 TBH this is a surprise for me, too. I'll have a look. Thanks for raising this. |
Also, as I pointed out in my repo's issue, all unit tests are broken for https://github.com/christophwille/dotnet-opa-wasm/blob/master/src/Opa.Wasm.UnitTests/MultiEntryPointTests.cs which is suprising as they are using the exact same rego as the npm-opa-wasm multi-entry point test sample app. 0.34 compiles a different wasm than 0.33, because entrypoints are no longer there (line 20), and basically all my outputs are []. |
So from playing with npm-opa-wasm's entrypoint tests, nothing seems to have changed. The plain JSON string returned from here is
This is tested using opa from main, which is not significantly different from 0.34.0. Could this be related to how the test data modules are built? |
Could you try playing with the |
Hunh, interesting. Great catch, I wouldn't have searched in the batch file because it worked fine with 0.33. Yes, replacing ' with " makes the wasm files work again. I copied the cmd line from the JS sample, and it definitely worked until 0.34. So some cmd line parsing in the Windows OPA exec most likely changed. |
Yeah that would also be a bit of a surprise. 🤔 But anyhow, the curious thing is that your single-quotes entrypoint strings make it that far and haven't been caught earlier. This makes me suspect that there's some golang-string-to-ast-string (or vice-versa) conversion happening that shouldn't happen. |
Well, one more thing could be at play here - I think I previously always used cmd.exe, but last month I reinstalled my machine from zero, and now the default is Windows Terminal with PS Core. So maybe .bat in Terminal is the thing that broke the ' handling. |
That sounds like a good lead. Would you be able to verify that somehow? |
Have you ensured that the multi.wasm is properly rebuilt and copied into the right place? If you want me to have a look and double check, please share it. |
I double-checked in terms of Clean + directory delete |
So I've tried to see what happens when an entrypoint is provided with extra single quotes: it will not work 😄 So the entrypoint will get recorded in the wasm file, and it's usable, but it won't miraculously compile and call the right data functions, but yield an immediate undefined. (I've changed the npm-opa-wasm module's multi-ep tests to pass |
@christophwille can you point me to the multi.wasm you've produced there? I'd be happy to have a look. |
This one is built using
|
That wasm file was basically no content, it's an example of the case I've described above: the entrypoint doesn't match anything -- there's no Could you go with |
Yes, I am going with " because it is consistent with the other cmd lines in that batch file anyways. Given that it doesn't match anything - don't you think this warrants an error? (User adding -e invalidentrypoint to the cmd line) Is there a case for not doing anything silently? |
Sorry, I was imprecise: it doesn't match any rules -- we don't know the data, though. You should be able to query |
I tend to agree that if |
Yeah that sounds like a good compromise! I'll create a new issue later today. |
Let's track this in #3957. Thanks for reporting this! 😃 |
See christophwille/dotnet-opa-wasm#21
I debugged into it and the change seems to be that entrypoints now adds apostrophes which it didn't before:
{"'example'":0,"'example/one'":1}
So, question: intentional change (I presume yes), but about the calling convention for an SDK: do you expect people passing an entry point to include the apostrophes (part of the entrypoint name) or without?
The text was updated successfully, but these errors were encountered: