make sure the CLI check thread doesn't end up keeping the JVM alive

stop! could be called by other means but the thread would keep
the JVM alive

--- src/main/shadow/cljs/devtools/server.clj
+++ src/main/shadow/cljs/devtools/server.clj
@@ -93,7 +93,7 @@
        (log/warn-ex t# ::shutdown-ex {:form ~(pr-str body)})
        (discard-println ~(str "shutdown failed: " (pr-str body))))))

-(defn shutdown-system [{:keys [shutdown-hook http port-files-ref socket-repl cli-repl nrepl] :as app}]
+(defn shutdown-system [{:keys [shutdown-hook http port-files-ref socket-repl cli-repl cli-checker nrepl] :as app}]
   (discard-println "shutting down ...")
   (try
     (. (Runtime/getRuntime) (removeShutdownHook shutdown-hook))
@@ -113,6 +113,9 @@
   (when nrepl
     (let [stop (::stop nrepl)]
       (do-shutdown (stop))))
+
+  (when cli-checker
+    (cli-checker))

   (do-shutdown (undertow/stop (:server http)))

@@ -203,7 +206,8 @@

     (log/debug ::cli-checker-start {:cli-port cli-port})

-    (doto (Thread. thread-fn)
+    (doto (Thread. thread-fn "shadow-cljs-npm-process-checker")
+      (.setDaemon true)
       (.start))

     (fn []


Add an entity-ref spec for references to entities

Two examples would be

    (entity-ref 'user)
    (entity-ref 'comment :many? true)

Under the hood, these validate just like

    :workflo.macros.specs.types/ref
    :workflo.macros.specs.types/ref-many

except that by parsing the descriptions of entity-ref specs, we
can obtain the name of the target entity.

--- src/main/workflo/macros/specs/types.cljc
+++ src/main/workflo/macros/specs/types.cljc
@@ -1,6 +1,6 @@
 (ns workflo.macros.specs.types
   (:refer-clojure :exclude [bigdec? bytes? double? float? uri?])
-  (:require [clojure.spec :as s]))
+  (:require [clojure.spec :as s :refer [Spec]]))

 ;;;; Helpers

@@ -53,10 +53,33 @@

 (s/def ::id any?)

-;;;; Reference types
+;;;; Simple reference types

 (s/def ::ref ::id)
 (s/def ::ref-many (s/coll-of ::id :kind vector?))
+
+;;;; Entity references
+
+(defn entity-ref-impl
+  [entity-sym opts gfn]
+  (let [subspec (s/spec (if (:many? opts) ::ref-many ::ref))]
+    (reify Spec
+      (conform* [_ x]
+        (s/conform* subspec x))
+      (unform* [_ x]
+        (s/unform* subspec x))
+      (explain* [_ path via in x]
+        (s/explain* subspec path via in x))
+      (gen* [_ overrides path rmap]
+        (if gfn (gfn) (s/gen* subspec overrides path rmap)))
+      (with-gen* [_ gfn]
+        (entity-ref-impl entity-sym opts gfn))
+      (describe* [_]
+        `(entity-ref ~entity-sym ~@(mapcat identity opts))))))
+
+(defn entity-ref
+  [entity-sym & {:keys [many?] :or {many false} :as opts}]
+  (entity-ref-impl entity-sym opts nil))

 ;;;; Type options


Rollback order of board props selection.

--- src/oc/storage/representations/board.clj
+++ src/oc/storage/representations/board.clj
@@ -155,10 +155,10 @@
   (let [{access-level :access-level :as board-access} (select-keys ctx [:access-level :role :premium?])
         viewer-or-author? (#{:author :viewer} access-level)
         is-drafts-board? (drafts-board? board)
-        rep-props (cond is-drafts-board?
+        rep-props (cond viewer-or-author?
+                        representation-props
+                        is-drafts-board?
                         drafts-board-representation-props
-                        viewer-or-author?
-                        representation-props
                         :else
                         public-representation-props)
         boards-map (:existing-org-boards ctx)


Add debug output.

Add debug output.

--- src/org/spootnik/cyanite/store_cache.clj
+++ src/org/spootnik/cyanite/store_cache.clj
@@ -127,7 +127,9 @@
               adata (get-data @pkeys)]
           (swap! adata #(assoc % ckey (conj (get % ckey) data)))))
       (flush! [this]
-        (run-flusher! mkeys))
+        (debug "Flushing the cache...")
+        (run-flusher! mkeys)
+        (debug "The cache has been flushed"))
       (-show-keys [this] (debug "MKeys:" mkeys))
       (-show-cache [this]
         (debug "Cache:")


Expose id-literal? in the API.

Expose id-literal? in the API.

--- src/common/datomish/api.cljc
+++ src/common/datomish/api.cljc
@@ -35,6 +35,7 @@
 (def <close transact/close)

 (def id-literal db/id-literal)
+(def id-literal? db/id-literal?)

 (def lookup-ref db/lookup-ref)


CMR-1341: Fixing failing test

CMR-1341: Fixing failing test

--- system-int-test/test/cmr/system_int_test/search/collection_search_format_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_search_format_test.clj
@@ -120,12 +120,12 @@
              "iso19115")))

     (testing "Retrieving results in SMAP ISO format is not supported"
-      (is (= {:errors ["The mime type [application/iso:smap+xml] is not supported."],
+      (is (= {:errors ["The mime types specified in the accept header [application/iso:smap+xml] are not supported."],
               :status 400}
              (search/get-search-failure-xml-data
                (search/find-metadata :collection :iso-smap {}))))
       (testing "as extension"
-        (is (= {:errors ["The mime type [application/iso:smap+xml] is not supported."],
+        (is (= {:errors ["The URL extension [iso_smap] is not supported."],
                 :status 400}
                (search/get-search-failure-xml-data
                  (search/find-concepts-in-format
@@ -169,7 +169,7 @@
                              (cx/string-at-path (fx/parse-str (:body response)) [:error])
                              (first (:errors (json/decode (:body response) true))))]
                (and (= 400 (:status response))
-                    (= (str "The mime type [" mime-type "] is not supported.") err-msg)))
+                    (= (str "The mime types specified in the accept header [" mime-type "] are not supported.") err-msg)))
              "application/atom+xml" true
              "application/json" false
              "text/csv" false)))
@@ -494,7 +494,7 @@

 (deftest search-errors-in-json-or-xml-format
   (testing "invalid format"
-    (is (= {:errors ["The mime type [application/echo11+xml] is not supported."],
+    (is (= {:errors ["The mime types specified in the accept header [application/echo11+xml] are not supported."],
             :status 400}
            (search/get-search-failure-xml-data
              (search/find-concepts-in-format


Reset the caret to position 0 when setting the text.

--- src/fm/simrunner/gui/text_field.clj
+++ src/fm/simrunner/gui/text_field.clj
@@ -12,5 +12,7 @@

 (defn -setText [this text]
   (when (not= (.getText this) text)
-    (.superSetText this text)))
+    (doto this
+      (.superSetText text)
+      (.setCaretPosition 0))))


Fail gracefully when program input state is nil

--- src/gamma_driver/drivers/basic.cljs
+++ src/gamma_driver/drivers/basic.cljs
@@ -45,7 +45,7 @@
 (defn input-incomplete? [driver program]
   (let [state  (@(:input-state driver) program)
         inputs (:inputs program)]
-    (if (some nil? (map state inputs))
+    (if (some nil? (map #(get state %) inputs))
       ;; We're going to bail at this point anyway, so let's spend some
       ;; extra time extracting what inputs were incomplete
       (remove (fn [input] (get state input)) inputs)


add rank-ending

add rank-ending

--- src/github_contributions/github.clj
+++ src/github_contributions/github.clj
@@ -44,6 +44,25 @@

 (def memoized-fetch-fork-info (memoize fetch-fork-info))

+(defn- rank-ending [num]
+  (cond
+   (and (= \3 (last num)) (not= '(\1 \3) (take-last 2 num))) "rd"
+   (and (= \2 (last num)) (not= '(\1 \2) (take-last 2 num))) "nd"
+   (and (= \1 (last num)) (not= '(\1 \1) (take-last 2 num))) "st"
+   :else "th"))
+
+(defn- render-row [fork-map]
+  (haml/html
+   (clostache/render-resource
+    "public/row.haml"
+    (assoc fork-map
+      :ranking (if (:contributor-rank fork-map)
+                 (format "%s%s of %s"
+                         (:contributor-rank fork-map)
+                         (rank-ending (str (:contributor-rank fork-map)))
+                         (:total-contributors fork-map))
+                 "-")))))
+
 (defn stream-contributions [send-event-fn sse-context user]
   (if user
     ;; TODO: remove limit
@@ -55,12 +74,5 @@
                (count repos) (count forked) (pr-str (mapv :name forked))))
       (doseq [fork forked]
         (let [fork-map (memoized-fetch-fork-info user (get! fork :name))]
-          (message-event
-           (haml/html
-            (clostache/render-resource
-             "public/row.haml"
-             (assoc fork-map
-               :ranking (if (:contributor-rank fork-map)
-                          (format "%s out of %s" (:contributor-rank fork-map) (:total-contributors fork-map))
-                          "-"))))))))
+          (message-event (render-row fork-map)))))
     (log/error :msg "No user given to fetch contributions. Ignored.")))


[#8797] Error scrollToIndex when tapping [Fetch messages] twice in a row

Signed-off-by: Andrey Shovkoplyas <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/ui/screens/chat/views.cljs
+++ src/status_im/ui/screens/chat/views.cljs
@@ -335,6 +335,7 @@
                                           :list-ref           messages-list-ref}])
            :inverted                  true
            :onEndReached              #(re-frame/dispatch [:chat.ui/load-more-messages])
+           :onScrollToIndexFailed     #()
            :keyboardShouldPersistTaps :handled}
           group-header {:header [group-chat-footer chat-id]}]
       (if pending-invite-inviter-name


updating a comment

updating a comment

--- src/cortex/nn/protocols.cljc
+++ src/cortex/nn/protocols.cljc
@@ -7,7 +7,7 @@
           (set! *unchecked-math* :warn-on-boxed)))

 (defprotocol PModule
-  "Protocol for a generic module. All cortex modules must implement this."
+  "Protocol for a generic module. All cortex.nn modules must implement this."
   (calc [m input]
     "Performs module calculation, returning an updated module that includes the output and
      any intermediate states computed.")
@@ -81,7 +81,6 @@
   (loss-gradient [this v target]
         "Computes the gradient of the loss with respect to v"))

-
 (defprotocol PSerialize
   "Default implementation simply calls into {} and adds type.  An override
 is necessary if your class has complex object members instead of simple keys.


Fix scroll issue

Fix scroll issue

Signed-off-by: shivekkhurana <692c972931c22fefc5e275bb5c7be66ee7193761@gmail.com>

--- src/status_im/ui/screens/offline_messaging_settings/views.cljs
+++ src/status_im/ui/screens/offline_messaging_settings/views.cljs
@@ -57,23 +57,24 @@
        [{:icon    :main-icons/add-circle
          :on-press #(re-frame/dispatch [:mailserver.ui/add-pressed])}]}]

-     [react/view {:style styles/switch-container}
-      [profile.components/settings-switch-item
-       {:label-kw  :t/offline-messaging-use-history-nodes
-        :value     use-mailservers?
-        :action-fn #(re-frame/dispatch [:mailserver.ui/use-history-switch-pressed (not use-mailservers?)])}]]
-     [react/view {:style styles/use-history-explanation-text-container}
-      [react/text {:style styles/explanation-text}
-       (i18n/label :t/offline-messaging-use-history-explanation)]]
+     [react/scroll-view
+      [react/view {:style styles/switch-container}
+       [profile.components/settings-switch-item
+        {:label-kw  :t/offline-messaging-use-history-nodes
+         :value     use-mailservers?
+         :action-fn #(re-frame/dispatch [:mailserver.ui/use-history-switch-pressed (not use-mailservers?)])}]]
+      [react/view {:style styles/use-history-explanation-text-container}
+       [react/text {:style styles/explanation-text}
+        (i18n/label :t/offline-messaging-use-history-explanation)]]

-     (when use-mailservers?
-       [:<>
-        [pinned-state preferred-mailserver-id]
+      (when use-mailservers?
+        [:<>
+         [pinned-state preferred-mailserver-id]

-        [react/text {:style styles/history-nodes-label}
-         (i18n/label :t/history-nodes)]
-        [list/flat-list {:data               (vals mailservers)
-                         :default-separator? false
-                         :key-fn             :name
-                         :render-fn          (render-row current-mailserver-id
-                                                         preferred-mailserver-id)}]])]))
+         [react/text {:style styles/history-nodes-label}
+          (i18n/label :t/history-nodes)]
+         [list/flat-list {:data               (vals mailservers)
+                          :default-separator? false
+                          :key-fn             :name
+                          :render-fn          (render-row current-mailserver-id
+                                                          preferred-mailserver-id)}]])]]))


Fix cold start problem with base clusters on large convs and missing bidtopid mapping

--- src/polismath/math/clusters.clj
+++ src/polismath/math/clusters.clj
@@ -227,39 +227,51 @@
 (defn clean-start-clusters
   "This function takes care of some possible messy situations which can crop up with using 'last-clusters'
   in kmeans computation, and generally gets the last set of clusters ready as the basis for a new round of
-  clustering given the latest set of data."
+  clustering given the latest set of data.
+
+  WARNING!!! This function is very slow for building up a new clustering from scratch, and thus for an empty
+  clustering we just call out to init-clusters. If you try building off of just a few seed clusters though,
+  this function will behave very poorly. This could potentially be optimized for down the road, but for now
+  be warned."
   [data clusters k & {:keys [weights]}]
   ; First recenter clusters (replace cluster center with a center computed from new positions)
-  (let [clusters (into [] (safe-recenter-clusters data clusters :weights weights))
-        ; next make sure we're not dealing with any clusters that are identical to eachother
-        uniq-clusters (uniqify-clusters clusters)
-        ; count uniq data points to figure out how many clusters are possible
-        ;; I don't like the into here, but seems necessary to solve a weird core.matrix issue with lists not having nth
-        possible-clusters (min k (count (distinct (into [] (matrix/rows (nm/get-matrix data))))))]
-    (loop [clusters uniq-clusters]
-      ; Whatever the case here, we want to do one more recentering
-      (let [clusters (recenter-clusters data clusters :weights weights)]
-        (if (> possible-clusters (count clusters))
-          ; first find the most distal point, and the cluster to which it's closest
-          (let [outlier (most-distal data clusters)]
-            (if (> (:dist outlier) 0)
-              ; There is work to be done, so do it
-              (recur
-                (->
-                  ; first remove the most distal point from the cluster it was in;
-                  (map
-                    (fn [clst]
-                      (assoc clst :members
-                        (remove (set [(:id outlier)]) (:members clst))))
-                    clusters)
-                  ; next add a new cluster containing only said point.
-                  (conj {:id (inc (apply max (map :id clusters)))
-                         :members [(:id outlier)]
-                         :center (nm/get-row-by-name data (:id outlier))})))
-              ; Else just return recentered clusters
-              clusters))
-          ; Else just return recentered clusters
-          clusters)))))
+  (if (seq clusters)
+    ;; In most cases, we have existing clusters we want to optimize for as we break things apart, and want
+    ;; to break things apart in such a way as to preserve as much structure as possible
+    (let [clusters (safe-recenter-clusters data clusters :weights weights)
+          ; next make sure we're not dealing with any clusters that are identical to eachother
+          uniq-clusters (uniqify-clusters clusters)
+          ; count uniq data points to figure out how many clusters are possible
+          ;; I don't like the into here, but seems necessary to solve a weird core.matrix issue with lists not having nth
+          possible-clusters (min k (count (distinct (into [] (matrix/rows (nm/get-matrix data))))))]
+      (loop [clusters uniq-clusters]
+        ; Whatever the case here, we want to do one more recentering
+        (let [clusters (recenter-clusters data clusters :weights weights)]
+          (if (> possible-clusters (count clusters))
+            ; first find the most distal point, and the cluster to which it's closest
+            (let [outlier (most-distal data clusters)]
+              (if (> (:dist outlier) 0)
+                ; There is work to be done, so do it
+                (recur
+                  (->
+                    ; first remove the most distal point from the cluster it was in;
+                    (mapv
+                      (fn [clst]
+                        (assoc clst :members
+                          (remove (set [(:id outlier)]) (:members clst))))
+                      clusters)
+                    ; next add a new cluster containing only said point.
+                    (conj {:id (inc (apply max (map :id clusters)))
+                           :members [(:id outlier)]
+                           :center (nm/get-row-by-name data (:id outlier))})))
+                ; Else just return recentered clusters
+                clusters))
+            ; Else just return recentered clusters
+            clusters))))
+    ;; Otherwise, just initialize a set of dummy clusters
+    (do
+      (log/warn "Had to initialize clusters from clean-start-clusters. This shouldn't have to happen, and maybe means bidToPid mapping didn't load into new conv.")
+      (init-clusters data k))))

 (defn setify-members


Multiple aspect addition doesn't work for unknwown reasons (well, it's a known reason: weak clojure foo)

--- src/main/clojure/alfresco/nodes.clj
+++ src/main/clojure/alfresco/nodes.clj
@@ -46,7 +46,7 @@
   (children [this] "Returns a seq of the node direct children")
   (parent [this] "Gives the primary parent of node")
   (delete! [this] "Deletes a node")
-  (add-aspect! [this & aspect-defs] "Adds aspects to a node. The aspects are provide as aspect-qname aspect-props couples")
+  (add-aspect! [this aspect props] "Adds an aspect to a node.")
   (del-aspect! [this aspect] "Removes an aspect from a node")
   (type-qname [this] "Returns the qname of the provided node's type")
   (set-type! [this type] "Sets the provided type onto the node. Yields nil"))
@@ -108,11 +108,12 @@
    (.deleteNode *node-service* (c/c2j node)))

   (add-aspect!
-   [node & aspect-defs]
-   {:pre [(even? (count aspect-defs))]}
-   (for [[aspect props] (partition 2 aspect-defs)]
-     (.addAspect *node-service* (c/c2j node) (m/qname aspect) props))
-   true)
+   [node aspect props]
+   (.addAspect *node-service*
+               (c/c2j node)
+               (m/qname aspect)
+               (zipmap (map m/qname (keys props))
+                       (vals props))))

   (del-aspect!
    [node aspect]


re-matcher does not exist in CLJS

re-matcher does not exist in CLJS

--- src/main/clojure/cljs/compiler.cljc
+++ src/main/clojure/cljs/compiler.cljc
@@ -215,7 +215,10 @@
   (if (= "" (str x))
     (emits "(new RegExp(\"\"))")
     (let [[_ flags pattern] (re-find #"^(?:\(\?([idmsux]*)\))?(.*)" (str x))]
-      (emits \/ (.replaceAll (re-matcher #"/" pattern) "\\\\/") \/ flags))))
+      (emits \/
+        #?(:clj (.replaceAll (re-matcher #"/" pattern) "\\\\/")
+           :cljs (string/replace pattern #"/" "\\\\/"))
+        \/ flags))))

 (defn emits-keyword [kw]
   (let [ns   (namespace kw)


fix fedora linux classpath issue for jars that don't exist

--- src/main/shadow/build/classpath.clj
+++ src/main/shadow/build/classpath.clj
@@ -625,11 +625,12 @@
   (let [abs-path (.getAbsolutePath file)]
     (boolean (some #(re-find % abs-path) exclude))))

-
-
 (defn get-classpath-entries [{:keys [index-ref] :as cp}]
   (let [{:keys [classpath-excludes]} @index-ref]
     (->> (get-classpath)
+         ;; apparently linux distros put jars on the classpath that don't exist?
+         ;; https://github.com/shadow-cljs/shadow-cljs.github.io/pull/19
+         (filter #(.exists ^File %))
          (remove #(should-exclude-classpath classpath-excludes %))
          (map #(.getCanonicalFile ^File %))
          (into []))))


Tweak some parameters

Tweak some parameters

--- src/overtone_workspace/grunbles.clj
+++ src/overtone_workspace/grunbles.clj
@@ -18,7 +18,7 @@
 ;; (grumble :freq-mul 2)
 ;; (ctl grumble :speed 3000)

-(volume (/  32  127))
+(volume (/  20  127))

 (def metro (metronome 10))

@@ -27,7 +27,7 @@
                 [4 8 2 1.5]
                 notes)]
     (at (metro beat)
-        (grumble :freq-mul 0.25))
+        (grumble :freq-mul 0.5))
     (at (metro beat)
         (if (zero? (mod beat 5))
           (grumble :freq-mul 1)))
@@ -40,8 +40,8 @@
 ;;(player (metro) [])
 ;;(stop)

-(def dirty-kick (freesound 777))
-(dirty-kick)
-(def kick (sample (freesound-path 2086)))
-(kick)
-(def close-hihat (sample-player (sample (freesound-path 802))))
+;; (def dirty-kick (freesound 777))
+;; (dirty-kick)
+;; (def kick (sample (freesound-path 2086)))
+;; (kick)
+;; (def close-hihat (sample-player (sample (freesound-path 802))))


reftype? -> heaptype?

reftype? -> heaptype?

--- proto-oct/src/proto_oct/core.clj
+++ proto-oct/src/proto_oct/core.clj
@@ -87,10 +87,10 @@
 (defemit :typedef [m]
   (str "typedef " (:name m) " " (:alias m) ";"))

-(defn oct-type [name reftype? & members]
+(defn oct-type [name heaptype? & members]
   {:type :oct-type
    :name name
-   :reftype? reftype?
+   :heaptype? heaptype?
    :members members})

 (defemit :oct-type [m]


Enable progress bar

Enable progress bar

--- frontend/src/cruncher/rename.cljs
+++ frontend/src/cruncher/rename.cljs
@@ -45,7 +45,7 @@
     (when (pos? (count new-nicknames))
       (lib/loading!)
       (lib/update-progress-status! {:status "ok", :to_delete (count new-nicknames), :deleted 0})
-      #_(progress/query-status this)
+      (progress/query-status this)
       (POST (clib/make-url url)
             {:body            (clib/clj->json new-nicknames)
              :handler         progress/finished-progress-handler


adding "." and "-" to matching regex for path-prefix

--- src/vignette/util/query_options.clj
+++ src/vignette/util/query_options.clj
@@ -10,7 +10,7 @@
 (def query-opts-map {:fill (create-query-opt #"^#[a-g0-9]+$|^\w+$")
                      :format (create-query-opt #"^\w+$")
                      :lang (create-query-opt #"^\w+$" false)
-                     :path-prefix (create-query-opt #"[\w\/]+" false)
+                     :path-prefix (create-query-opt #"[\w\.\/-]+" false)
                      :replace (create-query-opt #"^true$" false)})

 (defn query-opt-regex


Add a test for keep alive requests

Add a test for keep alive requests

--- test/picard/test/server.clj
+++ test/picard/test/server.clj
@@ -43,6 +43,36 @@
         :binding nil
         :request [(includes-hdrs {"content-length" "5"}) "Hello"]))))

+(deftest keepalive-requests
+  (running-call-home-app
+   (http-write "GET / HTTP/1.1\r\n\r\n"
+               "GET /foo HTTP/1.1\r\n\r\n"
+               "POST /bar HTTP/1.1\r\n"
+               "connection: close\r\n\r\n")
+   (is (next-msgs
+        :binding nil
+        :request [(includes-hdrs {:request-method "GET" :path-info "/"}) nil]
+        :done    nil
+        :binding nil
+        :request [(includes-hdrs {:request-method "GET" :path-info "/foo"}) nil]
+        :done    nil
+        :binding nil
+        :request [(includes-hdrs {:request-method "POST" :path-info "/bar"
+                                  "connection" "close"}) nil]))
+   (is (received-response
+        "HTTP/1.1 200 OK\r\n"
+        "content-type: text/plain\r\n"
+        "content-length: 5\r\n\r\n"
+        "Hello"
+        "HTTP/1.1 200 OK\r\n"
+        "content-type: text/plain\r\n"
+        "content-length: 5\r\n\r\n"
+        "Hello"
+        "HTTP/1.1 200 OK\r\n"
+        "content-type: text/plain\r\n"
+        "content-length: 5\r\n\r\n"
+        "Hello"))))
+
 (deftest request-callback-happens-before-body-is-recieved
   (running-call-home-app
    (http-write "POST / HTTP/1.1\r\n"


Skip `frame-rate` and `load-shader` snippets during automated compare.

--- test/clj/quil/snippet.clj
+++ test/clj/quil/snippet.clj
@@ -17,16 +17,18 @@

 (defn skip-automated-compare? [snippet-name]
   (contains? #{"current-frame-rate-target-frame-rate"
+               "frame-rate"
+               "load-shader"
                "noise"
                "noise-detail"
+               "ortho-perspective"
                "random-2d"
                "random-3d"
                "random"
                "random-gaussian"
                "resize-sketch"
                "save"
-               "time-and-date"
-               "ortho-perspective"} snippet-name))
+               "time-and-date"} snippet-name))

 (defn- imagemagick-installed? []
   (try


fix can not resolve field with type boolean

--- src/graphql_clj/executor.clj
+++ src/graphql_clj/executor.clj
@@ -148,7 +148,7 @@
     (let [type-name (:name field-type)
           tag (:tag field-type)
           inner-type (:inner-type field-type)]
-      (when result
+      (when (or result (= (.toString type-name)  "Boolean"))
         (cond
           (#{:scalar-definition :enum-definition} tag) result
           (#{:type-definition :interface-definition} tag) (if (seq selection-set)


add uuid into query

add uuid into query

--- src/hivewing_core/worker.clj
+++ src/hivewing_core/worker.clj
@@ -26,7 +26,7 @@
   "Get the data for worker record.  You pass in the worker via the worker uuid.  Returns the data
   as a hashmap. DOES NOT return the access_token"
   [worker-uuid]
-  (jdbc/query sql-db ["SELECT name, created_at, updated_at, apiary_uuid, hive_uuid FROM workers WHERE uuid = ? LIMIT 1" (ensure-uuid worker-uuid)] :result-set-fn first))
+  (jdbc/query sql-db ["SELECT uuid, name, created_at, updated_at, apiary_uuid, hive_uuid FROM workers WHERE uuid = ? LIMIT 1" (ensure-uuid worker-uuid)] :result-set-fn first))

 (defn worker-create
   [{apiary-uuid :apiary_uuid hive-uuid :hive_uuid :as parameters}]


Renamed 'protection domain' to 'protection system'

--- modules/cylon/src/modular/cylon.clj
+++ modules/cylon/src/modular/cylon.clj
@@ -365,18 +365,18 @@
              (s/validate new-login-form-schema))]
     (component/using (->LoginForm path context boilerplate) [:user-password-authorizer :http-session-store])))

-;; Now we can build a protection domain, composed of a login form, user
+;; Now we can build a protection system, composed of a login form, user
 ;; authorizer and session store. Different constructors can build this
 ;; component in different ways.

-(defrecord ProtectionDomain [protector user-password-authorizer http-session-store]
+(defrecord ProtectionSystem [protector user-password-authorizer http-session-store]
   component/Lifecycle
   (start [this] (component/start-system this (keys this)))
   (stop [this] (component/stop-system this (keys this)))
   ;; In this implementation, we export any routes provided by
   ;; sub-components. These are the routes that provide login forms and
   ;; so on, nothing to do with the routes that are protected by this
-  ;; protection domain.
+  ;; protection system.
   BidiRoutesContributor
   (routes [this] ["" (vec (keep #(when (satisfies? BidiRoutesContributor %) (routes %)) (vals this)))])
   (context [this] (or
@@ -387,17 +387,17 @@
   (add-user! [_ uid pw]
     (if (satisfies? NewUserCreator user-password-authorizer)
       (add-user! user-password-authorizer uid pw)
-      (throw (ex-info "This protection domain implementation does not support the creation of new users" {})))))
-
-(def new-default-protection-domain-schema
+      (throw (ex-info "This protection system implementation does not support the creation of new users" {})))))
+
+(def new-default-protection-system-schema
   {:password-file s/Any
    (s/optional-key :session-timeout-in-seconds) s/Int
    (s/optional-key :boilerplate) (s/=> 1)
    })

-(defn new-default-protection-domain [& {:as opts}]
-  (s/validate new-default-protection-domain-schema opts)
-  (map->ProtectionDomain
+(defn new-default-protection-system [& {:as opts}]
+  (s/validate new-default-protection-system-schema opts)
+  (map->ProtectionSystem
    {:protector (if-let [boilerplate (:boilerplate opts)]
                  (new-login-form :boilerplate boilerplate)
                  (new-login-form))
@@ -407,13 +407,13 @@
                          (or (:session-timeout-in-seconds opts)
                              10))}))

-;; Now that we have a protection domain, we want the ability to create
-;; bidi routes components that can be protected by simply declaring a dependency upon the protection domain component.
+;; Now that we have a protection system, we want the ability to create
+;; bidi routes components that can be protected by simply declaring a dependency upon the protection system component.

 (defrecord ProtectedBidiRoutes [routes context]
   component/Lifecycle
   (start [this]
-    (let [protector (get-in this [:protection-domain :protector])
+    (let [protector (get-in this [:protection-system :protector])
           routes (cond-> routes
                          (fn? routes) (apply [this])
                          protector ((partial protect-bidi-routes protector)))]
@@ -436,8 +436,8 @@

 (defn new-mandatory-protected-bidi-routes
   "Like new-protected-bidi-routes above, but the absence of
-  a :protection-domain dependency will cause an error."
+  a :protection-system dependency will cause an error."
   [routes & {:as opts}]
   (component/using
    (apply new-protected-bidi-routes routes (apply concat (seq opts)))
-   [:protection-domain]))
+   [:protection-system]))


discoveries order

discoveries order

Former-commit-id: 74249dc7174693022070249414d0fcb2af3e4c9a

--- src/syng_im/models/discoveries.cljs
+++ src/syng_im/models/discoveries.cljs
@@ -69,8 +69,7 @@
   (->> (-> (r/get-all :discoveries)
            (r/sorted :last-updated :desc)
            r/collection->map)
-       (map #(update % :tags vals))
-       (into '())))
+       (map #(update % :tags vals))))

 (defn- add-discoveries [discoveries]
   (realm/write (fn []


fix typos in sample

fix typos in sample

--- src/test/clojure/naojure/sample.clj
+++ src/test/clojure/naojure/sample.clj
@@ -45,17 +45,17 @@
  (hands :open))

 ;; complete movement in 0.1 second
-(nao/do robot :duration 0.1
+(nao/donao robot :duration 0.1
           (arms :out)
           (hands :left-open)
           (hands :right-close))

-(nao/do robot :channel chan
+(nao/donao robot :channel chan
  (arms :out )
  (hands :open)
  (leds :white))

-nao/do returns a channel which a message is sent on when the action completes
+nao/donao returns a channel which a message is sent on when the action completes

 variants
 - actions


updated clojurescript version

updated clojurescript version

--- resources/project.clj
+++ resources/project.clj
@@ -4,7 +4,7 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.7.0"]
-                 [org.clojure/clojurescript "1.7.170"]
+                 [org.clojure/clojurescript "1.7.189"]
                  [$REACT_INTERFACE$]
                  [org.omcljs/ambly "0.6.0"]
                  [natal-shell "0.1.2"]]


added version test

added version test

--- test/clj/swarmpit/docker/client_test.clj
+++ test/clj/swarmpit/docker/client_test.clj
@@ -9,6 +9,9 @@
 (def service-def (edn/read-string (slurp "test/clj/swarmpit/docker/service.edn")))

 (deftest ^:integration docker-client
+
+  (testing "version"
+    (is (some? (version))))

   (testing "get services"
     (is (some? (services))))


Test-get-formatted-time-2


Fixup error being shadowed by destructure in Slack

--- src/yetibot/core/adapters/slack.clj
+++ src/yetibot/core/adapters/slack.clj
@@ -97,7 +97,8 @@
                   :target *target*
                   :thread-ts *thread-ts*})

-        {:keys [ok error response_metadata] :as response}
+        {:keys [ok response_metadata]
+         slack-error :error :as response}
         (slack-chat/post-message
           (slack-config config) *target* msg
           (merge
@@ -105,7 +106,7 @@
             (when img?
               {:blocks [{"type" "image"
                          "image_url" msg
-                         "alt_text" msg}]})
+                         "alt_text" "Image"}]})
             (when *thread-ts*
               {:thread_ts *thread-ts*})))]
     (if ok


update example

update example

--- examples/uberjar/project.clj
+++ examples/uberjar/project.clj
@@ -3,5 +3,4 @@
   :dependencies [[clojure "1.2.0"]
                  [clojure-contrib "1.2.0"]
                  [clojure-csv/clojure-csv "1.1.0"]]
-  :omit-source true
   :main uberjar)


simple fix to arrays

simple fix to arrays

--- statspop/src/statspop/core.cljs
+++ statspop/src/statspop/core.cljs
@@ -2,10 +2,12 @@
     (:require [reagent.core :as reagent]))

-(def test-mini (js/jStat (array [[1 2] [3 4] [5 6]])))
+(def test-mini (js/jStat (clj->js [[1 2] [3 4] [5 6]])))

 (defn test-jstat [arr]
   (str (js/jStat.dimensions (js/jStat arr))))
+
+;; might just be worth rolling my own with github.com/thinktopic/aljabr for the matrix math.  except actually neither it nor thi-ng/ndarray seem to want to provide actual matrix math... there is also more js, in toji/gl-matrix.

 (.log js/console test-mini)
 (.log js/console (.dimensions test-mini))


CMR-2186: Remove empty facets from the return and order the facets to return science keywords first

--- search-app/src/cmr/search/services/query_execution/facets_v2_results_feature.clj
+++ search-app/src/cmr/search/services/query_execution/facets_v2_results_feature.clj
@@ -48,18 +48,17 @@
   from a collection search. Size specifies the number of results to return. Only a subset of the
   facets are returned in the v2 facets, specifically those that help enable dataset discovery."
   [size]
-  {:data-center (terms-facet :data-center size)
-   :project (terms-facet :project-sn2 size)
+  {:science-keywords (nested-facet :science-keywords size)
    :platform (terms-facet :platform-sn size)
    :instrument (terms-facet :instrument-sn size)
-   :processing-level-id (terms-facet :processing-level-id size)
-   :science-keywords (nested-facet :science-keywords size)})
+   :data-center (terms-facet :data-center size)
+   :project (terms-facet :project-sn2 size)
+   :processing-level-id (terms-facet :processing-level-id size)})

 (def v2-facets-root
   "Root element for the facet response"
   {:title "Browse Collections"
-   :type :group
-   :has_children true})
+   :type :group})

 (def fields->human-readable-label
   "Map of facet fields to their human readable label."
@@ -99,7 +98,7 @@
            :type :group
            :has_children true
            :children value-counts})
-        empty-response))))
+        nil))))

 (defn hierarchical-bucket-map->facets-v2
   "Takes a map of elastic aggregation results for a nested field. Returns a hierarchical facet for
@@ -111,45 +110,56 @@
   "Takes a map of elastic aggregation results containing keys to buckets and a list of the bucket
   names. Returns a facet map of those specific names with value count pairs"
   [bucket-map field-names]
-  (for [field-name field-names
-        :let [value-counts (frf/buckets->value-count-pairs (field-name bucket-map))
-              has-children (some? (seq value-counts))
-              base-node {:title (field-name fields->human-readable-label)
-                         :type :group
-                         ;; TODO with another ticket
-                         ;  :applied ;; either true or false
-                         :has_children has-children}]]
-    (if has-children
-      (assoc base-node :children (map (fn [[term count]]
-                                        {:title term
-                                         :type :filter
-                                         ;; TODO with another ticket
-                                         ;; applied ;; either true or false
-                                         :count count
-                                         ;; TODO with another ticket
-                                         ; :links ;; Apply or remove the given term to the provided search
-                                         :has_children false})
-                                      value-counts))
-      base-node)))
+  (remove nil?
+    (for [field-name field-names
+          :let [value-counts (frf/buckets->value-count-pairs (field-name bucket-map))
+                has-children (some? (seq value-counts))
+                base-node {:title (field-name fields->human-readable-label)
+                           :type :group
+                           ;; TODO with another ticket
+                           ;  :applied ;; either true or false
+                           :has_children has-children}]]
+      (when has-children
+        (assoc base-node :children (map (fn [[term count]]
+                                          {:title term
+                                           :type :filter
+                                           ;; TODO with another ticket
+                                           ;; applied ;; either true or false
+                                           :count count
+                                           ;; TODO with another ticket
+                                           ; :links ;; Apply or remove the given term to the provided search
+                                           :has_children false})
+                                        value-counts))))))
+
+
+(defn- add-links-to-facets
+  "Adds applied and links keys to the facets-v2 map."
+  [query facets-map]
+  (println "Query is " query)
+  facets-map)

 (defn create-v2-facets
   "Create the facets v2 response. Takes an elastic aggregations result and returns the facets."
-  [elastic-aggregations]
-  (let [flat-fields [:data-center :project :platform :instrument :processing-level-id]
+  [elastic-aggregations query]
+  (let [flat-fields [:platform :instrument :data-center :project :processing-level-id]
         hierarchical-fields [:science-keywords]
-        facets (concat (flat-bucket-map->facets-v2
-                        (apply dissoc elastic-aggregations hierarchical-fields) flat-fields)
-                       (map (fn [field]
-                              (assoc (hierarchical-bucket-map->facets-v2
-                                      field (field elastic-aggregations))
-                                     :title (field fields->human-readable-label)))
-                            hierarchical-fields))]
-    (assoc v2-facets-root :children facets)))
+        facets (concat (keep (fn [field]
+                                (when-let [sub-facets (hierarchical-bucket-map->facets-v2
+                                                        field (field elastic-aggregations))]
+                                  (assoc sub-facets :title (field fields->human-readable-label))))
+                             hierarchical-fields)
+                       (flat-bucket-map->facets-v2
+                        (apply dissoc elastic-aggregations hierarchical-fields) flat-fields))]
+    (if (seq facets)
+      (add-links-to-facets query (assoc v2-facets-root :has_children true :children facets))
+      (assoc v2-facets-root :has_children false))))
+

 (defmethod query-execution/pre-process-query-result-feature :facets-v2
-  [context query feature]
+  [_ query _]
   (assoc query :aggregations (facets-v2-aggregations DEFAULT_TERMS_SIZE)))

+;; [context query elastic-results query-results feature]
 (defmethod query-execution/post-process-query-result-feature :facets-v2
-  [_ _ {:keys [aggregations]} query-results _]
-  (assoc query-results :facets (create-v2-facets aggregations)))
+  [_ query {:keys [aggregations]} query-results _]
+  (assoc query-results :facets (create-v2-facets aggregations query)))


New tests test-read-database-statistic-existence, test-add-new-product-existence, and test-update-product-existence

--- test/hurvinek/db_interface_test.clj
+++ test/hurvinek/db_interface_test.clj
@@ -99,3 +99,21 @@
         (is (callable? 'hurvinek.db-interface/count-for-table))))

+(deftest test-read-database-statistic-existence
+    "Check that the hurvinek.db-interface/read-database-statistic definition exists."
+    (testing "if the hurvinek.db-interface/read-database-statistic definition exists."
+        (is (callable? 'hurvinek.db-interface/read-database-statistic))))
+
+
+(deftest test-add-new-product-existence
+    "Check that the hurvinek.db-interface/add-new-product definition exists."
+    (testing "if the hurvinek.db-interface/add-new-product definition exists."
+        (is (callable? 'hurvinek.db-interface/add-new-product))))
+
+
+(deftest test-update-product-existence
+    "Check that the hurvinek.db-interface/update-product definition exists."
+    (testing "if the hurvinek.db-interface/update-product definition exists."
+        (is (callable? 'hurvinek.db-interface/update-product))))
+
+


Fix typo in Cassandra ring session

Fix typo in Cassandra ring session

--- systems/ring-session-cassandra/src/containium/systems/ring_session_cassandra.clj
+++ systems/ring-session-cassandra/src/containium/systems/ring_session_cassandra.clj
@@ -61,7 +61,7 @@
                                 (= data (read-session this key)))
                      (assoc data :containium/last-db-write (System/currentTimeMillis))
                      data)]
-      (when-not (= data new-write)
+      (when-not (= data new-data)
         (let [q (if (get-in data [:noir :session/longlived]) write-q-long write-q)]
           (write-session-data cassandra q new-key new-data)))
       new-key))
@@ -94,7 +94,7 @@
             ttl-mins (:ttl-mins config)
             ttl-days (:ttl-days config)
             _ (assert ttl-mins "Missing :ttl-mins config")
-            _ (assert ttl-mins-long "Missing :ttl-mins-long config")
+            _ (assert ttl-days "Missing :ttl-days config")
             read-q (prepare cassandra "SELECT data FROM ring.sessions WHERE key = ?;")
             ;; TTL in the database queure is twice as what is configured, as unchanged session
             ;; data is only written once in TTL minutes to the database.


Comment out lein-ancient

Comment out lein-ancient

--- roles/clojure/files/profiles.clj
+++ roles/clojure/files/profiles.clj
@@ -5,16 +5,13 @@
                        [cljfmt "0.1.7"]
                        [criterium "0.4.2"]
                        [org.clojure/tools.namespace "0.2.5"]
-                       [rewrite-clj "0.4.11"
-                        :exclusions [org.clojure/tools.reader]]
                        [slamhound "1.5.3"]
                        [spyscope "0.1.4"]]

-        :plugins [#_[cider/cider-nrepl "0.9.0-SNAPSHOT"]
+        :plugins [[cider/cider-nrepl "0.9.0-SNAPSHOT"]
                   [codox "0.6.6"]
                   [jonase/eastwood "0.1.4"]
-                  [lein-ancient "0.5.5" :exclusions [commons-codec]]
-                  [lein-cljfmt "0.1.7" :exclusions [rewrite-clj]]
+                  #_[lein-ancient "0.5.5" :exclusions [commons-codec]]
                   [lein-cljsbuild "1.0.3"]
                   [lein-clojars "0.9.1"]
                   [lein-cloverage "1.0.2"]


move to snapshot

move to snapshot

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.0.0"
+(defproject cook "1.0.1-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.6.0"]


Snapshot version

Snapshot version


Changed tag size to 140. Set default for count to zero.

--- tagcount/src/tagcount/migration.clj
+++ tagcount/src/tagcount/migration.clj
@@ -17,8 +17,8 @@
       (jdbc/db-do-commands core/pooled-db-spec
                            (jdbc/create-table-ddl
                              :tag_count
-                             [:tag "varchar(50)" "PRIMARY KEY"]
-                             [:count "int" "NOT NULL"]
+                             [:tag "varchar(140)" "PRIMARY KEY"]
+                             [:count "int" "NOT NULL" "DEFAULT 0"]
                              [:valid_to "timestamptz" "NOT NULL"])))
     (println "Table tag_count already exists.")))


Add warning notice to six-hump-camel-back

The old version of check-gradient had a bug that prevented it from
checking any points with negative coodinates. Now that this bug was
fixed, this function no longer performs well on the gradient check,
implying that there is a flaw in its implementation for negative
numbers. Perhaps the derivative of a fractional power was taken
incorrectly?

--- cortex/src/cortex/optimise/functions.clj
+++ cortex/src/cortex/optimise/functions.clj
@@ -574,6 +574,8 @@
                            (Math/cos yx)
                            (Math/sin xy)))))))})

+;;; TODO: it looks like this function is broken. After it's fixed,
+;;; a test should be added to cortex.optimise.functions-test.
 (def six-hump-camel-back
   "-3 ≤ x ≤ 3
   -2 ≤ y ≤ 2


Use threading for better readability

Use threading for better readability

Definitely nicer!

--- frontend/analytics.cljs
+++ frontend/analytics.cljs
@@ -125,5 +125,7 @@
   (gstr/startsWith (name key) "utm"))

 (defn register-last-touch-utm [query-params]
-  (let [utm-params (filter utm? query-params)]
-    (mixpanel/register (into {} (map (fn [[key val]] [(str "last_" (name key)) val]) utm-params)))))
+  (mixpanel/register (->> query-params
+                          (filter utm?)
+                          (map (fn [[key val]] [(str "last_" (name key)) val]))
+                          (into {}))))


Creating an application works.

Creating an application works.

--- src/onix/web.clj
+++ src/onix/web.clj
@@ -1,5 +1,7 @@
 (ns onix.web
-    (:require [compojure.core :refer [defroutes context GET PUT POST DELETE]]
+  (:require [onix.persistence :as persistence])
+  (:require   [cheshire.core :as cheshire]
+              [compojure.core :refer [defroutes context GET PUT POST DELETE]]
               [compojure.route :as route]
               [compojure.handler :as handler]
               [ring.middleware.format-response :refer [wrap-json-response]]
@@ -15,6 +17,9 @@
               [nokia.ring-utils.ignore-trailing-slash :refer [wrap-ignore-trailing-slash]]
               [metrics.ring.expose :refer [expose-metrics-as-json]]
               [metrics.ring.instrument :refer [instrument]]))
+
+
+(def json-content-type "application/json;charset=UTF-8")

 (def ^:dynamic *version* "none")
 (defn set-version! [version]
@@ -33,6 +38,24 @@
                                 :version *version*
                                 :success true}))})

+(defn- create-application
+  [req]
+  (let [body (cheshire/parse-string (slurp (:body req)))
+        result (persistence/create-application body)]
+    (response (cheshire/generate-string body) json-content-type 201)))
+
+(defn- list-applications
+  []
+  (prn "LIST APPLICATIONS"))
+
+(defroutes applications-routes
+
+  (POST "/" req
+        (create-application req))
+
+  (GET "/" []
+       (list-applications)))
+
 (defroutes routes
   (context
    "/1.x" []
@@ -41,10 +64,12 @@
         [] "pong")

    (GET "/status"
-        [] (status)))
+        [] (status))
+
+   (context "/applications"
+            [] applications-routes))

   (route/not-found (error-response "Resource not found" 404)))
-

 (def app
   (-> routes


added some test ns's that were not being tested

--- test-cljs/frontend/test_runner.cljs
+++ test-cljs/frontend/test_runner.cljs
@@ -10,7 +10,9 @@
             [frontend.utils-test]
             [frontend.controllers.controls-test]
             [frontend.controllers.ws-test]
+            [frontend.models.test-build]
             [frontend.models.test-plan]
+            [frontend.models.test-project]
             [frontend.models.test-feature]
             [frontend.controllers.api-test]
             [frontend.test-datetime]


Add more unit test for Go.cd sync. These are the oldest parts of buildviz, and are mostly tested via wiremock

--- test/buildviz/go/sync_jobs_test.clj
+++ test/buildviz/go/sync_jobs_test.clj
@@ -126,4 +126,46 @@
                                                  :end 1483272000000
                                                  :outcome "pass"
                                                  :inputs [{:revision "AnotherPipeline/21", :sourceId 7}]}]]
-             @store)))))
+             @store))))
+
+  (testing "should sync a failing stage"
+    (let [store (atom [])]
+      (fake/with-fake-routes-in-isolation
+        (serve-up (a-config (a-pipeline-group "Development"
+                                              (a-pipeline "Build"
+                                                          (a-stage "DoStuff"))))
+                  (a-short-history "Build" "DoStuff"
+                                   (a-stage-run 42 "1" "Failed"
+                                                (a-job-run "AlphaJob" 1493201298062)))
+                  (a-pipeline-run "Build" 42)
+                  (a-builds-properties "Build" 42 "DoStuff" "1" "AlphaJob"
+                                       {:start-time (t/date-time 2017 1 1 10 0 0)
+                                        :end-time (t/date-time 2017 1 1 12 0)
+                                        :outcome "Failed"
+                                        :actual-stage-run "1"})
+                  (a-file-list "Build" 42 "DoStuff" "1" "AlphaJob")
+                  (provide-buildviz-and-capture-puts store))
+        (with-out-str (sut/sync-stages (url/url "http://gocd:8513")
+                                       (url/url "http://buildviz:8010")
+                                       beginning-of-2016 nil nil)))
+      (is (= [["/builds/Build%20DoStuff/42%201" {:start 1483264800000
+                                                 :end 1483272000000
+                                                 :outcome "fail"
+                                                 :inputs []}]]
+             @store))))
+
+  (testing "should ignore an ongoing stage"
+    (let [store (atom [])]
+      (fake/with-fake-routes-in-isolation
+        (serve-up (a-config (a-pipeline-group "Development"
+                                              (a-pipeline "Build"
+                                                          (a-stage "DoStuff"))))
+                  (a-short-history "Build" "DoStuff"
+                                   (a-stage-run 42 "1" "Unknown"
+                                                (a-job-run "AlphaJob" 1493201298062)))
+                  (a-pipeline-run "Build" 42)
+                  (provide-buildviz-and-capture-puts store))
+        (with-out-str (sut/sync-stages (url/url "http://gocd:8513")
+                                       (url/url "http://buildviz:8010")
+                                       beginning-of-2016 nil nil)))
+      (is (empty? @store)))))


Fix up test.

Fix up test.

--- test/onyx/peer/single_peer_test.clj
+++ test/onyx/peer/single_peer_test.clj
@@ -1,8 +1,9 @@
 (ns onyx.peer.single-peer-test
-  (:require [clojure.core.async :refer [chan >!! <!! close!]]
+  (:require [clojure.core.async :refer [chan >!! <!! close! sliding-buffer]]
             [midje.sweet :refer :all]
             [onyx.peer.task-lifecycle-extensions :as l-ext]
             [onyx.system :refer [onyx-development-env]]
+            [onyx.plugin.core-async]
             [onyx.api]))

 (def id (java.util.UUID/randomUUID))
@@ -74,7 +75,7 @@

 (def in-chan (chan (inc n-messages)))

-(def out-chan (chan (inc n-messages)))
+(def out-chan (chan (sliding-buffer (inc n-messages))))

 (defmethod l-ext/inject-lifecycle-resources :in
   [_ _] {:core.async/in-chan in-chan})
@@ -94,6 +95,9 @@
  {:catalog catalog :workflow workflow
   :task-scheduler :onyx.task-scheduler/round-robin})

+(doseq [_ (range n-messages)]
+  (prn (<!! out-chan)))
+
 (comment
  (doseq [v-peer v-peers]
    (onyx.api/shutdown-peer v-peer))


Drop trailing \n

Drop trailing \n

--- test/onyx/plugin/input_log_test.clj
+++ test/onyx/plugin/input_log_test.clj
@@ -28,7 +28,7 @@

 (def peer-group (onyx.api/start-peer-group peer-config))

-(def db-uri (str "datomic:free://" (slurp "eth0.ip") ":4334/" (java.util.UUID/randomUUID)))
+(def db-uri (str "datomic:free://" (butlast (slurp "eth0.ip")) ":4334/" (java.util.UUID/randomUUID)))

 (def schema
   [{:db/id #db/id [:db.part/db]


Better comments

Better comments

--- test/onyx_peers/jobs/basic_test.clj
+++ test/onyx_peers/jobs/basic_test.clj
@@ -30,9 +30,9 @@
         test-setup {:job-params {:batch-size 1}
                     :job-type :simple-job
                     :nemesis :na
-                    :time-limit 800 ; unused in this test
-                    :awake-ms 200 ; unused in this test
-                    :stopped-ms 100 ; unused in this test
+                    :time-limit 800 ; unused in non-jepsen test
+                    :awake-ms 200 ; unused in non-jepsen test
+                    :stopped-ms 100 ; unused in non-jepsen test
                     ; may or may not work when 5 is not divisible by n-jobs
                     :n-jobs 1
                     ; Minimum total = 5 (input ledgers) + 1 intermediate + 1 output


Temporarily deactivate fringe test case

Temporarily deactivate fringe test case

--- test/photon/current/projections.clj
+++ test/photon/current/projections.clj
@@ -36,7 +36,7 @@
                               {:projection-name "__streams__"}))]
     (fact "Now there is one event processed"
           (:processed new-sp) => 1.0))
-  (let [sn (cl/with-muon m
+  #_(let [sn (cl/with-muon m
              (cl/subscribe! (str url-str "/projection/imaginary")
                             {:from 0 :stream-type :hot}))]
     (fact "There is no stream for a non-existing projection"


Added demo for saving groups to mdb. Fixed bug in message publishing

--- metadata-db-app/src/cmr/metadata_db/data/ingest_events.clj
+++ metadata-db-app/src/cmr/metadata_db/data/ingest_events.clj
@@ -11,7 +11,7 @@
   [context exchange-name msg]
   (when (and (config/publish-messages)
              ;; TODO - Update/remove this when we add service indexing and group indexing.
-             (not (contains? [:service :access-group] (cc/concept-id->type (:concept-id msg)))))
+             (not (contains? #{:service :access-group} (cc/concept-id->type (:concept-id msg)))))
     (let [timeout-ms (config/publish-timeout-ms)
           queue-broker (get-in context [:system :queue-broker])]
       (when queue-broker


Added predicate to ignore servies when putting ingest messages on the queue

--- metadata-db-app/src/cmr/metadata_db/data/ingest_events.clj
+++ metadata-db-app/src/cmr/metadata_db/data/ingest_events.clj
@@ -3,12 +3,15 @@
   (:require [cmr.metadata-db.config :as config]
             [cmr.common.log :as log :refer (debug info warn error)]
             [cmr.common.services.errors :as errors]
+            [cmr.common.concepts :as cc]
             [cmr.message-queue.services.queue :as queue]))

 (defn publish-event
   "Put an ingest event on the message queue."
   [context exchange-name msg]
-  (when (config/publish-messages)
+  (when (and (config/publish-messages)
+             ;; TODO - Remove this when we add service indexing in CMR-1508
+             (not= :service (cc/concept-id->type (:concept-id msg))))
     (let [timeout-ms (config/publish-timeout-ms)
           queue-broker (get-in context [:system :queue-broker])]
       (when queue-broker


Check for the version at run time instead of compile time.

If 1.5.0 is first, this test wasn't running for any version.

--- integration-tests/src/test/clojure/immutant/integs/web/noir.clj
+++ integration-tests/src/test/clojure/immutant/integs/web/noir.clj
@@ -20,19 +20,22 @@
   (:use clojure.test)
   (:require [clj-http.client :as client]))

-(let [run-tests (not= "1.5.0-RC1"
-                      (:full immutant.integs/*current-clojure-version*))]
+(defn run-tests? []
+  (not= "1.5.0-RC1"
+        (:full immutant.integs/*current-clojure-version*)))

-  (when run-tests
-    (use-fixtures :once (with-deployment *file*
-                          {
-                           :root "target/apps/ring/noir-app/"
-                           :context-path "/noir-app"
-                           })))
+(let [file *file*]
+  (use-fixtures :once #(if (run-tests?)
+                         ((with-deployment file
+                            {
+                             :root "target/apps/ring/noir-app/"
+                             :context-path "/noir-app"
+                             }) %)
+                         (%))))

-  (deftest simple "it should work"
-    (if run-tests
-      (let [result (client/get "http://localhost:8080/noir-app/welcome")]
-        ;; (println "RESPONSE" result)
-        (is (.contains (result :body) "Welcome to noir-app, jim")))
-      (println "==> skipping noir tests under 1.5.0 since noir itself is broken under 1.5.0"))))
+(deftest simple "it should work"
+  (if (run-tests?)
+    (let [result (client/get "http://localhost:8080/noir-app/welcome")]
+      ;; (println "RESPONSE" result)
+      (is (.contains (result :body) "Welcome to noir-app, jim")))
+    (println "==> skipping noir tests under 1.5.0 since noir itself is broken under 1.5.0")))


Fix tests.

Fix tests.

--- test/io/cyanite/test_helper.clj
+++ test/io/cyanite/test_helper.clj
@@ -39,7 +39,10 @@
 (defrecord SynchronousQueueEngine [consumers]
   queue/QueueEngine
   (shutdown! [this])
-  (add! [this e]
+  (engine-event! [this e]
+    (doseq [f @consumers]
+      (f e)))
+  (writer-event! [this e]
     (doseq [f @consumers]
       (f e)))
   (consume! [this f]


adds tolerance for delay in status updates for service status (#522)

--- waiter/integration/waiter/basic_test.clj
+++ waiter/integration/waiter/basic_test.clj
@@ -42,10 +42,11 @@
         (testing "instances are non-null"
           (is (get-in service-settings [:instances :active-instances]))
           (is (get-in service-settings [:instances :failed-instances]))
-          (is (get-in service-settings [:instances :killed-instances])))
-
-        (testing "status is reported"
-          (is (wait-for #(= "Running" (get service-settings :status)) :interval 2 :timeout 30))))
+          (is (get-in service-settings [:instances :killed-instances]))))
+
+      (testing "status is reported"
+        (is (wait-for #(= "Running" (get (service-settings waiter-url service-id) :status)) :interval 2 :timeout 30)
+            (str "Service status is " (get (service-settings waiter-url service-id) :status))))

       (testing "explicitly specifying default parameter resolves to different service"
         (let [{:keys [service-description-defaults]} (waiter-settings waiter-url)


Removing unnecessary require in value_format.clj

--- src/vip/data_processor/validation/data_spec/value_format.clj
+++ src/vip/data_processor/validation/data_spec/value_format.clj
@@ -1,5 +1,4 @@
-(ns vip.data-processor.validation.data-spec.value-format
-  (:require [vip.data-processor.validation.data-spec.coerce :as coerce]))
+(ns vip.data-processor.validation.data-spec.value-format)

 (def all-digits
   {:check #"\A\d+\z"


CMR-6495 added test scenario for var name editing.

--- metadata-db-app/int-test/cmr/metadata_db/int_test/concepts/variable_save_test.clj
+++ metadata-db-app/int-test/cmr/metadata_db/int_test/concepts/variable_save_test.clj
@@ -70,4 +70,12 @@
             {:keys [status concept-id revision-id]} (util/save-concept concept3)]
         (is (= status 201))
         (is (not= concept1-concept-id concept-id))
-        (is (= 1 revision-id))))))
+        (is (= 1 revision-id)))
+      (let [concept4-var-name "different-variable-name"
+            concept4 (update concept1 :extra-fields assoc :variable-name concept4-var-name)]
+        (testing (str "save variable with the same native id, but a different variable name "
+                      "on a non-deleted variable is allowed")
+          (let [{:keys [status concept-id revision-id]} (util/save-concept concept4)]
+            (is (= 201 status))
+            (is (= concept1-concept-id concept-id))
+            (is (= 3 revision-id))))))))


return promise

return promise

--- clojure/src/dnd/core.cljs
+++ clojure/src/dnd/core.cljs
@@ -156,7 +156,8 @@
         (then (fn [blocks]
                 (reset! level (if (nil? blocks)
                                 (make-level)
-                                (transform [ALL ALL :color] clj->js blocks))))))))
+                                (transform [ALL ALL :color] clj->js blocks)))))
+        p/promise)))

 (defn -main []
   (async


Add random key

Add random key

--- clojure/src/life/core.clj
+++ clojure/src/life/core.clj
@@ -10,6 +10,11 @@
                    1 [0 0 0]})

 (def initial-board (into [] (repeat (* board-size board-size) 0)))
+
+(defn random-board []
+  (into
+   []
+   (take (* board-size board-size) (repeatedly #(Math/round (rand))))))

 (defn print-board [board]
   (let [lines (partition board-size board)
@@ -50,7 +55,8 @@

 (defn key-pressed [state event]
   (case (event :key-code)
-    32 (update state :paused not)
+    32 (update state :paused not) ;; space
+    82 (assoc state :board (random-board)) ;; r
     state))

 (def flip-life {0 1 1 0})


Deselect all shapes on ESC is clicked.

Deselect all shapes on ESC is clicked.

--- frontend/uxbox/ui/workspace/shortcuts.cljs
+++ frontend/uxbox/ui/workspace/shortcuts.cljs
@@ -18,7 +18,7 @@
    :ctrl+shift+f #(rs/emit! (dw/toggle-toolbox :draw))
    :ctrl+shift+i #(rs/emit! (dw/toggle-toolbox :icons))
    :ctrl+shift+l #(rs/emit! (dw/toggle-toolbox :layers))
-   :esc (constantly nil)
+   :esc #(rs/emit! (dw/deselect-all))
    :backspace #(rs/emit! (dw/remove-selected))})

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Added test functions.

Added test functions.

--- nav-obj-splitter.clj
+++ nav-obj-splitter.clj
@@ -38,5 +38,11 @@
 (def meta-data-example {:type-id 1 :type "Table" :id "70902" :name "Test Table (48)"})
 (def first-line-example "OBJECT Table 70902 Test Table (48)")
 (def meta-data-parsed (parse-first-line first-line-example))
-(is (= meta-data-example meta-data-parsed))
-(is (= "1-Table-70902.txt" (make-single-file-name meta-data-parsed)))+
+(deftest parsing
+  (is (= meta-data-example meta-data-parsed)))
+
+(deftest new-file-name
+  (is (= "1-Table-70902.txt" (make-single-file-name meta-data-parsed))))
+
+(run-tests 'nav.source.split)


Improved naming of standard functions

Improved naming of standard functions


Go back to page 1 after changing the filter text (#465)

--- src/cljs/org/broadinstitute/firecloud_ui/common/table.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/common/table.cljs
@@ -205,7 +205,8 @@
                                    (assoc-in columns [column-index :visible?] visible?)))))})}])])
                  (when filterable?
                    [:div {:style {:float "left" :marginLeft "1em"}}
-                    [table-utils/TextFilter {:on-filter #(swap! state update-in [:query-params] assoc :filter-text %)}]])
+                    [table-utils/TextFilter {:on-filter #(swap! state update-in [:query-params]
+                                                                assoc :filter-text % :current-page 1)}]])
                  (when (:filter-groups props)
                    [:div {:style {:float "left" :marginLeft "1em" :marginTop -3}}
                     [table-utils/FilterGroupBar


(maint) Suppress warning about empty contextPath

Jetty warns if a contextPath is an empty string. Since that is normal in
clients of this library, substitute "/" in this case, which is what
jetty ends up using anyway.

--- src/puppetlabs/trapperkeeper/services/webserver/jetty9_core.clj
+++ src/puppetlabs/trapperkeeper/services/webserver/jetty9_core.clj
@@ -739,6 +739,7 @@
         (normalized-uri-helpers/handler-maybe-wrapped-with-normalized-uri
          (ring-handler handler)
          normalize-request-uri?)
+        path (if (= "" path) "/" path)
         ctxt-handler (doto (ContextHandler. path)
                        (.setHandler handler))]
     (add-handler webserver-context ctxt-handler enable-trailing-slash-redirect?)))


Update to reflect experience achieved

Update to reflect experience achieved

--- support/build-support/src/main/clojure/immutant/build/tools.clj
+++ support/build-support/src/main/clojure/immutant/build/tools.clj
@@ -103,7 +103,7 @@
        (FileUtils/deleteQuietly artifact-dir)))))

 (defn increase-deployment-timeout [loc]
-  (zip/edit loc #(assoc-in % [:attrs :deployment-timeout] "1200")))
+  (zip/edit loc assoc-in [:attrs :deployment-timeout] "1200"))

 (defn add-extension [prefix loc name]
   (let [module-name (str prefix name)]
@@ -162,7 +162,7 @@
   (zip/append-child loc {:tag :property :attrs {:name prop :value value}}))

 (defn replace-system-property [loc prop value]
-  (zip/edit loc #(assoc % :attrs {:name prop :value value})))
+  (zip/edit loc assoc :attrs {:name prop :value value}))

 (defn set-system-property [loc prop value]
   (if-let [child (zfx/xml1-> loc :property (zfx/attr= :name value))]
@@ -175,10 +175,10 @@
 (defn set-welcome-root [loc]
   (if (= "false" (-> loc zip/node :attrs :enable-welcome-root))
     loc
-    (zip/edit loc #(update-in % [:attrs :enable-welcome-root] (constantly "false")))))
+    (zip/edit loc assoc-in [:attrs :enable-welcome-root] "false")))

 (defn disable-security [loc]
-    (zip/edit loc #(update-in % [:attrs] dissoc :security-realm)))
+  (zip/edit loc update-in [:attrs] dissoc :security-realm))

 (defn add-logger-levels [loc]
   (zip/append-child (zip/right


Minor cleanup in build.tools.

Minor cleanup in build.tools.

--- support/build-support/src/main/clojure/immutant/build/tools.clj
+++ support/build-support/src/main/clojure/immutant/build/tools.clj
@@ -258,28 +258,28 @@
   (if (zip/end? loc)
     (zip/root loc)
     (recur (zip/next
-            (cond
-             (looking-at? :extensions loc) (fix-extensions loc)
-             (looking-at? :extension loc) (fix-extension loc)
-             (looking-at? :subsystem loc) (fix-subsystem loc)
-             (looking-at? :profile loc) (fix-profile loc)
-             (looking-at? :periodic-rotating-file-handler loc) (add-logger-levels loc)
-             (looking-at? :virtual-server loc) (set-welcome-root loc)
-             (looking-at? :system-properties loc) (-> loc
-                                                      unquote-cookie-path
-                                                      allow-backslashes)
-             (looking-at? :jms-destinations loc) (zip/remove loc)
-             (looking-at? :deployment-scanner loc) (increase-deployment-timeout loc)
-             (looking-at? :native-interface loc) (disable-security loc)
-             (looking-at? :http-interface loc) (disable-security loc)
-             (looking-at? :max-size-bytes loc) (zip/edit loc assoc :content ["20971520"])
-             (looking-at? :address-full-policy loc) (zip/edit loc assoc :content ["PAGE"])
-             (looking-at? :hornetq-server loc) (update-hq-server loc)
-             (looking-at? :jms-connection-factories loc) (disable-flow-control loc)
-             (looking-at? :servers loc) (replace-servers loc)
-             (looking-at? :server-groups loc) (replace-server-groups loc)
-             (looking-at? :socket-binding-group loc) (fix-socket-binding-group loc)
-             :else loc)))))
+            (condp looking-at? loc
+              :extensions                     (fix-extensions loc)
+              :extension                      (fix-extension loc)
+              :subsystem                      (fix-subsystem loc)
+              :profile                        (fix-profile loc)
+              :periodic-rotating-file-handler (add-logger-levels loc)
+              :virtual-server                 (set-welcome-root loc)
+              :system-properties              (-> loc
+                                                  unquote-cookie-path
+                                                  allow-backslashes)
+              :jms-destinations               (zip/remove loc)
+              :deployment-scanner             (increase-deployment-timeout loc)
+              :native-interface               (disable-security loc)
+              :http-interface                 (disable-security loc)
+              :max-size-bytes                 (zip/edit loc assoc :content ["20971520"])
+              :address-full-policy            (zip/edit loc assoc :content ["PAGE"])
+              :hornetq-server                 (update-hq-server loc)
+              :jms-connection-factories       (disable-flow-control loc)
+              :servers                        (replace-servers loc)
+              :server-groups                  (replace-server-groups loc)
+              :socket-binding-group           (fix-socket-binding-group loc)
+              loc)))))

 (defn transform-config [file]
   (let [in-file (io/file jboss-dir file)


fix sort-alphabetically to use 'compare'

--- src/misaki/util/sequence.clj
+++ src/misaki/util/sequence.clj
@@ -12,5 +12,5 @@
 (defn sort-alphabetically
   "Sort list alphabetically."
   ([ls]   (sort-alphabetically identity ls))
-  ([f ls] (sort #(neg? (.compareTo (f %) (f %2))) ls)))
+  ([f ls] (sort #(neg? (compare (f %) (f %2))) ls)))


move validators to map, use prismatic schema instead of bouncer

--- src/navigator/validation.clj
+++ src/navigator/validation.clj
@@ -1,62 +1,54 @@
 (ns navigator.validation
-  (:require [bouncer
-             [core :as b]
-             [validators :as v]]))
+  (:require [schema.core :as s]))

-(defn task-in
-  [task]
-  (b/validate task
-              :task/id-sk        v/required
-              :task/id-sk-origin v/required
-              :task/name         v/required
-              :task/version      v/required
-              :task/description  v/required))
+(def validations
+  {:task           {:id-sk        s/Str
+                    :id-sk-origin s/Keyword
+                    :name         s/Str
+                    :version      s/Str
+                    :description  s/Str}
+   :perf-asmt      {:id-sk                    s/Str
+                    :id-sk-origin             s/Keyword
+                    (s/optional-key :name)    s/Str
+                    :version                  s/Str
+                    :type                     s/Keyword
+                    :duration-rating-days     s/Int
+                    :comps                    [s/Str]
+                    :credit-value-numerator   s/Int
+                    :credit-value-denominator s/Int}
+   :user2comp      {:sis-user-id                        s/Int
+                    :comp                               s/Str
+                    :start-date                         s/Str
+                    (s/optional-key :iscomplete)        s/Bool
+                    (s/optional-key :isoverridden)      s/Bool
+                    (s/optional-key :completion-date)   s/Str
+                    :proposed-completion-date           s/Str
+                    (s/optional-key :current-score)     s/Str
+                    (s/optional-key :final-score)       s/Str
+                    (s/optional-key :score-denominator) s/Int
+                    (s/optional-key :score-type)        s/Keyword}
+   :user2perf-asmt {:user  s/Str
+                    :task  s/Str
+                    :grade s/Bool}})

-(defn comp-in
-  [comp]
-  (b/validate comp
-              :comp/id-sk       v/required
-              :comp/name        v/required
-              :comp/description v/required
-              :comp/version     v/required
-              :comp/status      v/required
-              :comp/tags        v/required))
+(comment

-(defn comp-tag-in
-  [comp-tag]
-  (b/validate comp-tag
-              :comp-tag/name        v/required
-              :comp-tag/description v/required
-              :comp-tag/version     v/required
-              :comp-tag/type        v/required
-              :comp-tag/icon        v/required
-              :comp-tag/status      v/required
-              :comp-tag/disp-ctxs   v/required
-              :comp-tag/child-of    v/required))
+  (defn comp-tag-in
+    [comp-tag]
+    (s/validate
+     {:comp-tag/name s/Str
+      (s/optional-key :comp-tag/description) s/Str
+      :comp-tag/version s/Str
+      :comp-tag/type s/Str
+      (s/optional-key :comp-tag/isrequestable) s/Bool
+      (s/optional-key :comp-tag/icon) s/Str
+      :comp-tag/status s/Keyword
+      (s/optional-key :comp-tag/isfinal) s/Bool
+      ;; :comp-tag/disp-ctxs
+      ;; :comp-tag/child-tags ref
+      ;; :comp-tag/child-perf-asmts ref
+      ;; :comp-tag/child-comps ref
+      }
+     comp-tag))

-(defn perf-asmt-in
-  [perf-asmt]
-  (b/validate perf-asmt
-              :perf-asmt/id-sk        v/required
-              :perf-asmt/id-sk-origin v/required
-              :perf-asmt/name         v/required
-              :perf-asmt/version      v/required
-              :perf-asmt/type         v/required
-              :perf-asmt/comps        v/required))
-
-(defn user2comp-in
-  [user2comp]
-  (b/validate user2comp
-              :user2comp/sis-user-id              v/required
-              :user2comp/comp                     v/required
-              :user2comp/start-date               v/required
-              :user2comp/proposed-completion-date v/required
-              :user2comp/current-score            v/required
-              :user2comp/final-score              v/required
-              :user2comp/score-type               v/required))
-
-(defn user2perf-asmt-in
-  [user2perf-asmt]
-  (b/validate user2perf-asmt
-              :user2perf-asmt/user      v/required
-              :user2perf-asmt/perf-asmt v/required))
+  )


Refix gc-publication bug

Refix gc-publication bug

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -203,8 +203,8 @@
                                      snapshot))]
           (doseq [k to-remove]
             (let [pub-manager (:publication (snapshot k))
-                  pub (:publication pub-manager)
-                  conn (:connection pub-manager)]
+                  pub @(:publication pub-manager)
+                  conn @(:connection pub-manager)]
               (swap! publications dissoc k)
               (.close ^Publication pub)
               (.close ^Aeron conn))))


Allow sizing functions to work anywhere

Allow sizing functions to work anywhere

--- src/play_clj/core_render.clj
+++ src/play_clj/core_render.clj
@@ -103,12 +103,12 @@
   (.setToOrtho camera false width height))

 (defn height!
-  [{:keys [width height] :as screen} new-height]
-  (size! screen (* new-height (/ width height)) new-height))
+  [screen new-height]
+  (size! screen (* new-height (/ (game :width) (game :height))) new-height))

 (defn width!
-  [{:keys [width height] :as screen} new-width]
-  (size! screen new-width (* new-width (/ height width))))
+  [screen new-width]
+  (size! screen new-width (* new-width (/ (game :height) (game :width)))))

 (defn move!
   [{:keys [^Camera camera]} x y]


WIP refining routes

WIP refining routes

--- src/clj/clj_money/web/server.clj
+++ src/clj/clj_money/web/server.clj
@@ -2,7 +2,7 @@
   (:refer-clojure :exclude [update])
   (:require [clojure.tools.logging :as log]
             [clojure.pprint :refer [pprint]]
-            [compojure.core :refer [defroutes GET PUT POST DELETE ANY]]
+            [compojure.core :refer [defroutes routes GET PUT POST DELETE ANY]]
             [compojure.handler :refer [site]]
             [compojure.route :as route]
             [clojure.java.io :as io]
@@ -194,21 +194,37 @@
   [req]
   (route/not-found (slurp (io/resource "404.html"))))

+(defn wrap-authenticate
+  [handler]
+  (friend/authenticate
+    handler
+    {:workflows [(workflows/interactive-form)]
+     :credential-fn (partial clj-money.models.users/authenticate (env :db))
+     :redirect-on-auth? false}))
+
 (defroutes app
-  (-> (routes (-> api-routes
+  (-> (routes open-routes
+              (-> protected-routes
+                  wrap-models
+                  wrap-integer-id-params
+                  wrap-multipart-params
+                  wrap-keyword-params
+                  wrap-params
+                  (friend/wrap-authorize #{:user})
+                  wrap-authenticate)
+              (-> api-routes
+                  wrap-models
+                  wrap-integer-id-params
+                  wrap-json-response
+                  wrap-keyword-params
                   wrap-json-params
-                  wrap-json-response)
-              (-> protected-routes
-                  wrap-multipart-params)
-              open-routes)
-      wrap-anti-forger
+                  wrap-params
+                  (friend/wrap-authorize #{:user})
+                  wrap-authenticate))
+      wrap-anti-forgery
       wrap-exception-handling
-      wrap-models
-      wrap-integer-id-params
+      wrap-content-type
       (wrap-resource "public")
-      wrap-content-type
-      wrap-keyword-params
-      wrap-params
       wrap-session)
   (friend/logout (POST "/logout" [] (redirect "/")))
   (ANY "*" req


morph: minor bugfixes

morph: minor bugfixes

--- src/cljs/cljs_morphic/morph.cljs
+++ src/cljs/cljs_morphic/morph.cljs
@@ -126,7 +126,7 @@
   (cond
     (expanded-expression? x) :expr
     (morph? x) :morph
-    (vector? x) :vector
+    (morph-list? x) :vector
     :else (throw (str "Encountered non morphic structure in hierarchy " x))))

 (deflens it [x y] ; maybe 'self' is a better name than 'it'
@@ -638,8 +638,12 @@
 ; this is just boilerplate code to transform the react events
 ; into FRP signals that can be used in a functional manner

+(defn extract-morph-class [props]
+  (or (:css-class props) "Morph"))
+
 (defn extract-html-attributes [props]
   #js {:style (extract-morph-css props)
+       :className (extract-morph-class props)
        :onClick (event/extract-click-handler props)
        :onDoubleClick (event/extract-double-click-handler props)
        :onMouseEnter (event/extract-mouse-enter-handler props)
@@ -839,9 +843,10 @@
         om/IRender
         (render [self]
                 ; morph
-                (dom/div (extract-html-attributes props)
+                (apply dom/div (extract-html-attributes props)
                   (dom/div (clj->js {:style (extract-morph-shape-css props)})
-                    ((props :html) props))))))
+                    ((props :html) props))
+                  (map render submorphs)))))

 (defn render-root [morph _]
   (reify


modified trim-chars

modified trim-chars

--- src/cljs/cljs_repl_web/core.cljs
+++ src/cljs/cljs_repl_web/core.cljs
@@ -26,7 +26,7 @@
 (defn ^:export main []
   (let [{:keys [name verbose-repl? src-paths]} config/defaults
         local-storage-values (ls/get-local-storage-values)]
-    (dispatch [:options console-key {:trim-chars "[](){}"
+    (dispatch [:options console-key {:trim-chars "[](){}#'@^`~."
                                      :keys-handling {:visible-items 6
                                                      :item-height 20}}])
     (println "[Entering]" name)


Look up the hyphenation pattern on every change in the word field

This might turn out to be to costly. We might have to debounce the
requests.

--- src/cljs/hyphen_keeper/core.cljs
+++ src/cljs/hyphen_keeper/core.cljs
@@ -182,8 +182,8 @@
        :value @word
        :on-change (fn [e]
                     (reset! word (-> e .-target .-value string/lower-case))
-                    (load-hyphenation-patterns! @spelling @word))
-       :on-blur #(lookup-hyphenation-pattern! @spelling @word)}]
+                    (load-hyphenation-patterns! @spelling @word)
+                    (lookup-hyphenation-pattern! @spelling @word))}]
      (when help-text
        [:span#wordHelp.help-block help-text])]))


Added some movements, renamed others.

Added some movements, renamed others.

--- src/cljs/movement/movements.cljs
+++ src/cljs/movement/movements.cljs
@@ -6,11 +6,13 @@
 (def warmup [:joint-mobility :jump-rope :running])

 ; Mobility
-(def hip-mobility [:squat-routine :squat-routine-2.0 :movnat-routine])
-(def shoulder-mobility [:shoulder-rom-stabilisation :scapula-mobilisation])
-(def wrist-mobility [:wrist-prep])
-(def ankle-mobility [:ankle-prep])
-(def spine-mobility [:bridge-rotation :locked-knees-rounded-back-deadlift])
+(def hip-mobility [:squat-routine :squat-routine-2.0 :movnat-sitting-routine])
+(def shoulder-mobility [:shoulder-rom-stabilisation-routine :scapula-mobilisation-routine])
+(def wrist-mobility [:wrist-routine])
+(def ankle-mobility [:ankle-routine])
+(def spine-mobility [:slide-into-low-bridge-and-wall-rotation :rotate-into-low-bridge
+                     :rotate-into-high-bridge :high-bridge-hold
+                     :locked-knees-rounded-back-deadlift])

 ; Hanging
 (def hanging [:passive-hang :active-hang :false-grip-hang :side-to-side-swing
@@ -18,30 +20,30 @@
               :one-arm-passive :one-arm-active :shawerma
               :swing-grip-routine :figure-8])
 ; Locomotion
-(def locomotion [:swing-to-handstand :cart-wheel :handstand-walk :bridge-walk
+(def locomotion [:kick-to-handstand :cart-wheel :handstand-walk :bridge-walk
                  :duck-walk :horse-walk :lizard-crawl :ostrich-walk :bear-walk
-                 :crab-walk])
+                 :crab-walk :inchworm])
 ; Equilibre
-(def equilibre [:gatherings :wall-walk :wall-kick :handstand-walk
+(def equilibre [:headstand-leg-lift :wall-walk :wall-kick :handstand-walk
                 :handstand-push-up :air-baby :qdr])
 ; Leg strength
 (def leg-strength [:basic-squat :back-squat :front-squat :overhead-squat
                    :basic-lunge :back-lunge :front-lunge :overhead-lunge
-                   :deadlift :pistols :shrimp :behind-leg-squat
-                   :jump-onto-box-standing :jump-onto-box-squatting
-                   :explosive-flipping :natural-leg-curl])
+                   :deadlift :pistol :shrimp :behind-leg-squat
+                   :jump-onto-box-from-standing :jump-onto-box-from-squatting
+                   :front-flip :back-flip :natural-leg-curl])
 ; Auxiliary strength
-(def auxiliary [:l-sit :straddle :v-up :sitting-leg-lift :swedish-leg-lift
-                :hanging-leg-lift :gatherings :archups])
+(def auxiliary [:l-sit :l-straddle :v-up :sitting-leg-lift :swedish-leg-lift
+                :hanging-leg-lift :headstand-leg-lift :archup])
 ; Straight arm scapular strength
-(def sass [:swedish-bar-hold-front :swedish-bar-hold-back
+(def sass [:swedish-bar-front-support :swedish-bar-hold-back
            :back-lever :front-lever :side-lever :planche :handstand])
 ; Bent arm strength
 (def bas [:push-up-basic :push-up-russian :push-up-wide
           :push-up-diamond :push-up-hindu :push-up-lateral :push-up-bridge
           :push-up-archer :push-up-one-arm :push-up-one-leg-one-arm
-          :dips-basic :dips-russian :dips-single-bar :dips-korean :dips-ring
-          :dips-ring-wide :dips-ring-archer
+          :dip-basic :dip-russian :dip-single-bar :dip-korean :dip-ring
+          :dip-ring-wide :dip-ring-archer
           :handstand-push-up-head-wall :handstand-push-up-wall :handstand-push-up-free
           :push-up-planche :pull-up-basic :pull-up-wide :pull-up-rings :pull-up-rings-wide
           :pull-up-chest :pull-up-waist :pull-up-weighted :pull-up-scapula
@@ -50,7 +52,7 @@
           :one-arm-pull-up :row-basic :row-wide :front-lever-row
           :german-hang-pull :pull-over :front-lever-pull :back-lever-pull
           :tick-tock :back-lever-negative :front-lever-negative
-          :muscle-up :false-grip-pull-up :muscle-up-negative
+          :muscle-up :pull-up-false-grip :muscle-up-negative
           :muscle-up-l-sit :rope-climb])

 (def movnat-sitting [:split-stand-to-split-sit :walking-split-squat :side-shuffle


Add cleanup code

Add cleanup code

--- src/clojure_fabric/event_hub.clj
+++ src/clojure_fabric/event_hub.clj
@@ -21,6 +21,8 @@
   (:import io.grpc.stub.StreamObserver
            [clojure_fabric.proto Block ChaincodeEvent]
            [com.google.protobuf ByteString]
+           io.grpc.Status$Code
+           io.grpc.StatusRuntimeException
            io.grpc.ManagedChannel
            org.hyperledger.fabric.protos.msp.Identities$SerializedIdentity
            [org.hyperledger.fabric.protos.common Common$Block Common$BlockMetadataIndex
@@ -79,9 +81,10 @@
                      block-event-handlers
                      tx-id->chan-fn-map
                      chaincode-id->chan-fn-map
-                     observer
                      event-go-loop
-
+                     start-time
+                     end-time
+                     managed-channel
                      ;; connected
                      ;; mtx
                      ;; grpc-client
@@ -91,14 +94,16 @@

 (defn make-event-hub [user peer]
   (->EventHub user peer (async/chan (async/sliding-buffer default-sliding-buffer-size))
-              (async/chan) ;; command ch
+              (atom nil) ;;(async/chan) ;; command ch
               ;; block event ch & handlers
-              (async/chan (async/sliding-buffer default-sliding-buffer-size))
+              (atom nil) ;; (async/chan (async/sliding-buffer default-sliding-buffer-size))
               (atom {})  ;; block-event-handlers
               (atom {})  ;; tx-id->chan-fn-map
               (atom {})  ;; chaincode-id->chan-fn-map
-              (atom nil) ;; observer
               (atom nil) ;; event-go-loop
+              (atom nil) ;; start-time
+              (atom nil) ;; end-time
+              (atom nil) ;; managed-channel
               ))

 (def ^:dynamic *event-hub* nil)
@@ -180,38 +185,36 @@
   [fn]
   (->ChanFun (async/chan) fn))

-(defmacro with-refresh-event-go-loop! [[event-hub] & body]
-  `(do ~@body
-       (async/put! (deref (:command-ch ~event-hub)) :refresh)))
+(defmacro with-issuing-event-go-loop-command! [[event-hub command] & body]
+  `(let [command-ch# (deref (:command-ch ~event-hub))]
+     ~@body
+     (when command-ch#
+       (async/put! command-ch# ~command))))

 (defn register-block-event
   ([fn-name fn]
    (register-block-event *event-hub* fn-name fn))
   ([event-hub fn-name fn]
-   (with-refresh-event-go-loop! [event-hub]
+   (with-issuing-event-go-loop-command! [event-hub :refresh]
      (swap! (:block-event-handlers event-hub) assoc fn-name fn))))

 (defn unregister-block-event
   ([fn-name]
    (unregister-block-event *event-hub* fn-name))
   ([event-hub fn-name]
-   (with-refresh-event-go-loop! [event-hub]
+   (with-issuing-event-go-loop-command! [event-hub :refresh]
      (swap! (:block-event-handlers event-hub) dissoc fn-name))))

 (defn- %unregister-event
   [event-hub id k]
-   (let [ref-m (k event-hub)]
-    (with-refresh-event-go-loop! [event-hub]
-      (when-let [existing (get (deref ref-m) id)]
-        (async/close! (:ch existing))
-        (swap! ref-m dissoc id)))))
+  (let [ref-m (k event-hub)]
+    (with-issuing-event-go-loop-command! [event-hub :refresh]
+      (swap! ref-m dissoc id))))

 (defn- %register-event
   [event-hub id fn k]
   (let [ref-m (k event-hub)]
-    (with-refresh-event-go-loop! [event-hub]
-      (when-let [existing (get (deref ref-m) id)]
-        (async/close! (:ch existing)))
+    (with-issuing-event-go-loop-command! [event-hub :refresh]
       (swap! ref-m assoc id (make-chan-fun fn)))))

 (defn register-tx-event
@@ -242,8 +245,8 @@
   [event-hub]
   (letfn [(%get-all-chans [k]
             (map :ch (vals (deref (k event-hub)))))]
-    `[(:command-ch ~event-hub)
-      (:block-event-chan ~event-hub)
+    `[~@(:command-ch ~event-hub)
+      ~@(:block-event-chan ~event-hub)
       ~@(%get-all-chans :tx-id->chan-fn-map)
       ~@(%get-all-chans :chaincode-id->chan-fn-map)]))

@@ -256,24 +259,39 @@

 (defn add-event-go-loop!
   [event-hub]
-  (async/go-loop []
-    (let [[v ch] (async/alts! (get-all-event-chans event-hub))]
-      (cond (and (= (:command-ch event-hub) ch) (= v :refresh))
-            :renew-get-all-event-chans
-
-            (instance? Block v)
-            (doseq [[_ f] @(:block-event-handlers event-hub)]
-              (utils/ignore-errors
-               (f v)))
-
-            (instance? TxEvent v)
-            (utils/ignore-errors
-             ((:fn (get @(:tx-id->chan-fn-map event-hub) (:tx-id v))) v))
-
-            (instance? ChaincodeEvent v)
-            (utils/ignore-errors
-             ((:fn (get @(:chaincode-id->chan-fn-map event-hub) (:chaincode-id v))) v)))
-      (recur))))
+  (swap! (:command-ch event-hub) (async/chan))
+  (swap! (:block-event-chan event-hub) (async/chan (async/sliding-buffer default-sliding-buffer-size)))
+  (swap! (:start-time event-hub) (System/currentTimeMillis))
+  (swap! (:event-go-loop event-hub)
+         (let [command-ch (:command-ch event-hub)]
+           (async/go-loop []
+             (let [[v ch] (async/alts! (get-all-event-chans event-hub))]
+               (cond (and (= command-ch ch) (= v :refresh))
+                     :renew-get-all-event-chans
+
+                     (instance? Block v)
+                     (doseq [[_ f] @(:block-event-handlers event-hub)]
+                       (utils/ignore-errors
+                        (f v)))
+
+                     (instance? TxEvent v)
+                     (utils/ignore-errors
+                      ((:fn (get @(:tx-id->chan-fn-map event-hub) (:tx-id v))) v))
+
+                     (instance? ChaincodeEvent v)
+                     (utils/ignore-errors
+                      ((:fn (get @(:chaincode-id->chan-fn-map event-hub) (:chaincode-id v))) v)))
+               (when-not (and (= command-ch ch) (= v :quit))
+                 (recur))))
+           ;; When out of the loop, clear ch, event-go-loop, etc
+           (.shutdownNow ^ManagedChannel (deref (:managed-channel event-hub)))
+           (async/close! (deref (:command-ch event-hub)))
+           (async/close! (deref (:block-event-chan event-hub)))
+           (swap! (:managed-channel event-hub) nil)
+           (swap! (:command-ch event-hub) nil)
+           (swap! (:block-event-chan event-hub) nil)
+           (swap! (:event-go-loop event-hub) nil)
+           (swap! (:end-time event-hub) (System/currentTimeMillis)))))

 (defn- %id->ch
   [event-hub id k]
@@ -296,83 +314,61 @@
         data-list (:data clj-block)]
     (assert (= (count tx-status-codes) (count data-list)))
     ;; 1. Block Event on all channels
-    (async/put! (:block-event-chan event-hub) clj-block)
+    (async/put! (deref (:block-event-chan event-hub)) clj-block)
     (doseq [[data code] (map list data-list tx-status-codes)]
       (let [payload (:payload data)
             channel-header (get-in payload [:header :channel-header])
             tx-id (:tx-id channel-header)]
         ;; 2. Transaction Event with tx-id
-        (when-let [ch (tx-id->chan tx-id)]
+        (when-let [ch (tx-id->chan event-hub tx-id)]
           (async/put! ch (make-TxEvent tx-id code)))
         ;; 3. Chaincode event
         (when (= (:type channel-header) (proto/header-types :endorser-transaction))
           (let [chaincode-event (get-in payload [:data :actions 0 :payload :action
                                                  :proposal-response-payload :extension :events])]
-            (when-let [ch (chaincode-id->chan (:chaincode-id chaincode-event))]
+            (when-let [ch (chaincode-id->chan event-hub (:chaincode-id chaincode-event))]
               (async/put! ch chaincode-event))))))))

 (defn transaction-observer
-  [ch]
+  [event-hub]
   (reify StreamObserver
     (onNext [this event]
-      (case (.getEventCase ^EventsPackage$Event event)
-        EventsPackage$Event$EventCase/BLOCK (deliver-block-events-to-channels (.getBlock ^EventsPackage$Event event))
-        EventsPackage$Event$EventCase/REGISTER nil ;; init
-        ;; EventsPackage$Event$EventCase/CHAINCODE_EVENT ;; FIXME: not used??
-        EventsPackage$Event$EventCase/UNREGISTER nil;; shutdown
+      (condp = (.getEventCase ^EventsPackage$Event event)
+
+        EventsPackage$Event$EventCase/REGISTER
+        (add-event-go-loop! event-hub)
+
+        EventsPackage$Event$EventCase/BLOCK
+        (deliver-block-events-to-channels event-hub (.getBlock ^EventsPackage$Event event))
+
+        EventsPackage$Event$EventCase/CHAINCODE_EVENT nil
+        EventsPackage$Event$EventCase/REJECTION nil
+
+        EventsPackage$Event$EventCase/UNREGISTER
+        (with-issuing-event-go-loop-command! [event-hub :quit])
+
+        EventsPackage$Event$EventCase/FILTERED_BLOCK nil
         ))
     (onError [this err]
-      ;; FIXME call shutdownNow when Status$Code/INTERNAL or Status$Code/UNAVAILABLE
-      (async/put! ch err))
+      ;; FIXME:
+      ;; 1. log error
+      ;;      call shutdownNow when Status$Code/INTERNAL or
+      (when (and (instance? StatusRuntimeException err)
+                 (->> (.getStatus ^StatusRuntimeException err)
+                      (.getCode)
+                      (contains? #{Status$Code/INTERNAL Status$Code/UNAVAILABLE})))
+        (with-issuing-event-go-loop-command! [event-hub :quit])))
     (onCompleted [this]
-      (async/put! ch :done))))
-
-#_
+      (with-issuing-event-go-loop-command! [event-hub :quit]))))
+
+
 ;;https://grpc.io/docs/tutorials/basic/java.html
-(defn make-event-hub
-  [user peer]
-  (let [ch (async/chan (async/sliding-buffer default-sliding-buffer-size))
-        ^StreamObserver observer (transaction-observer ch)
-        ^ManagedChannel channel (proto/node->channel peer)]
-    (.chat (EventsGrpc/newStub channel)
-           observer)
-    (let [interest (-> (EventsPackage$Interest/newBuilder)
-                       (.setEventType EventsPackage$Event$EventCase/BLOCK)
-                       (.build))
-          register (-> (EventsPackage$Register/newBuilder)
-                       (.addEvents interest)
-                       (.build))
-          block-event (-> (EventsPackage$Event/newBuilder)
-                          (.setRegister register)
-                          (.setCreator (.toByteString ^Identities$SerializedIdentity
-                                                      (proto/clj->proto (proto/user->serialized-identity user))))
-                          (.build))]
-      (.onNext observer
-               (-> (EventsPackage$SignedEvent/newBuilder)
-                   (.setEventBytes (.toByteString block-event))
-                   (.setSignature (ByteString/copyFrom ^bytes (crypto/sign (.toByteArray block-event) (:private-key user) {:algorithm (:key-algorithm (:crypto-suite user))})))
-                   (.build)))
-      (try
-        (async/go-loop []
-          (let [block (async/<! ch)]
-            (case (.getEventCase ^EventsPackage$Event event)
-              EventsPackage$Event$EventCase/BLOCK (async/put! ch event) ;; ch is like eventQueue
-              EventsPackage$Event$EventCase/REGISTER :FIXME ;; connected, connectedTime
-              )
-            (cond= (type v)
-
-                   (instance? Exception v) (when-not (.isShutdown channel)
-                                             (.shutdownNow channel))
-                   ;; FIXME: do something here!!
-                   :else (recur))))
-        (finally (.onCompleted observer))))))
-
 (defn connect
   ([]
    (connect *event-hub*))
   ([event-hub]
-   (let [{:keys [ch user peer]} event-hub
-         ^StreamObserver observer (transaction-observer ch)
+   (let [{:keys [user peer]} event-hub
+         ^StreamObserver observer (transaction-observer event-hub)
          ^ManagedChannel channel (proto/node->channel peer)
          req-observer (.chat (EventsGrpc/newStub channel) observer)
          interest (-> (EventsPackage$Interest/newBuilder)
@@ -386,12 +382,15 @@
                          (.setCreator (.toByteString ^Identities$SerializedIdentity
                                                      (proto/clj->proto (proto/user->serialized-identity user))))
                          (.build))]
+     ;; Save managed-channel to call shutdownNow later
+     (swap! (:managed-channel event-hub) channel)
      (.onNext req-observer
               (-> (EventsPackage$SignedEvent/newBuilder)
                   (.setEventBytes (.toByteString block-event))
-                  (.setSignature (ByteString/copyFrom ^bytes (crypto/sign (.toByteArray block-event) (:private-key user) {:algorithm (:key-algorithm (:crypto-suite user))})))
-                  (.build)))
-     (swap! (:observer event-hub) req-observer))))
+                  (.setSignature (ByteString/copyFrom ^bytes (crypto/sign (.toByteArray block-event)
+                                                                          (:private-key user)
+                                                                          {:algorithm (:key-algorithm (:crypto-suite user))})))
+                  (.build))))))

 (defn disconnect


Using map? pred instead of keyword?

Using map? pred instead of keyword?

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -828,7 +828,7 @@
   (fn wrap-parser-exception-internal [env tx]
     (let [errors (atom {})]
       (let-chan [res (parser (assoc env ::errors* errors) tx)]
-        (cond-> (if (keyword? res) {} res)
+        (cond-> (if (map? res) res {})
           (seq @errors) (assoc ::errors @errors))))))

 (def error-handler-plugin


Use .isBound in safe-var-get instead of catching exception

--HG--
branch : bleeding-edge

--- src/de/kotka/vimclojure/util.clj
+++ src/de/kotka/vimclojure/util.clj
@@ -236,9 +236,8 @@

 (defn safe-var-get
   [the-var]
-  (try
-    (var-get the-var)
-    (catch IllegalStateException _ nil)))
+  (when (.isBound the-var)
+    (var-get the-var)))

 (defn- type-of-completion
   [thing]


Add default value for rest-api/mime-type function

--- src/emender_jenkins/rest_api.clj
+++ src/emender_jenkins/rest_api.clj
@@ -423,7 +423,8 @@
         :edn   "application/edn"
         :csv   "text/csv"
         :txt   "text/plain"
-        :xml   "text/xml"))
+        :xml   "text/xml"
+               "application/json"))

 (defn get-metadata
     [request]


:version callback

:version callback

--- src/er_cassandra/model/types.clj
+++ src/er_cassandra/model/types.clj
@@ -232,6 +232,11 @@
   ([updated-at-col]
    (fn [r] (assoc r updated-at-col (.toDate (t/now))))))

+(defn create-version-callback
+  "create a callback which will add an :version (v1 UUID) column "
+  ([] (create-version-callback :version))
+  ([version-col] (fn [r] (assoc r version-col (clj-uuid/v1)))))
+
 (defn create-select-view-callback
   "selects the given columns from a record"
   [cols]


Return [] when preparsing requests to "/"

--- src/io/aviso/rook/dispatcher.clj
+++ src/io/aviso/rook/dispatcher.clj
@@ -48,7 +48,7 @@
   [request]
   [(:request-method request)
    (mapv #(java.net.URLDecoder/decode ^String % "UTF-8")
-     (next (string/split (:uri request) #"/" -1)))])
+     (next (string/split (:uri request) #"/" 0)))])

 (defn unnest-dispatch-table
   "Given a nested dispatch table: