Git Product home page Git Product logo

dependency-problem's Introduction

dependency-problem

Diagnosing a dependency problem with clojure.spec and boot.

Introduction

I had a weird problem with Manifold (comes with Yada and Aleph). The following expression would throw an exception:

@(d/let-flow [a (d/success-deferred {:a 1})]
  a)
;; => java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry

I noticed that with a fresh project, this exception didn't occur:

;; boot -d manifold repl
(require '[manifold.deferred :as d])
(d/let-flow [a (d/success-deferred {:a 1})] a)
;;=> << {:a 1} >>

So the problem was probably in the combination of one of our other libraries with Manifold. Because we have quite a few dependencies I decided it was too much work bisecting them by hand. Clojure.spec and Boot to the rescue!

Solution

I used clojure.spec to generate random subsets of our dependencies. For each subset a script is generated which executes the above code snippet. If the script would return an exit code other than zero, we would have found the problematic dependency. Using clojure.test.spec I could find the smallest failing subset of dependencies. It turned out to be only one dependency in our case.

Running

Clone this repo and run boot diagnose to run the clojure.spec.test test or boot confirm to see the failing example.

Funding

This software was commissioned and sponsored by Doctor Evidence. The Doctor Evidence mission is to improve clinical outcomes by finding and delivering medical evidence to healthcare professionals, medical associations, policy makers and manufacturers through revolutionary solutions that enable anyone to make informed decisions and policies using medical data that is more accessible, relevant and readable.

License

Copyright Michiel Borkent 2017.

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

dependency-problem's People

Contributors

borkdude avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.