Giter Club home page Giter Club logo

coach's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar dmagliola avatar english avatar greysteil avatar hmarr avatar isaacseymour avatar jacobpgn avatar jgwmaxwell avatar joesouthan avatar jteneycke avatar lawrencejones avatar nickcampbell18 avatar olleolleolle avatar petehamilton avatar rthbound avatar stephenbinns avatar t-humphrey avatar wagenet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coach's Issues

Dependabot can't resolve your Ruby dependency files

Dependabot can't resolve your Ruby dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Bundler::GemNotFound with message: Could not find gem 'rspec-its (~> 1.2)' in any of the gem sources listed in your Gemfile.

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

You can mention @dependabot in the comments below to contact the Dependabot team.

Dependabot can't resolve your Ruby dependency files

Dependabot can't resolve your Ruby dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Bundler::GemNotFound with message: Could not find gem 'rspec-its (<= 1.2.0, >= 1.2)' in any of the gem sources listed in your Gemfile.

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

You can mention @dependabot in the comments below to contact the Dependabot team.

No defined way to test composition of middleware

Problem

Let's say I have a large application, with many middleware. Some middleware are simply composition units of others, for example:

class Middleware::Authenticate
  uses Middleware::ExtractBearerToken
  uses Middleware::LookupBearerToken
  uses Middleware::LogBearerToken

  requires :bearer_token
  provides :user

  def call
    provide(user: bearer_token.user)
    next_middleware.call
  end
end

I think this is a use-case which isn't currently tested well:

  • We have boot-time checking of the dependency tree (so we check that ExtractBearerToken provides :bearer_token)
  • We have unit tests of each sub-middleware behaving in the correct way in isolation.
  • We have request specs testing the overall route (including interactions of all the other middleware).

But there doesn't seem to be a simple way of saying, in a test, "run this smaller middleware chain" (i.e. invoke each sub-middleware and then run Middleware::Authenticate#call). The behaviours of this unit might vary depending on inputs/outputs of each sub-middleware in a way which isn't best expressed in isolated unit tests nor in the high-level request specs (which can be slow).

I think that endorsing this kind of testing to uncover interaction edge-cases would be incredibly valuable.

Proposal

Add a high-level API, either to coach/rspec or in the README, for running a full middleware chain like this.

The usage would look something like:

describe Middleware::Authenticate do
  subject(:instance) { Coach::Chain.new(described_class) } # this is the interesting bit
  
  it { is_expected.to call_next_middleware }
  it { is_expected.to provide(user: ...) }

  context "when a bearer token isn't in the request" do
    it "bails out before calling the main function"
  end
end

Dependabot can't resolve your Ruby dependency files

Dependabot can't resolve your Ruby dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Bundler::GemNotFound with message: Could not find gem 'rspec-its (<= 1.2.0, >= 1.2)' in any of the gem sources listed in your Gemfile.

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

You can mention @dependabot in the comments below to contact the Dependabot team.

Dependabot can't resolve your Ruby dependency files

Dependabot can't resolve your Ruby dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Bundler::GemNotFound with message: Could not find gem 'rspec-its (~> 1.2)' in any of the gem sources listed in your Gemfile.

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

You can mention @dependabot in the comments below to contact the Dependabot team.

Not compliant with `Rails.application.routes.recognize_path`

Apparently routes registered with coach do not show as true by the Rails.application.routes.recognize_path method.
As a side effect, some gems that might use this method will not work for those endpoints.
e.g. https://github.com/openzipkin/zipkin-ruby -> https://github.com/openzipkin/zipkin-ruby/blob/master/lib/zipkin-tracer/rack/zipkin-tracer.rb#L43.

I've being trying different instrumentation tools and they all failed to report, this one (zipkin) was the first I dug in why, but I suspect this might be affecting others too.

Easy way to routes multiple URLs to the same action

I have an old endpoint I want to quietly combine with a new one. Here's what I tried to do:

Old router:

router.draw(
    Routes::Badges,
    base: "/badges",
    actions: [
      ci_status: { method: :get, url: "/ci_status" },
      compatibility_score: { method: :get, url: "/compatibility_score" },
    ],
  )

Attempted new router:

router.draw(
    Routes::Badges,
    base: "/badges",
    actions: [
      compatibility_score: [
        { method: :get, url: "/compatibility_score" },
        { method: :get, url: "/ci_status" },
      ],
    ],
  )

It would be rad if that worked. Any reason not to support it / preferred alternative?

Parallel middleware

So, this might be a slightly unusual use case here...

One flow that I'm investigating using this for fetches data from multiple backends before acting on some combination of that information. We currently do this asynchronously using concurrent ruby, which works nicely to avoid the latency of serial network requests.

Rather than writing a know-it-all middleware, I'd far rather have a composable flow, which would allow single-purpose middlewares to be called in parallel, each providing their own data to the downstream handler. Would you consider a PR that introduced some kind of uses_parallel or less monstrously named concept?

There would obviously be some issues around the concept of next_middleware in this case, and I could solve this without the extra class method by using a configurable AsyncInjectionMiddleware or the like, but thought I'd sound you out.

Drop deprecated features

There are a few soon-to-be deprecated features that we should drop in a 3.0 release:

  • The duration field in our statistics logging (#52)
  • The session_id field in our request.coach event (#59)

This issue tracks those, and any others that we accumulate.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.