Commit Graph

2764 Commits

Author SHA1 Message Date
Daniel Harvey
913f254a1f chore(tests): explicitly set BigQuery retry limit in py-tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8523
GitOrigin-RevId: 52cb1f6c1d7eb61ebb1bf9a8318c9369f4594a30
2023-03-28 10:42:00 +00:00
Samir Talwar
69c238dc95 server/test-manual: A way to start PostgreSQL with a read replica.
This is for local testing. Details are in the README.

[DSF-218]: https://hasurahq.atlassian.net/browse/DSF-218?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8449
GitOrigin-RevId: 758aa9600fe79ed5c2917def3c86ac185267259e
2023-03-28 09:20:51 +00:00
Samir Talwar
d85de6bb6a CI: Get the GHC version from VERSIONS.json for all GitHub workflows.
Ideally, we'd have one place for this.

I have also removed the pinned Cabal version because v3.10 should address the bug we were seeing in the v3.8 series.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8497
GitOrigin-RevId: d0c68792c30e2e28ff2e210dd3ac8d28b83ac851
2023-03-27 18:53:18 +00:00
Antoine Leblanc
7aa341944b Remove HasServerConfigCtx from the schema cache build.
## Description

This PR is a incremental step towards achieving the goal of #8344. It is a less ambitious version of #8484.

This PR removes all references to `HasServerConfigCtx` from the cache build and removes `ServerConfigCtx` from `CacheBuildParams`, making `ServerConfigCtx` an argument being passed around manually instead. This has several benefits: by making it an arrow argument, we now properly integrate the fields that change over time in the dependency framework, as they should be, and we can clean up some of the top-level app code.

## Implementation

In practice, this PR introduces a `HasServerConfigCtx` instance for `CacheRWT`, the monad we use to build the cache, so we can retrieve the `ServerConfigCtx` in the implementation of `CacheRWM`. This contributes to reducing the amount of `HasServerConfigCtx` in the code: we can remove `SchemaUpdateT` altogether, and we can remove the `HasServerConfigCtx` instance of `Handler`. This makes `HasServerConfigCtx` almost **an implementation detail of the Metadata API**.

This first step is enough to achieve the goal of #8344: we can now build the schema cache in the app monad, since we no longer rely on `HasServerConfigCtx` to build it.

## Drawbacks

This PR does not attempt to remove the use of `ServerConfigCtx` itself in the schema cache build: doing so would make this PR much much bigger. Ideally, to avoid having all the static fields given as arrow-ish arguments to the cache, we could depend on `HasAppEnv` in the cache build, and use `AppContext` as an arrow argument. But making the cache build depend on the full `AppEnv` and `AppContext` creates a lot of circular imports; and since removing `ServerConfigCtx` itself isn't required to achieve #8344, this PR keeps it wholesale and defers cleaning it to a future PR.

A negative consequence of this is that we need an `Eq` instance on `ServerConfigCtx`, and that instance is inelegant.

## Future work

There are several further steps we can take in parallel after this is merged. First, again, we can make a new version of #8344, removing `CacheBuild`, FINALLY. As for `ServerConfigCtx`, we can split it / rename it to make ad-hoc structures. If it turns out that `ServerConfigCtx` is only ever used for the schema cache build, we could split it between `CacheBuildEnv` and `CacheBuildContext`, which will be subsets of `AppEnv` and `AppContext`, avoiding import loops.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8509
GitOrigin-RevId: 01b37cc3fd3490d6b117701e22fc4ac88b62b6b5
2023-03-27 17:44:27 +00:00
Daniel Harvey
2d9c8299c2 feature(server): add SQLServer logical models
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8388
GitOrigin-RevId: cbf813d1114cb03816003ba73788d33ac37f1473
2023-03-27 16:56:05 +00:00
Daniel Harvey
77d6058f3e chore(server): add basic Explain test for Logical Models
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8502
GitOrigin-RevId: 7cc64139d98155b94c0aadf16f8717881ea2add6
2023-03-27 15:21:42 +00:00
Daniel Harvey
305eebb3ab feature(server): add Logical Models support for CockroachDB
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8500
GitOrigin-RevId: 0205bd207843f50ad4fa12ad6e6c07d1f2740912
2023-03-27 14:00:07 +00:00
Antoine Leblanc
dd635fbbc7 Build the first schema cache in the app monad.
### Description

