Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: v1.7.0 #2312

Merged
merged 32 commits into from
Dec 23, 2022
Merged

release: v1.7.0 #2312

merged 32 commits into from
Dec 23, 2022

Conversation

abernix
Copy link
Member

@abernix abernix commented Dec 22, 2022

🚀 Features

Newly scaffolded projects now include a Dockerfile (Issue #2295)

Custom Router binary projects created using our scaffolding tooling will now have a Dockerfile emitted to facilitate building custom Docker containers.

By @o0Ignition0o in #2307

Apollo Uplink communication timeout is configurable (PR #2271)

The amount of time which can elapse before timing out when communicating with Apollo Uplink is now configurable via the APOLLO_UPLINK_TIMEOUT environment variable and the --apollo-uplink-timeout CLI flag, in a similar fashion to how the interval can be configured. It still defaults to 30 seconds.

By @o0Ignition0o in #2271

Query plan cache is pre-warmed using existing operations when the supergraph changes (Issue #2302, Issue #2308)

A new warmed_up_queries configuration option has been introduced to pre-warm the query plan cache when the supergraph changes.

Under normal operation, query plans are cached to avoid the recomputation cost. However, when the supergraph changes, previously-planned queries must be re-planned to account for implementation changes in the supergraph, even though the query itself may not have changed. Under load, this re-planning can cause performance variations due to the extra computation work. To reduce the impact, it is now possible to pre-warm the query plan cache for the incoming supergraph, prior to changing over to the new supergraph. Pre-warming slightly delays the roll-over to the incoming supergraph, but allows the most-requested operations to not be impacted by the additional computation work.

To enable pre-warming, the following configuration can be introduced which sets warmed_up_queries:

supergraph:
  query_planning:
    # Pre-plan the 100 most used operations when the supergraph changes.  (Default is "0", disabled.)
    warmed_up_queries: 100
    experimental_cache:
      in_memory:
        # Sets the limit of entries in the query plan cache
        limit: 512

Query planning was also updated to finish executing and setting up the cache, even if the response couldn't be returned to the client which is important to avoid throwing away computationally-expensive work.

By @Geal in #2309

🐛 Fixes

Propagate errors across inline fragments (PR #2304)

GraphQL errors are now correctly propagated across inline fragments.

By @o0Ignition0o in #2304

Only rebuild protos if reports.proto source changes

Apollo Studio accepts traces and metrics from Apollo Router via the Protobuf specification which lives in the reports.proto file in the repository. With this contribution, we only re-build from the reports.proto file when the file has actually changed, as opposed to doing it on every build which was occurring previously. This change saves build time for developers.

By @scottdouglas1989 in #2283

Return an error on duplicate keys in configuration (Issue #1428)

Repeat usage of the same keys in Router YAML can be hard to notice but indicate a misconfiguration which can cause unexpected behavior since only one of the values can be in effect. With this improvement, the following YAML configuration will raise an error at Router startup to alert the user of the misconfiguration:

telemetry:
  tracing:
    propagation:
      jaeger: true
  tracing:
    propagation:
      jaeger: false

In this particular example, the error produced would be:

ERROR duplicated keys detected in your yaml configuration: 'telemetry.tracing'

By @bnjjj in #2270

Return requested __typename in initial chunk of a deferred response (Issue #1922)

The special-case __typename field is no longer being treated incorrectly when requested at the root level on an operation which used @defer. For example, the following query:

{
  __typename
  ...deferedFragment @defer
}

fragment deferedFragment on Query {
  slow
}

The Router now exhibits the correct behavior for this query with __typename being returned as soon as possible in the initial chunk, as follows:

{"data":{"__typename": "Query"},"hasNext":true}

By @bnjjj in #2274

Log retriable Apollo Uplink failures at the debug level (Issue #2004)

The log levels for messages pertaining to Apollo Uplink schema fetch failures are now emitted at debug level to reduce noise since such failures do not indicate an actual error since they can be and are retried immediately.

By @bnjjj in #2215

Traces won't cause missing field-stats (Issue #2267)

Metrics are now correctly measured comprehensively and traces will obey the trace sampling configuration. Previously, if a request was sampled out of tracing it would not always contribute to metrics correctly. This was particularly problematic for users which had configured high sampling rates for their traces.

By @bryncooke in #2277 and #2286

Replace default notify watcher mechanism with PollWatcher (Issue #2245)

We have replaced the default mechanism used by our underlying file-system notification library, notify, to use PollWatcher. This more aggressive change has been taken on account of continued reports of failed hot-reloading and follows up our previous replacement of hotwatch. We don't have very demanding file watching requirements, so while PollWatcher offers less sophisticated functionality and slightly slower reactivity, it is at least consistent on all platforms and should provide the best developer experience.

By @garypen in #2276

Preserve subgraph error's path property when redacting subgraph errors (Issue #1818)

The path property in errors is now preserved. Previously, error redaction was removing the error's path property, which made debugging difficult but also made it impossible to correctly match errors from deferred responses to the appropriate fields in the requested operation. Since the response shape for the primary and deferred responses are defined from the client-facing "API schema", rather than the supergraph, this change will not result in leaking internal supergraph implementation details to clients and the result will be consistent, even if the subgraph which provides a particular field changes over time.

By @Geal in #2273

Use correct URL decoding for variables in HTTP GET requests (Issue #2248)

The correct URL decoding will now be applied when making a GET request that passes in the variables query string parameter. Previously, all '+' characters were being replaced with spaces which broke cases where the + symbol was not merely an encoding symbol (e.g., ISO8601 date time values with timezone information).

By @neominik in #2249

🛠 Maintenance

Return additional details to client for invalid GraphQL requests (Issue #2301)

Additional context will be returned to clients in the error indicating the source of the error when an invalid GraphQL request is made. For example, passing a string instead of an object for the variables property will now inform the client of the mistake, providing a better developer experience:

{
  "errors": [
    {
      "message": "Invalid GraphQL request",
      "extensions": {
        "details": "failed to deserialize the request body into JSON: invalid type: string \"null\", expected a map at line 1 column 100",
        "code": "INVALID_GRAPHQL_REQUEST"
      }
    }
  ]
}

By @bnjjj in #2306

OpenTelemetry spans to subgraphs now include the request URL (Issue #2280)

A new http.url attribute has been attached to subgraph_request OpenTelemetry trace spans which specifies the URL which the particular request was made to.

By @bnjjj in #2292

Errors returned to clients are now more consistently formed (Issue #2101)

We now return errors in a more consistent shape to those which were returned by Apollo Gateway and Apollo Server, and seen in the documentation. In particular, when available, a stable code field will be included in the error's extensions.

By @bnjjj in #2178

🧪 Experimental

Note

These features are subject to change slightly (usually, in terms of naming or interfaces) before graduating to general availability.

Read more about how we treat experimental features.

Introduce a router_service layer (Issue #1496)

A router_service layer is now part of our service stack and allows plugin developers to process raw HTTP requests and responses from clients prior to those requests reaching the GraphQL processing within the supergraph_service layer. This will become a stable part of our API as we receive feedback from its early adopters. Please open a discussion with any feedback you might have!

By @o0Ignition0o in #2170

Request pipeline customization via HTTP (Issue #1916)

We now offer the ability to configure some aspects of the Router via the response to an HTTP POST request to an external endpoint. Initially, we are only offering this option to customize the newly introduced router_service (above, in these release notes), but our intention is to introduce customization of existing service layers as well (e.g., supergraph_service, subgraph_service`, etc.). Conceptually, this addition allows similar customizations that are possible with Rhai or Rust plugin by sending the operation's context as of a particular phase of the request pipeline "over the wire" as of a particular to an external HTTP service which has the ability to process its properties and return a (potentially) modified response to the Router. This will become a stable part of our API as we receive feedback from its early adopters. Please open a discussion with any feedback you might have!

When this experimental option is enabled, contextual data will be transmitted as a JSON payload to an HTTP endpoint as a POST request. The response to such a request will be processed by the Router and any changes made by the external service will effect the remaining layers in the request pipeline. This allows external services to customize the Router behavior, but requires intentionally blocking Router's normal request pipeline. Therefore, any latency of a configured external service will have a direct impact on the performance of the Router and external services should be as performant as possible.

To experiement with this behavior, consider adopting a configuration similar to the following which communicates with a service running on http://127.0.0.1:8081 for the router service layer:

plugins:
  experimental.external:
    # A URL which will be called for each request for any configured stage.
    url: http://127.0.0.1:8081

    # A human-readable interval specifying the maximum allowed time. (Defaults to "1s", or one second)
    timeout: 2s

    # A "stage" represents a phase of the request pipeline in which the external service will be invoked.
    # They sit request pipeline as our Service Layers for Rust/Rhai, seen in our docs:
    #   https://www.apollographql.com/docs/router/customizations/overview/#how-customizations-work
    stages:
    
      # Currently, the only supported value is "router".
      router:
      
        # Define which properties of the request should be transmitted in the payload.
	# Choosing the least amount of data will reduce the size of the payload.
	# By default, all values are false and, when false, their presence in this map is optional.
        request: 
          headers: true
          context: true
          body: true
          sdl: true
	
	# Similar to "request", but which properties of the response should be sent.
	# Again, all values are false by default and only must be specified if they are enabled.
        response:
          headers: true
          context: true

By @garypen in #2229

BrynCooke and others added 26 commits December 13, 2022 20:07
<!--
First, 🌠 thank you 🌠 for considering a contribution to Apollo!

Some of this information is also included in the /CONTRIBUTING.md file
at the
root of this repository.  We suggest you read it!

  https://github.com/apollographql/router/blob/HEAD/CONTRIBUTING.md

Here are some important details to keep in mind:

* ⏰ Your time is important
To save your precious time, if the contribution you are making will
take more than an hour, please make sure it has been discussed in an
        issue first. This is especially true for feature requests!

* 💡 Features
Feature requests can be created and discussed within a GitHub Issue.
Be sure to search for existing feature requests (and related issues!)
prior to opening a new request. If an existing issue covers the need,
please upvote that issue by using the 👍 emote, rather than opening a
        new issue.

* 🕷 Bug fixes
These can be created and discussed in this repository. When fixing a
bug,
please _try_ to add a test which verifies the fix. If you cannot, you
should
still submit the PR but we may still ask you (and help you!) to create a
test.

* 📖 Contribution guidelines
Follow https://github.com/apollographql/router/blob/HEAD/CONTRIBUTING.md
when submitting a pull request. Make sure existing tests still pass, and
add
        tests for all new behavior.

* ✏️ Explain your pull request
Describe the big picture of your changes here to communicate to what
        your pull request is meant to accomplish. Provide 🔗 links 🔗 to
associated issues! Documentation in the docs/ directory should be
updated
        as necessary.  Finally, a /CHANGELOG.md entry should be added.

We hope you will find this to be a positive experience! Contribution can
be
intimidating and we hope to alleviate that pain as much as possible.
Without
following these guidelines, you may be missing context that can help you
succeed
with your contribution, which is why we encourage discussion first.
Ultimately,
there is no guarantee that we will be able to merge your pull-request,
but by
following these guidelines we can try to avoid disappointment.

-->

Co-authored-by: bryn <bryn@apollographql.com>
This PR adds a timeout to apollo uplink schema polling (30s by default,
configurable) and reports (90s, not configurable).
related to #2101 
This is a draft/attempt to have more consistent errors in the router
following this spec
https://www.apollographql.com/docs/apollo-server/data/errors/ with the
error extension code.

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Fix #1818 

the path is used to decide whether to assign the error on the primary or
deferred response
some dependency updates require more invloved changes. Here LRU now
requires a NonZeroUsize for the capacity argument. This changes the
minimal value in the configuration file.

Co-authored-by: Coenen Benjamin <benjamin.coenen@hotmail.com>
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [clap](https://togithub.com/clap-rs/clap) | dependencies | major |
`3.2.23` -> `4.0.29` |

---

### Release Notes

<details>
<summary>clap-rs/clap</summary>

###
[`v4.0.29`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4029---2022-11-29)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.28...v4.0.29)

###
[`v4.0.28`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4028---2022-11-29)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.27...v4.0.28)

##### Fixes

-   Fix wasm support which was broken in 4.0.27

###
[`v4.0.27`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4027---2022-11-24)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.26...v4.0.27)

##### Features

-   Have `Arg::value_parser` accept `Vec<impl Into<PossibleValue>>`
-   Implement `Display` and `FromStr` for `ColorChoice`

##### Fixes

-   Remove soundness issue by switching from `atty` to `is-terminal`

###
[`v4.0.26`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4026---2022-11-16)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.25...v4.0.26)

##### Fixes

-   *(error)* Fix typos in `ContextKind::as_str`

###
[`v4.0.25`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4025---2022-11-15)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.24...v4.0.25)

##### Features

- *(error)* Report available subcommands when required subcommand is
missing

###
[`v4.0.24`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4024---2022-11-14)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.23...v4.0.24)

##### Fixes

-   Avoid panic when printing an argument that isn't built

###
[`v4.0.23`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4023---2022-11-11)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.22...v4.0.23)

##### Fixes

- Don't panic on reporting invalid-long errors when followed by invalid
UTF8
-   *(help)* Clarified argument to `help` subcommand

###
[`v4.0.22`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4022---2022-11-07)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.21...v4.0.22)

##### Fixes

- *(help)* Don't overflow into next-line-help early due to stale
(pre-v4) padding calculations

###
[`v4.0.21`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4021---2022-11-07)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.20...v4.0.21)

##### Features

- *(derive)* `long_about` and `long_help` attributes, without a value,
force using doc comment (before it wouldn't be set if there wasn't
anything different than the short help)

###
[`v4.0.20`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4020---2022-11-07)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.19...v4.0.20)

##### Fixes

-   *(derive)*  Allow defaulted value parser for '()' fields

###
[`v4.0.19`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4019---2022-11-04)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.18...v4.0.19)

##### Features

-   `ColorChoice` now implements `ValueEnum`

###
[`v4.0.18`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4018---2022-10-20)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.17...v4.0.18)

##### Fixes

- *(derive)* Allow `#[command(skip)]` to also work with enum variants
with a value

###
[`v4.0.17`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4017---2022-10-18)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.16...v4.0.17)

##### Fixes

- Allow using `Arg::last(true)` with
`Arg::value_hint(ValueHint::CommandWithArguments)`

###
[`v4.0.16`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4016---2022-10-18)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.15...v4.0.16)

##### Fixes

- `Arg::exclusive(true)` should not be exclusive with the argument's own
`ArgGroup`

###
[`v4.0.15`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4015---2022-10-13)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.14...v4.0.15)

##### Fixes

-   *(error)* Don't suggest `--` when it doesn't help
- *(error)* Be more consistent in quoting, punctuation, and indentation
in errors

###
[`v4.0.14`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4014---2022-10-12)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.13...v4.0.14)

##### Fixes

- Only put `ArgGroup` in `ArgMatches` when explicitly specified, fixing
derives handling of option-flattened fields
([#&#8203;4375](https://togithub.com/clap-rs/clap/issues/4375))

###
[`v4.0.13`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4013---2022-10-11)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.12...v4.0.13)

##### Features

- *(derive)* Allow `()` for fields to mean "don't read"
([#&#8203;4371](https://togithub.com/clap-rs/clap/issues/4371))

###
[`v4.0.12`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4012---2022-10-10)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.11...v4.0.12)

##### Features

- Added `TypedValueParser::try_map` for when adapting an existing
`TypedValueParser` can fail
- *(error)* Create errors like clap with `Error::new`,
`Error::with_cmd`, and `Error::insert`

###
[`v4.0.11`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4011---2022-10-09)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.10...v4.0.11)

##### Fixes

-   *(help)* Fix wrapping calculations with ANSI escape codes

###
[`v4.0.10`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4010---2022-10-05)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.9...v4.0.10)

##### Features

- *(derive)* Support `#[arg(flatten)]` on `Option` types
([#&#8203;4211](https://togithub.com/clap-rs/clap/issues/4211),
[#&#8203;4350](https://togithub.com/clap-rs/clap/issues/4350))

###
[`v4.0.9`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;409---2022-10-03)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.8...v4.0.9)

##### Fixes

- *(derive)* Process doc comments for `#[command(subcommand)]` like in
clap v3

###
[`v4.0.8`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;408---2022-10-01)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.7...v4.0.8)

##### Fixes

- *(derive)* Remove a low-value assert preventing defaulting `Help` and
`Version` actions

###
[`v4.0.7`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;407---2022-09-30)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.6...v4.0.7)

##### Features

- *(derive)* Populate implicit ArgGroup
([#&#8203;3165](https://togithub.com/clap-rs/clap/issues/3165))

##### Fixes

-   *(derive)* Support `#[group(skip)]` on `Parser` derive
- *(derive)* Tell users about implicit arg groups when running into
group name conflicts
- *(error)* Don't report unrelated groups in conflict or requires errors

###
[`v4.0.6`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;406---2022-09-30)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.5...v4.0.6)

##### Features

- *(derive)* Support `#[group(skip)]`
([#&#8203;4279](https://togithub.com/clap-rs/clap/issues/4279),
[#&#8203;4301](https://togithub.com/clap-rs/clap/issues/4301))

###
[`v4.0.5`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;405---2022-09-30)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.4...v4.0.5)

###
[`v4.0.4`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;404---2022-09-29)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.3...v4.0.4)

##### Fixes

-   *(error)* Specialize the self-conflict error to look like clap v3

###
[`v4.0.3`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;403---2022-09-29)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.2...v4.0.3)

##### Fixes

-   *(error)* Quote literals consistently
-   *(error)* Stylize escape (`--`) suggestions
-   *(error)* Format help flag as a literal

###
[`v4.0.2`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4029---2022-11-29)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.1...v4.0.2)

###
[`v4.0.1`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;4019---2022-11-04)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v4.0.0...v4.0.1)

##### Features

-   `ColorChoice` now implements `ValueEnum`

###
[`v4.0.0`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#&#8203;400---2022-09-28)

[Compare
Source](https://togithub.com/clap-rs/clap/compare/v3.2.23...v4.0.0)

##### Highlights

**`Arg::num_args(range)`**

Clap has had several ways for controlling how many values will be
captured without always being clear on how they interacted, including

-   `Arg::multiple_values(true)`
-   `Arg::number_of_values(4)`
-   `Arg::min_values(2)`
-   `Arg::max_values(20)`
-   `Arg::takes_value(true)`

These have now all been collapsed into `Arg::num_args` which accepts
both
single values and ranges of values. `num_args` controls how many raw
arguments
on the command line will be captured as values per occurrence and
independent
of value delimiters.

See [Issue 2688](https://togithub.com/clap-rs/clap/issues/2688) for more
background.

**Polishing Help**

Clap strives to give a polished CLI experience out of the box with
little
ceremony. With some feedback that has accumulated over time, we took
this
release as an opportunity to re-evaluate our `--help` output to make
sure it is
meeting that goal.

In doing this evaluation, we wanted to keep in mind:

-   Whether other CLIs had ideas that make sense to apply
- Providing an experience that fits within the rest of applications and
works across all shells

Before:

    git
    A fictional versioning CLI

    USAGE:
        git <SUBCOMMAND>

    OPTIONS:
        -h, --help    Print help information

    SUBCOMMANDS:
        add      adds things
        clone    Clones repos
help Print this message or the help of the given subcommand(s)
        push     pushes things
        stash

After:

    A fictional versioning CLI

    Usage: git <COMMAND>

    Commands:
      clone  Clones repos
      push   pushes things
      add    adds things
      stash
      help   Print this message or the help of the given subcommand(s)

    Options:
      -h, --help  Print help information

- name/version header was removed because we couldn't justify the space
it occupied when
    -   Usage already includes the name
- `--version` is available for showing the same thing (if the program
has a version set)
-   Usage was dropped to one line to save space
-   Focus is put on the subcommands
-   Headings are now Title case
- The more general term "command" is used rather than being explicit
about being "subcommands"
- The output is more dense with the expectation that it won't affect
legibility but will allow more content
- We've moved to a more neutral palette for highlighting elements (not
highlighted above)

In talking to users, we found some that liked clap's `man`-like
experience.
When deviating from this, we are making the assumption that those are
more
power users and that the majority of users wouldn't look as favorably on
being
consistent with `man`.

See [Issue 4132](https://togithub.com/clap-rs/clap/issues/4132) for more
background.

**More Dynamicism**

Clap's API has focused on `&str` for performance but this can make
dealing with owned data difficult, like `#[arg(default_value_t)]`
generating a
String from the default value.

Additionally, to avoid `ArgMatches` from borrowing (and for some
features we
decided to forgo), clap took the `&str` argument IDs and hashed them.
This
prevented us from providing a usable API for iterating over existing
arguments.

Now clap has switched to a string newtype that gives us the flexibility
to
decide whether to use `&'static str`, `Cow<'static, str>` for fast
dynamic behavior, or
`Box<str>` for dynamic behavior with small binary size.

As an extension of that work, you can now call `ArgMatches::ids` to
iterate
over the arguments and groups that were found when parsing. The newtype
`Id`
was used to prevent some classes of bugs and to make it easier to
understand
when opaque Ids are used vs user-visible strings.

**Clearing Out Deprecations**

Instead of doing all development on clap 4.0.0, we implemented a lot of
new features during clap 3's development, deprecating the old API while
introducing the new API, including:

- Replacing the implicit behavior for args when parsing them with
`ArgAction`
- Replacing various one-off forms of value validation with the
`ValueParser` API
- Allowing derives to automatically do the right thing for `PathBuf`
(allowing invalid UTF-8)
-   Replacing `AppSettings` and `ArgSettings` enums with getters/setters
-   Clarifying terms and making them more consistent

##### Migrating

Steps:

0. [Upgrade to
v3](https://togithub.com/clap-rs/clap/blob/v3-master/CHANGELOG.md#migrating)
if you haven't already
1. Add CLI tests (including example below), `-h` and `--help` output at
a minimum (recommendation: [trycmd](https://docs.rs/trycmd/) for
snapshot testing)
2. *If using Builder API*: Explicitly set the
`arg.action(ArgAction::...)` on each argument (`StoreValue` for options
and `IncOccurrences` for flags)
3. Run `cargo check --features clap/deprecated` and resolve all
deprecation warnings
4.  Upgrade to v4
5.  Update feature flags

- *If `default-features = false`*, run `cargo add clap -F
help,usage,error-context`
- Run `cargo add clap -F wrap_help` unless you want to hard code line
wraps

6.  Resolve compiler errors
7. Resolve behavior changes (see "subtle changes" under BREAKING
CHANGES)
8.  *At your leisure:* resolve new deprecation notices

Example test (derive):

```rust

#[derive(clap::Parser)]
struct Cli {
    ...
}

#[test]
fn verify_cli() {
    use clap::CommandFactory;
    Cli::command().debug_assert()
}
```

Example test (builder):

```rust
fn cli() -> clap::Command {
    ...
}

#[test]
fn verify_cli() {
    cli().debug_assert();
}
```

Note: the idiomatic / recommended way of specifying different types of
args in the Builder API has changed:

Before

```rust
.arg(Arg::new("flag").long("flag"))  # --flag
.arg(Arg::new("option").long("option").takes_value(true))  # --option <option>
```

After:

```rust
.arg(Arg::new("flag").long("flag").action(ArgAction::SetTrue))  # --flag
.arg(Arg::new("option").long("option"))  # --option <option>
```

In particular, `num_args` (the replacement for `takes_value`) will
default appropriately
from the `ArgAction` and generally only needs to be set explicitly for
the
other `num_args` use cases.

##### Breaking Changes

Subtle changes (i.e. compiler won't catch):

- `arg!` now sets one of
([#&#8203;3795](https://togithub.com/clap-rs/clap/issues/3795)):
- `ArgAction::SetTrue`, requiring `ArgMatches::get_flag` instead of
`ArgMatches::is_present`
- `ArgAction::Count`, requiring `ArgMatches::get_count` instead of
`ArgMatches::occurrences_of`
- `ArgAction::Set`, requiring `ArgMatches::get_one` instead of
`ArgMatches::value_of`
- `ArgAction::Append`, requiring `ArgMatches::get_many` instead of
`ArgMatches::values_of`
- `ArgAction::Set`, `ArgAction::SetTrue`, and `Arg::Action::SetFalse`
now
    conflict by default to be like `ArgAction::StoreValue` and
`ArgAction::IncOccurrences`, requiring `cmd.args_override_self(true)` to
override instead
([#&#8203;4261](https://togithub.com/clap-rs/clap/issues/4261))
- By default, an `Arg`s default action is `ArgAction::Set`, rather than
`ArgAction::IncOccurrence` to reduce confusing magic through consistency
([#&#8203;2687](https://togithub.com/clap-rs/clap/issues/2687),
[#&#8203;4032](https://togithub.com/clap-rs/clap/issues/4032), see also
[#&#8203;3977](https://togithub.com/clap-rs/clap/issues/3977))
- `mut_arg` can no longer be used to customize help and version
arguments, instead disable them (`Command::disable_help_flag`,
`Command::disable_version_flag`) and provide your own
([#&#8203;4056](https://togithub.com/clap-rs/clap/issues/4056))
- Removed lifetimes from `Command`, `Arg`, `ArgGroup`, and
`PossibleValue`, assuming `'static`. `string` feature flag will enable
support for `String`s
([#&#8203;1041](https://togithub.com/clap-rs/clap/issues/1041),
[#&#8203;2150](https://togithub.com/clap-rs/clap/issues/2150),
[#&#8203;4223](https://togithub.com/clap-rs/clap/issues/4223))
- `arg!(--flag <value>)` is now optional, instead of required. Add
`.required(true)` at the end to restore the original behavior
([#&#8203;4206](https://togithub.com/clap-rs/clap/issues/4206))
- Added default feature flags, `help`, `usage` and `error-context`,
requiring adding them back in if `default-features = false`
([#&#8203;4236](https://togithub.com/clap-rs/clap/issues/4236))
- *(parser)* Always fill in `""` argument for external subcommands to
make it easier to distinguish them from built-in commands
([#&#8203;3263](https://togithub.com/clap-rs/clap/issues/3263))
- *(parser)* Short flags now have higher precedence than hyphen values
with `Arg::allow_hyphen_values`, to be consistent with
`Command::allow_hyphen_values`
([#&#8203;4187](https://togithub.com/clap-rs/clap/issues/4187))
- *(parser)* `Arg::value_terminator` must be its own argument on the CLI
rather than being in a delimited list
([#&#8203;4025](https://togithub.com/clap-rs/clap/issues/4025))
- *(help)* Line wrapping of help is now behind the existing `wrap_help`
feature flag, either enable it or hard code your wraps
([#&#8203;4258](https://togithub.com/clap-rs/clap/issues/4258))
- *(help)* Make `DeriveDisplayOrder` the default and removed the
setting. To sort help, set `next_display_order(None)`
([#&#8203;2808](https://togithub.com/clap-rs/clap/issues/2808))
- *(help)* Subcommand display order respects
`Command::next_display_order` instead of `DeriveDisplayOrder` and using
its own initial display order value
([#&#8203;2808](https://togithub.com/clap-rs/clap/issues/2808))
- *(help)* Subcommands are now listed before arguments. To get the old
behavior, see `Command::help_template`
([#&#8203;4132](https://togithub.com/clap-rs/clap/issues/4132))
- *(help)* Help headings are now title cased, making any user-provided
help headings inconsistent. To get the old behavior, see
`Command::help_template`, `Arg::help_heading`, and
`Command::subcommand_help_heading`
([#&#8203;4132](https://togithub.com/clap-rs/clap/issues/4132))
- *(help)* "Command" is used as the section heading for subcommands and
`COMMAND` for the value name. To get the old behavior, see
`Command::subcommand_help_heading` and `Arg::subcommand_value_name`
([#&#8203;4132](https://togithub.com/clap-rs/clap/issues/4132),
[#&#8203;4155](https://togithub.com/clap-rs/clap/issues/4155))
- *(help)* Whitespace in help output is now trimmed to ensure
consistency regardless of how well a template matches the users needs.
([#&#8203;4132](https://togithub.com/clap-rs/clap/issues/4132),
[#&#8203;4156](https://togithub.com/clap-rs/clap/issues/4156))
- *(help)* name/version/author are removed by default from help output.
To get the old behavior, see `Command::help_template`.
([#&#8203;4132](https://togithub.com/clap-rs/clap/issues/4132),
[#&#8203;4160](https://togithub.com/clap-rs/clap/issues/4160))
- *(help)* Indentation for second-line usage changed.
([#&#8203;4132](https://togithub.com/clap-rs/clap/issues/4132),
[#&#8203;4188](https://togithub.com/clap-rs/clap/issues/4188))
- *(env)* Parse `--help` and `--version` like any `ArgAction::SetTrue`
flag ([#&#8203;3776](https://togithub.com/clap-rs/clap/issues/3776))
- *(derive)* Leave `Arg::id` as `verbatim` casing, requiring updating of
string references to other args like in `conflicts_with` or `requires`
([#&#8203;3282](https://togithub.com/clap-rs/clap/issues/3282))
- *(derive)* Doc comments for `ValueEnum` variants will now show up in
`--help` ([#&#8203;3312](https://togithub.com/clap-rs/clap/issues/3312))
- *(derive)* When deriving `Args`, and `ArgGroup` is created using the
type's name, reserving it for future use
([#&#8203;2621](https://togithub.com/clap-rs/clap/issues/2621),
[#&#8203;4209](https://togithub.com/clap-rs/clap/issues/4209))
- *(derive)* `next_help_heading` can now leak out of a
`#[clap(flatten)]`, like all other command settings
([#&#8203;4222](https://togithub.com/clap-rs/clap/issues/4222))

Easier to catch changes:

- Looking up a group in `ArgMatches` now returns the arg `Id`s, rather
than the values to reduce overhead and offer more flexibility.
([#&#8203;4072](https://togithub.com/clap-rs/clap/issues/4072))
- Changed `Arg::number_of_values` (average-across-occurrences) to
`Arg::num_args` (per-occurrence) (raw CLI args, not parsed values)
([#&#8203;2688](https://togithub.com/clap-rs/clap/issues/2688),
[#&#8203;4023](https://togithub.com/clap-rs/clap/issues/4023))
- `num_args(0)` no longer implies
`takes_value(true).multiple_values(true)`
([#&#8203;4023](https://togithub.com/clap-rs/clap/issues/4023))
- `num_args(1)` no longer implies `multiple_values(true)`
([#&#8203;4023](https://togithub.com/clap-rs/clap/issues/4023))
- Does not check default or env values, only what the user explicitly
passes in
([#&#8203;4025](https://togithub.com/clap-rs/clap/issues/4025))
- No longer terminates on delimited values
([#&#8203;4025](https://togithub.com/clap-rs/clap/issues/4025))
- Replace `Arg::min_values` (across all occurrences) with
`Arg::num_args(N..)` (per occurrence) to reduce confusion over different
value count APIs
([#&#8203;4023](https://togithub.com/clap-rs/clap/issues/4023))
- Replace `Arg::max_values` (across all occurrences) with
`Arg::num_args(1..=M)` (per occurrence) to reduce confusion over
different value count APIs
([#&#8203;4023](https://togithub.com/clap-rs/clap/issues/4023))
- Replace `Arg::multiple_values(true)` with `Arg::num_args(1..)` and
`Arg::multiple_values(false)` with `Arg::num_args(0)` to reduce
confusion over different value count APIs
([#&#8203;4023](https://togithub.com/clap-rs/clap/issues/4023))
- Replace `Arg::takes_value(true)` with `Arg::num_args(1)` and
`Arg::takes_value(false)` with `Arg::num_args(0)` to reduce confusion
over different value count APIs
- Remove `Arg::require_value_delimiter`, either users could use
`Arg::value_delimiter` or implement a custom parser with
`TypedValueParser` as it was mostly to make `multiple_values(true)` act
like `multiple_values(false)` and isn't needed anymore
([#&#8203;4026](https://togithub.com/clap-rs/clap/issues/4026))
- `Arg::new("help")` and `Arg::new("version")` no longer implicitly
disable the
    built-in flags and be copied to all subcommands, instead disable
    the built-in flags (`Command::disable_help_flag`,
`Command::disable_version_flag`) and mark the custom flags as
`global(true)`.
([#&#8203;4056](https://togithub.com/clap-rs/clap/issues/4056))
- `Arg::short('h')` no longer implicitly disables the short flag for
help,
    instead disable
    the built-in flags (`Command::disable_help_flag`,
`Command::disable_version_flag`) provide your own
`Arg::new("help").long("help").action(ArgAction::Help).global(true)`.
([#&#8203;4056](https://togithub.com/clap-rs/clap/issues/4056))
- `ArgAction::SetTrue` and `ArgAction::SetFalse` now prioritize
`Arg::default_missing_value` over their standard behavior
([#&#8203;4000](https://togithub.com/clap-rs/clap/issues/4000))
- Changed `Arg::requires_ifs` and `Arg::default_value*_ifs*` to taking
an `ArgPredicate`, removing ambiguity with `None` when accepting owned
and borrowed types
([#&#8203;4084](https://togithub.com/clap-rs/clap/issues/4084))
- Removed `PartialEq` and `Eq` from `Command` so we could change
external subcommands to use a `ValueParser`
([#&#8203;3990](https://togithub.com/clap-rs/clap/issues/3990))
- Various `Arg`, `Command`, and `ArgGroup` calls were switched from
accepting `&[]` to `[]` via `IntoIterator` to be more flexible
([#&#8203;4072](https://togithub.com/clap-rs/clap/issues/4072))
- `Arg::short_aliases` and other builder functions that took `&[]` need
the `&` dropped
([#&#8203;4081](https://togithub.com/clap-rs/clap/issues/4081))
-   `ErrorKind` and `Result` moved into the `error` module
- `ErrorKind::EmptyValue` replaced with `ErrorKind::InvalidValue` to
remove an unnecessary special case
([#&#8203;3676](https://togithub.com/clap-rs/clap/issues/3676),
[#&#8203;3968](https://togithub.com/clap-rs/clap/issues/3968))
- `ErrorKind::UnrecognizedSubcommand` replaced with
`ErrorKind::InvalidSubcommand` to remove an unnecessary special case
([#&#8203;3676](https://togithub.com/clap-rs/clap/issues/3676))
- Changed the default type of `allow_external_subcommands` from `String`
to `OsString` as that is less likely to cause bugs in user applications
([#&#8203;3990](https://togithub.com/clap-rs/clap/issues/3990))
- *(help)* `Command::render_usage` now returns a `StyledStr`
([#&#8203;4248](https://togithub.com/clap-rs/clap/issues/4248))
- *(derive)* Changed the default for arguments from `parse` to
`value_parser`, removing `parse` support
([#&#8203;3827](https://togithub.com/clap-rs/clap/issues/3827),
[#&#8203;3981](https://togithub.com/clap-rs/clap/issues/3981))
    -   `#[clap(value_parser)]` and `#[clap(action)]` are now redundant
- *(derive)* `subcommand_required(true).arg_required_else_help(true)` is
set instead of `SubcommandRequiredElseHelp` to give more meaningful
errors when subcommands are missing and to reduce redundancy
([#&#8203;3280](https://togithub.com/clap-rs/clap/issues/3280))
- *(derive)* Remove `arg_enum` attribute in favor of `value_enum` to
match the new name (we didn't have support in v3 to mark it deprecated)
([#&#8203;4127](https://togithub.com/clap-rs/clap/issues/4127))
- *(parser)* Assert when the CLI looksup an unknown args when external
subcommand support is enabled to help catch bugs
([#&#8203;3703](https://togithub.com/clap-rs/clap/issues/3703))
- *(assert)* Sometimes `Arg::default_missing_value` didn't require
`num_args(0..=N)`, now it does
([#&#8203;4023](https://togithub.com/clap-rs/clap/issues/4023))
- *(assert)* Leading dashes in `Arg::long` are no longer allowed
([#&#8203;3691](https://togithub.com/clap-rs/clap/issues/3691))
- *(assert)* Disallow more `value_names` than `num_args`
([#&#8203;2695](https://togithub.com/clap-rs/clap/issues/2695))
- *(assert)* Always enforce that version is specified when the
`ArgAction::Version` is used
- *(assert)* Add missing `#[track_caller]`s to make it easier to debug
asserts
-   *(assert)* Ensure `overrides_with` IDs are valid
- *(assert)* Ensure no self-`overrides_with` now that Actions replace it
-   *(assert)* Ensure subcommand names are not duplicated
- *(assert)* Assert on `mut_arg` receiving an invalid arg ID or
`mut_subcommand` receiving an invalid command name

##### Compatibility

MSRV is now 1.60.0

Deprecated

- `Arg::use_value_delimiter` in favor of `Arg::value_delimiter` to avoid
having multiple ways of doing the same thing
- `Arg::requires_all` in favor of `Arg::requires_ifs` now that it takes
an `ArgPredicate` to avoid having multiple ways of doing the same thing
- `Arg::number_of_values` in favor of `Arg::num_args` to clarify
semantic differences
- `default_value_os`, `default_values_os`, `default_value_if_os`, and
`default_value_ifs_os` as the non `_os` variants now accept either a
`str` or an `OsStr`
([#&#8203;4141](https://togithub.com/clap-rs/clap/issues/4141))
-   `Arg::env_os` in favor of `Arg::env`
- `Command::dont_collapse_args_in_usage` is now the default
([#&#8203;4151](https://togithub.com/clap-rs/clap/issues/4151))
- `Command::trailing_var_arg` in favor of `Arg::trailing_var_arg` to
make it clearer which arg it is meant to apply to
([#&#8203;4187](https://togithub.com/clap-rs/clap/issues/4187))
- `Command::allow_hyphen_values` in favor of `Arg::allow_hyphen_values`
to make it clearer which arg it is meant to apply to
([#&#8203;4187](https://togithub.com/clap-rs/clap/issues/4187))
- `Command::allow_negative_numbers` in favor of
`Arg::allow_negative_numbers` to make it clearer which arg it is meant
to apply to
([#&#8203;4187](https://togithub.com/clap-rs/clap/issues/4187))
- *(help)* Deprecated `Command::write_help` and
`Command::write_long_help` in favor of `Command::render_help` and
`Command::render_long_help`
([#&#8203;4248](https://togithub.com/clap-rs/clap/issues/4248))
- *(derive)* `structopt` and `clap` attributes in favor of the more
specific `command`, `arg`, and `value` to open the door for [more
features](https://togithub.com/clap-rs/clap/issues/1807) and [clarify
relationship to the
builder](https://togithub.com/clap-rs/clap/discussions/4090)
([#&#8203;1807](https://togithub.com/clap-rs/clap/issues/1807),
[#&#8203;4180](https://togithub.com/clap-rs/clap/issues/4180))
- *(derive)* `#[clap(value_parser)]` and `#[clap(action)]` defaulted
attributes (its the default)
([#&#8203;3976](https://togithub.com/clap-rs/clap/issues/3976))

Behavior Changes

- *(help)* With `wrap_help` feature, if the terminal size cannot be
determined, `LINES` and `COLUMNS` variables are used
([#&#8203;4186](https://togithub.com/clap-rs/clap/issues/4186))

##### Features

- `Arg::num_args` now accepts ranges, allowing setting both the minimum
and maximum number of values per occurrence
([#&#8203;2688](https://togithub.com/clap-rs/clap/issues/2688),
[#&#8203;4023](https://togithub.com/clap-rs/clap/issues/4023))
- Allow non-bool `value_parser`s for `ArgAction::SetTrue` /
`ArgAction::SetFalse`
([#&#8203;4092](https://togithub.com/clap-rs/clap/issues/4092))
- Add `From<&OsStr>`, `From<OsString>`, `From<&str>`, and `From<String>`
to `value_parser!`
([#&#8203;4257](https://togithub.com/clap-rs/clap/issues/4257))
-   Allow resetting most builder methods
- Can now pass runtime generated data to `Command`, `Arg`, `ArgGroup`,
`PossibleValue`, etc without managing lifetimes with the `string`
feature flag
([#&#8203;2150](https://togithub.com/clap-rs/clap/issues/2150),
[#&#8203;4223](https://togithub.com/clap-rs/clap/issues/4223))
- New default `error-context`, `help` and `usage` feature flags that can
be turned off for smaller binaries
([#&#8203;4236](https://togithub.com/clap-rs/clap/issues/4236))
- Added `StyledStr::ansi()` to `Display` with ANSI escape codes
([#&#8203;4248](https://togithub.com/clap-rs/clap/issues/4248))
- *(error)* `Error::apply` for changing the formatter for dropping
binary size
([#&#8203;4111](https://togithub.com/clap-rs/clap/issues/4111))
-   *(error)* `Error::render`for formatting the error into a `StyledStr`
- *(help)* Show `PossibleValue::help` in long help (`--help`)
([#&#8203;3312](https://togithub.com/clap-rs/clap/issues/3312))
- *(help)* New `{tab}` variable for `Command::help_template`
([#&#8203;4161](https://togithub.com/clap-rs/clap/issues/4161))
- *(help)* `Command::render_help` and `Command::render_long_help` for
formatting the error into a `StyledStr`
([#&#8203;3873](https://togithub.com/clap-rs/clap/issues/3873),
[#&#8203;4248](https://togithub.com/clap-rs/clap/issues/4248))
- *(help)* `Command::render_usage` now returns a `StyledStr`
([#&#8203;4248](https://togithub.com/clap-rs/clap/issues/4248))

##### Fixes

- Verify `required` is not used with conditional required settings
([#&#8203;3660](https://togithub.com/clap-rs/clap/issues/3660))
- Replaced `cmd.allow_invalid_for_utf8_external_subcommands` with
`cmd.external_subcommand_value_parser`
([#&#8203;3733](https://togithub.com/clap-rs/clap/issues/3733))
- `Arg::default_missing_value` now applies per occurrence rather than if
a value is missing across all occurrences
([#&#8203;3998](https://togithub.com/clap-rs/clap/issues/3998))
- `arg!(--long [value])` to accept `0..=1` per occurrence rather than
across all occurrences, making it safe to use with `ArgAction::Append`
([#&#8203;4001](https://togithub.com/clap-rs/clap/issues/4001))
- Allow `OsStr`s for
`Arg::{required_if_eq,required_if_eq_any,required_if_eq_all}`
([#&#8203;4084](https://togithub.com/clap-rs/clap/issues/4084))
- *(help)* With `wrap_help` feature, if the terminal size cannot be
determined, `LINES` and `COLUMNS` variables are used
([#&#8203;4186](https://togithub.com/clap-rs/clap/issues/4186))
- *(help)* Use `Command::display_name` in the help title rather than
`Command::bin_name`
- *(help)* Show when a flag is `ArgAction::Count` by adding an `...`
([#&#8203;4003](https://togithub.com/clap-rs/clap/issues/4003))
- *(help)* Use a more neutral palette for coloring
([#&#8203;4132](https://togithub.com/clap-rs/clap/issues/4132),
[#&#8203;4117](https://togithub.com/clap-rs/clap/issues/4117))
- *(help)* Don't rely on ALL CAPS for help headers
([#&#8203;4132](https://togithub.com/clap-rs/clap/issues/4132),
[#&#8203;4123](https://togithub.com/clap-rs/clap/issues/4123))
- *(help)* List subcommands first, focusing the emphasis on them
([#&#8203;4132](https://togithub.com/clap-rs/clap/issues/4132),
[#&#8203;4125](https://togithub.com/clap-rs/clap/issues/4125))
- *(help)* Do not include global args in `cmd help help`
([#&#8203;4131](https://togithub.com/clap-rs/clap/issues/4131))
- *(help)* Use `[positional]` in list when relevant
([#&#8203;4144](https://togithub.com/clap-rs/clap/issues/4144))
- *(help)* Show all `[positional]` in usage
([#&#8203;4151](https://togithub.com/clap-rs/clap/issues/4151))
- *(help)* Polish up subcommands by referring to them as commands
([#&#8203;4132](https://togithub.com/clap-rs/clap/issues/4132),
[#&#8203;4155](https://togithub.com/clap-rs/clap/issues/4155))
- *(help)* Trim extra whitespace to avoid artifacts from different uses
of templates
([#&#8203;4132](https://togithub.com/clap-rs/clap/issues/4132),
[#&#8203;4156](https://togithub.com/clap-rs/clap/issues/4156))
- *(help)* Hint to the user the difference between `-h` / `--help` when
applicable
([#&#8203;4132](https://togithub.com/clap-rs/clap/issues/4132),
[#&#8203;4159](https://togithub.com/clap-rs/clap/issues/4159))
- *(help)* Shorten help by eliding name/version/author
([#&#8203;4132](https://togithub.com/clap-rs/clap/issues/4132),
[#&#8203;4160](https://togithub.com/clap-rs/clap/issues/4160))
- *(help)* When short help is long enough to activate `next_line_help`,
don't add blank lines
([#&#8203;4132](https://togithub.com/clap-rs/clap/issues/4132),
[#&#8203;4190](https://togithub.com/clap-rs/clap/issues/4190))
- *(help)* Make help output more dense (reducing horizontal whitespace)
([#&#8203;4132](https://togithub.com/clap-rs/clap/issues/4132),
[#&#8203;4192](https://togithub.com/clap-rs/clap/issues/4192))
- *(help)* Separate subcommand flags with "," like option flags
([#&#8203;4232](https://togithub.com/clap-rs/clap/issues/4232),
[#&#8203;4235](https://togithub.com/clap-rs/clap/issues/4235))
- *(help)* Quote the suggested help flag
([#&#8203;4220](https://togithub.com/clap-rs/clap/issues/4220))
- *(version)* Use `Command::display_name` rather than
`Command::bin_name`
([#&#8203;3966](https://togithub.com/clap-rs/clap/issues/3966))
- *(parser)* Always fill in `""` argument for external subcommands
([#&#8203;3263](https://togithub.com/clap-rs/clap/issues/3263))
- *(parser)* Short flags now have higher precedence than hyphen values
with `Arg::allow_hyphen_values`, like `Command::allow_hyphen_values`
([#&#8203;4187](https://togithub.com/clap-rs/clap/issues/4187))
- *(parser)* Prefer `InvalidSubcommand` over `UnknownArgument` in more
cases ([#&#8203;4219](https://togithub.com/clap-rs/clap/issues/4219))
- *(derive)* Detect escaped external subcommands that look like built-in
subcommands
([#&#8203;3703](https://togithub.com/clap-rs/clap/issues/3703))
- *(derive)* Leave `Arg::id` as `verbatim` casing
([#&#8203;3282](https://togithub.com/clap-rs/clap/issues/3282))
- *(derive)* Default to `#[clap(value_parser, action)]` instead of
`#[clap(parse)]`
([#&#8203;3827](https://togithub.com/clap-rs/clap/issues/3827))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/apollographql/router).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yMDguMiIsInVwZGF0ZWRJblZlciI6IjM0LjQwLjIifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Geoffroy Couprie <geoffroy@apollographql.com>
To get consistent behaviour across multiple platforms and file systems.

fixes: #2245
  
The watcher may not be as reactive, but I think it's reactive enough for
things which shouldn't change frequently.

As a bonus, we no longer get events if the content is the same, so less
spurious reloads, which is good. That means I had to modify the tests
though to use different contents.

The rhai file watching appeared to be working fine, but to be safe I
converted it to the PollWatcher as well.
Fixes #1496

A `router_service` is now part of our service stack, which allows plugin developers to process raw http requests and raw http responses, that wrap the already available `supergraph_service`
This new flag on the protobuf means that we no longer have to keep track
if we are sending traces or stats. Instead we are asserting that stats
are comprehensive and traces are ancillary.

From the router side we no longer skip metrics increment if a trace is
being sampled.

Co-authored-by: bryn <bryn@apollographql.com>
Since the fix is pretty simple, I made a PR. Fixes #2248

Co-authored-by: Geoffroy Couprie <geoffroy@apollographql.com>
close #2004

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
…2229)

fixes: #1916 

Simplified externalisation configuration:

```
plugins:
  experimental.external:
    url: http://127.0.0.1:8081
    timeout: 2s
    stages:
      router:
        request:
          headers: true
          context: true
          body: true
          sdl: true
        response:
          headers: true
```
The biggest pro is that it's just so simple it's very easy to configure.
The biggest con is lack of control: e.g. no control over header
propagation. The only supported stage at this moment is "router".
…st response is empty (#2274)

close #1922

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
…ion count (#2286)

This change has not been released but the issue was introduced in #2277
Fixes #2267
Metrics will always have the definitive operation count.

Co-authored-by: bryn <bryn@apollographql.com>
Co-authored-by: Coenen Benjamin <benjamin.coenen@hotmail.com>
…2289)

close #2287

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
…configuration (#2270)

close #1428

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
it was incompatible with redis_cluster_async
…ans (#2292)

close #2280

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [anyhow](https://togithub.com/dtolnay/anyhow) | dependencies | patch |
`1.0.66` -> `1.0.68` |
| [paste](https://togithub.com/dtolnay/paste) | dependencies | patch |
`1.0.10` -> `1.0.11` |
| [serde](https://serde.rs)
([source](https://togithub.com/serde-rs/serde)) | dependencies | patch |
`1.0.150` -> `1.0.151` |
| [serde_json](https://togithub.com/serde-rs/json) | dependencies |
patch | `1.0.89` -> `1.0.91` |
| [thiserror](https://togithub.com/dtolnay/thiserror) | dependencies |
patch | `1.0.37` -> `1.0.38` |

---

### Release Notes

<details>
<summary>dtolnay/anyhow</summary>

### [`v1.0.68`](https://togithub.com/dtolnay/anyhow/releases/tag/1.0.68)

[Compare
Source](https://togithub.com/dtolnay/anyhow/compare/1.0.67...1.0.68)

-   Opt out of `-Zrustdoc-scrape-examples` on docs.rs for now

### [`v1.0.67`](https://togithub.com/dtolnay/anyhow/releases/tag/1.0.67)

[Compare
Source](https://togithub.com/dtolnay/anyhow/compare/1.0.66...1.0.67)

- Improve the backtrace captured when `context()` is used on an `Option`
([#&#8203;280](https://togithub.com/dtolnay/anyhow/issues/280))

</details>

<details>
<summary>dtolnay/paste</summary>

### [`v1.0.11`](https://togithub.com/dtolnay/paste/releases/tag/1.0.11)

[Compare
Source](https://togithub.com/dtolnay/paste/compare/1.0.10...1.0.11)

-   Documentation improvements

</details>

<details>
<summary>serde-rs/serde</summary>

###
[`v1.0.151`](https://togithub.com/serde-rs/serde/releases/tag/v1.0.151)

[Compare
Source](https://togithub.com/serde-rs/serde/compare/v1.0.150...v1.0.151)

- Update `serde::`{`ser`,`de`}`::StdError` to re-export
`core::error::Error` when serde is built with `feature="std"` **off**
and `feature="unstable"` **on**
([#&#8203;2344](https://togithub.com/serde-rs/serde/issues/2344))

</details>

<details>
<summary>serde-rs/json</summary>

### [`v1.0.91`](https://togithub.com/serde-rs/json/releases/tag/v1.0.91)

[Compare
Source](https://togithub.com/serde-rs/json/compare/v1.0.90...v1.0.91)

-   Opt out of `-Zrustdoc-scrape-examples` on docs.rs for now

### [`v1.0.90`](https://togithub.com/serde-rs/json/releases/tag/v1.0.90)

[Compare
Source](https://togithub.com/serde-rs/json/compare/v1.0.89...v1.0.90)

-   Documentation improvements

</details>

<details>
<summary>dtolnay/thiserror</summary>

###
[`v1.0.38`](https://togithub.com/dtolnay/thiserror/releases/tag/1.0.38)

[Compare
Source](https://togithub.com/dtolnay/thiserror/compare/1.0.37...1.0.38)

-   Documentation improvements

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/apollographql/router).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC41OS4wIiwidXBkYXRlZEluVmVyIjoiMzQuNjMuMiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
`tonic_build` changes timestamps by a few nanos.

Router only needs to re-run `tonic_build` if `reports.proto` changes,
and that's managed by the build.rs file already via
`println!("cargo:rerun-if-changed={}", reports_src.to_str().unwrap());`

This just disables `tonic_build`'s rerun emits so it's fully managed by
`apollo-router`
* set up a cache for the `xtask lint` task do not rebuild xtask on each
CI run (-2mn on the total run)
* fix the cache for the `test_updated` task (-4mn on the total run)
* the rustfmt command from `xtask lint` can now run on stable rust
* `test_updated` runs on stable now (running it on nightly did not make
sens as it is not supported)
An off by one error lead the router to fail to propagate errors
correctly across inline fragments. This fixes it, andd adds a unit test.
close #2301 

Add more context to the error we're throwing if your GraphQL request is invalid, here is an exemple response if you pass `"variables": "null"` in your JSON payload.
```json
{
  "errors": [
    {
      "message": "Invalid GraphQL request",
      "extensions": {
        "details": "failed to deserialize the request body into JSON: invalid type: string \"null\", expected a map at line 1 column 100",
        "code": "INVALID_GRAPHQL_REQUEST"
      }
    }
  ]
}
```
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: o0Ignition0o <jeremy.lempereur@gmail.com>
Fixes #2295

Projects you create via scaffold will now have a Dockerfile so you can
build and ship a custom router container. The docs have been updated
with links and steps to build your custom router with plugins.
Fix #2302
Fix #2308

if a client timeouts and cancels a request before the query planner has
finished, we would still want to put the query plan in the cache, so it
is available the next time that query comes in. So we run it in a
separate task, and have the current request await on it

Co-authored-by: Jeremy Lempereur <jeremy.lempereur@iomentum.com>
This didn't appear to work in the script.
This also didn't work, despite being in the release xtask best I can tell
CHANGELOG.md Outdated Show resolved Hide resolved
…0. (#2318)

This should have been updated as part of the release process for the
1.6.0
release to indicate that Federation v2.2.2 was the active version as of
that
release. Apologies to the folks who rely on this information being
accurate
to do their job correctly.

In the future, we will introduce automation to eliminate the human
factor of
this, and that work is being tracked in
#2261.
Some edits I'd like to apply to the changelog for #2312.
@abernix abernix changed the title Release 1.7.0 release: 1.7.0 Dec 23, 2022
@abernix abernix changed the title release: 1.7.0 release: v1.7.0 Dec 23, 2022
@abernix abernix self-assigned this Dec 23, 2022
@abernix abernix merged commit 239b6b8 into main Dec 23, 2022
abernix added a commit that referenced this pull request Dec 23, 2022
This merges `main` back into `dev` after the #2312 release.
@abernix abernix deleted the 1.7.0 branch March 29, 2023 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants