Commit Graph

25 Commits

Author SHA1 Message Date
Samir Talwar
5df3e6fac4 Inline format arguments into the format string when possible. (#703)
V3_GIT_ORIGIN_REV_ID: 50d6a12eefbfcc6b217d226759856e957fac0f4b
2024-06-12 11:25:38 +00:00
Samir Talwar
0c6d6a67d2 Semicolons, everywhere! (#700)
If a function doesn't return a value, terminate with a semicolon.

I also moved `implicit_hasher` and `return_self_not_must_use` to the
"definitely keep disabling this" list, and installed
[Bacon](https://dystroy.org/bacon/) in the Nix shell to make it easier
to run Clippy.

V3_GIT_ORIGIN_REV_ID: ffb17b42d982518aec433a1676dba0a0dd0ad95d
2024-06-11 15:33:32 +00:00
Samir Talwar
ca830c05fb Be more explicit about clones, and remove a few. (#671)
Calling `.to_owned()` on a reference, `.to_vec()` on a vector reference,
etc. are just synonyms for `.clone()` which are less explicit about
cloning. Let's be explicit.

This also removes some unnecessary clones.

V3_GIT_ORIGIN_REV_ID: 1bc00c4106f0346303d73e4268c89030c0ce93fc
2024-06-05 13:26:33 +00:00
Samir Talwar
7281322f51 Enable a few lint warnings around conditions, and fix the highlighted areas. (#662)
1. Use `map_or(…, …)` instead of `.map(…).unwrap_or(…)`.
2. Use `.is_some_and(…)` instead of `.map(…).unwrap_or_default(…)`.
3. Nest `|` patterns where possible.
4. Be more specific about match patterns.

I found I could also simplify `typecheck_qualified_type_reference`
considerably.

V3_GIT_ORIGIN_REV_ID: 6a3b1a4c525c0187c2fdb6df0c979ca0b7b3016c
2024-06-05 08:42:03 +00:00
Samir Talwar
40e23db51e Apply a few lints to make it struct construction clearer. (#661)
1. Always name the struct when calling `default()`.
2. Sort construction according to the definitions.
3. Approve allowing `struct_field_names` because it doesn't seem to be
helpful.
4. Enable `manual_string_new`; nothing seems to be triggering it now.

V3_GIT_ORIGIN_REV_ID: 868742114b0bf27bc3ea03cdf1e63a0f710ebe33
2024-06-04 08:42:48 +00:00
Samir Talwar
d8277974a8 Move a couple of lint suppressions closer to the code. (#658)
Rather than allowing the `cast_precision_loss` and `inline_always`
warnings everywhere, we just suppress them in the few places they're
already used.

V3_GIT_ORIGIN_REV_ID: c28350a21efa029c8c6aae2a602eec2d75f42216
2024-06-03 12:16:14 +00:00
Samir Talwar
02ee05bed4 Merge match branches to reduce duplication. (#649)
V3_GIT_ORIGIN_REV_ID: 69b2e0a370c547aed9ed798fa54168bc67f98569
2024-05-31 14:44:11 +00:00
Samir Talwar
dfccac348e Use Clippy to help simplify conditions. (#648)
Just because it's fewer lines of code.

1. Invert `if`/`else` blocks with negative conditions.
2. Unwrap redundant `else` blocks.
3. Simplify a few branches to `let … else`.
4. Replace a `match` with `if let`.

V3_GIT_ORIGIN_REV_ID: 4f10730b688d21c1fc86a45ee5fb4adf008b3d94
2024-05-31 13:02:00 +00:00
Samir Talwar
79074bef84 Idiomatic iteration patterns. (#632)
Fix some warnings flagged by Clippy.

1. Elide `.into_iter()` where it's unnecessary.
2. Favor `&` over `.iter()`.
3. Use `.values()` on maps instead of discarding keys by destructuring.
4. Avoid `::from_iter(…)` in favor of `.collect()`.

I also replaced a call to `.cloned()` with `.copied()`.

V3_GIT_ORIGIN_REV_ID: 7d39665b0cd04f5bae9405c0ff5f044f57433f32
2024-05-30 06:22:45 +00:00
Anon Ray
543ffd4727 data shape for query usage analytics (#606)
## Description

The expectation is, that engine should emit usages of OpenDD objects
(i.e. models, commands, relationships, permissions, fields of types
etc.) from a GraphQL query.

This PR adds the types required to gather query usage analytics, under a new crate `query-usage-analytics`.

V3_GIT_ORIGIN_REV_ID: 49778c25a9019e0c8c9a2d13eaa8ba28638b8b55
2024-05-28 09:51:09 +00:00
Daniel Harvey
2bb8be9fa7 Split out execute crate (#588)
<!-- Thank you for submitting this PR! :) -->

## Description

Following `metadata-resolve` and `schema` crates, this splits out
`execute`, the largest folder in `engine`. Undoubtedly this could be
split further.

Functional no-op.

V3_GIT_ORIGIN_REV_ID: c272908153f78212d1f5dd58819707ac3cbcd439
2024-05-17 14:42:23 +00:00
Anon Ray
fb1fc29f34 fix cargo doc warnings (#585)
## Description

As advertised.

Now you can run the following to browse our internal code

```
cargo doc --no-deps --document-private-items --open
```

V3_GIT_ORIGIN_REV_ID: 5b7091a00ed6148b8a91168807b07aa6a925cac9
2024-05-16 09:04:54 +00:00
Daniel Harvey
de342fb2bf Split schema into own crate (#556)
<!-- Thank you for submitting this PR! :) -->

## Description

This PR splits the GraphQL schema generation into the `schema` crate.
Functional no-op.

V3_GIT_ORIGIN_REV_ID: 4f1a91387305d88e9b5fbe4bc8df0575292cf878
2024-05-10 12:28:22 +00:00
Daniel Harvey
11240e2bff Split metadata-resolve into own crate (#543)
<!-- Thank you for submitting this PR! :) -->

## Description

Now that metadata resolve has a clear interface with the rest of the
engine, let's take it out into it's own crate. This will make it easier
to maintain a strong boundary between things.

To simplify imports etc, removed nested layers of modules, so now we
import `use metadata_resolve::Qualified` instead of `use
crate::metadata::resolved::Qualified`.

The changes in `engine` crate are all just updating imports.

Functional no-op.

V3_GIT_ORIGIN_REV_ID: fb94304f7ed8883287c18bd6870045dfd69e3fe3
2024-05-02 12:29:22 +00:00
Gil Mizrahi
0323da8144 create auth and utils subdirectories in crates, and move architecture information to a separate doc. (#534)
## Description

1. I've moved the architecture information we had in `CONTRIBUTING.md`
to a separate document `docs/architecture.md` so we can evolve both
separately in the future.
2. I've introduced a couple of sub directories: `utils` and `auth`, for
supporting crates that are not the core functionality of the engine so
it is easier to find the most relevant crates.

New structure:

```
crates
├── auth
│   ├── dev-auth-webhook
│   ├── hasura-authn-core
│   ├── hasura-authn-jwt
│   └── hasura-authn-webhook
├── custom-connector
├── engine
├── lang-graphql
├── metadata-schema-generator
├── open-dds
└── utils
    ├── opendds-derive
    ├── recursion_limit_macro
    └── tracing-util
```

V3_GIT_ORIGIN_REV_ID: e0e9394da2fcd911f329c48107a76f8492fa304c
2024-05-01 09:05:15 +00:00
Samir Talwar
117c11d18f Do not include debug symbols in release builds. (#493)
This shrinks the Docker image size by half.

I have also normalized the two Dockerfiles so they share a cache for
longer.

V3_GIT_ORIGIN_REV_ID: f976725b09ad2c8022a912b15cdcde55ce5a9486
2024-04-23 09:42:45 +00:00
Samir Talwar
c7d9baaf66 Use references where possible instead of cloning. (#478)
When trying to reduce the number of dependencies we use in the engine, I
was blocked by a few `.clone()` calls that, on inspection, turned out to
be completely unnecessary.

I have replaced those with passing by reference, and then gone on a
pedant spree. I enabled the `needless_pass_by_value` Clippy warning and
fixed it everywhere that it highlighted. In most places, this meant
adding `&`, but I also marked some types as `Copy`, which makes
pass-by-value the right move.

In one place, I replaced calls to `async_map` with `if` and `else`, to
avoid constructing closures that capture across async boundaries. This
means I could just delete `async_map`.

V3_GIT_ORIGIN_REV_ID: 6ff71f0c553b707889d89552eff3e8c001e898cc
2024-04-18 17:35:48 +00:00
Daniel Harvey
90082f9fba Enable redundant_closure_for_method_calls clippy rule and fix (#468)
<!-- Thank you for submitting this PR! :) -->

## Description

In https://github.com/hasura/v3-engine/pull/441 we made all our skipped
Clippy rules explicit. This enables one (pretty arbitrarily) and fixes
what comes up.

V3_GIT_ORIGIN_REV_ID: 406692a2a134cb2a6cf5785acd0ac7c5b9f90c61
2024-04-17 14:58:18 +00:00
Philip Lykke Carlsen
8752081323 Add /metadata and /metadata-hash endpoints (#461)
## Description

This PR iterates on #459.

Rather than serving the engine metadata it serves an arbitrary file,
given by the command line argument `--introspection-metadata`.
Specifying this argument gives rise to endpoints `/metadata` and
`/metadata-hash`.

![image](https://github.com/hasura/v3-engine/assets/358550/63040f02-876a-4c29-8cf1-52a305ffff67)

Update: We only load the file in at engine startup and serve that
version. Changing the file on disk will not change what the engine
serves.

---------

Co-authored-by: Gil Mizrahi <gil@gilmi.net>
V3_GIT_ORIGIN_REV_ID: db88adb5c08c4489cc1abd5fb5236b8d5ba51b9a
2024-04-11 21:32:40 +00:00
Daniel Harvey
2a24b3060a use clippy settings in Cargo workspace (#441)
<!-- Thank you for submitting this PR! :) -->

## Description

Following the approach taken here:
https://github.com/hasura/ndc-postgres/pull/402

This moves the `clippy` settings into the Cargo workspace file instead
of passing them for each invocation.

We enable all pedantic settings, run `cargo clippy --fix` to auto fix a
few things, and then manually disable all other lints.

Plenty of them are worth enabling and fixing in future IMO.

---------

Co-authored-by: Samir Talwar <samir.talwar@hasura.io>
V3_GIT_ORIGIN_REV_ID: aa0e6ccb8d72a7393e14b5c58b82077a67d9cb15
2024-04-08 10:14:11 +00:00
Daniel Harvey
bdd5d06437 Move all crates into a folder (#355)
<!-- Thank you for submitting this PR! :) -->

## Description

This moves all the crates into a `/crates` folder. Everything appears to
just work, thanks Cargo!

V3_GIT_ORIGIN_REV_ID: 8e3ef287b1a46cabdb4d919a50e813ab2cddf8b1
2024-03-19 18:07:14 +00:00
Daniel Harvey
7e0f0bb1ab migrate build job to Github Actions (#352)
V3_GIT_ORIGIN_REV_ID: b26d1479508aeb9168459f0db82591f8995bb174
2024-03-15 17:24:02 +00:00
Rakesh Emmadi
f5c9a6f291 Custom deserializer for OpenDd objects (#313)
V3_GIT_ORIGIN_REV_ID: 4c7a9380e517ac8e7ac1bd44dbe879918bd0d9a2
2024-03-11 12:17:50 +00:00
Samir Talwar
dea588255b Set the crate properties once, to improve the Nix build. (#334)
V3_GIT_ORIGIN_REV_ID: ec5f3d968306a64ad5c63df324ca5c524838c598
2024-03-06 17:15:13 +00:00
Manas Agarwal
e27e5b7ffe v3: open-source hasura v3 engine
Hasura V3 Engine v3.alpha.12-19-2023
V3-GitOrigin-RevId: 6605575a52b347b5e9a14ecd1cc736f113c663b3

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10567
Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com>
GitOrigin-RevId: 38c98a4b1971efe3ac724c2371c43ceb7d31f140
2023-12-19 09:05:39 +00:00