This PR is one more step towards #8344: it splits `initializeContext` into two parts: the first one builds the `AppEnv`, and the second builds the `AppContext` and its corresponding `AppStateRef`. Splitting it allows us to run the first schema cache build _in the app monad_, which was one of the steps required to remove `CacheBuild`, and ultimately to achieve #8344, which in turn is a blocker for several projects.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8445
GitOrigin-RevId: 0ef9eeec0c941b915da505cc9b1c60f36b108a56
2023-03-27 10:27:25 +00:00
Daniel Chambers
8acd447803 Fix non-determinism in expected ordering in agent test suite test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8493
GitOrigin-RevId: 210b6beb991d806e9a3e4cc901ee922ede0e3c84
2023-03-27 02:22:51 +00:00
Samir Talwar
0256e1da7d nix: Switch to nixpkgs-unstable.
I am making this change for two reasons:

  * We expect to upgrade to GHC 9.2.7 imminently, which is not available on the nixos-22.11 branch.
  * We need to upgrade unixODBC, which has stagnated on nixos-22.11.

While we expect a new NixOS release in a month or two, we can't really afford to wait that long. In addition, we might need to upgrade GHC again soon after that.

I removed `hpack` because we don't actually use it any more.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8483
GitOrigin-RevId: 9a7ef1a97599a218e34dfde1ad4f6a7279d2ba0e
2023-03-24 20:36:48 +00:00
Tom Harding
b2f683f56d Logical Models for BigQuery
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8447
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
Co-authored-by: Nicolas Beaussart <7281023+beaussan@users.noreply.github.com>
Co-authored-by: Antoine Leblanc <1618949+nicuveo@users.noreply.github.com>
Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com>
Co-authored-by: ananya-2410 <107847554+ananya-2410@users.noreply.github.com>
Co-authored-by: Matthew Goodwin <49927862+m4ttheweric@users.noreply.github.com>
Co-authored-by: Abhijeet Khangarot <26903230+abhi40308@users.noreply.github.com>
Co-authored-by: Puru Gupta <32328846+purugupta99@users.noreply.github.com>
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: ddef9d54bfad6b7d5dc51251dbe47eac43995da3
2023-03-24 15:17:03 +00:00
Brandon Martin
63eabc2374 Add dataset support to Oracle in the Super Connector
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8469
Co-authored-by: Daniel Chambers <1214352+daniel-chambers@users.noreply.github.com>
GitOrigin-RevId: 6f2aebc150d7c93490e6da3ada5c282dd3d9a56c
2023-03-24 14:35:30 +00:00
Tom Harding
fe140ee791 Remove Fixture.Options argument from api-tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8480
GitOrigin-RevId: a6dd5c6c2cc6274b7bd1694cf1100efa48e6bdbd
2023-03-24 13:59:35 +00:00
Rakesh Emmadi
e12b12c274 server: improve schema-sync logs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8386
GitOrigin-RevId: a90a792389576dcfda493ab96aed279459c60d92
2023-03-24 09:41:36 +00:00
Antoine Leblanc
9e8c06e971 Split catalog migration and cache build, and solve the manager chicken-egg problem.
### Description

This PR is the logical continuation of #8343 and #8357, and replaces both.

