-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements the proposal from runtimeverification/hs-backend-booster#383 Namely: `add-module` ------------- * now returns the id of a given module, of the form `m<sha256_of_given_module>` * computes the SHA256 hash of the unparsed module string and saves the internalised module under this key * takes an optional `name-as-id: true` argument which implements the previous behaviour of `add-module` (still returns the new id), i.e. adds the module to the module map under the module name as well as the id. * if the same module is added twice with `name-as-id: true`, the second request will fail with a `Duplicate module` error * if the same module is sent twice with `name-as-id: false` or without `name-as-id`, the second request is idempotent and will succeed As discussed on the issue, the IDs and original names are not disjoint for ease of implementation. the `m` pre-pended to the hash is necessary to make the name a valid kore identifier. I have also not added the `modules` field to other methods as I'm unsure whether this should be replacing the current `module` parameter, which would be a backwards incompatible change to the API that would break a lot of our integration tests, or if it should be an additional field, @tothtamas28? --------- Co-authored-by: github-actions <[email protected]>
- Loading branch information
1 parent
a584730
commit 4e9fb7a
Showing
10 changed files
with
1,553 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Add module with `add-module` endpoint again | ||
|
||
This test uses [a-to-f](../../resources/a-to-f/) [definition](../../resources/a-to-f/definition.kore) split into two parts: | ||
|
||
When the server starts, a `TEST` module is loaded which contains the following transitions: | ||
|
||
``` | ||
a | ||
/ \ | ||
V V | ||
b c | ||
| | ||
V | ||
d | ||
``` | ||
|
||
Then a `NEW` module is added using the `add-module` endpoint [parameters](./params.json), | ||
adding the following transitions: | ||
|
||
|
||
``` | ||
d | ||
| | ||
V | ||
e | ||
| | ||
V | ||
f | ||
``` | ||
|
||
Expected: | ||
* Module successfully added even though it has been added already, because the content is exactly the same. |
Oops, something went wrong.