Commit Graph

5747 Commits

Author SHA1 Message Date
Philip Lykke Carlsen
afa1e2fc02 server/tests: Port Citus table relationship tests from pytest
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7047
GitOrigin-RevId: 1ddcc656a43adc2c34f36fa4cf220eebb91f09ae
2022-11-25 15:40:49 +00:00
Daniel Harvey
9dc863e479 [server/tests] allow api-tests to be filtered by backend type
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7056
GitOrigin-RevId: 84618c3d5a0c2273b51584831287968b4df73fba
2022-11-25 15:40:41 +00:00
Tom Harding
b85a6572bf Make fixtureRepl work again
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6906
Co-authored-by: Philip Lykke Carlsen <358550+plcplc@users.noreply.github.com>
GitOrigin-RevId: cf00c31f610ad65305a007d8fbc6b7971ce9b7a9
2022-11-25 13:15:43 +00:00
Philip Lykke Carlsen
88af86e21a server/tests: Add ghci macros to ease working with fixtureRepl
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7046
GitOrigin-RevId: 6a3f4780cfd86646bfdd933839ca0dfb865fd32c
2022-11-25 12:34:37 +00:00
Daniel Harvey
5ab101acd5 [server/tests] Re-add Citus views test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7043
GitOrigin-RevId: f737af39d5f6b46b29587400f53e2c6e2a772706
2022-11-25 10:33:25 +00:00
Philip Lykke Carlsen
375aa28c4e server/tests: Improve details in feature matrix tool
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7041
GitOrigin-RevId: ba0c6a28ac507d5d57fa1faf37f6e69deaba3a61
2022-11-24 17:54:40 +00:00
Nicolas Beaussart
b01a9e2784 frontend: re import code into new mono
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6966
GitOrigin-RevId: 92a8909a3d316f6a6d5dc512057e60995389383d
2022-11-24 17:21:59 +00:00
Tirumarai Selvan
4662d75bc6 revamp elastic connection pool docs
Restructure elastic connection pool docs to remove internal details and describe connection pooling benefits.