One core problem that this PR addresses: we had to create temporary a `HTTP.Manager` to initialize both the OSS and the Pro app: a manager is required to build the schema cache, but the dynamic TLS allow list is read from the schema cache... This PR solves this, by introducing the `TLSAllowListRef`, based on @abooij 's idea: it allows us to create a valid `HTTP.Manager` as soon as we have the metadata list, and then update the ref at a later point to make it point to the schema cache, allowing us to only build one and only one `HTTP.Manager`.

This paves the way towards building the schema cache _in the app monad_ and deprecating `CacheBuild`. Towards this, and also to clean the code, this PR also splits the catalog migration and the first schema cache build into two distinct functions. This doesn't result in a change of behaviour, as the transaction to update the catalog would always be done before attempting to build the schema cache.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8421
Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com>
GitOrigin-RevId: 0e0402122b4fc008c1932bccbdbadf11878e27eb
2023-03-23 16:42:53 +00:00
Antoine Leblanc
068b5e4523 Rename and clean CE app monad.
### Description

This small PR is on top of #8440. It continues the cleanup of `Hasura/App` by grouping together all instances on the app monad, renaming the app monad, and removing its `m` parameter.

See [this commit](cb6ecba3d4) to see the diff in isolation.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8441
GitOrigin-RevId: 7abb6524a160bcb4f75e729e726ce2af69643998
2023-03-23 15:52:48 +00:00
Anon Ray
14fcaafa43 server: pass a partially applied function instead of passing AppStateRef to http handlers
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8464
GitOrigin-RevId: b9dff36d2c560a093a6aff669315fe4fbc18b3f6
2023-03-23 14:33:29 +00:00
pranshi06
bc75136019 pro, server: fix event trigger log cleanup regression in Postgres event triggers
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8460
GitOrigin-RevId: 17e7b73d3b92459ff9149391ecd46ccb9a0846e5
2023-03-23 13:56:11 +00:00
Gil Mizrahi
c8c0fd200f Allow running read-only run_sql queries in read-only mode
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8409
GitOrigin-RevId: f7e92c0ba03d5b2b1d6a9d8060a49b351c56bd52
2023-03-23 13:05:02 +00:00
Daniel Harvey
e6da837dbf chore(tests): move postgres-specific queries to own Logical Model tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8462
GitOrigin-RevId: 4032a2eb6dbb63d04688747e28ad293c6963e696
2023-03-23 12:25:34 +00:00
Puru Gupta
3758b8ae26 server: consolidate schema cache and app context into a single IORef
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8370
GitOrigin-RevId: ad79849fc78ce98d060a569b2cbc3625c9588a05
2023-03-23 11:31:01 +00:00
ananya-2410
45decbeb89 ci: tag release v2.22.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8453
GitOrigin-RevId: e721250920b47b367026243b06eef3c37547bdcd
2023-03-23 06:38:09 +00:00
Antoine Leblanc
d7309b811e Partial cleanup of Hasura/App, refactor of GlobalCtx
### Description

