graphql-armory 0.1.0.pre11 โ 0.1.0.pre13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -1
- data/README.md +4 -4
- data/docs/authorization.md +7 -7
- data/docs/rate-limiting.md +1 -1
- data/docs/versioning.md +540 -0
- data/lib/graphql/armory/authorization/adapters/pundit.rb +26 -1
- data/lib/graphql/armory/authorization/audit/findings.rb +6 -1
- data/lib/graphql/armory/authorization/audit/overrides.rb +8 -2
- data/lib/graphql/armory/authorization/audit/payload_reuse.rb +9 -8
- data/lib/graphql/armory/authorization/definitions.rb +8 -92
- data/lib/graphql/armory/authorization/integration/object.rb +2 -2
- data/lib/graphql/armory/authorization/integration.rb +29 -2
- data/lib/graphql/armory/authorization/rule.rb +3 -3
- data/lib/graphql/armory/authorization.rb +3 -1
- data/lib/graphql/armory/definitions.rb +111 -0
- data/lib/graphql/armory/location.rb +101 -0
- data/lib/graphql/armory/rate_limits/analysis_guard.rb +9 -2
- data/lib/graphql/armory/version.rb +1 -1
- data/lib/graphql/armory/versioning/audit/command.rb +43 -0
- data/lib/graphql/armory/versioning/audit/own_checks.rb +139 -0
- data/lib/graphql/armory/versioning/audit/profiles.rb +123 -0
- data/lib/graphql/armory/versioning/audit/subscription_triggers.rb +98 -0
- data/lib/graphql/armory/versioning/audit.rb +559 -0
- data/lib/graphql/armory/versioning/controls.rb +403 -0
- data/lib/graphql/armory/versioning/decision.rb +89 -0
- data/lib/graphql/armory/versioning/deprecation.rb +95 -0
- data/lib/graphql/armory/versioning/diff/command.rb +49 -0
- data/lib/graphql/armory/versioning/diff.rb +349 -0
- data/lib/graphql/armory/versioning/dump/command.rb +46 -0
- data/lib/graphql/armory/versioning/dump.rb +107 -0
- data/lib/graphql/armory/versioning/gate.rb +140 -0
- data/lib/graphql/armory/versioning/integration.rb +903 -0
- data/lib/graphql/armory/versioning/lifecycle.rb +61 -0
- data/lib/graphql/armory/versioning/profiles.rb +122 -0
- data/lib/graphql/armory/versioning/rspec.rb +38 -0
- data/lib/graphql/armory/versioning/versions.rb +111 -0
- data/lib/graphql/armory/versioning/view.rb +61 -0
- data/lib/graphql/armory/versioning.rb +132 -0
- data/lib/graphql/armory.rb +1 -0
- data/lib/tasks/graphql_armory.rake +20 -0
- metadata +24 -2
- data/lib/graphql/armory/authorization/location.rb +0 -79
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8e1c1031aac2b8bb370345a622fb7d74403aa06594656cf72b4178469364db71
|
|
4
|
+
data.tar.gz: e0a45f56b54f68e2118eeb3ace191ce138cf48f2e120b8c9ac79d29dbcc77a3a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '08b594e550521e1fa3b9c2677b6c104fa84713156bfd62a7e6a32c5accb843ff9281e87d2333d8c6bdb7cb110f05c37a65c057a085ff2b21f63b30320dc2b4f0'
|
|
7
|
+
data.tar.gz: 16d4f937c3083050a8c7a12263614597bfd5f40461e3ebf07892dc385215505a7e2f00448daf19a00593de27a26608667c3d30feec5125d0941bc336d61f9a44
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.1.0.pre13 (2026-11-04)
|
|
4
|
+
|
|
5
|
+
This release adds [API versioning](docs/versioning.md): each client gets the schema of the version it names, so fields, arguments, enum values and types can arrive, be deprecated and leave without breaking older clients. It comes with an audit that finds, before production, every query a version would refuse and every member it would serve or leave out by mistake, plus a diff and an SDL dump per version. Upgrade if you need to evolve a public schema; nothing existing changes.
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- API versioning: each client gets the schema of the version it names, so a field can be added or removed without breaking clients built against an older version. `use GraphQL::Armory::Versioning, versions: %w[2024-06-01 2025-01-01], default: :latest` declares the versions (oldest first, `retired:` for the ones no longer served), `include GraphQL::Armory::Versioning::Base` in your base field class gives `field` the `added:` and `removed:` keywords, and your controller passes `context: { armory_version: request.headers["X-API-Version"] }`. The version applies to validation, both engines, introspection, suggestions and `to_definition`. A retired, unknown or malformed version is refused before anything runs, with `extensions.code` `RETIRED_API_VERSION` or `UNKNOWN_API_VERSION`; a request with no version follows the required `default:` (`:latest`, a label, or `:refuse` with `MISSING_API_VERSION`). `GraphQL::Armory::Versioning.version(context)` tells resolvers which version a query sees; signals `:version_served`, `:version_defaulted` and `:version_refused`. Arguments, input-object fields, arguments of your own query directives and enum values take `added:` and `removed:` too, through `Base` in their base classes; a `default_value:` naming a member outside a served version, a versioned argument or enum value shadowing its parent class's, and, on a directive used in the SDL (or a subclass of one), an argument with a lifecycle or whose type reaches versioned members are refused with `ConfigurationError`. Types take `lifecycle added:, removed:` (objects, interfaces, unions, enums, scalars, input objects, mutations), which hides every field and argument that uses them and every field they declare; a mutation's input and payload types follow it, and an object of a type outside the version is not authorized when an argument `loads:` an interface or union. `GraphQL::Armory::Versioning.types(schema, label)` answers one version's schema to tooling. A lifecycle on a root type, a versioned type in `extra_types` and `added:`/`removed:` on `implements` or `possible_types` need a type membership class with `Base`: a membership then lives only in its versions, with the interface's fields. A field, argument or enum value can have two definitions on one owner with lifecycles that do not overlap, to change its shape across versions; overlapping ones are refused, and Authorization's audit reads the pair as one member. Two type classes can share a `graphql_name` the same way, each returned by its own field twin; a `LateBoundType` naming such a type is refused, and the audit judges each twin's rule and no longer misses a reused mutation payload behind a late-bound name with twins. `GraphQL::Armory::Versioning::Audit.(schema)`, `expect(AppSchema).to have_consistent_versions` (`require "graphql/armory/versioning/rspec"`) and `rake "graphql_armory:versions:audit[AppSchema]"` report, before production, every refusal a query of a served version would hit and every member a version lists outside its lifecycle (kinds `:plugin`, `:visibility`, `:refused`, `:duplicate`, `:empty`, `:undeclared_version`, `:outside_lifecycle`, `:unchecked`), and what a version silently leaves out: a required argument hidden because its type is (`:implicit`; an optional one is listed as information, which `ok?` ignores), a type with no field or a union with no member (`:empty`), and an interface with no implementer (`:orphan_interface`). Limits: a `resolve_type` answering a type outside the client's version raises `UnresolvedTypeError`; a resolver returning an enum value outside the client's version raises graphql-ruby's `UnresolvedValueError`; lookups with no query (`Type.get_field`) see every field; a named `Schema::Visibility` profile of your own is refused. [API versioning](docs/versioning.md).
|
|
10
|
+
- Versioning's audit now reports fields served by another definition of their name or dropped while an interface declares them (`:fallback`), your own `visible?` methods ahead of the plugin's, declared through the new `own_checks:` option (`:own_check`), defaults naming values or input fields a version does not have (`:default_value`), and subscription arguments that differ between versions and break `trigger` (`:subscription_trigger`). [The audit](docs/versioning.md#the-audit).
|
|
11
|
+
- `deprecated: "<version>"` with `deprecation_reason:` deprecates a field, argument, input field or enum value only from that version on, by defining the member twice (before and from that version) through the class that declares it; it is refused on subscription arguments, and Authorization's audit lists a problem the pair shares once. [Deprecating](docs/versioning.md#deprecating). (#74)
|
|
12
|
+
- `Versioning::Diff.(schema, from:, to:)` lists what changes between two served versions as breaking, dangerous or safe, with `rake "graphql_armory:versions:diff[AppSchema,FROM,TO]"` (exit 1 when something breaks) and `expect(AppSchema).to have_no_breaking_changes(from:, to:)`; `Versioning::Dump.(schema, dir)` and `rake "graphql_armory:versions:dump[AppSchema,schema]"` write each served version's SDL plus `latest.graphql`; and a new "Evolving a version" guide covers add, deprecate, remove and retire. [Evolving a version](docs/versioning.md#evolving-a-version).
|
|
13
|
+
- `use GraphQL::Armory::Versioning, ..., profiles: true` (graphql 2.4.10 or later) runs each query under its version's named `Schema::Visibility` profile, built by `GraphQL::Armory::Versioning.profiles(schema)`, so each version's visibility is computed once (at boot with `preload: true`); a query naming any other profile raises `ConfigurationError`. The audit gains `:profiles` and `:retired_only`, and `benchmark/versioning.rb` measures the cost. `Audit.(schema, strict: true)` makes `:retired_only` a problem, and a `visible?` declared in `own_checks:` is not reported as `:profiles`. Limit: under a profile, Authorization's `visible_when:` raises and your own `visible?` is asked once per version, so it must not read the user. Without `profiles: true`, a query under a named `Schema::Visibility` profile of your own raises `ConfigurationError` when it is built: on graphql before 2.4.10 such a profile keeps the first query's version for every later query. [One visibility profile per version](docs/versioning.md#one-visibility-profile-per-version). (#74)
|
|
14
|
+
|
|
15
|
+
## 0.1.0.pre12 (2026-11-04)
|
|
16
|
+
|
|
17
|
+
This release makes [Authorization](docs/authorization.md) cheaper on lists and gives the audit a file and line for the types graphql-ruby generates, and it fixes a way an analysis your app runs itself could let [Rate limiting](docs/rate-limiting.md) undercount a query. Upgrade if you authorize long lists, read the audit's locations, or call `GraphQL::Analysis.analyze_query` before executing a `Query`. Nothing breaks.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Authorizing a list costs a third to a half less per item for one field, and about a fifth less with three. Within one query the gem remembers each type's rule and, with the Pundit adapter (a subclass included), which policies answer for each record class; nothing is kept across queries, so code reloading never serves a stale class. An adapter that wraps Pundit is asked as configured and remembers nothing. [Performance](docs/authorization.md#performance). (#62)
|
|
22
|
+
- The audit gives a location to the types graphql-ruby generates with no constant: a mutation's payload points to its mutation, and a connection or an edge to its node type. Before, their problems had none. Limit: an anonymous subclass of a named type and a subscription's payload still have none. [The audit](docs/authorization.md#the-audit). (#63)
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- A `Query` your app analyzed itself (`GraphQL::Analysis.analyze_query`) before executing it no longer lets that analysis's answers decide the execution. When an analyzer raised during the execution's analysis, the guard read them as "already charged and visited" and ran the query undercounted. The execution now decides from its own analysis, on both engines: it charges `Points` again, as it already did when nothing raised, takes a second `Concurrency` slot, and charges `Time` only for itself. `Points.headers` no longer report what the app's analysis recorded. Limit: a trace module that runs an analysis inside `analyze_multiplex` must be added after `use`. [Rate limiting](docs/rate-limiting.md). (#61)
|
|
4
27
|
|
|
5
28
|
## 0.1.0.pre11 (2026-11-03)
|
|
6
29
|
|
data/README.md
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
Open-source extensions for [graphql-ruby](https://github.com/rmosolgo/graphql-ruby), built on its public extension points: no fork, no monkey patching. One gem, one module at a time; each module has its own page in [`docs/`](docs) with the problem it solves, how to use it, and its limits.
|
|
8
8
|
|
|
9
|
-
> **Status: early development.** Prereleases on RubyGems (`0.1.0.
|
|
9
|
+
> **Status: early development.** Prereleases on RubyGems (`0.1.0.pre13`). The API may change before 1.0.
|
|
10
10
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
13
13
|
```ruby
|
|
14
|
-
gem "graphql-armory", "~> 0.1.0.
|
|
14
|
+
gem "graphql-armory", "~> 0.1.0.pre13" # a prerelease: `gem install graphql-armory --pre`
|
|
15
15
|
gem "pundit" # or "cancancan", for the authorization module
|
|
16
16
|
```
|
|
17
17
|
|
|
@@ -23,14 +23,14 @@ Status: โ
released, ๐ง in progress, โฌ not started. Update this table in th
|
|
|
23
23
|
|
|
24
24
|
| Order | Module | Status | Docs | Current limits |
|
|
25
25
|
|---|---|---|---|---|
|
|
26
|
-
| 1 | Authorization (Pundit, CanCanCan) | โ
| [docs/authorization.md](docs/authorization.md) | Released in 0.1.0.pre2 (prerelease). Pundit and CanCanCan (the audit checks less with CanCanCan). Global IDs in `loads:` decoded through `object_from_id`; `loads:` inside input objects scoped with `include Base`. `Execution::Next` needs graphql >= 2.6.2. The audit gives the file and line of each problem from 0.1.0.pre11. |
|
|
26
|
+
| 1 | Authorization (Pundit, CanCanCan) | โ
| [docs/authorization.md](docs/authorization.md) | Released in 0.1.0.pre2 (prerelease). Pundit and CanCanCan (the audit checks less with CanCanCan). Global IDs in `loads:` decoded through `object_from_id`; `loads:` inside input objects scoped with `include Base`. `Execution::Next` needs graphql >= 2.6.2. The audit gives the file and line of each problem from 0.1.0.pre11, and of generated payloads and connections from 0.1.0.pre12. |
|
|
27
27
|
| 2 | Encrypted, versioned IDs and cursors | โ
| [docs/encrypted-ids.md](docs/encrypted-ids.md) | Released in 0.1.0.pre4 (prerelease). `Encoder` (AES-256-GCM), versioned chains and `Legacy`, `Encoder.default` (ENV or Rails), `use GraphQL::Armory::IDs`. Composite primary keys not supported. |
|
|
28
28
|
| 3 | Persisted queries / operation allowlist | โ
| [docs/persisted-queries.md](docs/persisted-queries.md) | Released in 0.1.0.pre4 (prerelease). Operations can be published without a server deploy (`RedisStore`, unreleased). Allowlist from a build manifest (Apollo, Relay), `use GraphQL::Armory::PersistedQueries` with strict mode. A runtime store (database, sync endpoint) is planned for later. |
|
|
29
29
|
| 4 | Rate limiting | โ
| [docs/rate-limiting.md](docs/rate-limiting.md) | Released in 0.1.0.pre5 (prerelease); `RateLimits::Time` in 0.1.0.pre6. Points per client (query complexity) and operations at the same time, `MemoryStore` and `RedisStore`, the budget in response extensions and headers. `RateLimits::Time` charges the wall-clock milliseconds operations take. Invalid queries are charged `invalid_cost:` from 0.1.0.pre10. |
|
|
30
30
|
| 5 | Stable (keyset) connections | โ
| [docs/keyset-connections.md](docs/keyset-connections.md) | Released in 0.1.0.pre7 (prerelease). `Keyset.build(relation)` per resolver, ActiveRecord only, plain non-null columns of the relation's own table. Base64 cursors refused unless `plain_cursors: true`. No total count. `use` checks the cursor encoder when the schema loads, from 0.1.0.pre10. |
|
|
31
31
|
| 6 | Subscriptions over Pusher / Ably | โฌ | | Research not started. |
|
|
32
32
|
| 7 | Response caching | โฌ | | Research not started. |
|
|
33
|
-
| 8 | API versioning (
|
|
33
|
+
| 8 | API versioning | โ
| [docs/versioning.md](docs/versioning.md) | Released in 0.1.0.pre13 (prerelease). Versions per request (`context[:armory_version]`) with refusal codes and a required `default:` policy; `added:`/`removed:` on fields, arguments, enum values, types and memberships, and two definitions of one name to change its shape; `deprecated:` from one version on; an audit (`have_consistent_versions`, `rake graphql_armory:versions:audit`) of what each served version would refuse, serve outside its lifecycle or leave out; a diff of two versions (`have_no_breaking_changes`, `rake graphql_armory:versions:diff`) and a per-version SDL dump; and `profiles: true`, one `Schema::Visibility` profile per version (graphql 2.4.10 or later). |
|
|
34
34
|
| 9 | `@defer` / `@stream` | โฌ | | Research not started. |
|
|
35
35
|
| 10 | Dashboard | โฌ | | Research not started. |
|
|
36
36
|
|
data/docs/authorization.md
CHANGED
|
@@ -225,7 +225,7 @@ load "tasks/graphql_armory.rake"
|
|
|
225
225
|
- A type, a mutation or a resolver gives the line of its own `authorize`, or else of its class.
|
|
226
226
|
- An own check or a denial hook gives the line of its method.
|
|
227
227
|
|
|
228
|
-
`location` is `nil` when there is no Ruby line to give: a schema built from SDL, or
|
|
228
|
+
A type graphql-ruby generates gives the line of the class it came from: a mutation's payload the line of its mutation, a connection or an edge the line of its node type. `location` is `nil` when there is no Ruby line to give: a schema built from SDL, or any other class with no name and no `authorize` of its own, such as an anonymous subclass of a named type or the payload of a subscription. A field declared by a helper method gives the helper's line, and a class reopened in several files gives the first one. The location is not part of a problem for the [baseline](#adopting-it-on-a-schema-with-many-problems): moving code never turns an accepted problem into a new one.
|
|
229
229
|
|
|
230
230
|
| Kind | What it means | What to do |
|
|
231
231
|
|---|---|---|
|
|
@@ -508,16 +508,16 @@ Both execution engines are tested: the default interpreter and `Execution::Next`
|
|
|
508
508
|
|
|
509
509
|
## Performance
|
|
510
510
|
|
|
511
|
-
`benchmark/authorization.rb`, 1000 invoices, graphql 2.6.
|
|
511
|
+
`benchmark/authorization.rb`, 1000 invoices, graphql 2.6.14, Ruby 3.2, Docker on Windows. Time per query; the cost of the gem is armory minus plain:
|
|
512
512
|
|
|
513
513
|
| Engine | Query | plain | armory (array) | armory (relation) |
|
|
514
514
|
|---|---|---|---|---|
|
|
515
|
-
| interpreter | `number` |
|
|
516
|
-
| interpreter | 3 fields |
|
|
517
|
-
| next | `number` |
|
|
518
|
-
| next | 3 fields |
|
|
515
|
+
| interpreter | `number` | 7.9 ms | 18.8 ms | 21.9 ms |
|
|
516
|
+
| interpreter | 3 fields | 14.8 ms | 54.9 ms | 59.6 ms |
|
|
517
|
+
| next | `number` | 1.6 ms | 13.8 ms | 16.1 ms |
|
|
518
|
+
| next | 3 fields | 2.4 ms | 37.5 ms | 38.7 ms |
|
|
519
519
|
|
|
520
|
-
|
|
520
|
+
That is about 11 to 14 ยตs per item for one field, a third to a half less than in 0.1.0.pre11. Within one query the gem remembers, for each type, its rule and, for each record class, which Pundit policies answer for it; it never remembers a record or an answer across queries, and the next query looks everything up again, so code reloading cannot serve stale classes. Run it yourself: `docker compose run --rm test bundle exec ruby benchmark/authorization.rb` (add `GRAPHQL_ARMORY_ENGINE=next` for Next, and `PROFILE=1` passed with `docker compose run -e` to see where the time goes).
|
|
521
521
|
|
|
522
522
|
## Migrating
|
|
523
523
|
|
data/docs/rate-limiting.md
CHANGED
|
@@ -317,7 +317,7 @@ Invalid settings raise `RateLimits::ConfigurationError` at boot.
|
|
|
317
317
|
- Each query in a multiplex is charged on its own.
|
|
318
318
|
- With several keys, `Points` reads every balance and then charges, so a refused query leaves the others as they were. Two queries racing between those steps can leave a refused one having charged other keys. `Concurrency` gives back the slots a refused query took at once. `Time` charges every key the whole time; a store failure on one key does not stop the others.
|
|
319
319
|
- An invalid query (a syntax error, a validation error including a variable of the wrong type or a missing required one, no query string, or a refusal from `PersistedQueries` in strict mode) is charged `invalid_cost:` points after it answers; its answer does not change. This penalises the client's next valid query: it does not stop a flood of invalid ones, which are parsed and validated all the same, and a bucket stops at zero. A query the analyzers refused is not invalid: it is charged as before, also when a multiplex analyzer refuses the whole multiplex. Keys are charged in list order, as if the queries had come one at a time: a key that cannot pay all of it pays what it holds, and the keys after it pay only that much, so sending invalid queries together never costs a client less than sending them apart. Put the narrowest key first: a client with nothing left cannot keep draining a bucket it shares. Keys must not depend on the document or the variables, which an invalid query may not have. Failures here, including a query with no key, go to `on_store_error` and never replace the answer, so a missing key on an invalid query does not raise. A trace does this after the multiplex, also when an exception ends it early: then queries that never reached validation are validated to find the invalid ones. A query run with its own trace (`context[:trace]`, or a class given to `trace_mode`) is not charged.
|
|
320
|
-
- An `ExecutionError` raised during analysis, which graphql-ruby would discard before running the query, does not skip a limiter. A refusal already given stands. A limiter not asked yet is asked on its own, so another analyzer's raise still charges the query. A limiter that cannot answer, because a `complexity:` lambda or its `on_store_error` hook raised, refuses the query in hard mode with the code `RATE_LIMIT_NOT_CHARGED`, and in soft mode lets it run and records `charged: false`. A client with no limit still runs, and a query with no key raises `ConfigurationError`. When a query takes this path it is visited once more per limiter not asked yet and per other analyzer (see below), so a `complexity:` lambda can run several times, `key:` and `limit:` are asked again, and a validation timeout can take longer. An analysis your app runs itself
|
|
320
|
+
- An `ExecutionError` raised during analysis, which graphql-ruby would discard before running the query, does not skip a limiter. A refusal already given stands. A limiter not asked yet is asked on its own, so another analyzer's raise still charges the query. A limiter that cannot answer, because a `complexity:` lambda or its `on_store_error` hook raised, refuses the query in hard mode with the code `RATE_LIMIT_NOT_CHARGED`, and in soft mode lets it run and records `charged: false`. A client with no limit still runs, and a query with no key raises `ConfigurationError`. When a query takes this path it is visited once more per limiter not asked yet and per other analyzer (see below), so a `complexity:` lambda can run several times, `key:` and `limit:` are asked again, and a validation timeout can take longer. An analysis your app runs itself (`GraphQL::Analysis.analyze_query`) is not guarded: `Points` charges it and `Concurrency` takes a slot for it, which an analysis the app never executes holds until `stale_after`. If the app then executes the same `Query`, the execution charges `Points` again, takes a second slot (so with a `Concurrency` limit of 1 the execution is refused), charges `Time` only for itself, and decides only from its own analysis, so what the app's analysis answered cannot hide a raise during the execution. An analysis the app runs inside `analyze_multiplex` from a trace module added before `use` is outside this too: it is taken for the execution's own, so a raise during the execution's analysis is not guarded. Add such a module after `use`. A trace that takes no modules from the schema (`context[:trace]` or a class given to `trace_mode`) is outside this: `Points` is not protected on such a trace.
|
|
321
321
|
- On the same path every query analyzer that is not a limiter is then asked on its own. A refusal it returns stands, such as a `max_depth` or `max_complexity` refusal, and so does an `AnalysisError` it raises from `result`, with its own message. One that raises anything else again cannot answer, and the query is refused with the code `QUERY_LIMIT_UNKNOWN`, in soft mode and for a client with no limit too, because otherwise a client could get past that analyzer by asking for the field that makes it raise. That covers `max_complexity` with a `complexity:` lambda that raises and your own maximums alike. So do not raise `ExecutionError` from a `complexity:` lambda or an analyzer: an authorization check belongs in the field. Multiplex analyzers, including a `max_complexity` for a whole multiplex (which `Schema.multiplex` takes from the schema by default), cannot be asked again. When a raise stopped the visit before its end, a query in a multiplex with any multiplex analyzer is refused the same way. A lambda raises after the visit, when the multiplex analyzers have seen the whole query, so it is not refused for that. Each analyzer is asked once more at most, each with the whole remaining validation timeout, so a query on this path can take one more visit per analyzer, and an analyzer with side effects repeats them. After a validation timeout no other analyzer is asked again, since the query is already refused; a limiter not asked yet still is. Limits: this needs a rate limiter on the schema, since a schema with none keeps graphql-ruby's behaviour and the refusal is lost. An analyzer's refusal stands only if it answers the same way when asked again: one that remembers in the context that it already refused is lost. A refusal an analyzer raises as `AnalysisError` during the visit, followed by an `ExecutionError` from the same analyzer, becomes `QUERY_LIMIT_UNKNOWN` without its message. The multiplex analyzers keep the part of a refused query they saw before its visit raised, though it does not run.
|
|
322
322
|
- On `Execution::Next`, `validate: false` ignores every refusal from analysis, the limiters' included. Never pass it for a client's query.
|
|
323
323
|
- A field with `max_page_size: nil` under a schema with `default_max_page_size` is sized by that default, while at runtime it has no maximum, so it is charged less than it returns. Give such a field a number.
|