graphql-engine/server
Antoine Leblanc dec8579db8 Allow backend execution to happen on the base app monad.
### Description

Each Backend executes queries against the database in a slightly different stack: Postgres uses its own `TXeT`, MSSQL uses a variant of it, BigQuery is simply in `ExceptT QErr IO`... To accommodate those variations, we had originally introduced an `ExecutionMonad b` type family in `BackendExecute`, allowing each backend to describe its own stack. It was then up to that backend's `BackendTransport` instance to implement running said stack, and converting the result back into our main app monad.

However, this was not without complications: `TraceT` is one of them: as it usually needs to be on the top of the stack, converting from one stack to the other implies the use `interpTraceT`, which is quite monstrous. Furthermore, as part of the Entitlement Services work, we're trying to move to a "Services" architecture in which the entire engine runs in one base monad, that delegates features and dependencies to monad constraints; and as a result we'd like to minimize the number of different monad stacks we have to maintain and translate from and to in the codebase.

To improve things, this PR changes `ExecutionMonad b` from an _absolute_ stack to a _relative_ one: i.e.: what needs to be stacked on top of our base monad for the execution. In `Transport`, we then only need to pop the top of the stack, and voila. This greatly simplifies the implementation of the backends, as there's no longer any need to do any stack transformation: MySQL's implementation becomes a `runIdentityT`! This also removes most mentions of `TraceT` from the execution code since it's no longer required: we can rely on the base monad's existing `MonadTrace` constraint.

To continue encapsulating monadic actions in `DBStepInfo` and avoid threading a bunch of `forall` all over the place, this PR introduces a small local helper: `OnBaseMonad`. One only downside of all this is that this requires adding `MonadBaseControl IO m` constraint all over the place: previously, we would run directly on `IO` and lift, and would therefore not need to bring that constraint all the way.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7789
GitOrigin-RevId: e9b2e431c5c47fa9851abf87545c0415ff6d1a12
2023-02-09 14:40:04 +00:00
..
benchmarks Add benchmarks for allowlist operations 2022-11-01 17:28:15 +00:00
documentation Add a "roles and permissions" deep dive 2023-01-17 09:41:36 +00:00
lib server/tests: ensure that all responses have a Content-Type header 2023-02-09 10:28:19 +00:00
src-emit-metadata-openapi server: initial set of DTO types for metadata 2022-06-27 16:33:31 +00:00
src-exec server: dev build modes 2023-02-08 22:43:00 +00:00
src-lib Allow backend execution to happen on the base app monad. 2023-02-09 14:40:04 +00:00
src-rsr ci: tag release v2.19.0-beta.1 2023-02-09 12:24:28 +00:00
src-test [Gardening] Eliminate boolean blindness in rsoWebSocketCompression 2023-02-08 04:15:01 +00:00
test-manual Document and automate spinning up AlloyDB for testing. 2022-11-24 14:16:21 +00:00
test-mssql server: Split the integration tests out into their own directories. 2022-11-17 12:56:26 +00:00
test-postgres server: move event trigger schedule cleanup logic 2023-02-03 12:30:00 +00:00
tests-py server/tests-py: Enable TLS tests in parallel mode on CI. 2023-02-08 14:42:27 +00:00
.dockerignore update packages (#251) 2018-08-08 13:10:13 +05:30
.gitignore server: Clean up Cabal project files 2022-04-07 07:16:12 +00:00
.ormolu Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
commit_diff.txt Rewrite GraphQL schema generation and query parsing (close #2801) (#4111) 2020-08-21 12:27:01 -05:00
COMPILING-ON-MACOS.md frontend: switch cli and server to use the new nx assets 2023-01-25 12:07:01 +00:00
CONTRIBUTING.md frontend: switch cli and server to use the new nx assets 2023-01-25 12:07:01 +00:00
graphql-engine.cabal server: dev build modes 2023-02-08 22:43:00 +00:00
Makefile ci: misc. cleanup, naming 2022-01-03 06:26:39 +00:00
STYLE.md Nix: Use nixpkgs-fmt to format everything. 2022-06-20 13:02:45 +00:00
testing-guidelines.md Extract the test harness from the Hspec tests 2022-10-04 08:31:26 +00:00
troubleshooting.md Create troubleshooting.md 2022-05-30 09:18:44 +00:00
VERSIONS.json ghc 9.2.5 2022-11-15 11:26:42 +00:00