As part of another project (the continuation of #8421), i have started a cleanup of `Hasura.App`, focusing on deleting old code and grouping together things that belong together. This quickly grew into a refactor of `GlobalCtx`, now renamed into `BasicConnectionInfo`. This small refactor adds comments, and aims at making clear what the purpose of those types and functions is.

Furthermore, it also changes the way the default postgres connection info is created, by making that part of the process of creating the `BasicConnectionInfo`, to deduplicate similar effort across different files.

This is expected to be a no-op.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8440
GitOrigin-RevId: 412c5b1905f629beb9c6cd262b9798cb31c93bdb
2023-03-22 21:41:53 +00:00
Daniel Harvey
ebb571ef39 feature(server): metadata for SQLServer logical model
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8444
GitOrigin-RevId: 86cfd7adbf326560a0ec72034de3dcd9dcb5124c
2023-03-22 17:11:19 +00:00
Daniel Harvey
7e437fc32b feature(server): ordered columns in Logical Model return type
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8434
Co-authored-by: Philip Lykke Carlsen <358550+plcplc@users.noreply.github.com>
GitOrigin-RevId: 4ebd569bef868e01b15583e4af90d583d6713da7
2023-03-22 16:35:56 +00:00
Philip Lykke Carlsen
34e40e6caf refactor: newtype alias for action checking feature flags
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8429
GitOrigin-RevId: e543b608a91e0c39c39f06b772a7d43f360d5dc3
2023-03-22 10:48:22 +00:00
Philip Lykke Carlsen
a763eeeeb2 refactor: Componentizing Fixture
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8428
GitOrigin-RevId: 8295a85b4a42dc3821d100371de1f350ed97cda3
2023-03-22 09:55:48 +00:00
pranshi06
f194c47156 server: fix value of created_at for postgres event triggers
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8287
Co-authored-by: Karthikeyan Chinnakonda <15602904+codingkarthik@users.noreply.github.com>
GitOrigin-RevId: d4ae6a517da63f2f43567dc16fda135b3cd1d7e6
2023-03-22 07:32:42 +00:00
Daniel Chambers
08f05d45cf Include SQLite agent in Remote Joins HSpec API tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8382
GitOrigin-RevId: 6e264b4b3e49c1072b042b69ee256817a105c470
2023-03-22 03:30:02 +00:00
Solomon
cca1a92399 Simplify Transformable Requests Module
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8400
GitOrigin-RevId: 10728012c3d74e178c34b926e13d3627d514ce17
2023-03-22 00:01:07 +00:00
Tom Harding
e3d76a8fe5 Implement logical models metadata commands for BigQuery
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8415
GitOrigin-RevId: d972abb9a0763f036c8b1d58feca34967abfac5f
2023-03-21 18:47:49 +00:00
Tom Harding
dba32d91c2 Generalise logical model test return types across backends
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8411
GitOrigin-RevId: b2c2c761415ed5e6fae172d1ccdc72afb0d01574
2023-03-21 17:41:53 +00:00
Tom Harding
6651e9b60d Use DerivingStrategies in BigQuery.Types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8405
GitOrigin-RevId: ef3cd6cba009cb18e9441aabef146b060963dc65
2023-03-21 16:27:57 +00:00
Antoine Leblanc
e6b8b16478 Further remove explicit AppEnv threading in favour of askAppEnv
### Description

This PR continues some of the work done in #8392, and makes use of `HasAppEnv` to reduce the amount of explicit env passing in init functions, including removing it from the setup hook.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8408
GitOrigin-RevId: 4d6c906f78fbcc303571f9aac16d163d68b77e41
2023-03-21 15:51:30 +00:00
Antoine Leblanc
1d76015629 delete ExecutionCtx in favour of explicit argument passing
### Description

This small PR removes `ExecutionCtx`: it was only used as a `Reader` argument for `runGQ`, and two of its wrappers. Explicit argument passing removes one additional small record, and one more `runReaderT`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8397
GitOrigin-RevId: cdf65f643283be37d493d483d46a586f0f9ef885
2023-03-21 12:37:21 +00:00
pranshi06
ea691b3c06 server: improve logging around 'Internal Exception' errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8369
GitOrigin-RevId: 22160a2c8a17d571ceeda0bf3e9b672bea31b8f9
2023-03-21 12:00:00 +00:00
Antoine Leblanc
0a1628c0cc Clean AppEnv and AppContext passing, remove RunT, reduce ServerConfigCtx uses
## Description

This PR does several different things that happen to overlap; the most important being:
- it removes `RunT`: it was redundant in places where we already had `Handler`, and only used in one other place, `SchemaUpdate`, for which a local `SchemaUpdateT` is more than enough;
- it reduces the number of places where we create a `ServerConfigCtx`, since now `HasServerConfigCtx` can be implemented directly by `SchemaUpdateT` and `Handler` based on the full `AppContext`;
- it drastically reduces the number of arguments we pass around in the app init code, by introducing `HasAppEnv`;
- it simplifies `HandlerCtx` to reduce duplication

In doing so, this changes paves the way towards removing `ServerConfigCtx`, since there are only very few places where we construct it: we can now introduce smaller classes than `HasServerConfigCtx`, that expose only a relevant subset of fields, and implement them where we now implement `HasServerConfigCtx`.

This PR is loosely based on ideas in #8337, that are no longer applicable due to the changes introduced in #8159. A challenge of this PR was the postgres tests, which were running in `PGMetadataStorageAppT CacheBuild` 🙀

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8392
GitOrigin-RevId: b90c1359066d20dbea329c87762ccdd1217b4d69
2023-03-21 10:45:56 +00:00
awjchen
4f6240fb04 server: refactor ConnectionTemplateResolver
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8381
GitOrigin-RevId: 5286c384bb8c739170c90960a9b4a324a629c43b
2023-03-20 21:56:20 +00:00
Puru Gupta
5ec4d6e91b server: always add query type in http-log logs (whenever available)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8353
GitOrigin-RevId: f7a2f8ab033043ed331c15b861218547de6f2744
2023-03-20 16:14:25 +00:00
Daniel Harvey
fb562883f0 chore(ci): use ScalarType in LogicalModels tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8378
GitOrigin-RevId: afd4ac325dde8459ecd1ef8eb0bed855354327c2
2023-03-20 09:55:15 +00:00
Daniel Chambers
e9c697aaa9 Fix "limit" from permissions being incorrectly applied to aggregates in Data Connectors
[GDC-1064]: https://hasurahq.atlassian.net/browse/GDC-1064?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8345
GitOrigin-RevId: 9ef91944ba6408e1030a47de58f3271145433ee2
2023-03-20 04:02:23 +00:00
Jesse Hallett
1ad37eff31 server: codecs for network config, graphql introspection
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8132
GitOrigin-RevId: 6b800f35a76b6d38817862a4678644b8bf230a95
2023-03-17 17:46:16 +00:00
Auke Booij
29f0660dee chore(server): remove some unused function arguments
These didn't trigger GHC warnings because their name starts with an underscore.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7954
GitOrigin-RevId: 6898b165f073e70aad06e1a2aa5f703ac385f9ed
2023-03-17 15:51:33 +00:00
Daniel Harvey
8d92c48c3c chore(server): logical models in Citus
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8356
GitOrigin-RevId: 98cb2dcaebe45b98d506279bc7a363b8d2696cd8
2023-03-17 11:28:31 +00:00
Puru Gupta
c437a42f6d server: rename SchemaCacheRef to AppStateRef and add AppContext to it
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8159
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com>
GitOrigin-RevId: a57f6dc8b3e992d86490e5c51508827f00151dfe
2023-03-17 10:30:38 +00:00
Tom Harding
3c683b0852 chore(api-tests): talk about permissions, not explicit roles
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8359
GitOrigin-RevId: 5f0f106c8479b03bc3dbf445116c545bc43a2891
2023-03-16 16:49:53 +00:00
Tom Harding
ec24ea7182 Split permissions into Types and Metadata
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8358
GitOrigin-RevId: 2684c01a5ce2808577920fa6f8a53ee4c13b5f4e
2023-03-16 16:09:48 +00:00
Daniel Harvey
01636a9cfb chore(server/tests): use more Logical Model test helpers
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8348
GitOrigin-RevId: c9e168125696993a39ea816459c588108a880710
2023-03-16 15:02:15 +00:00
Tom Harding
97d655240c chore(api-tests): Move withPermissions out of Permissions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8351
GitOrigin-RevId: c1728269a415f5b77f38277edbdd8b28cd9211a5
2023-03-16 14:23:25 +00:00
Tom Harding
080fbe8c5c Remove postMetadata permission command calls
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8336
GitOrigin-RevId: 588e0e46177ec18ee851a507cadba0f8f95ab457
2023-03-16 12:06:23 +00:00