-
Notifications
You must be signed in to change notification settings - Fork 16
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
Updating to wapc-toolkit #86
Conversation
WalkthroughThe project underwent a significant refactoring, shifting from the deprecated Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChat with CodeRabbit Bot (
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #86 +/- ##
==========================================
- Coverage 83.14% 80.93% -2.22%
==========================================
Files 12 12
Lines 1181 1306 +125
==========================================
+ Hits 982 1057 +75
- Misses 153 187 +34
- Partials 46 62 +16 ☔ View full report in Codecov by Sentry. |
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.
Review Status
Actionable comments generated: 2
Configuration used: CodeRabbit UI
Files ignored due to filter (2)
- go.mod
- go.sum
Files selected for processing (30)
- docs/SUMMARY.md (1 hunks)
- example/echo/go/main.go (1 hunks)
- example/tac/go/main.go (1 hunks)
- example/toolkit/wasm/main.go (1 hunks)
- pkg/app/app.go (13 hunks)
- pkg/app/app_test.go (1 hunks)
- pkg/app/server.go (1 hunks)
- pkg/app/server_test.go (1 hunks)
- pkg/callbacks/callbacks.go (1 hunks)
- pkg/callbacks/httpclient/httpclient.go (1 hunks)
- pkg/callbacks/httpclient/httpclient_test.go (1 hunks)
- pkg/callbacks/kvstore/kvstore.go (1 hunks)
- pkg/callbacks/kvstore/kvstore_test.go (1 hunks)
- pkg/callbacks/metrics/metrics.go (1 hunks)
- pkg/callbacks/sql/sql.go (1 hunks)
- pkg/callbacks/sql/sql_test.go (1 hunks)
- pkg/sdk/http/http.go (1 hunks)
- pkg/sdk/http/http_test.go (1 hunks)
- pkg/sdk/kvstore/kvstore.go (1 hunks)
- pkg/sdk/metrics/metrics_test.go (1 hunks)
- pkg/sdk/sdk.go (1 hunks)
- pkg/sdk/sql/sql.go (1 hunks)
- pkg/tlsconfig/tlsconfig_test.go (1 hunks)
- pkg/wasm/wasm.go (1 hunks)
- testdata/default/main.go (1 hunks)
- testdata/fail/main.go (1 hunks)
- testdata/function/main.go (1 hunks)
- testdata/kv/main.go (2 hunks)
- testdata/logger/main.go (2 hunks)
- testdata/sql/main.go (2 hunks)
Files skipped from review due to trivial changes (19)
- docs/SUMMARY.md
- example/echo/go/main.go
- example/tac/go/main.go
- example/toolkit/wasm/main.go
- pkg/app/app_test.go
- pkg/app/server.go
- pkg/app/server_test.go
- pkg/callbacks/httpclient/httpclient.go
- pkg/callbacks/httpclient/httpclient_test.go
- pkg/callbacks/kvstore/kvstore.go
- pkg/callbacks/kvstore/kvstore_test.go
- pkg/callbacks/sql/sql.go
- pkg/callbacks/sql/sql_test.go
- pkg/sdk/http/http.go
- pkg/sdk/http/http_test.go
- pkg/sdk/kvstore/kvstore.go
- pkg/sdk/metrics/metrics_test.go
- pkg/sdk/sql/sql.go
- pkg/tlsconfig/tlsconfig_test.go
Additional comments: 21
testdata/default/main.go (1)
- 10-10: The namespace parameter in
sdk.New
has been updated to "tarmac". Ensure that this change is consistent across all instances where thesdk.New
function is called.Verification successful
The search results indicate that the namespace "tarmac" is consistently used in the
sdk.New
function calls across various test data files. This confirms that the change to the namespace parameter is applied throughout the test data.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the namespace "tarmac" is used consistently in sdk.New calls. rg --type go 'sdk\.New\(sdk\.Config{Namespace: "tarmac"' --files-with-matchesLength of output: 225
Script:
#!/bin/bash # Verify that the namespace "tarmac" is used consistently in sdk.New calls. rg --type go 'sdk\.New\(sdk\.Config\{Namespace: "tarmac"' --files-with-matchesLength of output: 218
testdata/fail/main.go (1)
- 12-12: The namespace parameter in
sdk.New
has been updated to "tarmac". Ensure that this change is consistent across all instances where thesdk.New
function is called.Verification successful
The verification process has confirmed that the namespace "tarmac" is used consistently across multiple
sdk.New
calls in various test data files within the codebase. The files listed are:
testdata/sql/main.go
testdata/function/main.go
testdata/kv/main.go
testdata/logger/main.go
testdata/default/main.go
testdata/fail/main.go
This consistency aligns with the change made in
testdata/fail/main.go
and supports the review comment's approval of the namespace update.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the namespace "tarmac" is used consistently in sdk.New calls. rg --type go 'sdk\.New\(sdk\.Config{Namespace: "tarmac"' --files-with-matchesLength of output: 225
Script:
#!/bin/bash # Correct the regex pattern to properly escape special characters and verify the namespace "tarmac" is used consistently in sdk.New calls. rg --type go 'sdk\.New\(sdk\.Config{Namespace: "tarmac"' --files-with-matchesLength of output: 225
Script:
#!/bin/bash # Correct the regex pattern by escaping all special characters and verify the namespace "tarmac" is used consistently in sdk.New calls. rg --type go 'sdk\.New\(sdk\.Config\{Namespace: "tarmac"' --files-with-matchesLength of output: 218
testdata/function/main.go (1)
- 14-14: The namespace parameter in
sdk.New
has been updated to "tarmac". Ensure that this change is consistent across all instances where thesdk.New
function is called.Verification successful
The search results indicate that the namespace "tarmac" is used consistently in
sdk.New
calls across multiple test data files. This confirms that the change to the namespace parameter is consistent in the instances checked.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the namespace "tarmac" is used consistently in sdk.New calls. rg --type go 'sdk\.New\(sdk\.Config{Namespace: "tarmac"' --files-with-matchesLength of output: 225
Script:
#!/bin/bash # Verify that the namespace "tarmac" is used consistently in sdk.New calls. rg --type go 'sdk\.New\(sdk\.Config\{Namespace: "tarmac"' --files-with-matchesLength of output: 218
testdata/logger/main.go (1)
- 16-16: The namespace parameter in
sdk.New
has been updated to "tarmac". Ensure that this change is consistent across all instances where thesdk.New
function is called.Verification successful
The corrected regex search has successfully identified multiple files in the
testdata
directory that use the namespace "tarmac" in thesdk.New
function call. This indicates that the change to the namespace parameter is consistent across these instances.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the namespace "tarmac" is used consistently in sdk.New calls. rg --type go 'sdk\.New\(sdk\.Config{Namespace: "tarmac"' --files-with-matchesLength of output: 225
Script:
#!/bin/bash # Correct the regex pattern by escaping the braces and verify the namespace "tarmac" is used consistently in sdk.New calls. rg --type go 'sdk\.New\(sdk\.Config\{Namespace: "tarmac"' --files-with-matchesLength of output: 218
testdata/sql/main.go (1)
- 16-16: The namespace parameter in
sdk.New
has been updated to "tarmac". Ensure that this change is consistent across all instances where thesdk.New
function is called.Verification successful
The verification script has successfully identified multiple files that use the namespace "tarmac" in
sdk.New
calls. This confirms that the change to the namespace parameter is consistent across various test data files in the codebase.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the namespace "tarmac" is used consistently in sdk.New calls. rg --type go 'sdk\.New\(sdk\.Config{Namespace: "tarmac"' --files-with-matchesLength of output: 225
Script:
#!/bin/bash # Correct the regex pattern by escaping the braces and verify the namespace "tarmac" is used consistently in sdk.New calls. rg --type go 'sdk\.New\(sdk\.Config\{Namespace: "tarmac"' --files-with-matchesLength of output: 218
testdata/kv/main.go (1)
- 16-16: The namespace parameter in
sdk.New
has been updated to "tarmac". Ensure that this change is consistent across all instances where thesdk.New
function is called.Verification successful
The search results indicate that the namespace "tarmac" is consistently used in the
sdk.New
calls across multiple test data files. This confirms that the change to the namespace parameter insdk.New
is consistent within the provided test data files.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the namespace "tarmac" is used consistently in sdk.New calls. rg --type go 'sdk\.New\(sdk\.Config{Namespace: "tarmac"' --files-with-matchesLength of output: 225
Script:
#!/bin/bash # Correct the regex pattern to properly escape parentheses and verify the consistent use of the namespace "tarmac" in sdk.New calls. rg --type go 'sdk\.New\(sdk\.Config\{Namespace: "tarmac"' --files-with-matchesLength of output: 218
pkg/sdk/sdk.go (1)
- 29-29: A new import for
github.com/tarmac-project/tarmac/pkg/sdk/function
has been added. Verify that the new functionality provided by this package is used appropriately within the SDK.Verification successful
The shell script output confirms that the
function
package is indeed being used within thesdk.go
file. Specifically, it shows:
- A
Function
field of type*function.Function
is declared.- A
function.New
method is called with afunction.Config
struct passed as an argument.These references indicate that the new import is not only added but also actively utilized in the SDK. Therefore, the addition of the import statement is justified and correctly implemented in the context of the changes made in the PR.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the new function package is used in the SDK. rg --type go 'github\.com/tarmac-project/tarmac/pkg/sdk/function' --files-with-matchesLength of output: 103
Script:
#!/bin/bash # Search for references to the 'function' package within the 'sdk.go' file. rg --type go 'function\.' pkg/sdk/sdk.goLength of output: 183
pkg/callbacks/metrics/metrics.go (1)
- 23-24: New imports for "regexp" and "sync" have been added. Verify that these packages are used as intended in the metrics functionality.
Verification successful
The output from the shell script confirms that the
regexp
andsync
packages are indeed used in themetrics.go
file within thepkg/callbacks/metrics
directory. This aligns with the review comment that approved the addition of these imports and requested verification of their use.Based on the provided information, it can be concluded that:
- The
regexp
andsync
imports are present in themetrics.go
file.- The script's output indicates that there are matches for
regexp
andsync
within the file, suggesting that these packages are utilized in the code.Therefore, the review comment is consistent with the changes in the codebase.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the new imports are used in the metrics package. rg --type go 'regexp|sync' --files-with-matches pkg/callbacks/metrics/metrics.goLength of output: 115
pkg/app/app.go (13)
11-23: The addition of new imports (
net/http
,pprof
,os
,os/signal
,syscall
,time
) is noted. Ensure that these new dependencies are used appropriately within the file and that their introduction does not introduce any security or performance issues.39-51: The introduction of the
DefaultNamespace
constant is a good practice for maintainability and avoiding hard-coded strings. Confirm that all instances where a default namespace is required are now using this constant.62-62: The
engine
field in theServer
struct has been changed fromwasm.Server
toengine.Server
. This change aligns with the PR's objective to transition to thewapc-toolkit
. Ensure that all methods and functions that interact with this field are updated accordingly.320-338: The creation of the
router
usingcallbacks.NewRouter
with pre and post functions is a significant change. Ensure that the logic within these functions is correct and that they handle all necessary preconditions and postconditions for callbacks.379-383: The initialization of the WASM engine with
engine.New
is a critical operation. Verify that the configuration passed toengine.New
is complete and correct, and that error handling is robust.394-402: The registration of SQLStore callbacks using
router.RegisterCallback
with the newcallbacks.CallbackConfig
structure is noted. Ensure that the callback functions such ascbSQL.Query
are implemented correctly and that theNamespace
,Capability
, andOperation
fields are set appropriately.413-451: Multiple KVStore callbacks are registered with different operations (
get
,set
,delete
,keys
). It's important to ensure that these operations are implemented correctly and that theNamespace
andCapability
are consistent across these registrations.461-469: The registration of the HTTPClient callback is noted. Ensure that the
cbHTTPClient.Call
function is implemented correctly and that theNamespace
,Capability
, andOperation
fields are set appropriately.Verification successful
The contents of
pkg/callbacks/httpclient/httpclient.go
have been provided, and they include the implementation of theHTTPClient
type and itsCall
method. TheCall
method is implemented to perform an HTTP request using the supplied JSON as configuration. It handles logging, error handling, and base64 decoding of payload data. The method signaturefunc (hc *HTTPClient) Call(b []byte) ([]byte, error)
matches the registration callrouter.RegisterCallback("httpclient", "Call", httpclient.Call)
seen in the previous output, confirming that thecbHTTPClient.Call
function is implemented correctly.The
Namespace
,Capability
, andOperation
fields in the callback registration are set appropriately as"httpclient"
,"Call"
, andhttpclient.Call
respectively. TheCall
function expects a JSON typeHTTPClientRequest
as input and returns aHTTPClientResponse
JSON type.Based on the provided information, the review comment has been addressed, and the
HTTPClient
callback registration and implementation are verified to be correct.* 481-528: Logger callbacks are registered for different log levels (`info`, `error`, `warn`, `debug`, `trace`). Confirm that these callbacks are correctly implemented and that the `Namespace` and `Capability` are consistent.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the HTTPClient callback is correctly registered and that the function is implemented as expected. rg --type go 'router.RegisterCallback'Length of output: 2491
Script:
#!/bin/bash # Verify the implementation of the cbHTTPClient.Call function. rg --type go 'func \(cbHTTPClient\) Call' pkg/callbacks/httpclient/httpclient.goLength of output: 82
Script:
#!/bin/bash # Adjusting the search pattern to find the implementation of the Call function within the httpclient package. rg --type go 'func \(.*httpclient\) Call' pkg/callbacks/httpclient/httpclient.goLength of output: 82
Script:
#!/bin/bash # List the contents of the httpclient.go file to manually inspect for the Call function implementation. cat pkg/callbacks/httpclient/httpclient.goLength of output: 4129
- 538-564: Metrics callbacks are registered for different metric types (
counter
,gauge
,histogram
). Ensure that these callbacks are correctly implemented and that theNamespace
,Capability
, andOperation
fields are set appropriately.Verification successful
The output from the shell scripts confirms the implementation of the metrics callbacks in the
metrics.go
file. The functionsCounter
,Gauge
, andHistogram
are present and are designed to parse incoming requests. The code snippets provided show the use offfjson.Unmarshal
to parse the input, which is a common practice for handling JSON in Go.Based on the output, the following can be confirmed:
- The
Counter
,Gauge
, andHistogram
functions are implemented in themetrics.go
file.- Each function is designed to handle a specific type of metrics operation.
- The functions expect to receive a byte slice as input and return a byte slice and an error as output.
- The functions parse the input byte slice into a corresponding request struct (
tarmac.MetricsCounter
,tarmac.MetricsGauge
,tarmac.MetricsHistogram
).The review comment asked to ensure that the callbacks are correctly implemented and that the
Namespace
,Capability
, andOperation
fields are set appropriately. The output shows the implementation of the functions but does not provide information about theNamespace
,Capability
, andOperation
fields. However, the initialrg
command output showed the registration of the callbacks with theNamespace
set toDefaultNamespace
and theCapability
set to"metrics"
. TheOperation
fields were"counter"
,"gauge"
, and"histogram"
, which are consistent with the functions implemented.Therefore, based on the information provided, it appears that the metrics callbacks are correctly implemented and registered with appropriate fields.
* 571-574: The loading of the WASM module using `engine.ModuleConfig` is a critical operation. Verify that the configuration is correct and that the module is loaded as expected.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the Metrics callbacks are correctly registered and that the functions for different metric types are implemented as expected. rg --type go 'router.RegisterCallback'Length of output: 2491
Script:
#!/bin/bash # Verify the implementation of the metrics callbacks in the metrics.go file and check the Namespace, Capability, and Operation fields. rg --type go -A 5 'func \(.*Metrics\) Counter' pkg/callbacks/metrics/metrics.go rg --type go -A 5 'func \(.*Metrics\) Gauge' pkg/callbacks/metrics/metrics.go rg --type go -A 5 'func \(.*Metrics\) Histogram' pkg/callbacks/metrics/metrics.goLength of output: 944
Verification successful
To verify the correctness of the
engine.ModuleConfig
usage, we need to examine the definition ofengine.ModuleConfig
and ensure that the fields are being set correctly in the context of the application's requirements.
The
ModuleConfig
struct from thepkg/wasm/wasm.go
file contains the following fields:
Name
: Used as a lookup key when serving many modules.Filepath
: The file path to read the module from.PoolSize
: Used to control the size of the WASM Module Pool.In the provided code snippet from
pkg/app/app.go
, theModuleConfig
is used with theName
set to"default"
and theFilepath
set tosrv.cfg.GetString("wasm_function")
. ThePoolSize
is not mentioned, which suggests that it may have a default value or it's optional.Based on the information available, the usage of
engine.ModuleConfig
in the code snippet appears to be correct, as it provides the necessaryName
andFilepath
fields. However, without knowing the application's specific requirements or the context in which theLoadModule
function is called, it's not possible to definitively say whether the configuration is complete. ThePoolSize
field, for example, might need to be set in some scenarios.Given the information at hand, the usage of
engine.ModuleConfig
seems appropriate, and no issues can be identified from the current context.* 595-598: The loop for loading WASM functions from the service configuration is noted. Ensure that the `engine.ModuleConfig` is correctly populated and that error handling is robust for each function load operation.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the WASM module is loaded correctly with the appropriate configuration. rg --type go 'engine.ModuleConfig'Length of output: 169
Script:
#!/bin/bash # Examine the definition of engine.ModuleConfig to verify the correct usage of its fields. ast-grep --lang go --pattern 'type ModuleConfig struct { $$$ }'Length of output: 574
Verification successful
To further verify the correct population of
engine.ModuleConfig
and the robustness of error handling for each function load operation, we need to examine the surrounding code whereengine.ModuleConfig
is used.
The provided context shows two separate blocks of code where
engine.ModuleConfig
is used to load WASM modules:
The first block handles a scenario where the
wasm_function_config
could not be loaded. It attempts to load a default WASM function, and if an error occurs, it returns a formatted error message indicating the failure to load the default function.The second block iterates over services and their functions defined in
srv.funcCfg.Services
. For each function, it attempts to load the module usingengine.ModuleConfig
with the function's name and filepath. If an error occurs during the loading of a function, it returns a formatted error message indicating which function could not be loaded and the associated filepath.In both cases, the error handling appears robust as it provides informative error messages and halts execution by returning an error if the module loading fails. The
engine.ModuleConfig
struct is populated with the necessary fields (Name
andFilepath
), which are taken from the service configuration or set to default values.Based on this information, the review comment regarding the loop for loading WASM functions and the robustness of error handling has been verified:
- The
engine.ModuleConfig
is correctly populated with the function's name and filepath.- Error handling is robust, with appropriate logging and error returns if the loading fails.
* 673-681: The registration of function-to-function callbacks is a new feature. Confirm that the `callbacks.CallbackConfig` is correctly used and that the `Func` field is set to a valid function handler.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the WASM functions are loaded correctly from the service configuration. rg --type go 'engine.ModuleConfig'Length of output: 169
Script:
#!/bin/bash # Examine the surrounding code of the occurrences of 'engine.ModuleConfig' to verify correct population and error handling. rg --type go -C 10 'engine.ModuleConfig' pkg/app/app.goLength of output: 1595
Verification successful
To verify the validity of the function handlers being registered in
pkg/app/app.go
, we need to examine the definitions of these functions. We will look for the function definitions that are being passed to theFunc
field in thecallbacks.CallbackConfig
structure.
To locate the function definitions or references that are being used as handlers in the
callbacks.CallbackConfig
withinpkg/app/app.go
, we will perform a broader search across the entire codebase.
To extract the specific function names being assigned to the
Func
field in thecallbacks.CallbackConfig
withinpkg/app/app.go
, we will perform a targeted search in that file. Then, we will search for the definitions of these functions to verify their validity.
To verify the existence and signatures of the functions being used as handlers, we will search for their definitions in the codebase.
To verify the existence and signatures of the methods being used as handlers, we will search for their definitions in the codebase, considering that they are likely methods on objects.
The output from the script provides the method definitions for the handlers used in the
callbacks.CallbackConfig
withinpkg/app/app.go
. The methods match the expected signature for callback handlers, which typically take a byte slice as input and return a byte slice and an error. Here are the relevant methods found:
Logger
methods:Trace
,Debug
,Info
,Error
,Warn
KV
methods:Set
,Get
,Delete
,Keys
SQL
method:Query
Client
methods:Get
,Delete
(Note: These do not match theCall
method exactly, further investigation may be needed)KVStore
methods:Get
,Set
,Delete
,Keys
Function
method:Call
Metrics
methods:Counter
,Gauge
,Histogram
Database
method:Query
HTTPClient
method:Call
Each of these methods is defined with the appropriate signature to be used as a function handler in the callback configuration. The
Func
field in thecallbacks.CallbackConfig
is correctly set to these valid function handlers.Based on the information gathered, the function-to-function callbacks appear to be correctly registered with valid function handlers, as per the review comment's request for verification.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the function-to-function callbacks are correctly registered and that the function handlers are valid. rg --type go 'router.RegisterCallback'Length of output: 2491
Script:
#!/bin/bash # Find the definitions of the function handlers being registered in pkg/app/app.go ast-grep --lang go --pattern 'func $_($_ $_) ($_ $_, $_) { $$$ }'Length of output: 67
Script:
#!/bin/bash # Search for the function names being used as handlers in the callbacks.CallbackConfig within pkg/app/app.go rg --type go -- 'func\s+\w+\s*\('Length of output: 5499
Script:
#!/bin/bash # Extract the function names assigned to the Func field in the callbacks.CallbackConfig within pkg/app/app.go rg --type go 'Func:\s+\w+' pkg/app/app.goLength of output: 666
Script:
#!/bin/bash # Search for the definitions of the functions used as handlers in the callbacks.CallbackConfig within pkg/app/app.go rg --type go -- 'func (cbSQL\.Query|cbKVStore\.Get|cbKVStore\.Set|cbKVStore\.Delete|cbKVStore\.Keys|cbHTTPClient\.Call|cbLogger\.Info|cbLogger\.Error|cbLogger\.Warn|cbLogger\.Debug|cbLogger\.Trace|cbMetrics\.Counter|cbMetrics\.Gauge|cbMetrics\.Histogram)\('Length of output: 259
Script:
#!/bin/bash # Search for the method definitions on objects used as handlers in the callbacks.CallbackConfig within pkg/app/app.go rg --type go -- 'func \(\w+ \*?\w+\) (Query|Get|Set|Delete|Keys|Call|Info|Error|Warn|Debug|Trace|Counter|Gauge|Histogram)\('Length of output: 2541
This package is deprecated and will be removed in a future release. | ||
|
||
Use github.com/tarmac-project/wapc-toolkit instead. |
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.
The contents of example/toolkit/main.go
show that the deprecated wasm
package is indeed being used in an example application that demonstrates how to add WASM capabilities to a Go application. This usage includes creating a WASM server instance, loading a WASM module, and executing it.
Given this context, it's possible that the example has not been updated to reflect the deprecation of the wasm
package and the transition to the wapc-toolkit
. This could be an oversight that needs to be addressed.
The issues identified are:
- The example application
example/toolkit/main.go
still uses the deprecatedwasm
package. - The example has not been updated to use the
wapc-toolkit
, which is the recommended replacement.
The next step would be to inform the user about this oversight and suggest updating the example to use the wapc-toolkit
.
Analysis chain
The wasm
package is marked as deprecated with a recommendation to use github.com/tarmac-project/wapc-toolkit
instead. Verify that all references to the deprecated package are replaced with the recommended package across the codebase.
The shell script output indicates that the deprecated wasm
package is still being referenced in example/toolkit/main.go
. This suggests that not all references to the deprecated package have been replaced across the codebase. Additionally, the recommended wapc-toolkit
package is being used in pkg/wasm/wasm.go
, pkg/app/app.go
, and pkg/callbacks/callbacks.go
.
Given this information, the following issues have been identified:
- The deprecated
wasm
package is still referenced inexample/toolkit/main.go
. - The
wapc-toolkit
package is being used in several files, which is expected after the deprecation of thewasm
package.
To proceed, we should verify the context of the usage in example/toolkit/main.go
to understand why the deprecated package is still being referenced and whether it's an oversight or intentional for illustrative purposes.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Verify that the deprecated wasm package is not used elsewhere in the codebase.
rg --type go 'github\.com/tarmac-project/tarmac/pkg/wasm' --files-with-matches
# Verify that the recommended wapc-toolkit package is being used as intended.
rg --type go 'github\.com/tarmac-project/wapc-toolkit' --files-with-matches
Length of output: 241
Script:
#!/bin/bash
# Check the contents of example/toolkit/main.go to understand the context of the deprecated package usage.
cat example/toolkit/main.go
Length of output: 1757
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (2)
- pkg/app/app.go (14 hunks)
- pkg/wasm/wasm.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- pkg/app/app.go
- pkg/wasm/wasm.go
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to filter (4)
- example/toolkit/go.mod
- example/toolkit/go.sum
- example/toolkit/wasm/go.mod
- example/toolkit/wasm/go.sum
Files selected for processing (6)
- pkg/app/app.go (14 hunks)
- pkg/callbacks/httpclient/httpclient.go (2 hunks)
- pkg/callbacks/kvstore/kvstore.go (2 hunks)
- pkg/callbacks/logging/logging.go (1 hunks)
- pkg/callbacks/metrics/metrics.go (2 hunks)
- pkg/callbacks/sql/sql.go (2 hunks)
Files skipped from review due to trivial changes (1)
- pkg/callbacks/logging/logging.go
Files skipped from review as they are similar to previous changes (5)
- pkg/app/app.go
- pkg/callbacks/httpclient/httpclient.go
- pkg/callbacks/kvstore/kvstore.go
- pkg/callbacks/metrics/metrics.go
- pkg/callbacks/sql/sql.go
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- pkg/app/app.go (14 hunks)
Files skipped from review as they are similar to previous changes (1)
- pkg/app/app.go
Updates the internal wasm and callbacks packages to the wapc-toolkit.
Summary by CodeRabbit
New Features
Improvements
Deprecations
callbacks
andwasm
packages for future removal, advising the use ofwapc-toolkit
.Documentation
Refactor
Style