Commit Graph

2764 Commits

Author SHA1 Message Date
Karthikeyan Chinnakonda
0a68d00422 server: remove a redundant argument passed to replaceMetadataV2
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7291
GitOrigin-RevId: 841144cdf9e70fb682cd27ea5f918b168f2a3bbd
2022-12-16 10:21:04 +00:00
Jesse Hallett
4d6604ba08 server: event trigger codecs
Codecs for event triggers, including webhook transforms. These are not hooked into the higher-up table metadata codec yet because some backend implementations implement event triggers with `error` which causes an error when codecs are evaluated. I plan to follow up with another PR to resolve that.

Ticket: https://hasurahq.atlassian.net/browse/GDC-585

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7237
GitOrigin-RevId: 8ce40fe6fedcf8b109d6ca50a505333df855a8ce
2022-12-15 20:38:21 +00:00
Tom Harding
1d0b466954 Run the DefaultRootFieldSpec tests on all backends.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7293
GitOrigin-RevId: f7c22212badc11016e87a491bb0017642b3ac7c0
2022-12-15 18:18:29 +00:00
Jesse Hallett
c265e303f6 server: codecs for remote schemas metadata
These codecs should fully cover the `remote_schemas` property of the Metadata type.

Ticket: [GDC-522](https://hasurahq.atlassian.net/browse/GDC-522)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6812
GitOrigin-RevId: 1b256f6829486295957c232b92ff184bd9a86469
2022-12-15 17:39:22 +00:00
Philip Lykke Carlsen
bd2e2080f8 server/tests: Port TestGraphQLQueryFunctions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7158
GitOrigin-RevId: a4b3ca8565df37905665303f96fd40ec4b9e76dd
2022-12-15 16:42:55 +00:00
Tom Harding
ae33e34e2d Implement permission checks in the API tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7264
GitOrigin-RevId: 55ff8ff31609b7598d2382ded5dd96f5825ee4fd
2022-12-15 16:02:31 +00:00
paritosh-08
9f99a40f2d Revert "server: fix MSSQL event trigger next_retry_at"
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7290
GitOrigin-RevId: 4cb461dd6f25e55ba1c9bd587d98a56f71ff8223
2022-12-15 15:31:40 +00:00
Naveen Naidu
282e94b2de pro/server: add user_id of the collaborator in http_log
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7154
GitOrigin-RevId: 6f60a7c7be5b083e6adf6c3ab9991142f62434df
2022-12-15 07:49:37 +00:00
Tom Harding
f2dd4a5eb7 Remove *Source fields from API test permissions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7275
GitOrigin-RevId: 44345ec361fdbb93f2c166825e5d78983759b5b0
2022-12-14 18:43:44 +00:00
Samir Talwar
beb20c7dab server/tests-py: Remove a check for PostgreSQL 10.
We no longer support this and therefore don't run tests against it.

This also refactors the code a little so it doesn't have to skip running a PostgreSQL-specific test against MS SQL Server.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7201
GitOrigin-RevId: 307c2ab0052162c012f7b1c55866b57f2fa6d9a6
2022-12-14 16:57:28 +00:00
Abby Sassel
57f456a4cf add run-new.sh docs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7278
GitOrigin-RevId: 6c17cc846b39a4236f65dd5ab6baac4529b38f4c
2022-12-14 16:11:00 +00:00
Divi
62708ca6bd ci: update catalog version for v2.16.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7271
GitOrigin-RevId: a7978ae1c0dd4d402f6293a74cf45acba560a456
2022-12-14 07:14:24 +00:00
Brandon Simmons
3b0ad30757 server: don't compress small responses
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7216
GitOrigin-RevId: 20a94267eca42edf8e79470711766a3fecac0f50
2022-12-13 17:50:01 +00:00
paritosh-08
3397c041bc server: fix MSSQL event trigger next_retry_at
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7173
GitOrigin-RevId: 862ab4136e0df6b7fa1e2db2c3edfffa318452de
2022-12-13 15:18:23 +00:00
Gil Mizrahi
570e16efe7 Revert "[server/test] create new HGE per test"
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7255
GitOrigin-RevId: c971e9e227263b0956069c0687acacf4d3ff90a9
2022-12-13 12:37:27 +00:00
Auke Booij
51fc104793 server: don't let query collection validation prevent engine startup
Generate more Metadata Inconsistencies instead of startup failures. Specifically this means that
- errors retrieving the main query of an executable GraphQL document, and
- errors during fragment inlining

no longer fail irrecoverably.

This also makes more parts of `buildSchemaCacheRule` into pure code, which is always nice.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7234
GitOrigin-RevId: aebf636c2fb1aad1c2df9a37f7d0b67c1ee40c42
2022-12-13 09:56:27 +00:00
Daniel Harvey
ed190d6cb6 [server/tests] drop old postgres database better, and use less connections
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7227
GitOrigin-RevId: d7b3b313440d3f3c91d4ecb550513b53cbf2e92e
2022-12-12 17:46:12 +00:00
kodiakhq[bot]
3ad81d18c8 [tooling] import hasura/pool into monorepo
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7226
Co-authored-by: Bryan O'Sullivan <23374+bos@users.noreply.github.com>
Co-authored-by: Falko Peters <41595+informatikr@users.noreply.github.com>
Co-authored-by: Bas van Dijk <576355+basvandijk@users.noreply.github.com>
Co-authored-by: Ozgun Ataman <13820+ozataman@users.noreply.github.com>
Co-authored-by: Michael Snoyman <49415+snoyberg@users.noreply.github.com>
Co-authored-by: Kim Altintop <6163+kim@users.noreply.github.com>
Co-authored-by: Vamshi Surabhi <6562944+0x777@users.noreply.github.com>
Co-authored-by: Evie Ciobanu <1017953+eviefp@users.noreply.github.com>
Co-authored-by: Robert <132113+robx@users.noreply.github.com>
Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com>
GitOrigin-RevId: c99a93563f9b1aa25e69ecc030f8dc526df4fb6b
2022-12-12 16:10:25 +00:00
Daniel Chambers
a26ecbc2b0 Enable mutations root field parsing for Data Connectors [GDC-665]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7221
GitOrigin-RevId: 88da78cd758bc8c2273b0d71a79d5fe46a4bc565
2022-12-12 04:42:56 +00:00
Brandon Simmons
6451d9c9ce server: refactor Hasura.Server.Compression for clarity/correctness
context: This is  foundation work, before we change how the server chooses to compress or not
part of effort: #5518

-----

Prior to this change it was difficult to understand how the functionality in this module related to the semantics of Accept-Encoding. We also didn't correctly handle directives with qvalues.

After this change certain technical infelicities are called out without modifying the behavior of the server; for instance we continue to fall back to identity (no compression) in the case where technically we're supposed to return 406, and we also  continue to treat `*` conservatively as meaning “use no compression”.

The only external change here is `gzip;q=x.y` now results in a zipped response.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7213
GitOrigin-RevId: 1910ffd70d29f1ab8825c601f1bd998be70ceeeb
2022-12-09 06:08:27 +00:00
pranshi06
8dab7df169 server: fix error in metadata APIs with inconsistency
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6669
Co-authored-by: Tirumarai Selvan <8663570+tirumaraiselvan@users.noreply.github.com>
Co-authored-by: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com>
GitOrigin-RevId: 1b004074b41ccb6512123cdb1707b39792e97927
2022-12-08 16:04:55 +00:00
Daniel Harvey
e37b91a25a [server/tests] limit capabilities in matrix tester using RTS opts
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7202
GitOrigin-RevId: c2b6ff37a0b5839726d02c04c69fadeff4465022
2022-12-08 08:45:34 +00:00
Samir Talwar
2ee0dbf8eb server: Fix permissions when running an update_table_many query.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6969
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 4c6f6959dd69ff861a0333619f7ad90a013ed6ef
2022-12-08 08:04:08 +00:00
Lyndon Maydwell
e9dcbf6491 Adding custom scalar types to SQLite DC Agent - GDC-610
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6783
Co-authored-by: David Overton <7734777+dmoverton@users.noreply.github.com>
Co-authored-by: Daniel Chambers <1214352+daniel-chambers@users.noreply.github.com>
GitOrigin-RevId: ee53c20b0090b6b3c88792ddc98b8287872fe0f3
2022-12-08 06:50:08 +00:00
Daniel Chambers
c14fd3ba4c Add mutability properties to the Data Connector schema API [GDC-664]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7190
GitOrigin-RevId: ce602b5e5cc5aee8716ff3f7a036b18b3bf47188
2022-12-08 02:07:01 +00:00
Daniel Harvey
1dd9e19b69 [server/test] create new HGE per test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7111
GitOrigin-RevId: 6d3e88cb29ca3e98cbd16141c9f924aa36fa6b43
2022-12-07 17:06:42 +00:00
Krushan Bauva
c540f803a6 server: add server_type information to version API
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7141
GitOrigin-RevId: e1d1c780e6b588f0868003eb6d40019960246aba
2022-12-07 11:30:20 +00:00
kodiakhq[bot]
3f3b19c565 server: tune builder runners, for ByteStrings we're about to send
`toLazyByteString` is a little deficient in two ways:

- It allocates relatively large chunks (4KB + 32KB +32KB, etc…) which is wasteful for small ByteStrings
- It shrinks each chunk (Copying the data to a new chunk of exactly the right size) if it's not more than half filled. If we're running the builder right before we send it over the wire, this copy is totally extraneous (we simply end up with more work for the next GC)

part of the effort: https://github.com/hasura/graphql-engine-mono/issues/5518

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7187
GitOrigin-RevId: b499cd49c33da6cfee96be629a36b5c812486e39
2022-12-07 06:01:08 +00:00
Lyndon Maydwell
3d5fb984b0 Fix metadata defaults bug - Defaults serialised into metadata table - GDC-647
## Description

There is a bug in the metadata defaults code, see [the original PR](https://github.com/hasura/graphql-engine-mono/pull/6286).

Steps to reproduce this issue:

* Start a new HGE project
* Start HGE with a defaults argument: `HASURA_GRAPHQL_LOG_LEVEL=debug cabal run exe:graphql-engine -- serve --enable-console --console-assets-dir=./console/static/dist --metadata-defaults='{"backend_configs": {"dataconnector": {"mongo": {"display_name": "BONGOBB", "uri": "http://localhost:8123"}}}}'`
* Add a source (doesn't need to be related to the defaults)
* Export metadata
* See that the defaults are present in the exported metadata

## Related Issues

* Github Issue: https://github.com/hasura/graphql-engine/issues/9237
* Jira: https://hasurahq.atlassian.net/browse/GDC-647
* Original PR: https://github.com/hasura/graphql-engine-mono/pull/6286

## Solution

* The test for if defaults should be included for metadata api operations has been extended to check for updates
* Metadata inconsistencies have been hidden for `/capabilities` calls on startup

## TODO

* [x] Fix bug
* [x] Write tests
* [x] OSS Metadata Migration to correct persisted data - `server/src-rsr/migrations/47_to_48.sql`
* [x] Cloud Metadata Migration - `pro/server/res/cloud/migrations/6_to_7.sql`
* [x] Bump Catalog Version - `server/src-rsr/catalog_version.txt`
* [x] Update Catalog Versions - `server/src-rsr/catalog_versions.txt` (This will be done by Infra when creating a release)
* [x] Log connection error as it occurs *(Already being logged. Requires `--enabled-log-types startup,webhook-log,websocket-log,http-log,data-connector-log`)
* [x] Don't mark metadata inconsistencies for this call.

## Questions

* [ ] Does the `pro/server/res/cloud/migrations/6_to_7.sql` cover the cloud scenarios?
* [ ] Should we have `SET search_path` in migrations?
* [x] What should be in `server/src-rsr/catalog_versions.txt`?

## Testing

To test the solution locally run:

> docker compose up -d

and

> cabal run  -- exe:api-tests --skip BigQuery --skip SQLServer --skip '/Test.API.Explain/Postgres/'

## Solution

In `runMetadataQuery` in `server/src-lib/Hasura/Server/API/Metadata.hs`:

```diff
-        if (exportsMetadata _rqlMetadata)
+        if (exportsMetadata _rqlMetadata || queryModifiesMetadata _rqlMetadata)
```

This ensures that defaults aren't present in operations that serialise metadata.

Note: You might think that `X_add_source` would need the defaults to be present to add a source that references the defaults, but since the resolution occurs in the schema-cache building phase, the defaults can be excluded for the metadata modifications required for `X_add_source`.

In addition to the code-change, a metadata migration has been introduced in order to clean up serialised defaults.

The following scenarios need to be considered for both OSS and Cloud:

* The user has not had defaults serialised
* The user has had the defaults serialised and no other backends configured
* The user has had the defaults serialised and has also configured other backends

We want to remove as much of the metadata as possible without any user-specified data and this should be reflected in migration `server/src-rsr/migrations/47_to_48.sql`.

## Server checklist

### Catalog upgrade

Does this PR change Hasura Catalog version?
-  Yes

### Metadata
Does this PR add a new Metadata feature?
-  No

### GraphQL
-  No new GraphQL schema is generated

### Breaking changes
-  No Breaking changes

## Changelog

__Component__ : server
__Type__: bugfix
__Product__: community-edition

### Short Changelog

Fixes a metadata defaults serialization bug and introduces a metadata migration to correct data that has been persisted due to the bug.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7034
GitOrigin-RevId: ad7d4f748397a1a607f2c0c886bf0fbbc3f873f2
2022-12-06 22:35:19 +00:00
Gil Mizrahi
a948e3460a add ci scripts for produce-feature-matrix
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7144
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: ab4e2e62ee2e347dfbbe08c16688b2ddfa3a1b1c
2022-12-06 16:42:39 +00:00
paritosh-08
3d4c66041f server: add event_processing_time metric
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6987
GitOrigin-RevId: 4f5948a225b18e2db59572482d2a608117fbb7d0
2022-12-06 15:11:04 +00:00
Solomon
599d9fd602 Dynamic Dispatch For Test Harness BackendType Metadata
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6982
GitOrigin-RevId: faeec9ba0dfcb641c13cdc3f88244237fb370c66
2022-12-06 00:06:53 +00:00
Gil Mizrahi
f45c379866 add concurrent_bulk api for parallel processing of read-only queries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7087
Co-authored-by: Tom Harding <6302310+i-am-tom@users.noreply.github.com>
Co-authored-by: Luca Restagno <59067245+lucarestagno@users.noreply.github.com>
GitOrigin-RevId: 0d7a212d004908bc014def9d3828647545c9e062
2022-12-05 13:50:19 +00:00
Daniel Harvey
ba800ec978 [pg-client] test cancelled queries actually stop running queries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7091
GitOrigin-RevId: 71cc1291d45a90a2c4f3519e12e365e968368dca
2022-12-05 12:19:11 +00:00
Daniel Harvey
aa9499ee0e [server/tests] remove unnecessary cleanup
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7157
GitOrigin-RevId: 93dc285c8629586336e56bb1622d94af0faa3e0e
2022-12-05 11:41:38 +00:00
Philip Lykke Carlsen
392ecf72b3 server: Improve modelling of function metadata and schema diffing
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7140
GitOrigin-RevId: 83f54308d002391903d3c3d421e589949e7d4dc4
2022-12-05 10:22:15 +00:00
Gil Mizrahi
1970785970 fix api-tests warnings and enable -Wall
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7137
GitOrigin-RevId: 1c06f99ef94e1343d33c79e59e844c0470ba71aa
2022-12-05 08:31:00 +00:00
Vishnu Bharathi
73ad0275f3 ci: tag release v2.16.0
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7148
GitOrigin-RevId: 25adaa09c57471ed96d3d131abfa6c6c4225d6fd
2022-12-05 07:37:26 +00:00
Daniel Chambers
354ab2f7aa Use Sandwich test framework for Data Connector agent test suite
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7133
GitOrigin-RevId: 625dde70d1c594dcdfd377efac78710174a74efc
2022-12-05 02:16:01 +00:00
Philip Lykke Carlsen
886302fd7e server/tests: Introuce pytest-to-haskell porting script
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7054
GitOrigin-RevId: 2c4597465da28d26993b347693813ce7d42962d3
2022-12-02 15:59:19 +00:00
Gil Mizrahi
2f83899979 Fix mssql aggregation test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7142
GitOrigin-RevId: 66447f0bd7859b3fc5203d87cba5ea2c6d5f054e
2022-12-02 12:53:32 +00:00
Daniel Harvey
ef5e983aee [server/tests] simplify TestEnvironment
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7123
GitOrigin-RevId: 0a7313dab729de08e273ba06e47f656d766ff82a
2022-12-02 11:36:57 +00:00
Daniel Harvey
16ecd63b01 [server/tests] don't do detailed teardown
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7128
GitOrigin-RevId: cbc52dadaca8ef7d4affb43528e8dcec0c8ec62e
2022-12-02 09:00:07 +00:00
Solomon
6c106c9e35 [GDC] Transform SourceConnConfig in runGetSourceTables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7112
GitOrigin-RevId: d6ab09ba001fa8d4d33cc8f669b588459360f910
2022-12-02 08:02:20 +00:00
Gil Mizrahi
e752010a83 Gil/fix feature matrix test and apply css
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7125
GitOrigin-RevId: fa051a4942a882efe6e3d673eab084b94ec8dd90
2022-12-01 19:26:39 +00:00
Abby Sassel
13eb1122ed server/tests: Table Computed Fields > Postgres
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7122
GitOrigin-RevId: e8c191a87465c1810908e8851bcc4b6919873bd8
2022-12-01 16:43:54 +00:00
Gil Mizrahi
9ce6fe7197 Feature matrix standalone tester tool
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7120
Co-authored-by: Samir Talwar <47582+SamirTalwar@users.noreply.github.com>
GitOrigin-RevId: 5db7f8e24f22414805b10143248bfacfb5b7a03a
2022-12-01 14:48:55 +00:00
Anon Ray
b398001c87 server/gardening: drop an unnecessary field from 'ServeCtx'
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7108
GitOrigin-RevId: 50caff9e60d53261ce15870338bc3aa97c479190
2022-12-01 07:48:58 +00:00
David Overton
a18c6976f8 Map scalar types to GraphQL built-in types for parsing [GDC-587]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6818
GitOrigin-RevId: 6d1887fb7865fe8ec24a73c77da291c7ecf8dfd2
2022-12-01 00:08:40 +00:00
Jesse Hallett
d6b8f29383 server: implement codecs for table permissions
This PR implements the remaining codecs for table permissions. However the codec for boolean expressions delegates to Aeson instances because Autodocodec doesn't currently have the necessary feature to write a codec for boolean expressions that will reliably parse valid data.

Boolean expressions are objects with keys like `_and`, `_or`, `_exists`, or `<field name>`. The parsing rules for each value depend on the key, so we need to be able to select different codecs for each key. We could do that with an `object` codec, but that doesn't account for the arbitrary field name keys that can be provided. OpenAPI supports object types with "additional properties", but I don't know if we can declare a specific type for those properties. There might or might not be a reasonable path to extending Autodocodec to handle this case.

Ticket: [GDC-585](https://hasurahq.atlassian.net/browse/GDC-585)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6978
GitOrigin-RevId: 0b0dcfd59ebd1d5022ff2ab86dd8d4c6f93bd039
2022-11-30 19:33:16 +00:00
Auke Booij
512340b864 Collect Metadata dependencies in a Sequence rather than a list
Dependencies seem to get concatenated very often, so let's use a data structure that supports efficient concatenation.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7050
GitOrigin-RevId: 6331963f99f17d1b908a6038318d8c4834cf4dd7
2022-11-30 18:13:31 +00:00
kodiakhq[bot]
26ce8ff768 server: -O1 + -funfolding-use-threshold=640, for memory residency
...and keep binary size down using `--gc-sections` (supported by all major linkers). Stripped size after this PR is `85.3 Mb` down from `121 Mb` on `main`.

This compliments Auke's recent work (though there is some overlap). See: https://github.com/hasura/graphql-engine-mono/pull/7033#issuecomment-1326673632

Old experiments, for reference:
https://github.com/hasura/graphql-engine-mono/pull/6605
https://github.com/hasura/graphql-engine-mono/pull/6606
https://github.com/hasura/graphql-engine-mono/pull/6589

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7079
GitOrigin-RevId: 0b0d86730fb959d6249bd17a87e39af12ef71261
2022-11-30 17:05:15 +00:00
Philip Lykke Carlsen
9bc1ff1d8e Structured logging in test-harness
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7092
GitOrigin-RevId: 201ee3ddc205bfc9d55c167e0b70b6606dbe4aa7
2022-11-30 12:12:21 +00:00
Philip Lykke Carlsen
3d1c663f51 server/tests: Remove pytest version of TestGraphQLQueryBasicCitus
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7073
GitOrigin-RevId: 17c6f4848d3c8dfb268a04442ec3a95f117fef89
2022-11-30 11:08:07 +00:00
Abby Sassel
74e30b8b0b Server/tests: Scalar Computed Fields > Postgres
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7094
GitOrigin-RevId: f5e632adc99ffa628a09d6703d2fdba9d2ade53e
2022-11-30 11:02:53 +00:00
Auke Booij
cfc9d7d219 server: build even more parts of the Schema Cache monadically
Rewrites the schema cache building code monadically for the following features as well:
- REST endpoints
- Cron triggers
- OpenTelemetry config
- Remote schema cache (post-introspection only), mainly remote schema relationships
- Actions
- Inherited roles

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7049
GitOrigin-RevId: c0727c6a170a27f722cc173973658ad201ebedb5
2022-11-30 09:12:15 +00:00
Vishnu Bharathi
3c9e914931 ci: tag release v2.16.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7103
GitOrigin-RevId: 52de369fc4bd35a92884706df4c0ec7c889d516c
2022-11-30 08:11:23 +00:00
paritosh-08
4e4f31de23 server: fix streaming subscription input type names
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7077
GitOrigin-RevId: dbc07b0c6e3d1c5721d15310623f27e74e1a6082
2022-11-30 06:48:58 +00:00
awjchen
04871c8a41 pro-server: add unit tests for the opentelemetry exporter
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6981
GitOrigin-RevId: 965fd2c4907c20407af9a987e9ea2e29f7e87349
2022-11-30 04:49:18 +00:00
awjchen
b1cb73e964 server: add another log line for metadata sync
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7102
GitOrigin-RevId: 0b18d4a07470c0c785db1b250d6d9c5e2b65676c
2022-11-30 04:03:18 +00:00
Puru Gupta
698190894f server: use kriti template to generate query param from list
## Description ✍️
This PR adds support to generate query params directly using a kriti template which can be used to flatten a list of parameter arguments as well.

### Changes in the Metadata API
Earlier the `query_params` key inside `request_transform` used to take in an object of key/value pairs where the `key` represents the query parameter name and `value` points to the value of the parameter or a kriti template which could be resolved to the value.

With this PR, we provide the user with more freedom to generate the complete query string using kriti template. The  `query_params` can now take in a string as well which will be a kriti template. This new change needs to be incorporated on the console and CLI metadata import/export as well.
- [x] CLI: Compatible, no changes required
- [ ] Console

## Changelog ✍️

__Component__ : server

__Type__: feature

__Product__: community-edition

### Short Changelog

use kriti template to generate query param from list of arguments

### Related Issues ✍
https://hasurahq.atlassian.net/browse/GS-243

### Solution and Design ✍
We use a kriti template to generate the complete query parameter string.

| Query Template | Output |
|---|---|
| `{{ concat ([concat({{ range _, x := [\"apple\", \"banana\"] }} \"tags={{x}}&\" {{ end }}), \"flag=smthng\"]) }}`| `tags=apple&tags=banana&flag=smthng`  |
| `{{ concat ([\"tags=\", concat({{ range _, x := $body.input }} \"{{x}},\" {{ end }})]) }}` | `tags=apple%2Cbanana%2C` |

### Steps to test and verify ✍
- start HGE and make the following request to `http://localhost:8080/v1/metadata`:
```json
{
    "type": "test_webhook_transform",
    "args": {
        "webhook_url": "http://localhost:3000",
        "body": {
            "action": {
                "name": "actionName"
            },
            "input": ["apple", "banana"]
        },
        "request_transform": {
            "version": 2,
            "url": "{{$base_url}}",
            "query_params": "{{ concat ([concat({{ range _, x := $body.input }} \"tags={{x}}&\" {{ end }}), \"flag=smthng\"]) }}",
            "template_engine": "Kriti"
        }
    }
}
```
- you should receive the following as output:
```json
{
    "body": {
        "action": {
            "name": "actionName"
        },
        "input": [
            "apple",
            "banana"
        ]
    },
    "headers": [],
    "method": "GET",
    "webhook_url": "http://localhost:3000?tags=apple&tags=banana&flag=smthng"
}
```

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6961
Co-authored-by: Tirumarai Selvan <8663570+tirumaraiselvan@users.noreply.github.com>
GitOrigin-RevId: 712ba038f03009edc3e8eb0435e723304943399a
2022-11-29 20:27:41 +00:00
Karthikeyan Chinnakonda
32a316aef7 server: provide an option to enable event triggers on logically replicated tables
## Description ✍️
This PR introduces a new feature to enable/disable event triggers during logical replication of table data for PostgreSQL and MS-SQL data sources. We introduce a new field `trigger_on_replication` in the `*_create_event_trigger` metadata API. By default the event triggers will not fire for logical data replication.

## Changelog ✍️

__Component__ : server

__Type__: feature

__Product__: community-edition

### Short Changelog

Add option to enable/disable event triggers on logically replicated tables

### Related Issues ✍

https://github.com/hasura/graphql-engine/issues/8814
https://hasurahq.atlassian.net/browse/GS-252

### Solution and Design
- By default, triggers do **not** fire when the session mode is `replica` in Postgres, so if the `triggerOnReplication` is set to `true` for an event trigger we run the query `ALTER TABLE #{tableTxt} ENABLE ALWAYS TRIGGER #{triggerNameTxt};` so that the trigger fires always irrespective of the `session_replication_role`
- By default, triggers do fire in case of replication in MS-SQL, so if the `triggerOnReplication` is set to `false` for an event trigger we add a clause `NOT FOR REPLICATION` to the the SQL when the trigger is created/altered, which sets the `is_not_for_replication` for the trigger as `true` and it does not fire during logical replication.

### Steps to test and verify ✍
- Run hspec integration tests for HGE

## Server checklist ✍

### Metadata ✍

Does this PR add a new Metadata feature?
-  Yes
  - Does `export_metadata`/`replace_metadata` supports the new metadata added?
    - 

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6953
Co-authored-by: Puru Gupta <32328846+purugupta99@users.noreply.github.com>
Co-authored-by: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com>
GitOrigin-RevId: 92731328a2bbdcad2302c829f26f9acb33c36135
2022-11-29 17:43:13 +00:00
Abby Sassel
7089b9de64 server/tests: Subscriptions > Value of Derived Field > Citus
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7065
GitOrigin-RevId: a14aa4e37971817b84e321dd6872cb17c12524a3
2022-11-29 11:17:21 +00:00
awjchen
41b64e8a9e server: clean up query variables hotfix
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6916
GitOrigin-RevId: ace6e625e70930d36e019be910a26101cb6eed5b
2022-11-29 10:06:14 +00:00
awjchen
badad573f6 server: implement resource attributes for the OpenTelemetry exporter
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6891
GitOrigin-RevId: 2c7b4767160e9fb976be4b5e656ef70cd19e4e0e
2022-11-29 07:35:09 +00:00
Daniel Chambers
ed79049637 Mutation Data Connector API types [GDC-594]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6893
GitOrigin-RevId: edf0f72027197ae61bfa8d27d53eabf6ca626112
2022-11-29 03:37:13 +00:00
Auke Booij
cca0b6e81a Further schema cache cleanups
Mostly trying to avoid tricky `Arrows` syntax, and unnecessary use of the `Hasura.Incremental` framework.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6997
GitOrigin-RevId: 9a2f5883e7e29af164e1581049ae003afec2cbe4
2022-11-29 01:02:09 +00:00
Auke Booij
7928179024 Delete SourceM type class
I encountered this dead code while doing other things: it's a type class with a single method which is never called. Deleting the type class allows us to simplify `TableCoreCacheRT` and `TableCacheRT`

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7075
GitOrigin-RevId: 121320349c478a93717b0706037553d8406cbfa9
2022-11-28 20:20:32 +00:00
Brandon Simmons
1b7602a2a5 server: define instance Functor InputFieldsParser by hand to lower memory usage slightly
fwiw: I was looking here because ghc-debug showed many closures associated with the Applicative instance,
but defining Monoid/Semigroup by hand and inlining didn't seem to have any effect

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7026
GitOrigin-RevId: 4ad2fd26519da98b2380658d89942c700de4ffa2
2022-11-28 15:58:11 +00:00
Philip Lykke Carlsen
a6e25a9e01 server/tests: Re-enable ObjectRelationshipsSpec for Citus
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7074
GitOrigin-RevId: 72592a29d6ea7897f93718b656fce4ac7179f4cc
2022-11-28 13:58:35 +00:00
Auke Booij
b0d4493b5c Replace non-canonical Select instance with a canonical one
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7066
GitOrigin-RevId: ef65253ad816d669d109cf45662817b3115b37c3
2022-11-28 09:50:18 +00:00
Abby Sassel
37e7480822 server/tests: refactor XToDBArrayRelationshipSpec setup/teardown
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7055
GitOrigin-RevId: 71d631165e4364d9cc22c303becf75fef5d01497
2022-11-25 17:59:19 +00:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 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
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
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
Samir Talwar
7c452bfca1 server/tests-py: Spawn a new PostgreSQL schema ("database") per test.
When running using the "new" style (with a HGE binary, not a URL), a new PostgreSQL metadata and source database are created for each test. When we get this into CI, this should drastically reduce the flakiness.

I have also enabled parallelization by default when using `run-new.sh`. It's much faster.

I had to basically rewrite _server/tests-py/test_graphql_read_only_source.py_ so that it does two different things depending on how it's run. It's unfortunate, but it should eventually go away.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6879
GitOrigin-RevId: a121b9035f8da3e61a3e36d8b1fbc6ccae918fad
2022-11-15 19:08:53 +00:00
Abby Sassel
3da0e2f1a2 NDAT-295 Cleanup Tests.Query structure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6878
GitOrigin-RevId: 521d8366a26ba933ebb7892d243a9ce94b90c8f0
2022-11-15 17:29:46 +00:00
Auke Booij
6ac67a5566 Allow collecting metadata dependencies and inconsistencies separately
`CollectedInfo` was just an awkward sum type. By using an explicit `Either` instead, we can guarantee at the type level that certain methods only write inconsistencies, or only write dependencies. This is useful, because if we can guarantee that no dependencies are written, then we don't need to run `resolveDependencies` on that part of the Metadata. In other words, we can keep it out of `BuildOutputs`, which greatly benefits performance - see e.g. hasura/graphql-engine-mono#6613.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6765
GitOrigin-RevId: 9ce099d2eee2278dbb6e5bea72063e4b6e064b35
2022-11-15 17:00:11 +00:00
Samir Talwar
3670a10ee5 Share database configuration across tests.
This enables sharing the Docker Compose-based database configuration across the Haskell-based API tests and the legacy Python integration tests.

Why? Because we depend on different database versions and I keep running out of disk space. I am far too lazy to buy another disk and set up my operating system _again_.

The files in question are:

- _docker-compose/databases.yaml_, which is the base specification for the databases
- _docker-compose.yml_, used by the API tests locally (and for other manual testing), which extends the above
- _.buildkite/docker-compose-files/test-oss-server-hspec.yml_, used by the API tests in CI, which extends _databases.yaml_
- _server/tests-py/docker-compose.yml_, used by the Python integration tests

The changes are summarized as follows:

1. The following snippets are moved from _docker-compose/databases.yaml_ to _docker-compose.yml_ and _.buildkite/docker-compose-files/test-oss-server-hspec.yml_, as they're not strictly necessary for other forms of testing:
    - the fixed port mappings (in the range 65000–65010)
    - the PostgreSQL initialization
    - the SQL Server initialization
2. Environment variables are used a little more in health checks and initialization scripts, as usernames, passwords, etc. can be overridden.
3. The volumes in _docker-compose/databases.yaml_ are made anonymous (unnamed), and the names are only specified in _docker-compose.yml_. We don't need to do this elsewhere.
    - For extra fun, I have removed all named volumes from the CI Docker Compose files, as they seem to be unnecessary.
4. _server/tests-py/docker-compose.yml_ now depends on _docker-compose/databases.yaml_.
    - This was the point.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6864
GitOrigin-RevId: f22f2839716f543ce8a62f890da244de7e23abaa
2022-11-15 14:32:46 +00:00
Abby Sassel
a2dcb70500 NDAT-295 Cleanup Tests.Schema structure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6871
GitOrigin-RevId: 314d2095de4db104dd9bd1fba6feb84de7bdb98c
2022-11-15 13:17:22 +00:00
Auke Booij
2d055df2a4 server: Simplify BuildOutputs
A bunch of configurations are retrieved from the Metadata, then stored in the `BuildOutputs` structure, only to then be forwarded to the `SchemaCache`, with extremely little processing in between.

So this simplifies the build pipeline for some parts of the metadata: just construct those things from `Metadata` directly, and store them in the `SchemaCache` without any intermediate container.

Why did we have the detour via `BuildOutputs` in the first place? Parts of the Metadata (codified by `MetadataObjId`) can generate _metadata inconsistencies_ and/or _schema dependencies_, which are related.

- Metadata inconsistencies are warnings that we show to the user, indicating that there's something wrong with their configuration, and they have to fix it.
- Schema dependencies are an internal mechanism that allow us to build a consistent view of the world. For instance, if we have a relationship from DB tables `books` to `authors`, but the `authors` table is inconsistent (e.g. it doesn't exist in the DB), then we have schema dependencies indicating that. The job of `resolveDependencies` is to then drop the relationship, so that we can at least generate a legal GraphQL schema for `books`.

If we never generate a schema dependency for a certain fragment of Metadata, then there is no reason to call `resolveDependencies` on it, and so there is no reason to store it in `BuildOutputs`.

---

The starting point that allows this refactor is to apply Metadata defaults before it reaches `buildAndCollectInfo`, so that metadata-with-defaults can be used elsewhere.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6609
GitOrigin-RevId: df0c4a7ff9451e10e02a40bf26304b26584ba483
2022-11-15 12:04:13 +00:00
Gil Mizrahi
15b3ac0aee ghc 9.2.5
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6777
Co-authored-by: Samir Talwar <47582+SamirTalwar@users.noreply.github.com>
GitOrigin-RevId: 916abab76446cf7c4e1e63dc112ba4994ab4d23d
2022-11-15 11:26:42 +00:00
Tom Harding
502115f969 Bump aeson to v2.1, drop the Extended module
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6869
GitOrigin-RevId: ecb2f7dfe7d00c0a01999c12b0264be7850e0f42
2022-11-15 10:44:36 +00:00
Solomon
d0a77a9f28 Prevents creation of duplicate GDC agent source kinds.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6865
GitOrigin-RevId: e3b3c68e91b22307ef4a9f215e34234b875d802f
2022-11-15 00:40:56 +00:00
Brandon Martin
22e6d7afcd server: Add Uppercase option to tests-dc-api
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6863
GitOrigin-RevId: 6e4950786cebedcbfcff26fed691a6b6bf0c1aa3
2022-11-14 23:08:26 +00:00
Daniel Harvey
ab0f67cfd9 [server/tests] fallback to default postgres port when none is provided
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6860
GitOrigin-RevId: abe30f2fa1df89281dae0ffaf9ef20ef50cf7d33
2022-11-14 22:38:28 +00:00
paritosh-08
ec13a55fd5 server: add validation for response transforms
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6821
GitOrigin-RevId: 88abcc408d0a1b73024356d9b32881bc3d4d746c
2022-11-14 15:19:23 +00:00
Abby Sassel
b7a09a42c1 NDAT-293 Update feature matrix with features tested in api-tests suite
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6855
GitOrigin-RevId: 37f8193b8528f90955d55d2812f6f45afca054c8
2022-11-14 14:37:30 +00:00
Lyndon Maydwell
6f9f44a441 Data Connectors API 400 error response - GDC-619
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6839
GitOrigin-RevId: 813ea5e976ff41754e7500abf6bcd0c8b70c960e
2022-11-14 05:26:16 +00:00
Philip Lykke Carlsen
6470eeb7f6 server/tests: Feature Matrix Compatibility Report
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6827
GitOrigin-RevId: f4d93684e5f47a6e43b4e870d2c87dbdee8f0bd8
2022-11-10 22:59:24 +00:00
Abby Sassel
8726236a9d NDAT-316 Improve askSourceInfo error reporting _even more_
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6835
GitOrigin-RevId: c15bea414176878c6ec96674376858294e48255b
2022-11-10 19:24:34 +00:00
paritosh-08
0b827fae66 server: remove built-in scalars from graphql schema printer
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6541
Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com>
GitOrigin-RevId: 5a2e35da2cf8718ee452429c56986066a3dc0c54
2022-11-10 18:53:05 +00:00
Jesse Hallett
31e402e767 server: remaining codecs for function metadata
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6654
GitOrigin-RevId: a9d24c72078d2a2b0c8a62a6084d5ab86518fdeb
2022-11-10 16:17:13 +00:00
Abby Sassel
63ec04493a NDAT-316 Improve askSourceInfo error reporting
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6807
GitOrigin-RevId: b27e642079915c3f0ca85d88195fe323e18800c1
2022-11-10 11:48:02 +00:00
Tom Harding
c0070bfd4b Add the ability to run api-tests against any (Postgres-like) connection string.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6791
GitOrigin-RevId: 5005eba75efbf7a0d7208be0a0794d63be82afd5
2022-11-10 09:44:11 +00:00
Samir Talwar
44a64ed983 server/test-harness: Wrap test resource setup/teardown.
When setting up a resource (typically some kind of web server) for use in tests, we need to remember to tear it down afterwards.

This moves this logic into one place, under the `TestResource` module.

Like `SetupAction`, it encapsulates setup and teardown, and also separates out waiting for the resource to be ready, so we don't accidentally leave it lying around in the case of a healthcheck failure.

Unlike `SetupAction`, it is monadic, and can be composed with other resources. In the future, we may want to adopt this logic for `SetupAction` too rather than using lists.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6806
GitOrigin-RevId: 74e2d76c5c09b8e0fe1cad84c9e77011f5a4d3db
2022-11-10 08:38:09 +00:00
awjchen
7d6e713d9f pro-server: hotfix: respect analyze_query_variables in logs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6754
GitOrigin-RevId: 3f1b0000d2962bd02708786331595828cf99b38c
2022-11-09 23:31:59 +00:00
Philip Lykke Carlsen
eb9506d954 server/tests: Structured logging in tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6805
GitOrigin-RevId: 4e4d3c12bad20948b5ad58b3ad6d1e882f4ceddb
2022-11-09 14:56:12 +00:00
Daniel Harvey
22556a482e tooling: update Mac compile guidance
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6804
GitOrigin-RevId: 43ce24a2dbbf2e8e5d1418d96ff552a324645e5f
2022-11-09 10:23:16 +00:00
Samir Talwar
8be01ae9aa server/api-tests: Use setupTablesAction everywhere.
This removes calls to `setup` and `teardown` in favor of `setupTablesAction`.

Because this action untracks and drops tables (at least until we figure out how to make throwaway databases), the teardown phase can fail. I have added a wrapper which logs and discards exceptions as a workaround for now.

In the future, when we can simply drop the database, it will probably be sensible to catch "table already untracked" exceptions specifically and let them slide, while still failing on all other exceptions.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6769
GitOrigin-RevId: 12cb8f81dd6aced892fe83c49b9a0bdbef8cc1ac
2022-11-09 09:36:43 +00:00
Gil Mizrahi
75ffa94b17 enable citus and cockroach streaming subscriptions and extend test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6711
GitOrigin-RevId: 10e012132bcef27b1ed35a654f349c6d74d72e1d
2022-11-09 07:23:37 +00:00
Daniel Chambers
431311e74e Add support for ordering by related tables and aggregates to the SQLite agent [GDC-313]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6773
GitOrigin-RevId: 9cca50511aa9e8ef7c4e2a20f280be0fa51aab85
2022-11-09 06:06:58 +00:00
Solomon
1ff7d3535f Refactor DataConnector FixtureName constructors
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6756
GitOrigin-RevId: 5f736a891ad15d4707f6a9d88037cbc89a4c00e5
2022-11-09 05:09:04 +00:00
Daniel Harvey
2d8e6372e9 [server/tests] - fresh CockroachDB per test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6788
GitOrigin-RevId: 71e1f0840de101796d2ebeec240a4f0075640a68
2022-11-08 18:59:17 +00:00
pranshi06
7b7845f697 server: add jwk-refresh-log type to default enabled logs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6775
GitOrigin-RevId: 23fbeceb91e51380ccf0bb5830a4471d8964a3f5
2022-11-08 16:48:44 +00:00
Daniel Harvey
48bb73ecb4 [server/tests] create new Postgres DB for each test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6741
GitOrigin-RevId: 0fa10ff8e3ab0ca9c36b1146ebf70434836f2531
2022-11-08 11:44:13 +00:00
pranshi06
fd6aa0a266 server: add jwk-refresh-log as configurable log type
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6705
GitOrigin-RevId: 1f6f45ce555cefc24836a2fc5363660e351fa13b
2022-11-08 07:37:50 +00:00
kodiakhq[bot]
3a76c57adf Some inlining and bang patterns to improve memory residency
Just forcing some of the most numerous thunks (with -hi profiling), it
seems some of these were retaining significant amount of data

this can follow merge of, or supersede #6679

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6710
GitOrigin-RevId: d0566ee288841e264637231a7f238946aa2e3564
2022-11-08 03:55:38 +00:00
Puru Gupta
a4eb5ad95d server: improve DX for heroku integration
## Description ✍️
This PR aims to improve the developer experience when using a heroku postgres instance as source database. Better error messages and relevant documentation are added as a part of this PR.

## Changelog ✍️

__Component__ : server

__Type__: enhancement

__Product__: community-edition

### Short Changelog

Improve DX for heroku integration

### Related Issues ✍
https://hasurahq.atlassian.net/browse/GS-202

### Steps to test and verify ✍
- Add a new heroku postgres instance as DB source in Hasura
- Try adding an event trigger
- Improved error message will be emitted:
```json
{
    "arguments": [],
    "error": {
        "description": null,
        "exec_status": "FatalError",
        "hint": null,
        "message": "pgcrypto can only be created in heroku_ext schema. Hint: You can set \"extensions_schema\" to provide the schema to install the extensions. Refer to the documentation here: https://hasura.io/docs/latest/deployment/postgres-requirements/#pgcrypto-in-pg-search-path",
        "status_code": "P0001"
    },
    "prepared": false,
    "statement": "CREATE EXTENSION IF NOT EXISTS pgcrypto SCHEMA public"
}
```

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6630
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com>
GitOrigin-RevId: a46d7c129a4e0378b7f33445f9bda11e0bddbd74
2022-11-08 03:55:30 +00:00
Samir Talwar
9ab4eb3994 server/api-tests: Only export spec from all test modules.
This ensures that tests don't accidentally share setup/teardown code.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6755
GitOrigin-RevId: 51551dfbc0668fcd884e7055ee3790c6f465bbf8
2022-11-08 03:54:52 +00:00
Divi
a509544440 ci: v2.15.0 catalog version update
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6760
GitOrigin-RevId: 87e4318f5cc7960a6e7032c5f2805cbe38564bf0
2022-11-08 03:53:27 +00:00
awjchen
ebb28ad4c9 pro-server: add support for exporting traces over OTLP
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5862
GitOrigin-RevId: fd80a59a1459095716f94cea7b2e54f9b5d19a98
2022-11-07 06:56:08 +00:00
awjchen
3e6840e4fa server: more adjustments to metadata sync logging
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6718
GitOrigin-RevId: 8cab5e6b39b1fa85e42fa176f3fb589c5da2c081
2022-11-05 22:38:22 +00:00
Jesse Hallett
de6e5d71b0 server: codecs for table, function, and remote relationship types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6608
GitOrigin-RevId: 9c91edec06e49b8d44960e322459ba7a05f26b5a
2022-11-04 21:44:41 +00:00
awjchen
8d6b39602a server: remove excessive metadata sync log line
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6715
GitOrigin-RevId: 564ae127b20638b15a6a0e407976ed4d90c81b4a
2022-11-04 19:42:17 +00:00
Daniel Harvey
e6c3113a43 [server]: feature flag to remove _stream fields from schema
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6698
GitOrigin-RevId: d2b80900d06353647505256fc351a07e6f7cd5f7
2022-11-04 13:10:35 +00:00
Daniel Chambers
381c81c806 Added new agent test to check ordering in deeply nested array relationships [GDC-605]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6721
GitOrigin-RevId: e0478bef0a8f5fffba9ef032be323cadc0f85116
2022-11-04 12:27:35 +00:00
Abby Sassel
8bb537e73b NDAT-72 CRDB Support for Value of Derived Field
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6707
GitOrigin-RevId: 8fab832a8ca225080d2797013f93d122e6424e35
2022-11-04 11:53:48 +00:00
Daniel Chambers
723c91bef4 Fixed unstable ordering issues in data connector agent test suite
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6687
GitOrigin-RevId: 278a6073923981683cb75cfb922f284e0960c324
2022-11-04 04:36:47 +00:00
Philip Lykke Carlsen
6720d77cd9 Perform fixture setup spec-by-spec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6708
GitOrigin-RevId: ac4b7350f6c0e9719f8b5973b267d72e3e4e444c
2022-11-03 20:27:02 +00:00
Philip Lykke Carlsen
1fa7f9b881 server/tests: Move 'emptySetupAction' to its single usage site
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6704
GitOrigin-RevId: 9adac1913fff3735b44c89c206e92544c9aa760b
2022-11-03 16:29:28 +00:00
Philip Lykke Carlsen
a4792a6b80 server/tests: Remove unnecessary complexity from Harness
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6700
GitOrigin-RevId: 3130097581b4e9284cd1074a5d74eb5165354eb4
2022-11-03 15:57:54 +00:00
Tom Harding
d823d201b9 CREATE SCHEMA _ IF NOT EXISTS in api-tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6701
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: 13ab91a8c4241fb4e60df9e8856bc926afac6be9
2022-11-03 14:54:48 +00:00
Lyndon Maydwell
4db9941b32 Prohibit underscores in dataconnector names [GDC-586]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6681
GitOrigin-RevId: 5335208fc4c8f0d1b16a45415329ef390a269b4c
2022-11-03 14:00:52 +00:00
Philip Lykke Carlsen
5b2877bc8f server/tests: Move subscriptions harness to a separate module
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6664
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: f5d7793606a50fb10f871ae757748fe5c21e50c8
2022-11-03 10:58:32 +00:00
Karthikeyan Chinnakonda
d7609233c4 Rename get_event_invocations to get_scheduled_event_invocations
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6513
Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com>
GitOrigin-RevId: 172ba6152ed77b90eeec9183a3fb4c6f177e45b3
2022-11-03 10:23:11 +00:00
Nicolas Inchauspe
b0d5238c3b console: globally add missing <!DOCTYPE html>
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6661
GitOrigin-RevId: ee45e493c76ad81569731dcd5468c846ba01cd12
2022-11-03 07:06:06 +00:00
awjchen
700d4616cb server: add logging for debugging metadata sync issues
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6657
GitOrigin-RevId: ab7b8015010d20a641606fad8cd1cc8563466d0c
2022-11-02 23:24:23 +00:00
Samir Talwar
342391f39d Upgrade Ormolu to v0.5.
This upgrades the version of Ormolu required by the HGE repository to v0.5.0.1, and reformats all code accordingly.

Ormolu v0.5 reformats code that uses infix operators. This is mostly useful, adding newlines and indentation to make it clear which operators are applied first, but in some cases, it's unpleasant. To make this easier on the eyes, I had to do the following:

* Add a few fixity declarations (search for `infix`)
* Add parentheses to make precedence clear, allowing Ormolu to keep everything on one line
* Rename `relevantEq` to `(==~)` in #6651 and set it to `infix 4`
* Add a few _.ormolu_ files (thanks to @hallettj for helping me get started), mostly for Autodocodec operators that don't have explicit fixity declarations

In general, I think these changes are quite reasonable. They mostly affect indentation.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6675
GitOrigin-RevId: cd47d87f1d089fb0bc9dcbbe7798dbceedcd7d83
2022-11-02 20:55:13 +00:00
Tom Harding
aaf8e9a8c1 Add tests for streaming subscriptions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6650
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 415f7904b591d2c4e32ec320570d1b8e0bef1719
2022-11-02 13:23:47 +00:00
Gil Mizrahi
60bd73e8d9 add a test for subscriptions with variables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6653
GitOrigin-RevId: b7d7f7392c50e983183812b270af3516c831d859
2022-11-02 12:47:04 +00:00
Daniel Harvey
11ff01f3e9 [server] Fix CockroachDB live queries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6551
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: e78ce17d3ff5c677360b2927dca04a91e144952e
2022-11-02 11:41:02 +00:00
Samir Talwar
dbc027424b Rename relevantEq to (==~) for Ormolu's sake.
Ormolu v0.5 tries to reformat code using operators according to fixity. Unfortunately, it doesn't really understand backticked functions (even when they have an associated `infix` declaration), and so messes up the formatting.

This is probably a bug in Ormolu, but we can work around it by using a symbol operator.

Happy to bikeshed on `==~` (which I am reading as "pretty much equal to"). Please yell at me if you prefer something else.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6651
GitOrigin-RevId: 79af427422194460200b2b48339cdb9ee9b33c33
2022-11-02 10:43:48 +00:00
Tom Harding
7df6198b68 Add multiplexed subscription testing
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6637
GitOrigin-RevId: a92b333b88c548ba514e69598a86098d8f6243cc
2022-11-02 09:39:47 +00:00
Karthikeyan Chinnakonda
9177335c31 Source catalog migrations minor enhancements
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6531
Co-authored-by: paritosh-08 <85472423+paritosh-08@users.noreply.github.com>
GitOrigin-RevId: 51dd55692f59d6ad0fd54674fb7d3ce00d5d83dd
2022-11-01 22:42:40 +00:00
Solomon
f5c68ee49e Fixes chinook table/column customizations to have consistent casing
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6642
GitOrigin-RevId: 629879fa057c3860aac1c3a83d2dfd199edb44e1
2022-11-01 22:08:59 +00:00
Lyndon Maydwell
4b968b17e0 ConfigSpec Data Connector Agent Test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6616
GitOrigin-RevId: dd5582cd6b61b7412d931035c043daa5fbb55c71
2022-11-01 21:38:12 +00:00
Daniel Harvey
cc87b25373 [tests] - allow Postgres source DB port to be overwritten in api-tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6646
GitOrigin-RevId: b96a68c5eab1ac33a226d2d89141e0de9eaeff93
2022-11-01 21:05:00 +00:00
Tom Harding
fbcf90d56f Add a test for Distinct queries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6426
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 65387489ab0cabe0cb520799821380732ecef3e7
2022-11-01 19:58:46 +00:00
Auke Booij
29b2161402 Add benchmarks for allowlist operations
There are some incremental Metadata API methods that have no good justification for taking so much time to complete. This adds some of them to the CI benchmark suite, so that we can track their performance.

I have a prototype to speed up some of these methods 10x; see hasura/graphql-engine-mono#6613.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6627
GitOrigin-RevId: fecc7f28cae734b4acad68a63cbcdf0a2693d567
2022-11-01 17:28:15 +00:00
Vishnu Bharathi
9318cb2533 ci: tag release v2.15.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6639
GitOrigin-RevId: e8b73f1eed61c279bf53b90339dba5f09f0e2d9a
2022-10-31 15:58:31 +00:00
Vishnu Bharathi
c729bd0ef3 ci: tag release v2.14.0
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6624
GitOrigin-RevId: a36d030369cc5572b9d11b4a65fd7294ece1fd56
2022-10-31 08:10:33 +00:00
hasura-bot
3ca779797d server: deduplicate Postgres function names with HashSet (close #8888)
GITHUB_PR_NUMBER: 9112
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/9112

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6353
Co-authored-by: Daniel Shuy <17351764+daniel-shuy@users.noreply.github.com>
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: ebfb57b98fe93b86d5319dc78ac1308e00941a2e
2022-10-28 08:24:25 +00:00
Vishnu Bharathi
348668a3c5 ci: tag release v2.13.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6593
GitOrigin-RevId: f91405a0ea5b7204c944b7f247e10f0d88c88d57
2022-10-28 05:38:33 +00:00
David Overton
87bcdb97c7 Use JSON instead of GraphQL for comparison operators
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6563
GitOrigin-RevId: 0819414df199292e0146ce3009295ce3e49f2439
2022-10-28 01:14:09 +00:00
Auke Booij
98ac94ae27 Benchmark the incremental metadata API
This introduces an adhoc operation to the benchmark of `huge_schema`, so that we can track performance of the incremental Metadata API.

This untracks a table that is not referenced by anything else in the `huge_schema` metadata, so that we don't need to cascade any changes. And then it tracks it again.

Benchmarking this will be valuable for working on `Hasura.Incremental`.

Results will start showing up in the benchmark report when this is merged to `main`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6553
GitOrigin-RevId: 65dad4f7a5fe1c230c5def136640bb68f4a4aa9b
2022-10-27 19:40:24 +00:00
Daniel Harvey
8ad0c65051 [tests] api-tests use separate metadata database
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6573
GitOrigin-RevId: baa425216fc7394d01d0e2923d7c7e54598da40b
2022-10-27 19:08:45 +00:00
Daniel Harvey
b3471f27b8 [server] enable Cockroach subscriptions and re-add CustomFieldsSpec test
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6568
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 678c4fcb55a576d52cdb8f40dcfe2bf7948e8863
2022-10-27 17:27:32 +00:00
Naveen Naidu
938a0a66cc server: do not apply default tenant time limits to Hasura EE
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6552
Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com>
GitOrigin-RevId: 2e4466308c3a9b5aba6dd55a79dae7de096a0f27
2022-10-27 15:37:00 +00:00
Tom Harding
78f3754953 Add Cockroach and Postgres to DataValidation tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6343
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 9f5d98e180721eaf12fd4c4e60a42b6dee6b5cca
2022-10-27 12:20:41 +00:00
Samir Talwar
6a81bdd0b9 server/tests-py: Generate random ports for a few more helper services.
I missed these.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6481
GitOrigin-RevId: 8bc92c27c8de25bc3518be5b788e7b5c55867df8
2022-10-27 11:49:06 +00:00
Samir Talwar
6f85498a44 server/tests-py: Use non-deprecated TLS code.
`ssl.wrap_socket` is deprecated in favor of `SSLContext.wrap_socket`.

Also throws in a quick speed improvement to _server/tests-py/run.sh_ on x86_64.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6498
GitOrigin-RevId: 7bbe5f86daf45677e2a39cfcfe183794ffcd2954
2022-10-27 09:17:22 +00:00
David Overton
9921823915 GDC-189 custom aggregations
>

## Description
->

This PR allows DC agents to define custom aggregate functions for their scalar types.

### Related Issues
->

GDC-189

### Solution and Design
>

We added a new property `aggregate_functions` to the scalar types capabilities. This allows the agent author to specify a set of aggregate functions supported by each scalar type, along with the function's result type.

During GraphQL schema generation, the custom aggregate functions are available via a new method `getCustomAggregateOperators` on the `Backend` type class.
Custom functions are merged with the builtin aggregate functions when building GraphQL schemas for table aggregate fields and for `order_by` operators on array relations.

### Steps to test and verify
>

• Codec tests for aggregate function capabilities have been added to the unit tests.
• Some custom aggregate operators have been added to the reference agent and are used in a new test in `api-tests`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6199
GitOrigin-RevId: e9c0d1617af93847c1493671fdbb794f573bde0c
2022-10-27 00:44:06 +00:00
hasura-bot
a2e6e50e27 Fix broken links
GITHUB_PR_NUMBER: 9138
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/9138

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6462
Co-authored-by: arpitpandey0209 <9442768+arpitpandey0209@users.noreply.github.com>
GitOrigin-RevId: 85ce1a190477803f553deb31c1c95b512fa3fca0
2022-10-26 14:22:19 +00:00
ananya-2410
e2dc37ab60 ci: tag release v2.14.0-beta.2
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6540
GitOrigin-RevId: 20cfc7b281e3664b67b4fa8be44a307716efef63
2022-10-26 08:47:06 +00:00
Vamshi Surabhi
40de5f21f9 remove cyclic dependencies in 'Hasura.GraphQL.Schema' module
Prior to this commit, various definition types representing GraphQL schema internally and the logic which collected a schema from the definition types were in a single module called `Hasura.GraphQL.Schema`. This created cyclic dependencies between `Hasura.GraphQL.Schema` module and `Hasura.GraphQL.Schema.Convert` module.

This is now fixed by:
1. Moving all the definition related types into `Hasura.GraphQL.Schema.Definition` module
1. The logic that collects a GraphQL Schema from these types into `Hasura.GraphQL.Schema.Collect`

With these changes, `Hasura.GraphQL.Schema` module just exports both these modules.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6517
GitOrigin-RevId: d5207cf31335aeeddd874ed6f921a17892580b4c
2022-10-25 15:02:28 +00:00
Philip Lykke Carlsen
8cb14a592d server: Add an ExperimentalFeatureFlag for Aggregation Predicates
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6523
GitOrigin-RevId: 76861a1bf0d9895901564935b0778e7bda75c6a9
2022-10-25 13:21:40 +00:00
Vamshi Surabhi
c2a1d30765 simplify type collection for introspection
No user facing changes. Minor cleanup.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6519
GitOrigin-RevId: 7d9b6077a609175642059895800e9c540cf62790
2022-10-25 11:13:38 +00:00
Philip Lykke Carlsen
064095abdb server/tests: Add ability to test subscriptions in test-harness
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6494
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: d773139d59e590a5dbbc1c596958e2731dff3e76
2022-10-25 09:06:45 +00:00
Luca Restagno
49e9c47db3 Docs: improve Console contributing instructions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6471
GitOrigin-RevId: bec885589e9e8e631e73dc288dea60375d5e9248
2022-10-25 08:14:52 +00:00
Antoine Leblanc
50bdd9610e [documentation] add more details to remote joins engineering documentation
### Description

This small PR develops a bit the existing documentation about remote joins. It adds a new section that details where each piece of the feature is located, and adds two paragraphs detailing some of the implementation details of the execution.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6505
GitOrigin-RevId: 6edd5459e4081cc6c9a80fdc92c2d479dedb2be9
2022-10-24 20:54:26 +00:00
Daniel Harvey
daf55101f4 tests: force remove BigQuery datasets and don't bother manually removing tables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6473
GitOrigin-RevId: 15cefa76cfd472f4197ae965970dfbc203f694a4
2022-10-24 16:54:35 +00:00
Daniel Chambers
792ef3117d Export Chinook dataset to JSON lines for Athena consumption
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6489
GitOrigin-RevId: 36a068179d595f3d838995fb057b8ee590d1fd02
2022-10-24 02:10:51 +00:00
Abby Sassel
3427488c68 NDAT-206 Disable the relay schema for cockroach sources
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6468
GitOrigin-RevId: 9c7735c2318580f1b853d6a8d2d586cffef72c59
2022-10-21 19:11:41 +00:00
paritosh-08
b8bbb8a621 server: optional query params in REST connector
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6381
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: b777b373b2fbe19ceb32f812d4eaba45ef0a5a58
2022-10-21 18:40:48 +00:00
Samir Talwar
133a9b7452 server/tests-py: Generate random ports for helper services.
If the tests are run with specific ports assigned to specific services,
set through the environment variables, we continue to use those ports.
We just don't hard-code them now, we pick them up from the environment
variables.

However, if the environment variables are not set, we generate a random
port for each service. This allows us to run multiple tests in parallel
in the future, independently.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6218
GitOrigin-RevId: 3d2a1880bf67544c848951888ce7b4fa1ba379dc
2022-10-21 17:34:21 +00:00
Samir Talwar
c3afa0fdd7 Install and use ODBC Driver 18 for SQL Server (msodbcsql18).
This installs the ODBC Driver 18 for SQL Server in all our shipped Docker images, and update our tests and documentation accordingly.

This version supports arm64, and therefore can run natively (or via Docker) on macOS on aarch64.

`msodbcsql17` is still installed in production-targeted Docker images so that users do not _have_ to migrate to the new driver.

Nix expressions are packaged for the new driver, as it is not yet available in nixpkgs.

In this version, [the default encryption setting was changed from "no" to "yes"](https://techcommunity.microsoft.com/t5/sql-server-blog/odbc-driver-18-0-for-sql-server-released/ba-p/3169228). In addition, "mandatory" and "optional" were added as synonyms for "yes" and "no" respectively.

I have therefore modified all connection strings in tests to specify `Encrypt=optional` (and changed some from `Encrypt=no`). I chose "optional" rather than "no" because I feel it's more honest; these connection strings will work with or without an encrypted connection.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6241
GitOrigin-RevId: 959f88dd1f271ef06a3616bc46b358f364f6cdfd
2022-10-21 16:25:04 +00:00
Gil Mizrahi
d12827561b NDAT-207 fix unique constraints and indexes for cockroachdb
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6444
GitOrigin-RevId: 2baf2c954aeead47b82396cafe703e41e0f201a2
2022-10-21 14:03:55 +00:00
Gil Mizrahi
9c3bd2f0d0 server/postgres: fix the schema types conflict between aggregation predicates and table selection aggregates
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6452
GitOrigin-RevId: ed43442c7ade298659bdc42ff76e8e229825f0f1
2022-10-21 13:28:43 +00:00
Daniel Harvey
ac4b15c07b CI: reject unused imports
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6466
GitOrigin-RevId: 157a51f338e4e80dffedb8b0dcf57173ba6bd126
2022-10-21 11:12:53 +00:00
paritosh-08
e692c3b20d server: add IF EXISTS while dropping the constraint in source migration
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6457
GitOrigin-RevId: 1e76ca71c35cf117da7a073080df8a39e5820ddd
2022-10-21 04:44:08 +00:00
Vamshi Surabhi
a01d1188f2 scaffolding for remote-schemas module
The main aim of the PR is:

1. To set up a module structure for 'remote-schemas' package.
2. Move parts by the remote schema codebase into the new module structure to validate it.

## Notes to the reviewer

Why a PR with large-ish diff?

1. We've been making progress on the MM project but we don't yet know long it is going to take us to get to the first milestone. To understand this better, we need to figure out the unknowns as soon as possible. Hence I've taken a stab at the first two items in the [end-state](https://gist.github.com/0x777/ca2bdc4284d21c3eec153b51dea255c9) document to figure out the unknowns. Unsurprisingly, there are a bunch of issues that we haven't discussed earlier. These are documented in the 'open questions' section.

1. The diff is large but that is only code moved around and I've added a section that documents how things are moved. In addition, there are fair number of PR comments to help with the review process.

## Changes in the PR

### Module structure

Sets up the module structure as follows:

```
Hasura/
  RemoteSchema/
    Metadata/
      Types.hs
    SchemaCache/
      Types.hs
      Permission.hs
      RemoteRelationship.hs
      Build.hs
    MetadataAPI/
      Types.hs
      Execute.hs
```

### 1. Types representing metadata are moved

Types that capture metadata information (currently scattered across several RQL modules) are moved into `Hasura.RemoteSchema.Metadata.Types`.

- This new module only depends on very 'core' modules such as
  `Hasura.Session` for the notion of roles and `Hasura.Incremental` for `Cacheable` typeclass.

- The requirement on database modules is avoided by generalizing the remote schemas metadata to accept an arbitrary 'r' for a remote relationship
  definition.

### 2. SchemaCache related types and build logic have been moved

Types that represent remote schemas information in SchemaCache are moved into `Hasura.RemoteSchema.SchemaCache.Types`.

Similar to `H.RS.Metadata.Types`, this module depends on 'core' modules except for `Hasura.GraphQL.Parser.Variable`. It has something to do with remote relationships but I haven't spent time looking into it. The validation of 'remote relationships to remote schema' is also something that needs to be looked at.

Rips out the logic that builds remote schema's SchemaCache information from the monolithic `buildSchemaCacheRule` and moves it into `Hasura.RemoteSchema.SchemaCache.Build`. Further, the `.SchemaCache.Permission` and `.SchemaCache.RemoteRelationship` have been created from existing modules that capture schema cache building logic for those two components.

This was a fair amount of work. On main, currently remote schema's SchemaCache information is built in two phases - in the first phase, 'permissions' and 'remote relationships' are ignored and in the second phase they are filled in.

While remote relationships can only be resolved after partially resolving sources and other remote schemas, the same isn't true for permissions. Further, most of the work that is done to resolve remote relationships can be moved to the first phase so that the second phase can be a very simple traversal.

This is the approach that was taken - resolve permissions and as much as remote relationships information in the first phase.

### 3. Metadata APIs related types and build logic have been moved

The types that represent remote schema related metadata APIs and the execution logic have been moved to `Hasura.RemoteSchema.MetadataAPI.Types` and `.Execute` modules respectively.

## Open questions:

1. `Hasura.RemoteSchema.Metadata.Types` is so called because I was hoping that all of the metadata related APIs of remote schema can be brought in at `Hasura.RemoteSchema.Metadata.API`. However, as metadata APIs depended on functions from `SchemaCache` module (see [1](ceba6d6226/server/src-lib/Hasura/RQL/DDL/RemoteSchema.hs (L55)) and [2](ceba6d6226/server/src-lib/Hasura/RQL/DDL/RemoteSchema.hs (L91)), it made more sense to create a separate top-level module for `MetadataAPI`s.

   Maybe we can just have `Hasura.RemoteSchema.Metadata` and get rid of the extra nesting or have `Hasura.RemoteSchema.Metadata.{Core,Permission,RemoteRelationship}` if we want to break them down further.

1. `buildRemoteSchemas` in `H.RS.SchemaCache.Build` has the following type:

   ```haskell
   buildRemoteSchemas ::
     ( ArrowChoice arr,
       Inc.ArrowDistribute arr,
       ArrowWriter (Seq CollectedInfo) arr,
       Inc.ArrowCache m arr,
       MonadIO m,
       HasHttpManagerM m,
       Inc.Cacheable remoteRelationshipDefinition,
       ToJSON remoteRelationshipDefinition,
       MonadError QErr m
     ) =>
     Env.Environment ->
     ( (Inc.Dependency (HashMap RemoteSchemaName Inc.InvalidationKey), OrderedRoles),
       [RemoteSchemaMetadataG remoteRelationshipDefinition]
     )
       `arr` HashMap RemoteSchemaName (PartiallyResolvedRemoteSchemaCtxG remoteRelationshipDefinition, MetadataObject)
   ```

   Note the dependence on `CollectedInfo` which is defined as

   ```haskell
   data CollectedInfo
     = CIInconsistency InconsistentMetadata
     | CIDependency
         MetadataObject
         -- ^ for error reporting on missing dependencies
         SchemaObjId
         SchemaDependency
     deriving (Eq)
   ```

   this pretty much means that remote schemas is dependent on types from databases, actions, ....

   How do we fix this? Maybe introduce a typeclass such as `ArrowCollectRemoteSchemaDependencies` which is defined in `Hasura.RemoteSchema` and then implemented in graphql-engine?

1. The dependency on `buildSchemaCacheFor` in `.MetadataAPI.Execute` which has the following signature:

   ```haskell
   buildSchemaCacheFor ::
     (QErrM m, CacheRWM m, MetadataM m) =>
     MetadataObjId ->
     MetadataModifier ->
   ```

   This can be easily resolved if we restrict what the metadata APIs are allowed to do. Currently, they operate in an unfettered access to modify SchemaCache (the `CacheRWM` constraint):

   ```haskell
   runAddRemoteSchema ::
     ( QErrM m,
       CacheRWM m,
       MonadIO m,
       HasHttpManagerM m,
       MetadataM m,
       Tracing.MonadTrace m
     ) =>
     Env.Environment ->
     AddRemoteSchemaQuery ->
     m EncJSON
   ```

   This should instead be changed to restrict remote schema APIs to only modify remote schema metadata (but has access to the remote schemas part of the schema cache), this dependency is completely removed.

   ```haskell
   runAddRemoteSchema ::
     ( QErrM m,
       MonadIO m,
       HasHttpManagerM m,
       MonadReader RemoteSchemasSchemaCache m,
       MonadState RemoteSchemaMetadata m,
       Tracing.MonadTrace m
     ) =>
     Env.Environment ->
     AddRemoteSchemaQuery ->
     m RemoteSchemeMetadataObjId
   ```

   The idea is that the core graphql-engine would call these functions and then call
   `buildSchemaCacheFor`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6291
GitOrigin-RevId: 51357148c6404afe70219afa71bd1d59bdf4ffc6
2022-10-21 03:15:04 +00:00
Samir Talwar
c2cb07f7e8 server/tests-py: Start webhook.py inside the test harness.
We use a helper service to start a webhook-based authentication service for some tests. This moves the initialization of the service out of _test-server.sh_ and into the Python test harness, as a fixture.

In order to do this, I had to make a few changes. The main deviation is that we no longer run _all_ tests against an HGE with this authentication service, just a few (those in _test_webhook.py_). Because this reduced coverage, I have added some more tests there, which actually cover some areas not exacerbated elsewhere (mainly trying to use webhook credentials to talk to an admin-only endpoint).

The webhook service can run both with and without TLS, and decide whether it's necessary to skip one of these based on the arguments passed and how HGE is started, according to the following logic:

* If a TLS CA certificate is passed in, it will run with TLS, otherwise it will skip it.
* If HGE was started externally and a TLS certificate is provided, it will skip running without TLS, as it will assume that HGE was configured to talk to a webhook over HTTPS.
* Some tests should only be run with TLS; this is marked with a `tls_webhook_server` marker.
* Some tests should only be run _without_ TLS; this is marked with a `no_tls_webhook_server` marker.

The actual parameterization of the webhook service configuration is done through test subclasses, because normal pytest parameterization doesn't work with the `hge_fixture_env` hack that we use. Because `hge_fixture_env` is not a sanctioned way of conveying data between fixtures (and, unfortunately, there isn't a sanctioned way of doing this when the fixtures in question may not know about each other directly), parameterizing the `webhook_server` fixture doesn't actually parameterize `hge_server` properly. Subclassing forces this to work correctly.

The certificate generation is moved to a Python fixture, so that we don't have to revoke the CA certificate for _test_webhook_insecure.py_; we can just generate a bogus certificate instead. The CA certificate is still generated in the _test-server.sh_ script, as it needs to be installed into the OS certificate store.

Interestingly, the CA certificate installation wasn't actually working, because the certificates were written to the wrong location. This didn't cause any failures, as we weren't actually testing this behavior. This is now fixed with the other changes.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6363
GitOrigin-RevId: 0f277d374daa64f657257ed2a4c2057c74b911db
2022-10-20 19:00:01 +00:00
Daniel Harvey
be9c3e5a66 tests: remove unused imports
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6456
GitOrigin-RevId: 563ce912236552c4bf75dc7f7f506b7dced25118
2022-10-20 13:14:00 +00:00
Lyndon Maydwell
37c65d4395 Support MetadataDefaults Options - GDC-108
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6286
GitOrigin-RevId: ef861e6070e667322fb2657166d3d343d6cab4bc
2022-10-20 12:46:45 +00:00
Anon Ray
e22b3816d9 server: fix the 'starting API server' log to be in correct place
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5198
GitOrigin-RevId: a70477086778697d04042a779e77a8fd74220d2d
2022-10-20 08:30:36 +00:00
Samir Talwar
0a66d87305 server/tests-py: Upgrade to postgresql-client-15.
This means we can run `TestPGDump` against it.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6372
GitOrigin-RevId: 2512a1f372342e5793b97aeb34f19b92be99b6b2
2022-10-20 05:57:30 +00:00
Daniel Chambers
84b84a78e1 Add column scalar type information Data Connector query API request [GDC-493]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6433
GitOrigin-RevId: c5f5e0c2e25c6820d9f73a1e90699cf18dc4cd47
2022-10-20 03:24:53 +00:00
Rakesh Emmadi
1c745959b9 relocate 'ServerReplicas' and 'ResizePoolStrategy' types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6448
GitOrigin-RevId: 2d317fd004db63e2830dfb8def92acb51bb576a0
2022-10-20 01:34:17 +00:00
Solomon
3e3ebe9743 Update Kriti to 0.3.3
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6430
GitOrigin-RevId: 5430f6c6b89f5f5dd65bd6ecf086fa5516a95140
2022-10-20 00:59:23 +00:00
Antoine Leblanc
49d0594759 [server] prune join fields of remote relationships to remote schema (close hasura/graphql-engine#8345)
## Description

This PR fixes hasura/graphql-engine#8345: when creating the final representation of a remote relationship to a remote schema (a `RemoteJoin`), we would mistakenly label ALL join fields in the selection set as being relevant to that one relationship: if there are more than one remote relationship to process in that selection set, that would be the union of all their join fields. The problem with this error is that, when processing remote relationships, we correctly ignore all the ones for which at least one join key is null. Consequently, this error would result in us ignoring remote relationships for which an _unrelated_ join key was null, resulting in that data missing in the final JSON result.

This PR simply ensures that the aggregation of fields that are passed to `createRemoteJoin` is pruned to only contain the fields relevant to the join being created. This is a very small change, and the bulk of this PR is the regression tests.

## Changelog

__Component__ : server
__Type__: bugfix
__Product__: community-edition

### Short Changelog

fix remote relationship to remote schema sometimes being erroneously null when multiple relationships are defined on the same table / graphql object ([#8345](https://github.com/hasura/graphql-engine/issues/8345))

### Long Changelog

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6420
GitOrigin-RevId: eb54462724b007f80b674dcf234adf6d9cfaaf79
2022-10-20 00:11:51 +00:00
Brandon Simmons
cc6f1c3b69 multitenant: make ourIdleGC parameters tunable, and with better defaults (SRE-191)
Context: https://hasurahq.atlassian.net/browse/SRE-10

Also remove an overlapping instance.

-----

The new flags if this needs to be tweaked on production by SRE are:

- --idleGCIdleInterval : "When the system has been idle for idleGCIdleInterval we may opportunistically try a major GC to run finalizers"
-  --idleGCMinGCInterval : "We never run an opportunistic GC unless it has been at least idleGCMinGCInterval seconds since the last major GC"
-  --idleGCMaxNoGCInterval : "If it has been longer than idleGCMaxNoGCInterval since the last major GC, force a GC to run finalizers"

Be aware: we may see memory usage grow to higher peaks than before, especially when under load

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6449
GitOrigin-RevId: 662d2f968f0d73b3b6eebb857c49aaede3312705
2022-10-19 21:36:56 +00:00
Gil Mizrahi
c6fdb44388 Test on_conflict on cockroachdb.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6423
GitOrigin-RevId: 58e1c3f60934332720cadb74c8cb29730e797287
2022-10-19 08:51:49 +00:00
Gil Mizrahi
666f34d564 Add cockroach to default and on_conflict tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6412
GitOrigin-RevId: 637abad70096a06c39a13b9c8683444e2bebdecf
2022-10-18 19:48:27 +00:00
Philip Lykke Carlsen
d81571f928 Add support for explain in CockroachDB
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6415
GitOrigin-RevId: d60363d6f466a764b79c887631f9e3f094946440
2022-10-18 16:49:03 +00:00
Tom Harding
346640fdf1 Add tests for query variables
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6383
GitOrigin-RevId: 87345b60ca2206aac097740109fedfeff045598a
2022-10-18 15:55:22 +00:00
Samir Talwar
8435d7a5fb server: Update the contributing guide.
* The versions for some tools were out of date; updated accordingly.
* The link to the Dockerfile was broken.
* Included instructions for Nix.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6403
GitOrigin-RevId: 3acbafe90e4bb9267dcdb2dce5e205773a14dfc9
2022-10-18 09:50:46 +00:00
Tom Harding
17ea024884 Add tests for query fragments
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6385
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 2cb3255cf9c1aea9e010affecc5f038ea6aa6ab9
2022-10-18 09:17:41 +00:00
Philip Lykke Carlsen
032c25240b fix: Disable subscriptions in CockroachDB
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6368
GitOrigin-RevId: b1434b830d3ef84e13c7abb64ecb6ef3c1878a55
2022-10-18 08:44:34 +00:00
Tom Harding
c1b66d7243 Add tests for query aliases
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6384
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 331baf9ec41bc6b2d618362e87defa44ca39da40
2022-10-18 08:11:06 +00:00
Solomon
1e8846d27d Refactor GDC Fixture Modules for Hspec Tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6358
GitOrigin-RevId: 19b63d1db75998875463eb2a88e938eba688ecb0
2022-10-18 05:33:46 +00:00
Daniel Chambers
5c51ff4288 Fix conflicting data connector comparison exp GraphQL types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6394
GitOrigin-RevId: c272e8aad426a18ccadfec005e03d5b2669e035c
2022-10-18 04:19:12 +00:00
Solomon
15ac95d446 Adds GDC Fixture to query specs
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6352
GitOrigin-RevId: 2abba0743648e7f24baddd7591eee737ba795869
2022-10-18 02:48:33 +00:00
Solomon
5e85b0c534 Mutable Sqlite GDC Fixture - GDC-455
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6351
GitOrigin-RevId: bdcb3cfa694dda6a0d1473331bc689aae418a5bb
2022-10-17 22:53:14 +00:00
Tom Harding
a4a7d06000 Add (failing) remote relationship test for CockroachDB
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6315
GitOrigin-RevId: dd15b1743343d8d1156cc18462b24535f5e05f56
2022-10-17 15:19:03 +00:00
Daniel Harvey
f4f4221d04 tests: Docker Compose healthchecks
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6282
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
Co-authored-by: Samir Talwar <47582+SamirTalwar@users.noreply.github.com>
GitOrigin-RevId: c2b1f958364ce5e1ef704fa1275d18ac810ca35b
2022-10-17 13:20:31 +00:00
Samir Talwar
ed4d948adf server/tests-py: Make run.sh work on aarch64.
This helps with running the tests locally on a recent Mac.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6304
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: eb5c6a185f68b216c94df2581acf71906cce7872
2022-10-17 12:08:25 +00:00
Rakesh Emmadi
5666161ac9 server/multitenant: resize sources' connection pools when a cloud project is scaled, global connection pooling
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5708
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
Co-authored-by: pranshi06 <85474619+pranshi06@users.noreply.github.com>
Co-authored-by: Puru Gupta <32328846+purugupta99@users.noreply.github.com>
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
Co-authored-by: Anon Ray <616387+ecthiender@users.noreply.github.com>
GitOrigin-RevId: 513d497548d89b397d4a299355b11607daec3c7e
2022-10-17 08:06:12 +00:00
Solomon
4700ac44fb Webhook Transforms: Move RequestCtx into a type family
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5975
GitOrigin-RevId: 08ad528b2600379deb4cef9d39968126c7c745d8
2022-10-16 03:55:06 +00:00
Solomon
011e7be360 Dispatch JSON serialization by BackendType for Table Names in Test Suite
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6350
GitOrigin-RevId: 736a41592c3acd018fa1777dafc0b2e8098d2dc6
2022-10-14 01:47:49 +00:00
Daniel Chambers
6d8231903c Reworked scalar type determination in SQLite agent [GDC-455]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6335
GitOrigin-RevId: baf7619a0c705bddcbd75f8842bf8fcfeeaa05c9
2022-10-13 19:03:25 +00:00
Jesse Hallett
c6bcf1cd76 server: codecs for object & array relationships, and computed fields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5923
GitOrigin-RevId: e0c7584539998f5af16795f023640aa5c659b783
2022-10-13 17:57:23 +00:00
Krushan Bauva
63f90cc93c server: add api limit - batch limit
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6183
Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com>
Co-authored-by: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com>
GitOrigin-RevId: 517766e10a3e94a54b754df69c47c61232d8dbb2
2022-10-13 16:54:26 +00:00
Samir Talwar
0d4d7e6b1e server/tests-py: Start helper services in the test harness.
This makes it possible for the test harness to start the test JWK server and the test remote schema server.

In order to do this, we still generate the TLS certificates in the test script (because we need to install the generated CA certificate in the OS certificate store), and then pass the certificate and key paths into the test runner.

Because we are still using _test-server.sh_ for now, we don't use the JWK server fixture in that case, as HGE needs the JWK server to be up and running when it starts. Instead, we keep running it outside (for now).

This is also the case for the GraphQL server fixture when we are running the server upgrade/downgrade tests.

I have also refactored _graphql_server.py_ so there isn't a global `HGE_URLS` value, but instead the value is passed through.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6303
GitOrigin-RevId: 06f05ff674372dc5d632e55d68e661f5c7a17c10
2022-10-13 15:45:24 +00:00
Philip Lykke Carlsen
10ae79173e Mention all src-rsr files in 'extra-source-files' section
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6341
GitOrigin-RevId: 90d9a43304ab48caa67f2d0267a821ebb51a362c
2022-10-13 13:58:20 +00:00
Daniel Harvey
4e23afed8d tests: disable stringifyNumbers in tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6338
GitOrigin-RevId: d3819dfda342af2b70df00d49edfc05dfa9582f5
2022-10-13 12:19:32 +00:00
pranshi06
dccc2cea03 server: unauthenticated behaviour with Apollo ws
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4862
GitOrigin-RevId: 14db3fa732c7d6430795193e425769b63a221f19
2022-10-13 09:33:53 +00:00
Samir Talwar
96a768e526 Upgrade HLint to v3.4.1.
This upgrades CI and anyone using Nix to HLint v3.4.1.

If you're not using Nix, this doesn't actually _do_ anything on your
local machine; it's just a suggestion.

It also applies a bunch of simple HLint refactors, using
`make lint-hs-fix`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6324
GitOrigin-RevId: de8267e4909d6dcd3f83543188517f3aaeebc5f3
2022-10-12 19:14:56 +00:00
Jesse Hallett
332faabc24 server: codecs for remaining database configuration types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6062
GitOrigin-RevId: f1ba9fa30267d1825ba36480103cd973616f3079
2022-10-12 16:30:05 +00:00
Tom Harding
9242aea138 Add Delete tests for Cockroach
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6283
GitOrigin-RevId: 25c075741afbc7730cf13cd79c8838e812eb8cff
2022-10-12 15:03:32 +00:00
Samir Talwar
e78dc7f4eb server/tests-py: Remove checks for PostgreSQL 9.x.
We no longer run tests against these PostgreSQL versions.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6320
GitOrigin-RevId: 175ec5bd5db5fe0a96733f948a10b141aa40ba09
2022-10-12 14:27:48 +00:00
Daniel Harvey
557bbe0327 server: remove unused imports
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6314
GitOrigin-RevId: 7e22264c0d6159cb446af28bf9834f6abda3ab03
2022-10-12 11:30:29 +00:00
Divi
66fa31944d ci: add catalog version for v2.14.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6308
GitOrigin-RevId: ceba6d62264603ee5d279814677b29bcc43ecaea
2022-10-12 06:40:35 +00:00
Brandon Martin
59820c5db5 server: Add tablePermissionsCommands to DataConnector API
Adding tablePermissionsCommands metadata api commands to dataconnector api

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5877
GitOrigin-RevId: feda63a963c6059a9ad72c0f1e13ed2dbb8e0d9b
2022-10-12 01:44:36 +00:00
paritosh-08
5c774cf839 server,pro: fix batch_size behaviour for auto event trigger log cleanup
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6279
GitOrigin-RevId: 20b8e6a22a26d97cd78655027aa2f30b7838462d
2022-10-11 19:27:53 +00:00
Daniel Harvey
f2f83be6cc tests: re-enable pg-dump tests for Postgres 14
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6248
GitOrigin-RevId: f64989caa0768a5f309f38b147062e0bf3a61155
2022-10-11 17:53:25 +00:00
Tom Harding
2f94bcf6c7 Add Update tests for Cockroach
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6271
GitOrigin-RevId: ecb38e084f433e29e3ae4e2a6f2039907afcf6d3
2022-10-11 15:18:56 +00:00
Tom Harding
4237c56419 Add more Cockroach tests to api-tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6189
Co-authored-by: Daniel Harvey <4729125+danieljharvey@users.noreply.github.com>
GitOrigin-RevId: fb03fc2f21ef392f63a5d0d4164ff75cc215692c
2022-10-11 14:48:38 +00:00
Gil Mizrahi
3a73997555 server/cockroach: fix long identifiers tests for cockroach
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6257
GitOrigin-RevId: 94aa7e59159db2130718285221db88f20ca7079a
2022-10-11 12:59:51 +00:00
Divi
2e2aab9f2f ci: catalog version update for v2.13.0
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6293
GitOrigin-RevId: cbadd0591f01ae1f038fb9d92aff68e46cc600d1
2022-10-11 12:11:34 +00:00
Tom Harding
d7d83d26d6 Add simple Insert tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6269
Co-authored-by: Samir Talwar <47582+SamirTalwar@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: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com>
Co-authored-by: hasura-bot <30118761+hasura-bot@users.noreply.github.com>
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
Co-authored-by: Daniel Chambers <1214352+daniel-chambers@users.noreply.github.com>
Co-authored-by: Abhijeet Khangarot <26903230+abhi40308@users.noreply.github.com>
Co-authored-by: Manas Agarwal <5352361+manasag@users.noreply.github.com>
Co-authored-by: Vijay Prasanna <11921040+vijayprasanna13@users.noreply.github.com>
GitOrigin-RevId: e522df6409137aca2209e4e686f673a389abd546
2022-10-11 11:18:26 +00:00
Philip Lykke Carlsen
ee34921d0d refactor: QualifiedIdentifier to use TableIdentifier
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6210
GitOrigin-RevId: 1fa24321396bbb68dd5f8516aab76850ebeebfa4
2022-10-11 10:43:43 +00:00
Tom Harding
4fdbda05ec Enable Postgres enums for Cockroach
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6232
GitOrigin-RevId: cc29e4932c3a24039efaf28f890a3dad97b51c3e
2022-10-11 09:09:26 +00:00
Lyndon Maydwell
d54bb30d3b Structured Error Protocol for Data Connectors Agents - GDW-137
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6061
Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com>
GitOrigin-RevId: 855d96378030f4e01b0c74b00e20e592e51e7a49
2022-10-11 00:26:24 +00:00
Daniel Harvey
34d01caebb tests: simplify healthchecks for Pytests in Docker
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6270
GitOrigin-RevId: 70a6c1298bfaf032f6279a6575f37feb8270a392
2022-10-10 19:18:41 +00:00
Daniel Harvey
1aaa7b1b47 server: revert "fetch col_description using value from column directly"
Reverts hasura/graphql-engine-mono#6228

We are getting metadata timeouts again, this needs looking into before enabling again.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6277
GitOrigin-RevId: 397c1704834a5e2332cca50d14a46c117f34d1ca
2022-10-10 15:28:44 +00:00
Daniel Chambers
8369cac3bd Data Connector agent data schema capabilities [GDC-479]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6268
GitOrigin-RevId: 4ec29566d3c2ab2144dad8055b4442a4027915ec
2022-10-10 06:59:30 +00:00
Daniel Chambers
c862c64b33 Break down Data Connector agent schema tests into finer grained, more accurate, tests [GDC-479]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6225
GitOrigin-RevId: 8eaadcc14cf4bc90a22450e924daf8cc340ed2ea
2022-10-10 02:25:09 +00:00
Auke Booij
6f6177db38 Remove some unnecessary OPTIONS_GHC pragmas
I didn't track why these were left behind. Presumably GHC 9.2 has an improved redundant constraint checker, so that explains a few. Otherwise, perhaps code got refactored along the way.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6256
GitOrigin-RevId: b6275edf3e867f8e33bdec533ce9932381d36bbb
2022-10-07 17:27:08 +00:00
Auke Booij
4c016b4c42 Clean up pg-client-hs
- Remove a few unnecessary helper functions
- Delete kind annotations
- Bring GHC warnings and language extensions more in line with those of the `graphql-engine` library
- Constrain unconstrained dependency on `hasql-pool`

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6251
GitOrigin-RevId: 10c2530f007f70cf1464cec36566ee2264589881
2022-10-07 11:56:55 +00:00
Tom Harding
1d1ab15b47 Remove parsing for functions in Cockroach
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6250
GitOrigin-RevId: 389f58a327096ef9586c7a0f35df243955f73a5d
2022-10-07 09:51:07 +00:00
Daniel Harvey
ba2e585a15 server: fetch col_description using value from column directly
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6228
GitOrigin-RevId: 8a887817ae3003bc63b49a79d3d4772b2dcea020
2022-10-07 08:42:16 +00:00
Samir Talwar
36031d62d2 server/tests-py: Fix the run.sh and run-new.sh scripts to work with our new server-builder image.
This updates _docker-compose.yml_ to use the new image tags, and updates _run.sh_ accordingly.

While I was at it, I also added a `docker compose pull` instruction to make sure that we don't have surprises half-way through the script, and a few `echo` lines for clarity.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6235
GitOrigin-RevId: 3855f6898bd3e906c5f423d9d0d6a7031de3777a
2022-10-06 19:04:58 +00:00
Daniel Harvey
ad53402d1d test: Check CockroachDB can query into JSONB values with a path
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6124
GitOrigin-RevId: 3de6b6c602d41d4d340c355171c10ac33582b9a5
2022-10-06 13:03:03 +00:00
Gil Mizrahi
d8452bf11c server: remove ghc libs from freeze file, update guides
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6231
GitOrigin-RevId: d877e46d7130217cd95eb9c507921e76a0009151
2022-10-06 12:27:09 +00:00
Daniel Harvey
87ca46f79b tests: add Postgres 14 and Postgres 15 pytests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5968
GitOrigin-RevId: 6569e58b89f014268152cfe7bf1f6c11233fbe49
2022-10-06 09:46:38 +00:00
Brandon Simmons
823babe885 server: switch to ghc 9.2 (2nd try)
## Migrating, for server devs

You will need the fork of 9.2.4 that we're using (for now):

```
ghcup -c -n install ghc --force -u "https://storage.googleapis.com/graphql-engine-cdn.hasura.io/ghc-bindists/ghc-x86_64-deb10-linux-9.2.4-hasura-fix.tar.xz" 9.2.4
```

or for m1 mac:

```
ghcup -c -n install ghc --force -u  "https://storage.googleapis.com/graphql-engine-cdn.hasura.io/ghc-bindists/ghc-arm64-apple-darwin-9.2.4-hasura-fix.tar.xz"
```

Samir is working on a nix build for nix folx

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6154
GitOrigin-RevId: 6716e3f2ee19f0281c8ad25383a1241fc362d616
2022-10-06 09:09:01 +00:00
Daniel Chambers
d713cad315 Add support for lowercase table and column names in the Data Connector agent tests [GDC-463]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6179
GitOrigin-RevId: 6455e5809ea06b86dfbcddf781ee105088ca78f9
2022-10-05 23:25:00 +00:00
Samir Talwar
6a586cdaa0 api-tests: Sort and uniquify test module names in the Cabal file.
The duplicates make Cabal 3.8.x choke.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6206
GitOrigin-RevId: 7c6c69c721aed659a19db7b9124749dd6566d5dc
2022-10-05 12:38:48 +00:00
Philip Lykke Carlsen
3fea9ce4fc Refactor FromItem to use TableIdentifier
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6166
GitOrigin-RevId: 97d4fb0bec6d1c60e168f2503328ad5ef38915b2
2022-10-05 10:04:57 +00:00
Samir Talwar
64c40b9a95 CI: Run the "server hpack" check on main and invalidate the cache properly.
We seem to be rebuilding hpack on every PR. I'm hoping this will allow PRs to share a cache.

I have also changed the cache key to include the entirety of _server/VERSIONS.json_, and added the GHC version there, to make sure it's properly invalidated.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6142
GitOrigin-RevId: fc61a26ad721f59f52687913f6978902f4c2ca0a
2022-10-04 09:01:20 +00:00
Tom Harding
f05f746b94 Extract the test harness from the Hspec tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6095
Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com>
GitOrigin-RevId: 51693f7324e62e201a2bdc701255cf6c730745e2
2022-10-04 08:31:26 +00:00
Auke Booij
05b3a64e8f Clean up Hasura.Prelude a bit
- Remove `onJust` in favor of the more general `for_`
- Remove `withJust` which was used only once
- Remove `hashNub` in favor of `Ord`-based `uniques`
- Simplify some of the implementations in `Hasura.Prelude`
- Add `hlint` hint from `maybe True` to `all`, and `maybe False` to `any`

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6173
GitOrigin-RevId: 2c6ebbe2d04f60071d2a53a2d43c6d62dbc4b84e
2022-10-03 21:50:53 +00:00
Auke Booij
6602ad44b1 Print the definitions of the types that are conflicting
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6139
GitOrigin-RevId: 1ab0eecb0f75fb57534fd39add9bfde5041c090e
2022-10-03 21:13:18 +00:00
Auke Booij
3efabe99b3 Memoize column parsers (within roles)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6036
GitOrigin-RevId: 225698f6db02b16599d9f157c9fe4c03b16fb71b
2022-10-03 20:11:44 +00:00
Auke Booij
6515ae8dbe Improve description for table select columns enum type
Before:
```
select Name {unName = "upeopoeklplxfaa"}columns of table "exbiovdrgjqskdr"
```
After:
```
select "upeopoeklplxfaa" columns of table "exbiovdrgjqskdr"
```

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6143
GitOrigin-RevId: 80a4075057c6d7361a000cb5c1e9b7a166a4f125
2022-10-03 11:00:10 +00:00
Auke Booij
b03ed983f1 Remove spaces before colons in error messages and descriptions
This PR is the result of running the following commands:
```bash
$ git grep -l '".* : "' -- '*.hs' | xargs sed -i -E 's/(".*) : "/\1: "/'
$ scripts/dev.sh test --integration --accept
```

Also manually fixed a few tests and docs

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6148
GitOrigin-RevId: cf8b87605d41d9ce86613a41ac5fd18691f5a641
2022-10-01 14:48:58 +00:00
Brandon Simmons
98a9c5af79 server: remove default +RTS -qn2 setting
We notice significant improvements to max GC pause time, for huge schema (both on 8.10 and 9.2)

This was added when we were on ghc-8.6.5. The referenced issues (from old oss repo) seem irrelevant or don't have useful information afaict

re. https://hasurahq.atlassian.net/browse/SRE-10
https://hasurahq.atlassian.net/browse/SRE-129

-----

**EDIT**: old discussion https://hasurahq.slack.com/archives/CKFUG6RCH/p1576518775017100

It sounds as though if the `replace_metadata` benchmark doesn't regress then we're okay

**EDIT**: Ooh nice, replace_metadata is much faster across the benchmark sets (see "both compared" details)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6133
GitOrigin-RevId: c1e2292f29a52584062dfebf2dd676118fcd978f
2022-09-30 20:11:54 +00:00
Philip Lykke Carlsen
7739f8e4a0 server: Permit strings for numerical input fields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5996
GitOrigin-RevId: 2ed36898aa0286618f3dafe3513ef4e01c58aaba
2022-09-30 13:25:57 +00:00
Gil Mizrahi
d1434e4932 run bigquery with retry in test-harness
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6141
GitOrigin-RevId: dce43ed5ce5ffffaa7680f5fa550c7df59c8cae4
2022-09-30 12:49:02 +00:00
Gil Mizrahi
8c725acac8 fix type name generation for aggregation predicate functions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6138
GitOrigin-RevId: bfb77f97bb30c43bca698a1c405f75abd3eaffb9
2022-09-30 09:36:34 +00:00
Samir Talwar
3cb9bab9f1 server/tests-py: Provide the admin secret to the HGE server.
When we run the HGE server inside the test harness, it needs to run with
an admin secret for some tests to make sense. This tags each test that
requires an admin secret with `pytest.mark.admin_secret`, which then
generates a UUID and injects that into both the server and the test case
(if required).

It also simplifies the way the test harness picks up an existing admin
secret, allowing it to use the environment variable instead of requiring
it via a parameter.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6120
GitOrigin-RevId: 55c5b9e8c99bdad9c8304098444ddb9516749a2c
2022-09-29 17:20:07 +00:00
Daniel Harvey
cffd564a7e tests: NoQueriesAvailable fix for CockroachDB
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6071
GitOrigin-RevId: 5dd4261fd6fc84d059f9b2d28f7efe0f140333e9
2022-09-29 13:50:17 +00:00
Samir Talwar
60f81023db server/tests-py: Run the auth hook inside the test harness.
This teaches `hge_server` how to run more tests, thanks to `hge_env`.

It also simplifies the logic a bit more.

I have also modified _run.sh_ and _docker-compose.yml_ so we can run multiple test suites, one after another.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6105
GitOrigin-RevId: eff009362eb6bb90c07cedaf96dfe6ec9336ff32
2022-09-29 10:44:03 +00:00
Jesse Hallett
d32dc881e3 server: fix MySQL connection pool settings getting swapped on parse
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6063
GitOrigin-RevId: 90f6f8485aa6a9d073edc56dcba5530f5cf787c4
2022-09-28 21:11:26 +00:00
Samir Talwar
93e8803d3e Reload sources when applying metadata.
If we don't do this, we might end up applying metadata with a stale schema cache.

Following the principle of least surprise, replacing the metadata should probably compute inconsistencies with regards to the actual state of the database.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6026
GitOrigin-RevId: ff7469d7d9857c8a9f517d5d0b6f1ecf463621b3
2022-09-28 13:48:25 +00:00
Samir Talwar
8cb2738cbe server/tests-py: Declaratively state the HGE environment variables.
This has two purposes:

* When running the Python integration tests against a running HGE instance, with `--hge-url`, it will check the environment variables available and actively skip the test if they aren't set. This replaces the previous ad-hoc skip behavior.
* More interestingly, when running against a binary with `--hge-bin`, the environment variables are passed through, which means different tests can run with different environment variables.

  On top of this, the various services we use for testing now also provide their own environment variables, rather than expecting a test script to do it.

In order to make this work, I also had to invert the dependency between various services and `hge_ctx`. I extracted a `pg_version` fixture to provide the PostgreSQL version, and now pass the `hge_url` and `hge_key` explicitly to `ActionsWebhookServer`.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6028
GitOrigin-RevId: 16d866741dba5887da1adf4e1ade8182ccc9d344
2022-09-28 09:21:02 +00:00
Samir Talwar
d9afcc1857 Upgrade all package-lock.json files to the v2 format.
NPM v7 uses a new (backwards-compatible) lockfile format. This upgrades all our various _package-lock.json_ files to use the new format.

It's much more verbose so that NPM can be a lot faster.

I figured it was cleaner to do this once in a separate PR rather than upgrading them in combination with adding or upgrading a new dependency.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5869
GitOrigin-RevId: 322fb63b96e2d873a4a3cc05fa6c7afa414716ce
2022-09-28 08:15:29 +00:00
Daniel Harvey
d03d86a5e7 ci: Testing more Postgres versions with Hspec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5919
GitOrigin-RevId: c6d1d0463b3640d4f33b54de6a2a425dec3920a2
2022-09-28 03:39:22 +00:00
Daniel Chambers
6af3fa2d78 Add the ability to test against tables in configurable schemas in Data Connector Agent test suite
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6083
GitOrigin-RevId: 5a7ee37ed3a62224a062dbaac7d322dfd95b83c4
2022-09-27 23:42:32 +00:00
Daniel Harvey
27fca2a3ed tests: fix ViewsSpec for CockroachDB
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6076
GitOrigin-RevId: 8423880cd5b6ba5794fa5096cf3955fb858b4610
2022-09-27 20:12:15 +00:00
Tom Harding
a9f7c1ef80 Reverse stringifyNumbers assertions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6079
GitOrigin-RevId: 2db16d057f5ff2ea261d23b43eeced22ebd0235a
2022-09-27 16:52:21 +00:00
paritosh-08
fabbd134b2 server: add metadata origin in streaming subscription field parser
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6075
GitOrigin-RevId: 901ba21dbcbf9bee4ca38cba21a5440ca10f3407
2022-09-27 15:56:46 +00:00
Daniel Harvey
3fadeeb5f9 server: Console Sentry DSN support
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5899
GitOrigin-RevId: 941647350def3ef21979c091e562c374ad562016
2022-09-27 14:51:52 +00:00
Abby Sassel
629f60eb55 server/postgres: address translateTableRelationship feedback
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6073
GitOrigin-RevId: 6316d64256d4fd34936e1d8c6afffb0db15f2fe7
2022-09-27 14:16:52 +00:00
paritosh-08
a88e6cfa9d server, pro: make http manager with allowlist in migrateCatalogSchema
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6045
GitOrigin-RevId: 34d67615b5a9e6b7f59760ecf89977764fcb1868
2022-09-27 09:25:28 +00:00
Daniel Harvey
bfa5296ecf server: Upgrade to CockroachDB 22.2 nightly and enable skipped tests from oid error
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6046
GitOrigin-RevId: 21a660bf4deab9bbe0465443685338191b90e485
2022-09-27 08:55:45 +00:00
Tom Harding
a1c5ac46f6 Extract dc-api and its tests from graphql-engine.cabal
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6000
Co-authored-by: Daniel Chambers <1214352+daniel-chambers@users.noreply.github.com>
GitOrigin-RevId: d8f3cd0194191ab4c51a5a7d350cb2c3a0a5a7f3
2022-09-27 07:21:54 +00:00
awjchen
8e05e51f1b server: report metrics API status from config API
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5599
GitOrigin-RevId: b66eb5c3a0034fe5ab7c764b34f7def77edd3fc0
2022-09-27 06:49:45 +00:00
Auke Booij
8e600362e7 Improve error message phrasing in safeSelectionSet
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6053
GitOrigin-RevId: c2595f396845e9ca809b93566b38239d80a244b8
2022-09-27 06:08:25 +00:00
Daniel Harvey
f42bc4b816 server: feature flag for disabling TABLE_updates fields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6039
GitOrigin-RevId: fcbafe2e4b8cf72d739033b372b536d59c398c4e
2022-09-26 13:25:37 +00:00
kodiakhq[bot]
c5de79d10c server: merge graphql-parser-hs into the monorepo
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5906
Co-authored-by: José Lorenzo Rodríguez <37621+lorenzo@users.noreply.github.com>
Co-authored-by: Vitali Barozzi <26206141+vitalibarozzi@users.noreply.github.com>
Co-authored-by: Karthikeyan Chinnakonda <15602904+codingkarthik@users.noreply.github.com>
Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com>
Co-authored-by: jkachmar <8461423+jkachmar@users.noreply.github.com>
Co-authored-by: Antoine Leblanc <1618949+nicuveo@users.noreply.github.com>
Co-authored-by: Solomon <24038+solomon-b@users.noreply.github.com>
Co-authored-by: paritosh-08 <85472423+paritosh-08@users.noreply.github.com>
Co-authored-by: Evie Ciobanu <1017953+eviefp@users.noreply.github.com>
Co-authored-by: Vamshi Surabhi <6562944+0x777@users.noreply.github.com>
Co-authored-by: Samir Talwar <47582+SamirTalwar@users.noreply.github.com>
GitOrigin-RevId: 4864173fd616fbbb2fe3a839d0c5eabd76a2e1f2
2022-09-26 11:23:37 +00:00
Auke Booij
7e10ff4e13 server: don't export the backend_only permissions flag if it is set to false while exporting metadata
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6006
GitOrigin-RevId: 60207193b654407bffdbf8436f5be36f46c6d8c6
2022-09-26 06:11:57 +00:00
Philip Lykke Carlsen
46ef2e5d2a feat: Document aggregation predicates
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5894
GitOrigin-RevId: 2a06f7afdec6741aca7464eee42617aca920b9ad
2022-09-23 13:49:49 +00:00
Lyndon Maydwell
4d2e37b3e6 Raw Query Support for Data Connectors - GDW-394
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5890
Co-authored-by: Vijay Prasanna <11921040+vijayprasanna13@users.noreply.github.com>
GitOrigin-RevId: f6bd2ed5fe170bcce262564cf4f45c95c9bdff94
2022-09-22 21:09:06 +00:00
Samir Talwar
fef1caabce server/tests-py: Support MSSQL and Citus with run.sh and run-new.sh.
This adds support for running the Python integration tests for MSSQL and Citus just as in CI, as follows:

```
./server/tests-py/run.sh backend-mssql
./server/tests-py/run.sh backend-citus
```

These run the named CI jobs, providing the appropriate backend.

(In reality, all backends are always provided, which is much simpler.)

It also provides the various databases to _server/tests-py/run-new.sh_, though the tests fail as they don't properly initialize the sources. (This will be fixed in the future by provisioning sources in the test framework itself.)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5997
GitOrigin-RevId: c276a4779a35bb538ef0dc02ac8b7cb2d5a8dec5
2022-09-22 19:03:44 +00:00
Brandon Simmons
d2b3ec8938 ci/benchmarks: fix copypaste bug affecting regression report highlighting in #5942
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6021
GitOrigin-RevId: eb77bf97a52e533c565bfb12a45c0851f832610d
2022-09-22 16:24:15 +00:00
Gil Mizrahi
dd37456949 replace SELECT FROM with SELECT 1 FROM to fix count aggregates for cockroachdb
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5787
GitOrigin-RevId: f5f01a64ccffa36c93a0a88228ac927fbd3aa168
2022-09-22 13:58:03 +00:00
kodiakhq[bot]
81df74852e ci/benchmarks: tweak what we present in regression report
- Make regression report more compact, remove `min` since it doesn't behave like a limit
- It looks like the low-load variants are probably just noisier with fewer samples, so remove them from the regression view:

![samples](https://user-images.githubusercontent.com/210815/191076137-f5c3a0c6-9586-4ea4-a5a7-66000e7a2540.png)

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5942
GitOrigin-RevId: 8a9ab00c251f04d7d5a542731696cb5f86ad2b78
2022-09-22 13:28:56 +00:00
Abby Sassel
37b846c28d server/postgres: aggregation predicate filters should respect aggregation queries permissions
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5936
GitOrigin-RevId: ecb6d677873676ec2bcb7d0bedd1ec707f8e05a1
2022-09-22 12:53:05 +00:00
Abby Sassel
b59008c880 server/postgres: implement execution of aggregation predicates (permissions)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5959
GitOrigin-RevId: eebfe36d217c333b393a308a1db19271809b6a87
2022-09-22 11:15:04 +00:00
Karthikeyan Chinnakonda
3b167b7df1 server: fix bug when streaming subscription cursor has custom name
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6009
GitOrigin-RevId: ba69bbd3a2c8f44e717cb64c8195041edc80a2d6
2022-09-22 09:52:36 +00:00
ananya-2410
c34d2504e8 ci: tag release v2.13.0-beta.1
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6008
GitOrigin-RevId: 3b877e49dcf5ce4116b8b68581a9189521ac81f9
2022-09-22 08:19:04 +00:00
Daniel Harvey
f80ec1d543 server: Rename AltJ to ViaJSON
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5911
GitOrigin-RevId: bd4dec9792f2137b2f4e3169e19109a3d3f63b50
2022-09-21 18:42:30 +00:00
Tom Harding
e71496efa5 Replace Hasura.RQL.Types.Numeric with refined
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5913
GitOrigin-RevId: 96e218229a08dfbc5a598d709be1ee2083d41ec6
2022-09-21 18:03:04 +00:00
paritosh-08
1c7e19c209 server/docs: event trigger log cleanup | remove default for clear_older_than
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5998
GitOrigin-RevId: 1376fd2192c7daaf73e8099cdb2f1aab4b8c3cd1
2022-09-21 17:29:55 +00:00
Samir Talwar
8b8d7ab96d server/tests-hspec: Simplifying the steps required to run these on macOS on aarch64.
This makes a few changes to the test scripts and makefiles in order to make things simpler for the average Apple user.

First of all, we change the `wait_for_mysql` function to use "localhost", not "127.0.0.1", as this fixed an issue on my system when attempting to connect to the MySQL server.

Secondly, we split the SQL Server test image into two:

* The first is the server itself, which now automatically uses `azure-sql-edge` as the image if you are on an aarch64 chip and using the `make` commands.
* The second is the initialization script. Because `sqlcmd` is not available in the `azure-sql-edge` image on aarch64, we use a separate container based on `mssql-tools` to initialize the server.

The README has been updated.

Tested on both macOS/aarch64 (with other changes) and Linux/x86_64.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5986
GitOrigin-RevId: b16e079861dcbcc66773295c47d715e443b67eea
2022-09-21 16:48:21 +00:00
Daniel Harvey
231de5166a server: bump CockroachDB image and un-skip fixed tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5967
GitOrigin-RevId: 28a2f8e94d091c8ddd272b6abf3828c40662ef38
2022-09-21 14:11:06 +00:00
Daniel Harvey
e2ced4011d server: import local Postgres modules as Postgres
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5962
GitOrigin-RevId: 862862c34b6c633c94ee8ae1f075afca2799fd2b
2022-09-21 11:35:50 +00:00
Daniel Chambers
3365a18516 Rename DataConnector cross_table capability to subquery
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5980
GitOrigin-RevId: c289b2a7afb4d07214aac2b4d89c9b87a75e98aa
2022-09-21 10:48:05 +00:00
paritosh-08
876c906660 server: event trigger log cleanup | rename start_event_trigger_cleanups API
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5976
GitOrigin-RevId: 752c905d31b3700aa49d816ec573df74715f6654
2022-09-21 06:00:39 +00:00
Daniel Chambers
dc9a86680c Gardening: Clean up Data Connector API types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5977
GitOrigin-RevId: 1a6898d6416fff265a8add74d414c979f7fa3bc5
2022-09-21 05:13:03 +00:00
Brandon Simmons
fc9cc14943 ci/benchmarks: don't measure decompression in k6 (NOT REAL PERFORMANCE IMPROVEMENT)
See: https://github.com/grafana/k6/issues/2685

It might be interesting to think about taking into consideration decompression time when thinking about performance, but In general I think doing so is surprising and I wasted a lot of time trying to figure out why my optimizations to the compression codepath weren't improving things  to the degree I expected

The downside here is we lose error reporting, so you'll need to only set
discardResponseBodies: true after the query has been tested.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5940
GitOrigin-RevId: 82a589a59b93f10ffb5391e4a3190459fb6e613b
2022-09-21 02:07:54 +00:00
Auke Booij
4c8ea8e865 Import pg-client-hs as PG
Result of executing the following commands:
```shell
# replace "as Q" imports with "as PG" (in retrospect this didn't need a regex)
git grep -lE 'as Q($|[^a-zA-Z])' -- '*.hs' | xargs sed -i -E 's/as Q($|[^a-zA-Z])/as PG\1/'
# replace " Q." with " PG."
git grep -lE ' Q\.' -- '*.hs' | xargs sed -i 's/ Q\./ PG./g'
# replace "(Q." with "(PG."
git grep -lE '\(Q\.' -- '*.hs' | xargs sed -i 's/(Q\./(PG./g'
# ditto, but for [, |, { and !
git grep -lE '\[Q\.' -- '*.hs' | xargs sed -i 's/\[Q\./\[PG./g'
git grep -l '|Q\.' -- '*.hs' | xargs sed -i 's/|Q\./|PG./g'
git grep -l '{Q\.' -- '*.hs' | xargs sed -i 's/{Q\./{PG./g'
git grep -l '!Q\.' -- '*.hs' | xargs sed -i 's/!Q\./!PG./g'
```
(Doing the `grep -l` before the `sed`, instead of `sed` on the entire codebase, reduces the number of `mtime` updates, and so reduces how many times a file gets recompiled while checking intermediate results.)

Finally, I manually removed a broken and unused `Arbitrary` instance in `Hasura.RQL.Network`. (It used an `import Test.QuickCheck.Arbitrary as Q` statement, which was erroneously caught by the first find-replace command.)

After this PR, `Q` is no longer used as an import qualifier. That was not the goal of this PR, but perhaps it's a useful fact for future efforts.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5933
GitOrigin-RevId: 8c84c59d57789111d40f5d3322c5a885dcfbf40e
2022-09-20 19:55:51 +00:00
paritosh-08
f7115891f7 server: event trigger log cleanup | change metedata API field name
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5965
GitOrigin-RevId: aa50006946e79fe4d9c971568221dc436040b738
2022-09-20 16:33:11 +00:00
Tom Harding
8dcc8f8fca Implement aggregation tests for hspec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5960
GitOrigin-RevId: bac9bae3ea39c005f0e7b9c5f7864f012d395ebb
2022-09-20 15:23:46 +00:00
paritosh-08
607b26362d server: event trigger cleanup | fix query_timeout field name
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5953
GitOrigin-RevId: b80b6672db5a73cafca77ba06cf25f71c7dc8c10
2022-09-20 12:47:22 +00:00
Samir Talwar
0b3c8ccaca server/tests-py: Support running BigQuery tests with run.sh.
This fixes a few issues so that we can run `./server/tests-py/run.sh backend-bigquery` to run the Python integration tests for BigQuery locally.

* We forward the relevant environment variables to the Docker container.
* We increase the HTTP timeout, as I'm seeing requests taking up to 90s locally.
* We rewrite the setup so that it avoids `INSERT INTO`, which is not available using the BigQuery free tier. Instead, we use `CREATE TABLE ... AS SELECT ...`. This is the same method used by the Haskell integration tests.

We also capture local server output in a volume so it's easier to figure out what went wrong later.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5921
GitOrigin-RevId: c628f8c08a84f2582958659ab6d6494832471f6f
2022-09-20 10:56:36 +00:00
Abby Sassel
89f9a5fdf2 server/tests: add permissionRows field and Permission constructor
Factoring out some minor cleanup from a PR which [tests aggregate filters and permissions](https://github.com/hasura/graphql-engine-mono/pull/5936). This PR adds a `permissionRows` field to the `Permission`s type, needed to test row permissions (https://github.com/hasura/graphql-engine-mono/pull/5936) and some default constructors.

Relates to https://github.com/hasura/graphql-engine-mono/issues/5888

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5949
GitOrigin-RevId: 89679a49496364473976cc73afa4d064a02bbf21
2022-09-20 09:17:32 +00:00