Commit Graph

5705 Commits

Author SHA1 Message Date
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
paritosh-08
00005020a6 server: rename event trigger metric hasura_event_processing_time_seconds to hasura_event_webhook_processing_time_seconds
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6950
GitOrigin-RevId: a32ce3f167eb6bb5c48645a614288c043c252d26
2022-11-21 07:49:28 +00:00
paritosh-08
e74ba68230 server: add default naming convention to ServerConfig
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6918
GitOrigin-RevId: 6c97f566d50f633c3ae7b8cec65ce76a36a4c088
2022-11-21 05:05:14 +00:00
Nicolas Beaussart
66077866cb platform: introduce nx docs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6829
GitOrigin-RevId: b0a6a7ccc647ca13863f4c296b7c6b993f784bbb
2022-11-18 18:56:30 +00:00
Adron Hall
91e483123d Reordered the prereq for getting started with Athena.
## Description

Reordering the flow so that things are presented in the order in which a user would arrive at the particular step.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6935
GitOrigin-RevId: 5c04bc4142f3417cfb2eab0d057d0e264adf3f6b
2022-11-18 16:47:12 +00:00
Nicolas Inchauspe
4df205197a console: prevent react-ace to use a service worker
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6778
GitOrigin-RevId: 0a00b924bcc7b9dc0c7b465dc4d05a67549fd329
2022-11-18 16:39:53 +00:00
Sean Park-Ross
619cc552f0 Updates Docusaurus to 2.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6390
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
Co-authored-by: surendran82 <26085612+surendran82@users.noreply.github.com>
GitOrigin-RevId: ca59e788e7d16bf74389c00a51db18604350b483
2022-11-18 16:02:38 +00:00
Philip Lykke Carlsen
cdb62ff277 server/tests: Avoid schema aliasing
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6942
GitOrigin-RevId: d439290ae60f8f4be616c9217d03137cace675a6
2022-11-18 15:57:36 +00:00
Daniel Harvey
4683d4786d [server/tests] new Citus DB per test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6833
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 343aba12ff30c67908160b4c153334d46c5655ff
2022-11-18 11:10:29 +00:00
Daniel Chambers
7e9f5bdd96 Fixed filtering not being applied across object relations in SQLite agent
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6937
GitOrigin-RevId: 655e9be98059a1e86566b975ae646b49d67fa06e
2022-11-18 08:15:50 +00:00
Lyndon Maydwell
7228d0327f Add display_name, release_name fields to MD Agent APIs - GDC-626
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6849
GitOrigin-RevId: 0ab90aaf281cc1c043f73fd6d63c4c18d58c7c92
2022-11-18 04:19:08 +00:00
Solomon
461e6ceb3f Breakup api-tests into a lib and an exe.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6798
GitOrigin-RevId: 7e4f7be34124e1e8d67534b1e45381f90d31bea8
2022-11-18 01:34:33 +00:00
Brandon Martin
da611aaa58 [GDC] Add explicit ordering to distinct, paginated, and filtered test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6932
GitOrigin-RevId: 42cd06ac91935c2a86820df9125681018d895770
2022-11-18 01:00:23 +00:00
Stef Moreno
387a73b11f docs: link to DB matrix to individual DB sections
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6909
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: ab49f8aa5c15da285cfab7e67baffaae52d83cad
2022-11-18 00:13:54 +00:00
Abby Sassel
4626084eaf NDAT-293 Cleanup Test.Databases.Postgres
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6929
GitOrigin-RevId: ef973937b3d80fba2ffa4a30ba9460c799eb677c
2022-11-17 22:35:40 +00:00
Tom Harding
bb141dacb4 String interpolation for Postgres backend module
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6927
GitOrigin-RevId: 153975ec6e860a0bd1a06a85f11567d0fdc5b14d
2022-11-17 20:08:25 +00:00
Luca Restagno
6e091bae30 console: E2E test to verify DB compatibility
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6867
GitOrigin-RevId: be5803fd3b3436fc38c75ae70aa8d3e6a7f38402
2022-11-17 17:00:58 +00:00
Tom Harding
d0cf84d921 Fix EventTrigger tests for the compatibility matrix
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6921
GitOrigin-RevId: b104829355a5c2465d3f845c98d70334b7e8b7d7
2022-11-17 15:48:30 +00:00
Tom Harding
28af0a74e3 String interpolation for Cockroach backend module
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6922
GitOrigin-RevId: 62eb29eb9fcf1c11300a82682b0c1e246308e874
2022-11-17 15:11:44 +00:00
Mohd Bilal
11484f5699 cli: refactor migrate/source/file, migrate/source/stub and migrate/stub/testing to use internal/errors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6666
GitOrigin-RevId: db16b44d5abe3d63357a5806a0c479a6fc690a01
2022-11-17 14:27:20 +00:00
Samir Talwar
f24f0c6ce7 CI: Use the same PostgreSQL base images where possible.
Rather than varying it, let's just use `postgis/postgis` everywhere.

This uses the latest version of PostGIS, in which some of the raster codes have changed. This seems benign (it's just one digit) in the hex stream. I can't find the relevant release notes though.

Also syncs _images.go_ and _databases.yaml_ so we use the same thing where possible.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6903
GitOrigin-RevId: bb5c56f2e7ff69e4c008f1d658850af08c96badc
2022-11-17 13:54:19 +00:00
Samir Talwar
80c977da85 server: Split the integration tests out into their own directories.
We currently have a fairly intricate way of running our PostgreSQL and MSSQL integration tests (not the API tests). By splitting them out, we can simplify this a lot. Most prominently, we can rely on Cabal to be our argument parser instead of writing our own.

We can also simplify how they're run in CI. They are currently (weirdly) run alongside the Python integration tests. This breaks them out into their own jobs for better visibility, and to avoid conflating the two.

The changes are as follows:

- The "unit" tests that rely on a running PostgreSQL database are extracted out to a new test directory so they can be run separately.
  - Most of the `Main` module comes with them.
  - We now refer to these as "integration" tests instead.
- Likewise for the "unit" tests that rely on a running MS SQL Server database. These are a little simpler and we can use `hspec-discover`, with a `SpecHook` to extract the connection string from an environment variable.
  - Henceforth, these are the MS SQL Server integration tests.
- New CI jobs have been added for each of these.
  - There wasn't actually a job for the MS SQL Server integration tests. It's pretty amazing they still run well.
- The "haskell-tests" CI job, which used to run the PostgreSQL integration tests, has been removed.
- The makefiles and contributing guide have been updated to run these.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6912
GitOrigin-RevId: 67bbe2941bba31793f63d04a9a693779d4463ee1
2022-11-17 12:56:26 +00:00
Abby Sassel
8fec25349f NDAT-295 Add Tests.Databases directory
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6904
GitOrigin-RevId: 6145f6f5734b58ec3f7f2169de3c4c214c2da95e
2022-11-17 11:54:51 +00:00
Antoine Leblanc
42e5205eb5 server: reduce schema contexts to the bare minimum
### Description

This monster of a PR took way too long. As the title suggests, it reduces the schema context carried in the readers to the very strict minimum. In practice, that means that to build a source, we only require:
  - the global `SchemaContext`
  - the global `SchemaOptions` (soon to be renamed `SchemaSourceOptions`)
  - that source's `SourceInfo`

Furthermore, _we no longer carry "default" customization options throughout the schema_. All customization information is extracted from the `SourceInfo`, when required. This prevents an entire category of bugs we had previously encountered, such as parts of the code using uninitialized / unupdated customization info.

In turn, this meant that we could remove the explicit threading of the `SourceInfo` throughout the schema, since it is now always available through the reader context.

Finally, this meant making a few adjustments to relay and actions as well, such as the introduction of a new separate "context" for actions, and a change to how we create some of the action-specific postgres scalar parsers.

I'll highlight with review comments the areas of interest.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6709
GitOrigin-RevId: ea80fddcb24e2513779dd04b0b700a55f0028dd1
2022-11-17 10:35:54 +00:00
Daniel Harvey
29f5f1da80 [tooling] add install manifest for testing Yugabyte
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6883
GitOrigin-RevId: 7a9e9a3d7d069fb8c7f16c473e344bc7906dc56c
2022-11-17 10:06:02 +00:00
Daniel Chambers
bf11489491 Fix ambiguous ordering in Data Connector agent test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6915
GitOrigin-RevId: f75bd88e84a7e71cf4ced459349644c22f7240de
2022-11-17 02:27:12 +00:00
David Overton
1934e929da Fix flaky round-trip unit tests
Fix bug in round-trip JSON tests for several of the data connectors API types.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6914
GitOrigin-RevId: 07499628a01c45a4fbac2a3672aac2225f27a068
2022-11-17 00:57:19 +00:00
Abby Sassel
da9d5a6c47 NDAT-295 Cleanup remaining Tests dir
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6901
GitOrigin-RevId: 9b52d08ff37f92aabaa9f7ae701cebc7db7cd456
2022-11-16 19:29:33 +00:00
paritosh-08
5be4d37240 server,pro: add metrics related to event trigger runtime
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6825
GitOrigin-RevId: 913e1bd21912db781d69f579aee943faf6ce3a11
2022-11-16 17:12:48 +00:00
paritosh-08
3a79fdbfcc server: fix template validation behaviour
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6870
GitOrigin-RevId: e55ec0a39c68e960665d59f6c1824f5ba115f84d
2022-11-16 16:37:34 +00:00
Gil Mizrahi
12dea92a92 CockroachDB version check
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6900
GitOrigin-RevId: 07d417c7bb49b7f41900d24f543ff531362f9741
2022-11-16 15:42:30 +00:00
Krushan Bauva
34777286d8 server: version command should be independent of any other flags
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6659
GitOrigin-RevId: 039e8150ad032b0187a7d8798667b736e5372937
2022-11-16 14:45:15 +00:00
Abby Sassel
7df9dc5832 NDAT-295 Cleanup Tests.Subscriptions structure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6882
GitOrigin-RevId: 854d30dc0a1859c08f082df4d3c375325c59cf9c
2022-11-16 13:24:15 +00:00
Vijay Prasanna
980813c4c5 refactor (console): relationship tab components for GDC, local types & stories
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6801
GitOrigin-RevId: d1e97752bc52633a3a853a8d474efb6c437ba5dd
2022-11-16 12:58:25 +00:00
Tom Harding
4722029bf4 Remove hpack and its CI jobs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6880
GitOrigin-RevId: 311bfcd0dc663917d8b300cc2806933529fbd4b5
2022-11-16 12:05:33 +00:00
Tom Harding
0ff55c37f8 Remove MySQL tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6872
GitOrigin-RevId: 87a55e2384433c076c8815f991e753e4112d60dd
2022-11-16 11:26:01 +00:00
Tom Harding
93a2736c30 String interpolation for Citus backend modules
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6884
GitOrigin-RevId: abb15634de5c0a387284e2bed25622c302df6a3b
2022-11-16 10:38:50 +00:00
ananya-2410
5a7692ba68 ci: tag release v2.15.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6895
GitOrigin-RevId: e8b282490310362bd0cdc4b05988999598a6445a
2022-11-16 08:12:21 +00:00
Daniel Chambers
a89104626a Run Data Connector agent test suite against Athena in CI [GDC-509]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6536
GitOrigin-RevId: 819576c23f9d4e81191e532dbcf374d34945047e
2022-11-16 02:02:11 +00:00
hasura-bot
1af1a52480 docs: update upgrade-ce-to-ee.mdx
GITHUB_PR_NUMBER: 9212
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/9212

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6887
Co-authored-by: Chris Toth <97546117+chris-hasura@users.noreply.github.com>
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: 41b7567b9f439e25284301be34c70ece43265740
2022-11-15 22:39:49 +00:00
Solomon
94b4db90f2 [nix] Moves graphql-parser into an overlay and updates hedgehog dependency
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6886
GitOrigin-RevId: f576763ab83ed2ebdd05f4da8a4cb184d472e6ba
2022-11-15 21:55:12 +00:00
Brandon Martin
1e6cf5f133 super-connector: More coalesce defaults for rows/aggregates
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6861
Co-authored-by: Daniel Chambers <1214352+daniel-chambers@users.noreply.github.com>
GitOrigin-RevId: 3a3efd89196e619ae7491d3fc95c19f8c5156f2e
2022-11-15 20:53:55 +00:00
Auke Booij
5b93014ee8 Make Schema Cache building code slightly more readable
- Avoid a few banana brackets `(| ... |)`, often by just using local `let` bindings
- Use proper `Arrows` syntax rather than helpers like `>->`
- Use monadic `do` syntax instead of `Arrows` syntax where possible
- Avoid `traverseA @Maybe`, in favor of a `case`

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6751
GitOrigin-RevId: c07b22a1a259db6d135486ec71a716705e280717
2022-11-15 20:14:22 +00:00