[Rendered](https://tiru-elastic-connection-pool.hasura-docs-mono.pages.dev/docs/latest/databases/connect-db/cloud-connection-pooling/)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6960
Co-authored-by: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com>
GitOrigin-RevId: 10c0ebfe1313fcf0c25631e6103978ce774502f8
2022-11-24 15:18:13 +00:00
hasura-bot
0df52d8497 docs: fix streaming subscription example (close #9241)
GITHUB_PR_NUMBER: 9242
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/9242

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6984
Co-authored-by: Jeff Lambert <11539524+jflambert@users.noreply.github.com>
GitOrigin-RevId: ed0965a016e3957ecc91184595478741e1cc7b25
2022-11-24 14:33:03 +00:00
Samir Talwar
a0dc296ede Document and automate spinning up AlloyDB for testing.
We sometimes need to test against cloud databases. Here, we add a Terraform module to start a new AlloyDB cluster and instance, which we can then use for testing purposes.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7002
GitOrigin-RevId: 2d661b5cc6d60e47485ea68b781e13426ed4f097
2022-11-24 14:16:21 +00:00
Abby Sassel
eebeb5cc3b Server/tests: Remote Relationships > Citus
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7040
GitOrigin-RevId: 1a177e2d8a903144576990d047addcef70c69544
2022-11-24 13:31:04 +00:00
Varun Choudhary
3061f7a90c console: forwardClientHeader is not saved while creating action
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7012
GitOrigin-RevId: 3c343a794a581033cfbf1e2759e08694b4839e74
2022-11-24 12:54:25 +00:00
Stefano Magni
fdb2d87174 console: Fix the RequestHeadersSelector interaction tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6963
GitOrigin-RevId: 5e6b56d5536d82cb93189b5b33c7cb14bc88d899
2022-11-24 12:16:08 +00:00
Varun Dey
248ea61600 cli: expose deploy command in public API [GT-307]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6994
GitOrigin-RevId: 915e60952bc7c8f21169e4d49bb7733988a8ee40
2022-11-24 11:43:05 +00:00
Luca Restagno
4c109f9b85 Console: retain filters and sorts conditions while moving from one tab to the other
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6905
Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com>
Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com>
Co-authored-by: Erik Magnusson <32518962+ejkkan@users.noreply.github.com>
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com>
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
Co-authored-by: awjchen <13142944+awjchen@users.noreply.github.com>
Co-authored-by: Krushan Bauva <31391329+krushanbauva@users.noreply.github.com>
GitOrigin-RevId: 889feeb75b8119f94d9d5da071c50374ac59f589
2022-11-24 10:11:43 +00:00
Karthikeyan Chinnakonda
e9794a6639 server: fix bug with customized remote schema enum variables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6993
GitOrigin-RevId: 0458c806176e752aea5a848e68246744c3e5b38a
2022-11-24 08:47:46 +00:00
Mohd Bilal
c55cca3061 cli: refactor migrate/ to use internal/errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7006
GitOrigin-RevId: bfa2be15cef0460b32576e8297cfa177ed59031a
2022-11-23 17:15:19 +00:00
Daniel Harvey
79b50add5e [server] regularly ping selected sources
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6945
GitOrigin-RevId: cad67b121090d4100330067d3d50f575292b4584
2022-11-23 16:41:46 +00:00
Stefano Magni
c50cfad476 console: Improve the analytics docs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7015
GitOrigin-RevId: 66e461f20173d5e669056f3d818821a1f1384bb4
2022-11-23 16:04:30 +00:00
Abby Sassel
4598e1e008 NDAT-300: skip fewer CockroachDB tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7016
GitOrigin-RevId: 0fbbfd9fed46301759ee4d62827c9ab7989617b6
2022-11-23 15:22:19 +00:00
Nicolas Beaussart
1b33ebc32d ci: introduce required review github action
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7011
GitOrigin-RevId: 357186328a784ad5b44a155d098944c242b08ca8
2022-11-23 14:33:45 +00:00
Kailash Sudhakar
458ce8b384 Build configs for preview builds through GKE
Build configs for preview builds through GKE

## Description ✍️

Moving the docs preview builds from Cloudflare to "websitecloud" Google Cloud Project which is currently handling the staging and production deployments:

The preview triggers are expected to be called only on changes to the docs folder

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6999
GitOrigin-RevId: 1699fe7677ebc03b8ce6338394e91d8e848640c3
2022-11-23 14:18:37 +00:00
Samir Talwar
43779ff0c1 server/tests-py: Fix test_inconsistent_meta.py for split databases.
This test did not work when splitting the metadata and source backends. Fixed mostly by running the relevant SQL using `source_backend.engine`, but I also took the time to clean it up a little, and broke up _test.yaml_ into 3 files.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6957
GitOrigin-RevId: bbca60a8906caba2d0cffd834b3b8595fca058fd
2022-11-23 14:14:01 +00:00
Matthew Goodwin
7a1dc37bf6 refactor (console): create global metadata hooks that use the new metadata types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6931
Co-authored-by: Vijay Prasanna <11921040+vijayprasanna13@users.noreply.github.com>
GitOrigin-RevId: e57ed8bf14f2b855c6f4c20e072ecd25a784d08b
2022-11-23 13:18:15 +00:00
Varun Choudhary
8a35522970 console: console crashes on searching special character on table and action search bar
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7008
GitOrigin-RevId: 29e445da8d4be0daba60b02eb8a40c640086df2b
2022-11-23 12:07:23 +00:00
Sameer Kolhar
42d2e9bf10 console: add UI to show DB connection latency reports on cloud console
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6808
GitOrigin-RevId: 2768bdf3611ecaf40ed1b967d27c57aa3d80034a
2022-11-23 11:08:29 +00:00
Shahidh K Muhammed
e495c788b2 docs: update security team's email address
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6968
GitOrigin-RevId: d65596d0b5b6a36f4b2b35db4a50c3b6d0a91c72
2022-11-23 10:32:19 +00:00
awjchen
339e19048b server: update metadata api for the OpenTelemetry exporter
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6844
GitOrigin-RevId: 3d808215fc46a79caf85a1c4d964ac874f905029
2022-11-23 07:54:53 +00:00
Samir Talwar
c6557ced13 server/test-harness: Do not fail if the database cannot be dropped.
Sometimes this happens, especially in CI. It's alright. We can just leave it lying around and it will be destroyed when the container and associated volume are removed.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7003
GitOrigin-RevId: dcb74920c12341d7a15f9b6ebfe52d0864de4738
2022-11-23 07:54:44 +00:00
Abby Sassel
9c4aaccdb2 Server/test: fix enum test for CosmosDB: cleanup types in teardown
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6992
GitOrigin-RevId: 4c872e5837367b1449c9c0eeb085b708560d9bbd
2022-11-23 07:54:36 +00:00
Daniel Harvey
80c3846aaa [server/tests] run setup for each set of tests again
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7000
GitOrigin-RevId: 2e85870c970144dbd417cf555b14b63c18f495ab
2022-11-23 07:54:28 +00:00
Sean Park-Ross
26a5946622 Docs: Docusaurus update fixes
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6998
GitOrigin-RevId: 2b60acba07f8c0bdce116ec44986efcaa3f4587d
2022-11-23 07:54:19 +00:00
Daniel Harvey
bc2d173161 [server/tests] New SQLServer DB per test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6834
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 3ee30313e47ba64d5b50ff46345ce507735c4d1f
2022-11-23 07:54:10 +00:00
Auke Booij
67b922bac1 Avoid GraphQL schema rebuild when changing irrelevant Metadata
This increases the speed of `create_query_collection` and `add_collection_to_allowlist` by a factor ~~10~~ 65, by caching the in-memory GraphQL schema. This speedup also applies more broadly to Metadata changes relating to:
- allowlists
- query collections
- cron triggers
- REST endpoints
- API limits
- metrics config
- GraphQL introspection options
- TLS allow lists
- OpenTelemetry

When is construction of the in-memory GraphQL schema cached between Metadata operations?

Before this PR, **never**! It's rebuilt fully, for every role, on every Metadata operation.

However, there are many Metadata operations that don't influence the GraphQL schema. So we should be caching its construction.

The `Hasura.Incremental` framework allows us to cache such constructions: whenever we have an arrow `Rule m a b`, where `a` is the input to the arrow and `b` the output, we can use the `Inc.cache` combinator to obtain a new arrow which is only re-executed when the input `a` changes in a material way. To test this, `a` needs an `Eq` instance. (Before hasura/graphql-engine-mono#6877, this was a `Cacheable` type class which has now been removed.)

We can't simply apply `Inc.cache` to the "Steps 3 and 4" in `buildSchemaCacheRule`, because the inputs (components of `BuildOutputs` such as `SourceCache`) don't have an `Eq` instance.

So the changes to `buildSchemaCacheRule` restructure the code so that the input to "Step 1", namely the Metadata, can be used as a caching key instead, so that `Inc.cache` can be applied to the whole sequence of steps.

That works to cache construction of the GraphQL schema, but it means that now only those Metadata operations that _don't_ influence any of the products of steps 1-4 can use a cached build of the GraphQL schema. The most important intermediate product is `BuildOutputs`. So now the exercise becomes to minimize the amount of stuff stored in `BuildOutputs`, so that as many Metadata operations as possible can be handled outside of the codepath that produces a GraphQL schema.

Per hasura/graphql-engine-mono#6609, the `BuildOutputs` structure is too big, and stores things unnecessarily. Refer to the PR description there for reasoning - the same logic applies to this PR, and simply goes a few steps further. In doing so, it can benefit from hasura/graphql-engine-mono#6765, which allows us to verify at compile time that certain Schema Cache building steps _don't_ generate "Metadata dependencies". If a certain Metadata dependency is never generated, we don't need to handle that case in `deleteMetadataObject`. Thus such intermediate products don't need to be passed through `resolveDependencies`, and thus they don't need to be stored in `BuildOutputs`, and thus their rebuild won't trigger a GraphQL schema rebuild.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6613
GitOrigin-RevId: 27d2e69d3461bd4c32f08febef9995c0369fab3a
2022-11-23 07:54:01 +00:00
Gil Mizrahi
b213907671 use schemaName in postgres event triggers tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6964
GitOrigin-RevId: b05a1333583d59684b5fbd33b43544080d542696
2022-11-23 07:53:53 +00:00
Varun Choudhary
489d1fe493 console: browse back from allow list using browser back button
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6990
GitOrigin-RevId: 1c99dbdb7098dee57839cd98e4d19c19edd470b9
2022-11-23 07:53:45 +00:00
Nicolas Inchauspe
0ebb4a04ec console: fix code exporter style
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6952
GitOrigin-RevId: 269cff9788a12a02f13f89c2d98793b8aa50ca25
2022-11-23 07:53:36 +00:00
Vishnu Bharathi
5d7f4fa1a9 ci: tag multiple releases
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6983
GitOrigin-RevId: 5e118b498d95cdcd5141a171a6e61e122181e093
2022-11-23 07:53:27 +00:00
awjchen
329f3f0a39 multitenant: make shutdown logic more abstract
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5836
GitOrigin-RevId: 2f94cdee01702e49ff130f6a40f6be26fa69ec88
2022-11-23 07:53:19 +00:00
Brandon Simmons
378817d05a server: memoize in tableSelectColumnsEnum and mkNumericAggFields for more sharing
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6789
GitOrigin-RevId: 744600d42b497b77f2eca5fc46715e0df3e1fc8e
2022-11-23 07:53:11 +00:00
Vishnu Bharathi
c89e31b253 ci: tag release v2.15.2
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6980
GitOrigin-RevId: 662897f76160eeaa6a5b88d8e6b9381362c4df07
2022-11-23 07:52:59 +00:00
Erik Magnusson
55715f7074 console: added styling for relationship legacy tabs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6938
GitOrigin-RevId: 644364a3e47bd23a5740aaf9e3b294a1f453f2c1
2022-11-21 17:07:45 +00:00
Auke Booij
cdac24c79f server: delete the Cacheable type class in favor of Eq
What is the `Cacheable` type class about?
```haskell
class Eq a => Cacheable a where
  unchanged :: Accesses -> a -> a -> Bool
  default unchanged :: (Generic a, GCacheable (Rep a)) => Accesses -> a -> a -> Bool
  unchanged accesses a b = gunchanged (from a) (from b) accesses
```
Its only method is an alternative to `(==)`. The added value of `unchanged` (and the additional `Accesses` argument) arises _only_ for one type, namely `Dependency`. Indeed, the `Cacheable (Dependency a)` instance is non-trivial, whereas every other `Cacheable` instance is completely boilerplate (and indeed either generated from `Generic`, or simply `unchanged _ = (==)`). The `Cacheable (Dependency a)` instance is the only one where the `Accesses` argument is not just passed onwards.

The only callsite of the `unchanged` method is in the `ArrowCache (Rule m)` method. That is to say that the `Cacheable` type class is used to decide when we can re-use parts of the schema cache between Metadata operations.

So what is the `Cacheable (Dependency a)` instance about? Normally, the output of a `Rule m a b` is re-used when the new input (of type `a`) is equal to the old one. But sometimes, that's too coarse: it might be that a certain `Rule m a b` only depends on a small part of its input of type `a`. A `Dependency` allows us to spell out what parts of `a` are being depended on, and these parts are recorded as values of types `Access a` in the state `Accesses`.

If the input `a` changes, but not in a way that touches the recorded `Accesses`, then the output `b` of that rule can be re-used without recomputing.

So now you understand _why_ we're passing `Accesses` to the `unchanged` method: `unchanged` is an equality check in disguise that just needs some additional context.

But we don't need to pass `Accesses` as a function argument. We can use the `reflection` package to pass it as type-level context. So the core of this PR is that we change the instance declaration from
```haskell
instance (Cacheable a) => Cacheable (Dependency a) where
```
to
```haskell
 instance (Given Accesses, Eq a) => Eq (Dependency a) where
```
and use `(==)` instead of `unchanged`.

If you haven't seen `reflection` before: it's like a `MonadReader`, but it doesn't require a `Monad`.

In order to pass the current `Accesses` value, instead of simply passing the `Accesses` as a function argument, we need to instantiate the `Given Accesses` context. We use the `give` method from the `reflection` package for that.
```haskell
give :: forall r. Accesses -> (Given Accesses => r) -> r

unchanged :: (Given Accesses => Eq a) => Accesses -> a -> a -> Bool
unchanged accesses a b = give accesses (a == b)
```
With these three components in place, we can delete the `Cacheable` type class entirely.

The remainder of this PR is just to remove the `Cacheable` type class and its instances.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6877
GitOrigin-RevId: 7125f5e11d856e7672ab810a23d5bf5ad176e77f
2022-11-21 16:35:37 +00:00
Abby Sassel
2b639406ca Misc docs compatibility updates
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6956
GitOrigin-RevId: 4f8db44a62efc1e0b7998e43a301424648928c0b
2022-11-21 15:46:44 +00:00
Auke Booij
09e328223e Fix build errors related to dynamic building
When building under the `dev.sh`-adjusted `cabal.local` files, it's not possible to build all Haskell components:
```shell
$ cabal build all all:tests all:benchmarks
[... snipped ...]
[1 of 1] Compiling Harness.GraphqlEnginePro ( src/Harness/GraphqlEnginePro.hs, /home/auke/graphql-engine-mono/dist-newstyle/build/x86_64-linux/ghc-9.2.5/test-harness-pro-0.1.0.0/opt/build/Harness/GraphqlEnginePro.o, /home/auke/graphql-engine-mono/dist-newstyle/build/x86_64-linux/ghc-9.2.5/test-harness-pro-0.1.0.0/opt/build/Harness/GraphqlEnginePro.dyn_o )

src/Harness/GraphqlEnginePro.hs:13:1: error:
    Could not find module 'Control.Concurrent.Extended'
    There are files missing in the 'graphql-engine-1.0.0' package,
    try running 'ghc-pkg check'.
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
13 | import Control.Concurrent.Extended (sleep)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Harness/GraphqlEnginePro.hs:14:1: error:
    Could not find module 'Data.Environment'
    There are files missing in the 'graphql-engine-1.0.0' package,
    try running 'ghc-pkg check'.
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
14 | import Data.Environment qualified as Env
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6962
GitOrigin-RevId: dd7992dfa4e5b999f9b3d39389121bde1465965d
2022-11-21 15:07:53 +00:00
Abby Sassel
0343bfc9a7 Server/Test and document Azure Cosmos DB support
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6943
GitOrigin-RevId: 7fba24a0b711c1c54b93a944f97b2da8e202a2fd
2022-11-21 14:37:59 +00:00
Aravind K P
695bd632f4 cli: port migrate create migrate apply to use internal/errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6634
Co-authored-by: Mohd Bilal <24944223+m-Bilal@users.noreply.github.com>
GitOrigin-RevId: 90db2db2b98bfe5e2948ae2866443f6d9501f402
2022-11-21 12:08:51 +00:00
Erik Magnusson
42832cdc84 console: fallback for editing expanded text fields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6951
GitOrigin-RevId: fa0d2b8538b612ec86b1f9fa180188bb8d55b289
2022-11-21 10:59:47 +00:00
Luca Restagno
02c21d21aa console: fix the condition to show the custom table tracking modal
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6944
GitOrigin-RevId: bfacd2dcf1aad95feb323db9686c7d9d15ebdaba
2022-11-21 10:29:48 +00:00
paritosh-08
0cc66d0f31 docs: add event trigger metrics
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6898
GitOrigin-RevId: f16577e2d964937287e1cbbd582467e908e9fd69
2022-11-21 08:27:28 +00:00