stable
Clone or download
Separate concerns between what is related to the WASM call and the pre-receive logic
Currently the two are mixed together which will lead to code duplication if we want to call a WASM module elsewhere. The call convention between the library and PHP should not be a concern of the code wanting to use a WASM module. We expect one of those three messages from the Wasmtime wrapper library: * success: `{"data": <wasm_module_output>}` * user code error (e.g. unreachable code reached): `{"user_error": <error_message>}` * internal error: `{"internal_error": <error_message>}` Only `<wasm_module_output>` is under the control of the user writting the WASM module, the rest is an internal convention. For example in the case of a pre-receive hook WASM module we expect the response to look something like this: `{"data":"{\\"rejection_message\\":null}"}`. Part of story #31077: deploy a WebAssembly module to validate incoming references as a pre-receive hook Change-Id: I1da7396c6f936c8d8e88c628b0b679ca2f36bac4
Modified Files
Name | ||||
---|---|---|---|---|
M | plugins/git/include/Hook/PreReceive/PreReceiveAction.php | +51 | −40 | Go to diff View file |
M | plugins/git/include/Hook/PreReceive/PreReceiveCommand.php | +10 | −8 | Go to diff View file |
A | plugins/git/include/Hook/PreReceive/PreReceiveHookResponse.php | +34 | −0 | Go to diff View file |
M | plugins/git/include/gitPlugin.php | +3 | −1 | Go to diff View file |
M | plugins/git/tests/unit/Hook/PreReceive/PreReceiveActionTest.php | +75 | −79 | Go to diff View file |
M | src/additional-packages/wasmtime-wrapper-lib/src/lib.rs | +11 | −4 | Go to diff View file |
M | src/additional-packages/wasmtime-wrapper-lib/src/wire.rs | +6 | −0 | Go to diff View file |
A | src/common/Mapper/ValinorMapperBuilderFactory.php | +73 | −0 | Go to diff View file |
M | src/common/WebAssembly/EmptyWASMCaller.php | +3 | −3 | Go to diff View file |
M | src/common/WebAssembly/FFIWASMCaller.php | +28 | −7 | Go to diff View file |
M | src/common/WebAssembly/WASMCaller.php | +3 | −2 | Go to diff View file |
A | src/common/WebAssembly/WASMExecutionException.php | +42 | −0 | Go to diff View file |
A | src/common/WebAssembly/WASMInternalErrorResponse.php | +27 | −0 | Go to diff View file |
A | src/common/WebAssembly/WASMUserCodeErrorResponse.php | +28 | −0 | Go to diff View file |
A | src/common/WebAssembly/WASMValidResponse.php | +27 | −0 | Go to diff View file |
M | src/common/include/SiteCache.php | +8 | −1 | Go to diff View file |
M | src/composer.json | +1 | −0 | Go to diff View file |
M | src/composer.lock | +74 | −1 | Go to diff View file |
M | tests/psalm/psalm.xml | +1 | −0 | Go to diff View file |
A | tests/unit/common/WebAssembly/WASMCallerStub.php | +68 | −0 | Go to diff View file |