add-test-record is side-effecting

add-test-record is side-effecting

--- cljs/src/test/plastic/test/karma.cljs
+++ cljs/src/test/plastic/test/karma.cljs
@@ -56,7 +56,7 @@
 (defn set-karma-state! [new-state]
   (karma-state-updater! identity new-state))

-(defn add-test-record [collection record]
+(defn add-test-record! [collection record]
   (update-karma-state! update-in [:collections collection] conj record))

 ; -------------------------------------------------------------------------------------------------------------------
@@ -82,15 +82,15 @@
   (call-default-reporter record))

 (defmethod cljs.test/report [::karma :pass] [record]
-  (add-test-record :pass record)
+  (add-test-record! :pass record)
   (call-default-reporter record))

 (defmethod cljs.test/report [::karma :fail] [record]
-  (add-test-record :fail record)
+  (add-test-record! :fail record)
   (call-default-reporter record))

 (defmethod cljs.test/report [::karma :error] [record]
-  (add-test-record :error record)
+  (add-test-record! :error record)
   (call-default-reporter record))

 (defmethod cljs.test/report [::karma :end-run-tests] [record]


Use fixtures

Use fixtures

--- test/icecap/store/riak_test.clj
+++ test/icecap/store/riak_test.clj
@@ -18,6 +18,8 @@
       (finally
         (wc/shutdown conn)))))

+(use-fixtures :once connect)
+
 (defspec ^:riak riak-store-roundtrip
   (roundtrip-prop riak-test-store))


Created test case to cover bug where latest commit was overwritten by nil if fetching of commit failed

--- test/lambdacd_git/core_test.clj
+++ test/lambdacd_git/core_test.clj
@@ -77,7 +77,7 @@
                                                                               ref          "refs/heads/master"}}]
   (let [wait-for-result-channel (async/go
                                   (let [execute-step-result (lambdacd-core/execute-step {} (:ctx @state)
-                                                                                (fn [args ctx]
+                                                                                (fn [_ ctx]
                                                                                (wait-for-git ctx (get-in @state [:git :remote]) :ref ref :ms-between-polls ms-between-polls)))]
                                     (first (vals (:outputs execute-step-result)))))]
     (swap! state #(assoc % :result-channel wait-for-result-channel))
@@ -87,7 +87,7 @@
 (defn start-clone-step [state ref cwd]
   (let [wait-for-result-channel (async/go
                                   (let [execute-step-result (lambdacd-core/execute-step {} (:ctx @state)
-                                                                                (fn [args ctx]
+                                                                                (fn [_ ctx]
                                                                                (clone ctx (get-in @state [:git :remote]) ref cwd)))]
                                     (first (vals (:outputs execute-step-result)))))]
     (swap! state #(assoc % :result-channel wait-for-result-channel))
@@ -96,7 +96,7 @@
 (defn start-list-changes-step [state cwd old-revision new-revision]
   (let [wait-for-result-channel (async/go
                                   (let [execute-step-result (lambdacd-core/execute-step {} (:ctx @state)
-                                                                                (fn [args ctx]
+                                                                                (fn [_ ctx]
                                                                                (list-changes {:cwd             cwd
                                                                                :old-revision old-revision
                                                                                :revision     new-revision} ctx)))]
@@ -209,12 +209,12 @@
                     (git-commit "initial commit")
                     (git-checkout-b "some-branch")

-                    (start-wait-for-git-step :ref (fn [ref] true))
+                    (start-wait-for-git-step :ref (fn [_] true))
                     (git-commit "some commit on master")
                     (wait-for-step-to-complete)

                     (git-checkout "some-branch")
-                    (start-wait-for-git-step :ref (fn [ref] true))
+                    (start-wait-for-git-step :ref (fn [_] true))
                     (git-commit "some commit on branch")

                     (get-step-result))]
@@ -282,7 +282,20 @@
                     (git-commit "initial commit")
                     (get-step-result))]
       (is (= :success (:status (step-result state))))
-      (is (= (commit-hash-by-msg state "initial commit") (:revision (step-result state)))))))
+      (is (= (commit-hash-by-msg state "initial commit") (:revision (step-result state))))))
+  (testing "that it does not overwrite the latest commit with nil if polling for a new commit fails"
+    (let [was-called? (atom false)
+          return-nil-on-first-call-then-some-commit (fn [_ _] (if @was-called? "some commit hash" (do (reset! was-called? true) nil)))]
+      (with-redefs [core/initial-revisions (constantly "some commit hash")
+                    core/current-revision-or-nil return-nil-on-first-call-then-some-commit]
+        (let [wait-at-least-two-polls (fn [state] (do (Thread/sleep 3) state))
+              state (-> (init-state)
+                        (start-wait-for-git-step :ms-between-polls 1)
+                        (wait-at-least-two-polls)
+                        (kill-waiting-step)
+                        (get-step-result))]
+          (is (str-containing "some commit hash" (:out (step-result state)))))))))
+
 (deftest clone-test
   (testing "that we can clone a specific commit"
     (let [state (init-state)


Remove dead "use-om" dev option

Remove dead "use-om" dev option

--- src-cljs/frontend/components/header.cljs
+++ src-cljs/frontend/components/header.cljs
@@ -94,9 +94,6 @@
               [:a {:on-click #(raise! owner [:set-user-session-setting {:setting :use-local-assets
                                                                         :value (not use-local-assets)}])}
                "local assets " (if use-local-assets "off " "on ")])
-            [:a {:on-click #(raise! owner [:set-user-session-setting {:setting :use-om
-                                                                      :value false}])}
-             "om off "]
             (let [current-build-id (get user-session-settings :om_build_id "dev")]
               (for [build-id (remove (partial = current-build-id) ["dev" "whitespace" "production"])]
                 [:a.menu-item


increase input height as you type

increase input height as you type

--- src-cljs/frontend/components/issues.cljs
+++ src-cljs/frontend/components/issues.cljs
@@ -27,9 +27,10 @@
 (defn issue-form [_ owner]
   (reify
     om/IDisplayName (display-name [_] "Issue form")
-    om/IInitState (init-state [_] {:issue-title ""})
-    om/IRenderState
-    (render-state [_ {:keys [issue-title submitting?]}]
+    om/IInitState (init-state [_] {:issue-title ""
+                                   :input-height 64})
+    om/IRenderState
+    (render-state [_ {:keys [issue-title submitting? input-height]}]
       (let [{:keys [issue-db cust cast!]} (om/get-shared owner)
             char-limit 120
             chars-left (- char-limit (count issue-title))
@@ -66,9 +67,13 @@
                                                   (om/set-state! owner :submitting? false)))))}
           [:div.adaptive
            [:textarea (merge {:value issue-title
+                              :style {:height input-height}
                               :required "true"
                               :disabled (or submitting? (not (utils/logged-in? owner)))
-                              :onChange #(om/set-state! owner :issue-title (.. % -target -value))}
+                              :onChange #(do (om/set-state! owner :issue-title (.. % -target -value))
+                                             (let [node (.-target %)]
+                                               (when (not= (.-scrollHeight node) (.-clientHeight node))
+                                                 (om/set-state! owner :input-height (max 64 (.-scrollHeight node))))))}
                              (when (neg? chars-left)
                                {:data-warning "true"}))]
            [:label (merge {:data-label (if (utils/logged-in? owner)


Add function to make infinite datasets for regression and classification

--- experiment/src/cortex/experiment/util.clj
+++ experiment/src/cortex/experiment/util.clj
@@ -6,6 +6,17 @@
   (:import [java.io File]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; General training utils
+(defn infinite-dataset
+  "Given a finite dataset, generate an infinite sequence of maps partitioned
+  by :epoch-size"
+  [map-seq & {:keys [epoch-size]
+              :or {epoch-size 1024}}]
+  (->> (repeatedly #(shuffle map-seq))
+       (mapcat identity)
+       (partition epoch-size)))
+
+
 ;; Classification dataset utils
 (defn infinite-class-balanced-dataset
   "Given a dataset, returns an infinite sequence of maps perfectly


fix typo

fix typo

--- src/babel/francais/morphology/verbs.cljc
+++ src/babel/francais/morphology/verbs.cljc
@@ -344,7 +344,7 @@
                        :person :3rd}}}}

    {:p [#"^([^' ]+)nts$"     "se $1dre"]
-    :g [#"^se ([^' ]+)dre$"  "se $1ts"]
+    :g [#"^se ([^' ]+)dre$"  "$1ts"]
     :u {:synsem {:agr {:number :plur
                        :person :1st}}}}


separate reflexive and non-reflexive past and also use :essere feature where necessary with past tense

--- src/babel/francais/morphology/verbs.cljc
+++ src/babel/francais/morphology/verbs.cljc
@@ -220,13 +220,12 @@
                                     :person :3rd}}}
                  :infl :present}}}])

-(def past
+(def past-reflexive
   [
-   ;; <reflexive past>: e.g. "amusé" => "s'amuser"
    {:comment "past participle reflexive singular masculine -er where stem begins with a vowel"
-    :p [#"^([aeéiou]\S+)é$"    "s'$1er"] ;; :p : how to transform a finite form to infinitive
-    :g [#"^s'([aeéiou]\S+)er$" "$1é"]  ;; :g : how to transform an infinitive into a finite form.
-    :u {:synsem {:infl :past-p ;; :u : what to unify against for these tranformations to occur.
+    :p [#"^([aeéiou]\S+)é$"    "s'$1er"]
+    :g [#"^s'([aeéiou]\S+)er$" "$1é"]
+    :u {:synsem {:infl :past-p
                  :subcat {:1 {:agr {:number :sing
                                     :gender :masc}}}}}}

@@ -278,15 +277,23 @@
     :u {:synsem {:infl :past-p
                  :subcat {:1 {:agr {:number :plur
                                     :gender :fem}}}}}}
-   ;; </reflexive past>
-
-   ;; <non-reflexive past>: e.g. "parlé" => "parler"
+   ])
+
+(def past
+  [
    ;; singular: could be masculine or feminine
    {:comment "past participle non-reflexive singular -er"
     :p [#"^(\S+)é$"            "$1er"]
     :g [#"^(\S+)er$"           "$1é"]
     :u {:synsem {:infl :past-p
+                 :essere true
                  :subcat {:1 {:agr {:number :sing}}}}}}
+
+   {:comment "past participle non-reflexive singular -er"
+    :p [#"^(\S+)é$"            "$1er"]
+    :g [#"^(\S+)er$"           "$1é"]
+    :u {:synsem {:infl :past-p
+                 :essere false}}}

    {:comment "past participle non-reflexive -re"
     :p [#"^(\S+)u$"            "$1re"]
@@ -303,9 +310,9 @@
     :p [#"^(\S+)és$"           "$1er"]
     :g [#"^(\S+)er$"           "$1és"]
     :u {:synsem {:infl :past-p
+                 :essere true
                  :subcat {:1 {:agr {:gender :masc
                                     :number :plur}}}}}}
-
    ;; singular feminine
    {:comment "past participle non-reflexive singular masculine"
     :p [#"^(\S+)ée$"           "$1er"]
@@ -318,9 +325,9 @@
     :p [#"^(\S+)ées$"          "$1er"]
     :g [#"^(\S+)er$"           "$1ées"]
     :u {:synsem {:infl :past-p
+                 :essere true
                  :subcat {:1 {:agr {:number :plur
                                     :gender :fem}}}}}}
-   ;; </non-reflexive past>
    ])

 (def conditional
@@ -698,6 +705,7 @@
          [
           conditional
           past
+          past-reflexive
           present-nonreflexive-er-verb
           present-nonreflexive-ir-verb
           present-reflexive
@@ -714,9 +722,12 @@
           :g (:g pattern)
           :u (unifyc (:u pattern)
                      (let [agr (atom :top)
+                           essere (atom :top)
                            infl (atom :top)]
-                       {:synsem {:infl infl
+                       {:synsem {:essere essere
+                                 :infl infl
                                  :subcat {:1 {:agr agr}}}
+                        :essere essere
                         :infl infl
                         :agr agr}))})
        replace-patterns-source))


BUGFIX: Fixed broken tab ordering for tabs without any logged time

--- src/background/relevance/background.cljs
+++ src/background/relevance/background.cljs
@@ -94,7 +94,7 @@
         score     (if (is-http? url) total (* total non-http-penalty))
         ]
     (or (when tab-time score)
-        (- 2000 idx))))
+        (- idx))))

 (defn sort-tabs! [window-id data]
   (go


Parallelized command processing

Parallelized command processing

Spawn N command-processing threads, where N is auto-configured based on the
number of available processors.

Signed-off-by: Deepak Giridharagopal <d11186354d1ef01ca06ae37d7e23e827da13e85f@puppetlabs.com>

--- src/com/puppetlabs/cmdb/cli/services.clj
+++ src/com/puppetlabs/cmdb/cli/services.clj
@@ -61,6 +61,7 @@
 ;; The following functions setup interaction between the main
 ;; Grayskull components.

+(def nthreads (+ 2 (.availableProcessors (Runtime/getRuntime))))
 (def mq-addr "vm://localhost?jms.prefetchPolicy.all=1")
 (def mq-endpoint "com.puppetlabs.cmdb.commands")

@@ -115,28 +116,30 @@
     (sql/with-connection db
       (migrate!))

-    (let [broker            (do
-                              (log/info "Starting broker")
-                              (mq/start-broker! (mq/build-embedded-broker mq-dir)))
-          command-processor (do
-                              (log/info "Starting command processor")
-                              (future
-                                (load-from-mq mq-addr mq-endpoint db)))
-          web-app           (do
-                              (log/info "Starting query server")
-                              (future
-                                (jetty/run-jetty ring-app web-opts)))
-          db-gc             (do
-                              (log/info "Starting database compactor")
-                              (future
-                                (db-garbage-collector db db-gc-interval)))]
+    (let [broker        (do
+                          (log/info "Starting broker")
+                          (mq/start-broker! (mq/build-embedded-broker mq-dir)))
+          command-procs (do
+                          (log/info (format "Starting %d command processor threads" nthreads))
+                          (into [] (for [n (range nthreads)]
+                                     (future
+                                       (load-from-mq mq-addr mq-endpoint db)))))
+          web-app       (do
+                          (log/info "Starting query server")
+                          (future
+                            (jetty/run-jetty ring-app web-opts)))
+          db-gc         (do
+                          (log/info "Starting database compactor")
+                          (future
+                            (db-garbage-collector db db-gc-interval)))]

       ;; Publish performance data via JMX
       (log/info "Starting JMX metrics publisher")
       (metrics/report-to-jmx)

       ;; Stop services by blocking on the completion of their futures
-      (deref command-processor)
+      (doseq [cp command-procs]
+        (deref cp))
       (deref web-app)
       (deref db-gc)
       ;; Stop the mq the old-fashioned way


Removed explicit call to do-swing

Removed explicit call to do-swing

since it is implicitly made by the surrounding with-action-on.

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/draw/control/util.clj
+++ src/conexp/contrib/draw/control/util.clj
@@ -143,10 +143,9 @@
         (with-action-on combo-box
           (let [selected (.getSelectedItem ^JComboBox (.getSource evt)),
                 control  (get choices selected)]
-            (do-swing
              (.removeAll choice-pane)
              (control frame scene choice-pane)
-             (.validate frame))))
+             (.validate frame)))
         (.setSelectedIndex combo-box 0)))))

 (defmacro with-layout-modifiers


Revert "Consistent capitalization"

Revert "Consistent capitalization"

This reverts commit b3b06d67cdd8ce2e1084bb309b85e8834649620e.

Breaks a lot of webdriver tests, and I think we decided earlier
to only capitalize the first word in headings

--- frontend/components/project_settings.cljs
+++ frontend/components/project_settings.cljs
@@ -29,7 +29,7 @@
    [:li [:a {:href "edit"} "Overview"]]
    [:li.side-title "Tweaks"]
    [:li [:a {:href "#parallel-builds"} "Parallelism"]]
-   [:li [:a {:href "#env-vars"} "Environment Variables"]]
+   [:li [:a {:href "#env-vars"} "Environment variables"]]
    [:li [:a {:href "#experimental"} "Experimental Settings"]]
    [:li.side-title "Test Commands"]
    [:li [:a {:href "#setup"} "Dependencies"]]
@@ -39,10 +39,10 @@
    [:li [:a {:href "#webhooks"} "Webhooks"]]
    [:li [:a {:href "#badges"} "Status Badges"]]
    [:li.side-title "Permissions"]
-   [:li [:a {:href "#checkout"} "Checkout SSH Keys"]]
-   [:li [:a {:href "#ssh"} "SSH Keys"]]
-   [:li [:a {:href "#api"} "API Tokens"]]
-   [:li [:a {:href "#aws"} "AWS Keys"]]
+   [:li [:a {:href "#checkout"} "Checkout SSH keys"]]
+   [:li [:a {:href "#ssh"} "SSH keys"]]
+   [:li [:a {:href "#api"} "API tokens"]]
+   [:li [:a {:href "#aws"} "AWS keys"]]
    [:li.side-title "Build Artifacts"]
    [:li [:a {:href "#artifacts"} "Artifacts"]]
    [:li.side-title "Continuous Deployment"]
@@ -96,8 +96,7 @@
     (render [_]
       (html
        [:div.project-settings-block
-        [:h2 "Overview for " (vcs-url/project-name (get-in project-data [:project :vcs_url]))]
-        [:p "How to configure your project:"]
+        [:h2 "How to configure " (vcs-url/project-name (get-in project-data [:project :vcs_url]))]
         [:ul.overview-options
          [:li.overview-item
           [:h4 "Option 1"]
@@ -246,7 +245,7 @@
       (let [controls-ch (om/get-shared owner [:comms :controls])]
         (html
          [:div
-          [:h2 (str "Change Parallelism for " (vcs-url/project-name (get-in project-data [:project :vcs_url])))]
+          [:h2 (str "Change parallelism for " (vcs-url/project-name (get-in project-data [:project :vcs_url])))]
           (if-not (:plan project-data)
             [:div.loading-spinner common/spinner]
             (list (parallelism-picker project-data controls-ch)
@@ -264,7 +263,7 @@
             controls-ch (om/get-shared owner [:comms :controls])]
         (html
          [:div.environment-variables
-          [:h2 "Environment Variables for " (vcs-url/project-name (:vcs_url project))]
+          [:h2 "Environment variables for " (vcs-url/project-name (:vcs_url project))]
           [:div.environment-variables-inner
            [:p
             "Add environment variables to the project build.  You can add sensitive data (e.g. API keys) here, rather than placing them in the repository. "
@@ -400,7 +399,7 @@
             controls-ch (om/get-shared owner [:comms :controls])]
         (html
          [:div.dependencies-page
-          [:h2 "Install Dependencies for " (vcs-url/project-name (:vcs_url project))]
+          [:h2 "Install dependencies for " (vcs-url/project-name (:vcs_url project))]
           [:p
            "You can also set your dependencies commands from your "
            [:a {:href "/docs/configuration#dependencies"} "circle.yml"] ". "
@@ -448,7 +447,7 @@
             controls-ch (om/get-shared owner [:comms :controls])]
         (html
          [:div.tests-page
-          [:h2 "Tests Setup for " (vcs-url/project-name (:vcs_url project))]
+          [:h2 "Set up tests for " (vcs-url/project-name (:vcs_url project))]
           [:p
            "You can also set your test commands from your "
            [:a {:href "/docs/configuration#dependencies"} "circle.yml"] ". "
@@ -550,7 +549,7 @@
             settings (state-utils/merge-inputs project inputs project-model/notification-keys)]
         (html
          [:div
-          [:h2 "Chatroom Setup for " (vcs-url/project-name (:vcs_url project))]
+          [:h2 "Chatroom setup for " (vcs-url/project-name (:vcs_url project))]
           [:div.chat-rooms
            (for [chat-spec [{:service "Hipchat"
                              :doc (list [:p "To get your API token, create a \"notification\" token via the "
@@ -669,7 +668,7 @@
     (om/component
      (html
       [:div.status-page
-       [:h2 "Status Badges for " project-name]
+       [:h2 "Status badges for " project-name]
        [:div "Use this tool to easily create embeddable status badges. Perfect for your project's README or wiki!"]
        [:div.status-page-inner
         [:form
@@ -737,7 +736,7 @@
             controls-ch (om/get-shared owner [:comms :controls])]
         (html
          [:div.sshkeys-page
-          [:h2 "SSH Keys for " (vcs-url/project-name (:vcs_url project))]
+          [:h2 "SSH keys for " (vcs-url/project-name (:vcs_url project))]
           [:div.sshkeys-inner
            [:p "Add keys to the build VMs that you need to deploy to your machines. If the hostname field is blank, the key will be used for all hosts."]
            [:form
@@ -801,7 +800,7 @@
             controls-ch (om/get-shared owner [:comms :controls])]
         (html
          [:div.checkout-page
-          [:h2 "Checkout Keys for " project-name]
+          [:h2 "Checkout keys for " project-name]
           [:div.checkout-page-inner
            (if (nil? checkout-keys)
              [:div.loading-spinner common/spinner]
@@ -946,7 +945,7 @@
             controls-ch (om/get-shared owner [:comms :controls])]
         (html
          [:div.circle-api-page
-          [:h2 "API Tokens for " (vcs-url/project-name (:vcs_url project))]
+          [:h2 "API tokens for " (vcs-url/project-name (:vcs_url project))]
           [:div.circle-api-page-inner
            [:p "Create and revoke project-specific API tokens to access this project's details using our API. First choose a scope "
             [:i.fa.fa-question-circle#scope-popover-hack {:title "Scope"}]
@@ -1001,7 +1000,7 @@
   (om/component
    (html
     [:div
-     [:h2 "Build Artifacts for " (vcs-url/project-name (get-in project-data [:project :vcs_url]))]
+     [:h2 "Build artifacts for " (vcs-url/project-name (get-in project-data [:project :vcs_url]))]
      [:div.doc
       [:p
        "Circle supports saving files from any build. See "
@@ -1021,7 +1020,7 @@
             controls-ch (om/get-shared owner [:comms :controls])]
         (html
          [:div.heroku-api
-          [:h2 "Personal Heroku API Key for " (vcs-url/project-name (:vcs_url project))]
+          [:h2 "Set personal Heroku API key for " (vcs-url/project-name (:vcs_url project))]
           [:div.heroku-step
            [:h4 "Step 1: Heroku API key"]
            [:div (when (:heroku_api_key user)
@@ -1077,7 +1076,7 @@
    (html
     [:div
      [:h2
-      "Other Deployments for " (vcs-url/project-name (get-in project-data [:project :vcs_url]))]
+      "Other deployments for " (vcs-url/project-name (get-in project-data [:project :vcs_url]))]
      [:div.doc
       [:p "Circle supports deploying to any server, using custom commands. See "
        [:a {:target "_blank",
@@ -1101,7 +1100,7 @@
             input-path (fn [& ks] (apply conj state/inputs-path :aws :keypair ks))]
         (html
          [:div.aws-page
-          [:h2 "AWS Keys for " (vcs-url/project-name (:vcs_url project))]
+          [:h2 "AWS keys for " (vcs-url/project-name (:vcs_url project))]
           [:div.aws-page-inner
            [:p "Set the AWS keypair to be used for authenticating against AWS services during your builds. "
             "Credentials are installed on your containers into the " [:code "~/.aws/config"] " and "


ignore comps in perf-asmt-in for now

ignore comps in perf-asmt-in for now

--- src/oarlock.clj
+++ src/oarlock.clj
@@ -18,7 +18,7 @@
   (tx-entity! db-conn :task task))

 (defn perf-asmt-in [db-conn perf-asmt]
-  (tx-entity! db-conn :perf-asmt (hatch/slam-all perf-asmt :perf-asmt)))
+  (tx-entity! db-conn :perf-asmt (hatch/slam-all (dissoc perf-asmt :comps) :perf-asmt)))

 (defn student2perf-asmt-in [db-conn user2perf-asmt]
   (tx-entity! db-conn :student2perf-asmt user2perf-asmt))


next step

next step

--- ohack/src/ohack/core.clj
+++ ohack/src/ohack/core.clj
@@ -108,3 +108,9 @@
                           ;; 24 degrees
                           (map (fn [root-note] (rand-chord root-note :major 4 24))
                                (cycle base-line)))))))
+
+
+
+;; ok, let's get back to more basics and build up to other exciting things.
+;; first, let's add a few imports.
+


move into let block

move into let block

--- ohack/src/ohack/core.clj
+++ ohack/src/ohack/core.clj
@@ -226,18 +226,18 @@
       ;; since index-line-list is not a hash-map
       index-group-list (collect-into-consecutive (keys index-line-list))

+      ;; from the 6-line groups, get lines from the original index-line maps
+      ;; and sorted by increasing line indexes.
+      ;; how this works:
+      ;; 1. each set of 6 indexes gets passed to the lambda function
+      ;; 2. using index-to-line, select the 6 matching lines as a hash-map
+      ;; 3. sort by keys to ensure increasing line index order
+      ;; 4. get the vals, i.e., the lines in correct order
+      ;; now, we have a seq containing sets of 6 lines
+      sorted-grouped-line-set-list (map #(vals (sort (select-keys index-to-line %)))
+                                        ;; these will be grouped into sets of 6 lines, with indexes
+                                        (sort index-group-list))
+
       ]

-  ;; from the 6-line groups, get lines from the original index-line maps
-  ;; and sorted by increasing line indexes.
-  ;; how this works:
-  ;; 1. each set of 6 indexes gets passed to the lambda function
-  ;; 2. using index-to-line, select the 6 matching lines as a hash-map
-  ;; 3. sort by keys to ensure increasing line index order
-  ;; 4. get the vals, i.e., the lines in correct order
-  ;; now, we have a seq containing sets of 6 lines
-  (map #(vals (sort (select-keys index-to-line %)))
-       ;; these will be grouped into sets of 6 lines, with indexes
-       (sort index-group-list))
-
   )


Fix branch name used to push in finish

Fix branch name used to push in finish

--- src/leiningen/pallet_release/release.clj
+++ src/leiningen/pallet_release/release.clj
@@ -142,14 +142,13 @@
 (defn finish
   "Finish a PalletOps release"
   [project args]
-  (let [new-version (new-version)
-        current-branch (git/current-branch)]
+  (let [new-version (new-version)]
     (lein/clean project)
     (test project)
     (git/add "-u")
     (git/commit
      (str "Updated project.clj, release notes and readme for " new-version))
-    (git/push "origin" current-branch)
+    (git/push "origin" (git/current-branch))
     (.delete (file ".pallet-release"))
     (println
      "Wait for travis to push to master,\n"


fixed flicker on bad login

fixed flicker on bad login

--- src/main/untangled_template/ui/root.cljs
+++ src/main/untangled_template/ui/root.cljs
@@ -47,7 +47,7 @@
           (dom/span #js {:className "navbar-brand"}
             (dom/span nil "Template Brand")))
         (dom/div #js {:className "collapse navbar-collapse"}
-          (when logged-in?
+          (when (= true logged-in?)
             (dom/ul #js {:className "nav navbar-nav"}
               ;; More nav links here
               (dom/li nil (dom/a #js {:className "active" :onClick #(r/nav-to! this :main)} "Main"))


remove unneeded namespaces in Generic SQL util

--- src/metabase/driver/generic_sql/util.clj
+++ src/metabase/driver/generic_sql/util.clj
@@ -6,12 +6,8 @@
             [colorize.core :as color]
             [korma.core :as korma]
             [korma.db :as kdb]
-            [metabase.db :refer [sel]]
             [metabase.driver :as driver]
-            [metabase.driver.query-processor :as qp]
-            (metabase.models [database :refer [Database]]
-                             [field :refer [Field]]
-                             [table :refer [Table]])))
+            [metabase.driver.query-processor :as qp]))

 ;; Cache the Korma DB connections for a given Database for 60 seconds instead of creating new ones every single time
 (defn- db->connection-spec [database]


CMR-6732: CMR Bulk index of granule by concept id should not try to index into the all_revisions index.

--- bootstrap-app/src/cmr/bootstrap/data/bulk_index.clj
+++ bootstrap-app/src/cmr/bootstrap/data/bulk_index.clj
@@ -234,7 +234,12 @@
                                                                          (:db-batch-size system))]
                           concept-batch)
         total (index/bulk-index {:system (helper/get-indexer system)} concept-batches)]
-    (index/bulk-index {:system (helper/get-indexer system)} concept-batches {:all-revisions-index? true})
+
+    ;; for concept types that have all revisions index, also index the all revisions index
+    (when-not (#{:tag :granule} concept-type)
+      (index/bulk-index
+       {:system (helper/get-indexer system)} concept-batches {:all-revisions-index? true}))
+
     (info "Indexed " total " concepts.")
     total))


Color parens of different levels differently

--- test/demo.cljs
+++ test/demo.cljs
@@ -25,7 +25,7 @@

 (def nssrc
   "(ns example
-  (:require [cloact.core :as cloact :refer [atom]])
+  (:require [cloact.core :as cloact :refer [atom]]))
 ")

 (defn src-for-names [names]
@@ -46,7 +46,7 @@
         open-p (str "[" open "]")
         close-p (str "[" close "]")
         iden-p (str "[^" sep "]+")
-        any-p ".|\\n"
+        any-p (str "[" ws "]+" "|.")
         patt (re-pattern (str "("
                               (string/join ")|(" [str-p open-p close-p
                                                   iden-p any-p])
@@ -64,25 +64,36 @@
        any [:other s]))))

 (defn syntaxify [src]
-  (let [def-re #"^def|^ns\b"]
+  (let [def-re #"^def|^ns\b"
+        parcol ["#9a3" "#c83" "#4a8"]
+        ncol (count parcol)
+        paren-style (fn [level]
+                      {:style {:color (nth parcol (mod level ncol))}})]
     (loop [tokens (tokenize src)
            prev nil
+           level 0
            res []]
       (let [[kind val] (first tokens)
-            part (case kind
-                   :str-litt [:span {:style {:color "green"}} val]
-                   :keyw     [:span {:style {:color "blue"}} val]
-                   :builtin  [:span {:style {:font-weight "bold"}} val]
-                   :iden     (if (and prev (re-find def-re prev))
-                               [:span {:style {:color "#55c"
-                                               :font-weight "bold"}} val]
-                               val)
-                   val)
+            level' (case kind
+                     :open (inc level)
+                     :close (dec level)
+                     level)
+            style (case kind
+                    :str-litt {:style {:color "green"}}
+                    :keyw     {:style {:color "blue"}}
+                    :builtin  {:style {:font-weight "bold"}}
+                    :iden     (when (and prev (re-find def-re prev))
+                                {:style {:color "#55c"
+                                         :font-weight "bold"}})
+                    :open     (paren-style level)
+                    :close    (paren-style level')
+                    nil)
             remain (rest tokens)]
         (if-not (empty? remain)
           (recur remain
                  (if (= kind :other) prev val)
-                 (conj res part))
+                 level'
+                 (conj res [:span style val]))
           (apply vector :pre res))))))

 (defn src-for [defs]


Fix compute ordering in compiler?

Fix compute ordering in compiler?

--- src/aurora/language.cljs
+++ src/aurora/language.cljs
@@ -362,7 +362,7 @@
             sink (aclone values)]
         (dotimes [i (alength source-ixes)]
           (aset sink (aget sink-ixes i) (aget source (aget source-ixes i))))
-        (Fact. shape sink)))))
+        (Fact. shape sink nil)))))

 (defn pattern->deconstructor [pattern]
   (let [shape (.-shape pattern)
@@ -398,7 +398,7 @@
                   (let [sink (make-array (alength var-ixes))]
                     (dotimes [i (alength var-ixes)]
                       (aset sink i (aget source (aget var-ixes i))))
-                    (Fact. nil sink)))))))))))
+                    (Fact. nil sink nil)))))))))))

 (comment
   (deffact eg "[a] has a [b] with a [c]")
@@ -431,104 +431,92 @@
 (defrecord Recall [memory pattern]) ;; memory is one of :known :pretended :remembered :forgotten :known&pretended
 (defrecord Compute [pattern])
 (defrecord Output [memory pattern]) ;; memory is one of :pretended :remembered :forgotten
-;; (defrecord OutputMany [memory vars expr]) ;; memory is one of :pretended :remembered :forgotten

 ;; horrible non-relational things
 (deffact Let "Let [name] be the result of [vars] [expr]")
 (deffact When "When [vars] [expr]")

-(defn recall->nodes [plan {:keys [memory pattern]}]
-  (let [[plan node] (add-flow plan (FilterMap. (memory->nodes memory) (pattern->deconstructor pattern)))]
-    [plan [node] (pattern->vars pattern)]))
+;; if clause can be calculated somehow then return a new [plan node vars] pair that calculates it
+;; otherwise return nil
+(defn add-clause [plan nodes vars clause]
+  (condp = (type clause)
+    Recall (let [{:keys [memory pattern]} clause
+                 [plan node] (add-flow plan (FilterMap. (memory->nodes memory) (pattern->deconstructor pattern)))]
+             [plan [node] (pattern->vars pattern)])
+    Compute (let [{:keys [pattern]} clause]
+              (condp = (.-shape pattern)
+                Let (when (every? (set vars) (:vars pattern))
+                      (let [let-fun (expr->fun vars (:expr pattern))
+                            filter-map-fun (if (contains? (set vars) (:name pattern))
+                                             ;; filter
+                                             (let [name-ix (ix-of vars (:name pattern))]
+                                               (fn [fact]
+                                                 (let [new-value (.apply let-fun nil (.-values fact))]
+                                                   (when (= new-value (aget (.-values fact) name-ix))
+                                                     fact))))
+                                             ;; define
+                                             (fn [fact]
+                                               (let [new-value (.apply let-fun nil (.-values fact))
+                                                     new-values (aclone (.-values fact))]
+                                                 (apush new-values new-value)
+                                                 (Fact. nil new-values nil))))
+                            [plan node] (add-flow plan (->FilterMap nodes filter-map-fun))]
+                        [plan [node] (conj vars (:name pattern))]))
+                When (when (every? (set vars) (:vars pattern))
+                       (let [when-fun (expr->fun vars (:expr pattern))
+                             filter-map-fun (fn [fact]
+                                              (when (.apply when-fun nil (.-values fact))
+                                                fact))
+                             [plan node] (add-flow plan (->FilterMap nodes filter-map-fun))]
+                         [plan [node] vars]))))
+    Output (let [{:keys [memory pattern]} clause
+                 _ (assert (every? (set vars) (pattern->vars pattern)))
+                 [plan output-node] (add-flow plan (FilterMap. nodes (pattern->constructor pattern vars)))
+                 plan (add-output plan output-node memory)]
+             [plan nodes vars])))

 (comment
   (let [plan empty-flow-plan
-        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
-        [plan nodes-b vars-b] (recall->nodes plan (Recall. :known (->connected 'x 0)))]
+        [plan nodes-a vars-a] (add-clause plan nil nil (Recall. :known&pretended (->edge 'x 'y)))
+        [plan nodes-b vars-b] (add-clause plan nil nil (Recall. :known (->connected 'x 0)))]
     [plan nodes-a nodes-b vars-a vars-b])
-  )
-
-;; if clause can be calculated somehow then return a new [plan node vars] pair that calculates it
-;; TODO make this extensible
-(defn compute->nodes [plan nodes vars {:keys [pattern]}]
-  (condp = (.-shape pattern)
-    Let (when (every? (set vars) (:vars pattern))
-          (let [let-fun (expr->fun vars (:expr pattern))
-                filter-map-fun (fn [fact]
-                                 (let [new-value (.apply let-fun nil (.-values fact))
-                                       new-values (aclone (.-values fact))]
-                                   (apush new-values new-value)
-                                   (Fact. nil new-values)))
-                [plan node] (add-flow plan (->FilterMap nodes filter-map-fun))]
-            [plan [node] (conj vars (:name pattern))]))
-    When (when (every? (set vars) (:vars pattern))
-           (let [when-fun (expr->fun vars (:expr pattern))
-                 filter-map-fun (fn [fact]
-                                  (when (.apply when-fun nil (.-values fact))
-                                    fact))
-                 [plan node] (add-flow plan (->FilterMap nodes filter-map-fun))]
-             [plan [node] vars]))))
-
-(comment
+
   (let [plan empty-flow-plan
-        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
-        [plan nodes-b vars-b] (compute->nodes plan nodes-a vars-a (Compute. (->Let 'z '[x y] "x + y")))]
+        [plan nodes-a vars-a] (add-clause plan nil nil (Recall. :known&pretended (->edge 'x 'y)))
+        [plan nodes-b vars-b] (add-clause plan nodes-a vars-a (Compute. (->Let 'z '[x y] "x + y")))]
     [plan nodes-a nodes-b vars-a vars-b])

-
   (let [plan empty-flow-plan
-        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
-        res (compute->nodes plan nodes-a vars-a (Compute. (->Let 'z '[w x y] "w + x + y")))]
+        [plan nodes-a vars-a] (add-clause plan nil nil (Recall. :known&pretended (->edge 'x 'y)))
+        res (add-clause plan nodes-a vars-a (Compute. (->Let 'z '[w x y] "w + x + y")))]
     res)

   (let [plan empty-flow-plan
-        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
-        [plan nodes-b vars-b] (compute->nodes plan nodes-a vars-a (Compute. (->When '[x y] "x > y")))]
+        [plan nodes-a vars-a] (add-clause plan nil nil (Recall. :known&pretended (->edge 'x 'y)))
+        [plan nodes-b vars-b] (add-clause plan nodes-a vars-a (Compute. (->When '[x y] "x > y")))]
     [plan nodes-a nodes-b vars-a vars-b])
   )

-(defn computes->nodes [plan nodes vars computes]
-    (loop [orig-nodes nodes
-           plan plan
-           nodes nodes
-           vars vars
-           computes-remaining computes
-           computes-applied computes-applied
-           computes-unapplied []]
-      (if-let [[compute & computes-remaining] (seq computes-remaining)]
-        (if-let [[new-plan new-nodes new-vars] (compute->nodes plan nodes vars compute)]
-          (recur orig-nodes new-plan new-nodes new-vars computes-remaining (conj computes-applied compute) computes-unapplied)
-          (recur orig-nodes plan nodes vars computes-remaining computes-applied (conj computes-unapplied compute)))
-        (if (= nodes orig-nodes)
-          [plan nodes vars (set computes-applied)]
-          (recur nodes plan nodes vars computes-unapplied computes-applied [])))))
-
-(comment
-  (let [plan empty-flow-plan
-        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
-        [plan nodes-b vars-b computes-applied] (computes->nodes plan nodes-a vars-a [(Compute. (->When '[x z] "x > z"))
-                                                                                (Compute. (->Let 'z '[x y] "x + y"))
-                                                                                (Compute. (->Let 'z '[w x] "a + x"))])]
-    [plan nodes-b vars-b computes-applied])
-  )
-
-(defn output->nodes [plan nodes vars {:keys [memory pattern]}]
-  (assert (every? (set vars) (pattern->vars pattern)))
-  (let [[plan output-node] (add-flow plan (FilterMap. nodes (pattern->constructor pattern vars)))
-        plan (add-output plan output-node memory)]
-    plan))
-
-(comment
-  (let [plan empty-flow-plan
-        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
-        [plan nodes-b vars-b computes-applied] (computes->nodes plan nodes-a vars-a [(Compute. (->When '[x z] "x > z"))
-                                                                                (Compute. (->Let 'z '[x y] "x + y"))
-                                                                                (Compute. (->Let 'z '[w x] "a + x"))])
-        plan (output->nodes plan nodes-b vars-b (Output. :remembered (->connected 'x 'y)))]
-    plan)
-  )
-
-(defn join->nodes [plan nodes-a vars-a computes-applied-a nodes-b vars-b computes-applied-b]
+;; RULES
+
+(defrecord Rule [clauses])
+
+;; Correctness: Each clause must appear at least once in the plan
+;; Heuristic: Each Recall clause is used at most once in the plan
+;; Heuristic: Each Filter/Let clause is used at most once per path in the plan
+
+(defn add-computes [plan&nodes&vars computes]
+  (let [plan&nodes&vars (atom plan&nodes&vars)
+        computes-skipped #js []]
+    (doseq [compute computes]
+      (if-let [new-plan&nodes&vars (apply add-clause (conj @plan&nodes&vars compute))]
+        (reset! plan&nodes&vars new-plan&nodes&vars)
+        (apush computes-skipped compute)))
+    (if (= (count computes) (count computes-skipped))
+      @plan&nodes&vars
+      (recur @plan&nodes&vars computes-skipped))))
+
+(defn join-clauses [plan nodes-a vars-a nodes-b vars-b]
   (let [key-vars (intersection (set vars-a) (set vars-b))
         val-vars (union (set vars-a) (set vars-b))
         key-ixes-a (ixes-of vars-a key-vars)
@@ -539,45 +527,41 @@
         [plan index-b] (add-flow plan (->Index nodes-b key-ixes-b))
         [plan lookup-a] (add-flow plan (->Lookup [index-a] index-b key-ixes-a val-ixes-a))
         [plan lookup-b] (add-flow plan (->Lookup [index-b] index-a key-ixes-b val-ixes-b))]
-    [plan [lookup-a lookup-b] (distinct (concat vars-a vars-b)) (union computes-applied-a computes-applied-b)]))
-
-(comment
+    [plan [lookup-a lookup-b] (distinct (concat vars-a vars-b))]))
+
+(comment
+
   (let [plan empty-flow-plan
-        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
-        [plan nodes-b vars-b] (recall->nodes plan (Recall. :known (->connected 'y 'z)))
-        [plan nodes-c vars-c computes-applied] (join->nodes plan nodes-a vars-a #{} nodes-b vars-b #{})]
+        [plan nodes-a vars-a] (add-clause plan nil nil (Recall. :known&pretended (->edge 'x 'y)))
+        [plan nodes-b vars-b] (add-clause plan nil nil (Recall. :known (->connected 'y 'z)))
+        [plan nodes-c vars-c] (join-clauses plan nodes-a vars-a #{} nodes-b vars-b #{})]
     [plan nodes-c vars-c])
   )
-
-;; RULES
-
-(defrecord Rule [clauses])
-
-;; Correctness: Each clause must appear at least once in the plan
-;; Heuristic: Each Recall clause is used at most once in the plan
-;; Heuristic: Each Filter/Let clause is used at most once per path in the plan

 (defn add-rule [plan rule]
   (let [recalls (filter #(= Recall (type %)) (:clauses rule))
         computes (set (filter #(= Compute (type %)) (:clauses rule)))
         outputs (filter #(= Output (type %)) (:clauses rule))
         main-plan (atom plan)
-        nodes&vars&computes-applied (for [recall recalls]
-                                      (let [plan @main-plan
-                                            [plan node vars] (recall->nodes plan recall)
-                                            [plan node vars computes-applied] (computes->nodes plan node vars computes)]
-                                        (reset! main-plan plan)
-                                        [node vars computes-applied]))
-        [nodes vars computes-applied] (reduce (fn [[nodes-a vars-a computes-applied-a] [nodes-b vars-b computes-applied-b]]
-                                               (let [plan @main-plan
-                                                     [plan nodes vars computes-applied-old] (join->nodes plan nodes-a vars-a computes-applied-a nodes-b vars-b computes-applied-b)
-                                                     [plan nodes vars computes-applied-new] (computes->nodes plan nodes vars (difference computes computes-applied-old))]
-                                                 (reset! main-plan plan)
-                                                 [nodes vars (union computes-applied-old computes-applied-new)]))
-                                              nodes&vars&computes-applied)]
-    (assert (= computes-applied (set computes)) (str "Could not apply " (pr-str (difference (set computes) computes-applied))))
+        nodes&vars (for [recall recalls]
+                     (let [[plan node vars] (add-computes (add-clause @main-plan nil nil recall) computes)]
+                       (reset! main-plan plan)
+                       [node vars]))
+        [nodes vars] (reduce (fn [[nodes-a vars-a] [nodes-b vars-b]]
+                               (let [computes-unapplied (difference computes
+                                                                    (filter #(add-clause @main-plan nodes-a vars-a %) computes)
+                                                                    (filter #(add-clause @main-plan nodes-b vars-b %) computes))
+                                     [plan nodes vars] (add-computes
+                                                        (join-clauses @main-plan nodes-a vars-a nodes-b vars-b)
+                                                        computes-unapplied)]
+                                 (reset! main-plan plan)
+                                 [nodes vars]))
+                             nodes&vars)
+        computes-unapplied (filter #(not (add-clause @main-plan nodes vars %)) computes)]
+    (assert (empty? computes-unapplied) (str "Could not apply " (pr-str computes-unapplied) " to " (pr-str vars)))
     (doseq [output outputs]
-      (reset! main-plan (output->nodes @main-plan nodes vars output)))
+      (let [[plan node vars] (add-clause @main-plan nodes vars output)]
+        (reset! main-plan plan)))
     @main-plan))

 (defn add-rules [plan rules]
@@ -673,4 +657,21 @@
   (fixpoint! state-0)
   (for [state (take 5 (iterate #(tick&fixpoint plan %) state-0))]
     (count (get-facts state :known))))
-  )
+
+  (let [rules [(Rule. [
+                       (aurora.language.Recall. :known&pretended, (js/aurora.language.fact :http/response #js ['content "google" 'some]))
+                       (aurora.language.Output. :remembered (js/aurora.language.fact "1df7454c_069e_40ab_b117_b8d43212b473" #js ['value74]))
+                       (aurora.language.Output. :forgotten (js/aurora.language.fact "1df7454c_069e_40ab_b117_b8d43212b473" #js ['value]))
+                       (aurora.language.Recall. :known&pretended, (js/aurora.language.fact "1df7454c_069e_40ab_b117_b8d43212b473" #js ['value]))
+                       (aurora.language.Compute. (->Let 'value74  #{'value} "value + \"hey\""))])]
+        plan (add-rules empty-flow-plan rules)
+        state (flow-plan->flow-state plan)]
+    (add-facts state :known [(fact. "1df7454c_069e_40ab_b117_b8d43212b473" #js ["Click me"])])
+    (add-facts state :pretended [(fact. :http/response #js ["yo" "google" 1234])])
+    (fixpoint! state)
+    (-> state
+        (get-facts :known)
+        first
+        (.-values))
+  )
+  )


Fix tags implementations

Fix tags implementations

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -834,8 +834,7 @@
    s sortby     SORTBY     code  "sort entries by function"
    c comparator COMPARATOR code  "sort by comparator function"
    m meta       META       edn   "metadata to set on each collection entry"]
-  (let [options (merge +tags-defaults+ *opts*)
-        grouper (fn [entries]
+  (let [grouper (fn [entries]
                   (->> entries
                        (mapcat (fn [entry]
                                  (map #(-> [% entry]) (:tags entry))))
@@ -845,7 +844,10 @@
                                        (update-in [path :entries] conj entry)
                                        (assoc-in [path :group-meta :tag] tag))))
                                {})))]
-    (assortment-impl "tags" :io.perun/tags grouper options)))
+    (assortment-pre-wrap {:task-name "tags"
+                          :tracer :io.perun/tags
+                          :grouper grouper
+                          :options (merge +tags-defaults+ *opts*)})))

 (deftask inject-scripts
   "Inject JavaScript scripts into html files.


Add JES logs to UI

Add JES logs to UI

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/monitor/workflow_details.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/monitor/workflow_details.cljs
@@ -43,6 +43,19 @@
            [:div {} k [:span {:style {:margin "0 1em"}} "→"] (display-value v)])])])})

+(defn- backend-logs [data]
+  (when-let [log-map (data "backendLogs")]
+    ;; Right now we only ever have a single log, so we should only ever hit the "true" case.
+    ;; But in case something changes, I'll leave the general case so the UI doesn't totally bomb.
+    (if (= 1 (count log-map))
+      (create-field "JES log" (display-value (first (vals log-map))))
+      [:div {:style {:paddingBottom "0.25em"}} "Backend logs:"
+       (map
+         (fn [[name value]]
+           (create-field name (display-value value)))
+         log-map)])))
+
+
 (react/defc CallDetail
   {:get-initial-state
    (fn []
@@ -64,10 +77,11 @@
                 (create-field "Status" (moncommon/icon-for-call-status status) status))
               (create-field "Started" (moncommon/render-date (data "start")))
               (create-field "Ended" (moncommon/render-date (data "end")))
+              [IODetail {:label "Inputs" :data (data "inputs")}]
+              [IODetail {:label "Outputs" :data (data "outputs")}]
               (create-field "stdout" (display-value (data "stdout")))
               (create-field "stderr" (display-value (data "stderr")))
-              [IODetail {:label "Inputs" :data (data "inputs")}]
-              [IODetail {:label "Outputs" :data (data "outputs")}]]])
+              (backend-logs data)]])
           (:data props)))])})

@@ -93,7 +107,7 @@

 (react/defc WorkflowDetails
   {:render
-   (fn [{:keys [props state]}]
+   (fn [{:keys [state]}]
      (let [server-response (:server-response @state)]
        (cond
          (nil? server-response)


CMR-3214: Fixed test failure caused by bad xslt.

--- system-int-test/test/cmr/system_int_test/search/collection_concept_retrieval_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_concept_retrieval_test.clj
@@ -67,16 +67,22 @@
   (fn [format-key umm response]
     format-key))

+(defn- update-iso-entry-title
+  "Returns the ISO19115 collection with entry title updated to the given value.
+  This is a temporary workaround and should be removed once CMR-3256 is fixed."
+  [coll correct-entry-title]
+  (assoc coll :entry-title correct-entry-title))
+
 ;; ISO-19115 must be handled separately from the other formats becaue it uses xslt to translate
 ;; ECHO10 and the resulting XML is not quite the same as what we get when going from UMM to XML.
 (defmethod result-matches? :iso19115
   [format-key umm response]
   (let [metadata-xml (:body response)
         metadata-umm (-> (umm-c/parse-collection metadata-xml)
-                         ;; parser prepends "gov.nasa.echo:" to entry-title for some reason
-                         (update-in [:entry-title]
-                                    (fn [entry-title]
-                                      (str/replace entry-title "gov.nasa.echo:" "")))
+                         ;; Update entry-title to the correct value as the xslt is not generating
+                         ;; the correct entry-title as of now.
+                         ;; This is temporary and should be removed once CMR-3256 is fixed.
+                         (update-iso-entry-title (:entry-title umm))
                          ;; remove default added by parser
                          (assoc :metadata-language nil)
                          ;; remove default added by parser


don't broadcast user changes to orginating user

--- src/chat/server/sync.clj
+++ src/chat/server/sync.clj
@@ -74,10 +74,12 @@
 (defn broadcast-user-change
   "Broadcast user info change to clients that can see this user"
   [user-id info]
-  (let [ids-to-send-to (intersection
-                         (set (:any @connected-uids))
-                         (into #{} (map :id)
-                               (db/with-conn (db/fetch-users-for-user user-id))))]
+  (let [ids-to-send-to (disj
+                         (intersection
+                           (set (:any @connected-uids))
+                           (into #{} (map :id)
+                                 (db/with-conn (db/fetch-users-for-user user-id))))
+                         user-id)]
     (doseq [uid ids-to-send-to]
       (chsk-send! uid info))))

@@ -100,7 +102,6 @@
   [{:as ev-msg :keys [event id ring-req]}]
   (when-let [user-id (get-in ring-req [:session :user-id])]
     (broadcast-user-change user-id [:user/disconnected user-id])))
-

 (defn- user-can-message? [user-id ?data]
   (db/with-conn
@@ -189,7 +190,9 @@
     (if (valid-nickname? (?data :nickname))
       (try
         (do (db/with-conn @(db/set-nickname! user-id (?data :nickname)))
-            (broadcast-user-change user-id [:user/name-change {:user-id user-id :nickname (?data :nickname)}])
+            (broadcast-user-change user-id [:user/name-change
+                                            {:user-id user-id
+                                             :nickname (?data :nickname)}])
             (when ?reply-fn (?reply-fn {:ok true})))
         (catch java.util.concurrent.ExecutionException _
           (when ?reply-fn (?reply-fn {:error "Nickname taken"}))))


Be careful with index manipulations.

Be careful with index manipulations.

--- src/clj/fleetdb/core.clj
+++ src/clj/fleetdb/core.clj
@@ -385,26 +385,30 @@
     (assoc rmap (record "id") record)))

 (defn- rmap-update [rmap old-record new-record]
+  (assert (= (old-record "id") (new-record "id")))
   (assoc rmap (old-record "id") new-record))

 (defn- rmap-delete [rmap old-record]
+  (assert (contains? rmap (old-record "id")))
   (dissoc rmap (old-record "id")))

 (defn- ispec-on-fn [ispec]
-  (let [nispec (normalize-ispec ispec)]
-    (let [attrs  (map first nispec)
-          nattrs (count nispec)]
-      (cond!
-        (= nattrs 1) (let [attr (first attrs)] #(get % attr))
-        (> nattrs 1) #(vec-map (fn [attr] (get % attr)) attrs)))))
+  (let [nispec (normalize-ispec ispec)
+        attrs  (map first nispec)
+        nattrs (count nispec)]
+    (cond!
+      (= nattrs 1) (let [attr (first attrs)] #(% attr))
+      (> nattrs 1) #(vec-map (fn [attr] (% attr)) attrs))))

 (defn- index-insert [index on-fn record]
   (update index (on-fn record)
     (fn [indexed]
       (cond
         (nil? indexed) record
-        (set? indexed) (conj indexed record)
-        :single-record (hash-set indexed record)))))
+        (set? indexed) (do (assert (not (contains? indexed record)))
+                           (conj indexed record))
+        :single-record (do (assert (not (= indexed record)))
+                           (hash-set indexed record))))))

 (defn- index-delete [index on-fn record]
   (let [aval    (on-fn record)
@@ -425,7 +429,9 @@
       records)))

 (defn- imap-apply [imap apply-fn]
-  (mash (fn [ispec index] (apply-fn (ispec-on-fn ispec) index)) imap))
+  (mash (fn [ispec index]
+          (apply-fn (ispec-on-fn ispec) index))
+        imap))

 (defn- imap-insert [imap record]
   (imap-apply imap
@@ -441,7 +447,8 @@

 (defn- imap-delete [imap record]
   (imap-apply imap
-    (fn [on-fn index] (index-delete index on-fn record))))
+    (fn [on-fn index]
+      (index-delete index on-fn record))))

 ;; Query implementations


fallback to empty list

fallback to empty list

--- src/clj/swarmpit/api.clj
+++ src/clj/swarmpit/api.clj
@@ -123,7 +123,7 @@
   ([label]
    (try (-> (dc/configs label)
             (dmi/->configs))
-        (catch Exception _ {}))))
+        (catch Exception _ []))))

 (defn config
   [config-id]


friendly description for nil values

friendly description for nil values

--- src/clj_money/schema.clj
+++ src/clj_money/schema.clj
@@ -8,7 +8,9 @@
    {:fn #(re-find #"integer\?" (print-str %))
     :message "must be a number"}
    {:fn #(re-find #"invalid format" (print-str %))
-    :message "is not valid"}])
+    :message "is not valid"}
+   {:fn #(re-find #"instance\? java\.lang\.String nil" (print-str %))
+    :message "is required"}])

 (defn- friendly-message
   "Takes a single prismatic rule violation token and returns


Was using wrong :ns which broke use/refer.

--- src/cljs/go/compiler.clj
+++ src/cljs/go/compiler.clj
@@ -209,7 +209,9 @@
         (str (string/upper-case (subs s 0 1)) (when (next s) (subs s 1)))))))

 (defn go-type-fqn [s]
-  (apply str (map go-public (string/split (str s) #"[./]"))))
+  (if (and (symbol? s) (= "js" (namespace s)))
+    (name s)
+    (apply str (map go-public (string/split (str s) #"[./]")))))

 (defn go-short-name [s]
   (last (string/split (str s) #"\.")))
@@ -450,7 +452,8 @@

 (defmethod emit* :var
   [{:keys [info env tag] :as arg}]
-  (let [info (cond-> info (and *go-dot* (:type info)) (update-in [:name] go-type-fqn))
+  (let [ns (and (symbol? (:name info)) (some-> info :name namespace symbol))
+        info (cond-> info (and *go-dot* (:type info)) (update-in [:name] #(symbol (str ns) (go-type-fqn %))))
         statement? (= :statement (:context env))]
     ; We need a way to write bindings out to source maps and javascript
     ; without getting wrapped in an emit-wrap calls, otherwise we get
@@ -477,12 +480,11 @@
        (binding [*go-return-tag* (when (go-needs-coercion? tag *go-return-tag*)
                                    *go-return-tag*)]
          (emit-wrap env (emits (munge (cond ;; this runs munge in a different order from most other things.
-                                       (or (= ana/*cljs-ns*  (:ns info))
+                                       (or (= ana/*cljs-ns* ns)
                                            (:field info))
                                        (update-in info [:name] (comp go-public munge name))
-                                       (:ns info)
-                                       (update-in info [:name] #(str (:ns info) "."
-                                                                     (-> % name munge go-public)))
+                                       ns
+                                       (update-in info [:name] #(str ns "." (-> % name munge go-public)))
                                        :else info)))))))))
 (defmethod emit* :meta
   [{:keys [expr meta env]}]
@@ -1033,10 +1035,9 @@
     (binding [*go-return-tag* nil
               *go-dot* true]
       (emit-wrap env
-        (emits "(&" (case (-> ctor :info :ns)
-                      js ctor
-                      goog (normalize-goog-ctor ctor)
-                      (update-in ctor [:info :name] (comp munge go-type-fqn))) "{"
+        (emits "(&" (if (= 'goog (-> ctor :info :ns))
+                      (normalize-goog-ctor ctor)
+                      ctor) "{"
                       (comma-sep
                        (concat
                         (if-let [types (seq (map (comp :tag meta) fields))]


cjl - Fix parsing

cjl - Fix parsing

--- src/icfp2015/problem.clj
+++ src/icfp2015/problem.clj
@@ -34,7 +34,7 @@
   "Returns (count (:sourceSeeds problem)) games given a problem."
   [problem]
   (let [n (:sourceLength problem)
-        coord-to-vec (fn [{ :keys [x y] }] [x y])
+        coord-to-vec (fn [{ :keys [x y] }] [y x])
         format-unit (fn [{ :keys [members pivot] }]
                       { :members (set (map coord-to-vec members))
                         :pivot (coord-to-vec pivot) })


don't open menu if ctrl+shift click (only ctrl+click)

--- src-cljs/frontend/controllers/controls.cljs
+++ src-cljs/frontend/controllers/controls.cljs
@@ -658,7 +658,7 @@
       (assoc-in [:mouse-down] false)
       (assoc-in [:editing-eids :editing-eids] #{}))))

-(defn mouse-depressed-intents [state button ctrl?]
+(defn mouse-depressed-intents [state button ctrl? shift?]
   (let [tool (get-in state state/current-tool-path)
         drawing-text? (and (keyword-identical? :text tool)
                            (get-in state [:drawing :in-progress?]))]
@@ -668,7 +668,7 @@
      (when drawing-text? [:finish-text-layer])
      (cond
        (= button 2) [:open-menu]
-       (and (= button 0) ctrl?) [:open-menu]
+       (and (= button 0) ctrl? (not shift?)) [:open-menu]
        (get-in state [:layer-properties-menu :opened?]) [:submit-layer-properties]
        (contains? #{:pen :rect :circle :line :select} tool) [:start-drawing]
        (and (keyword-identical? tool :text) (not drawing-text?)) [:start-drawing]
@@ -682,8 +682,8 @@
 (declare handle-text-layer-finished-after)

 (defmethod control-event :mouse-depressed
-  [browser-state message [x y {:keys [button type ctrl?]}] state]
-  (let [intents (mouse-depressed-intents state button ctrl?)
+  [browser-state message [x y {:keys [button type ctrl? shift?]}] state]
+  (let [intents (mouse-depressed-intents state button ctrl? shift?)
         new-state (-> state
                     (update-mouse x y)
                     (assoc-in [:mouse-down] true)
@@ -698,9 +698,9 @@
             new-state intents)))

 (defmethod post-control-event! :mouse-depressed
-  [browser-state message [x y {:keys [button ctrl?]}] previous-state current-state]
+  [browser-state message [x y {:keys [button ctrl? shift?]}] previous-state current-state]
   ;; use previous state so that we're consistent with the control-event
-  (let [intents (mouse-depressed-intents previous-state button ctrl?)]
+  (let [intents (mouse-depressed-intents previous-state button ctrl? shift?)]
     (doseq [intent intents]
       (case intent
         :finish-text-layer (handle-text-layer-finished-after current-state)


PR comments

PR comments

--- search-app/src/cmr/search/validators/opendata.clj
+++ search-app/src/cmr/search/validators/opendata.clj
@@ -2,10 +2,7 @@
  "Validate Opendata formatted collections against JSON schema in /resources/schema"
  (:require
   [clojure.java.io :as io]
-  [cheshire.core :as cheshire]
-  [cmr.common.validations.json-schema :as json-schema]
-  [cmr.common.mime-types :as mime-types]
-  [cmr.search.models.query :as query-model]))
+  [cmr.common.validations.json-schema :as json-schema]))

 (defn- load-opendata-schema
   "Load and parse named opendata schema from resources"


fix bb priority queue

fix bb priority queue

--- src/java_time/graph.cljc
+++ src/java_time/graph.cljc
@@ -193,7 +193,7 @@
     (let [path (ConversionPath. (vector) (vector) #{src} 0)]
       (if (assignable? src dst)
         path
-        (let [q #?(:bb (atom ())
+        (let [q #?(:bb (atom (list path))
                    :default (doto (PriorityQueue.) (.add path)))
               add #?(:bb #(swap! q (fn [prev]
                                      (sort-by (fn [^ConversionPath p]


more optimizations

more optimizations

--- src/babel/over.cljc
+++ src/babel/over.cljc
@@ -98,7 +98,8 @@
     (log/trace (str "moreover-head (candidate) head child: [" (get-in parent [:child]) "] '" (morph child) "' sem:" (strip-refs (get-in child '(:synsem :sem) :top))))
     (let [result
           (unify (copy parent)
-                 (unify {:head (copy child)}
+                 (unify {:head (copy child)
+                         :head-filled true}
                         {:head {:synsem {:sem (lexfn-sem-impl (copy (get-in child '(:synsem :sem) :top)))}}}))]
       (if (not (fail? result))
         (let [debug (log/trace (str "moreover-head: " (get-in parent '(:rule)) " succeeded: " (get-in result [:rule])
@@ -107,8 +108,7 @@
                                     (strip-refs (get-in parent [:head :synsem]))))

               debug (log/trace (str " resulting sem: " (strip-refs (get-in result '(:synsem :sem)))))]
-          (merge {:head-filled true}
-                 result))
+          result)

         ;; else: attempt to put head under parent failed: provide diagnostics through log/debug messages.
         (if (= *extra-diagnostics* true)


Expect json format for project POST.

Expect json format for project POST.

--- src/kixi/hecuba/amon.clj
+++ src/kixi/hecuba/amon.clj
@@ -188,7 +188,7 @@

   :post!
   (fn [{{body :body} :request}]
-    {:project-id (upsert! commander :project (-> body read-edn-body ->shallow-kebab-map))})
+    {:project-id (upsert! commander :project (-> body read-json-body ->shallow-kebab-map))})

   :handle-created
   (fn [{id :project-id {routes :modular.bidi/routes} :request}]


Need these git commands.

Need these git commands.

I think I need to dig into the git stuff here.  Adding these stubs
makes me think I'm doing something wrong.  :)


plug any function in the init and shut sequence

--- src/clj/algorithms_clj/macro_initiation.clj
+++ src/clj/algorithms_clj/macro_initiation.clj
@@ -46,7 +46,6 @@

 (defmacro add-m-4
   [a b]
-  ;; TODO - Does not work
   `(constexpr add ~a ~b))

 (def x1 1)
@@ -376,17 +375,17 @@

 (def modules
   {:rest-api {:prerequisites [:trade-db :logger :monitor]
-              :init-sequence #(println "rest ai init")
-              :shut-sequence #(println "rest ai shut")}
+              :init-sequence [println "rest ai init"]
+              :shut-sequence [println "rest ai shut"]}
    :trade-db {:prerequisites [:monitor]
-              :init-sequence #(println "trade db init")
-              :shut-sequence #(println "trade db shut")}
+              :init-sequence [println "trade db init"]
+              :shut-sequence [println "trade db shut"]}
    :monitor {:prerequisites []
-             :init-sequence #(println "monitor init")
-             :shut-sequence #(println "monitor shut")}
+             :init-sequence [println "monitor init"]
+             :shut-sequence [println "monitor shut"]}
    :logger {:prerequisites [:monitor]
-            :init-sequence #(println "logger init")
-            :shut-sequence #(println "logger shut")}})
+            :init-sequence [println "logger init"]
+            :shut-sequence [println "logger shut"]}})

 (def module-dependencies
   (reduce-kv
@@ -429,7 +428,9 @@

 (defn run-init-sequence
   []
-  (map (fn [f] (f)) (:init-sequence global-init-shut-sequence)))
+  (map
+    (fn [[f & args]] (apply f args))
+    (:init-sequence global-init-shut-sequence)))

 ;; --------------------------------------------------------
 ;; Example 7: Generating some code based on data structure


Attribute can't be a set

Attribute can't be a set

--- src/com/wsscode/pathom/connect/indexes.cljc
+++ src/com/wsscode/pathom/connect/indexes.cljc
@@ -3,7 +3,7 @@
             [com.wsscode.pathom.core :as p]
             [clojure.spec.alpha :as s]))

-(>def :com.wsscode.pathom.connect/attribute (s/or :attribute ::p/attribute :set :com.wsscode.pathom.connect/attributes-set))
+(>def :com.wsscode.pathom.connect/attribute ::p/attribute)
 (>def :com.wsscode.pathom.connect/attributes-set (s/coll-of ::p/attribute :kind set?))
 (>def :com.wsscode.pathom.connect/io-map (s/map-of :com.wsscode.pathom.connect/attribute :com.wsscode.pathom.connect/io-map))


Make the first gate devcard example work with a worker pipeline

--- src/devcards/audio_utils/devcards/gate.cljs
+++ src/devcards/audio_utils/devcards/gate.cljs
@@ -4,12 +4,12 @@
             [goog.string :as gstring]
             [goog.string.format]
             [sablono.core :refer-macros [html]]
-            [audio-utils.audio-chunker :as c]
             [audio-utils.gate :as g]
-            [audio-utils.web-audio :as a]
             [audio-utils.viz :refer [linear-distribution
                                      plot-buffers
                                      sine-wave]]
+            [audio-utils.web-audio :as a]
+            [audio-utils.worker :as w]
             [cljs.core.async :refer [<! timeout]]))

 (defn run-test
@@ -17,42 +17,37 @@
   (swap! state assoc :processing? true)
   (let [ctx         (a/audio-context)
         sample-rate (.-sampleRate ctx)
-        buffer-size (:buffer-size @state)
         input-data  ((:data-fn @state) sample-rate)
         source      (a/create-buffer-source ctx 1 sample-rate
                                             input-data)
-        gate        (g/gate
-                     {:ctx         ctx
-                      :buffer-size buffer-size
-                      :threshold   (:threshold @state)
-                      :look-ahead  (:look-ahead @state)
-                      :hold        (:hold @state)
-                      :rms-window  (:rms-window @state)})
-        output      #js []
-        recorder    (doto (.createScriptProcessor ctx buffer-size 1 1)
-                      (aset "onaudioprocess"
-                            (fn [event]
-                              (let [in-buf  (.-inputBuffer event)
-                                    in-data (.getChannelData in-buf 0)]
-                                (dotimes [n (.-length in-data)]
-                                  (.push output (aget in-data n)))))))
+        worker      (new js/Worker (:worker @state))
+        entry-node  (w/main-entry-node worker ctx
+                                       {:buffer-size     2048
+                                        :input-channels  1
+                                        :output-channels 1})
+        output-data (volatile! [])
+        exit-node   (w/main-exit-node worker
+                                      (fn [channel-data]
+                                        (vswap! output-data concat
+                                                (first channel-data))))
         dest        (.createMediaStreamDestination ctx)]
-    (g/connect-source gate source)
-    (.connect (:node gate) recorder)
-    (.connect recorder dest)
+    (.connect source entry-node)
+    (.connect entry-node dest)
     (set! (.-onended source)
           (fn [e]
-            (.disconnect recorder)
-            (g/disconnect gate)
             (.disconnect source)
+            (.disconnect dest)
             (go
               (<! (timeout 1000))
+              (.disconnect entry-node)
+              (.terminate worker)
               (swap! state assoc
+                     :processing? false
                      :finished?   true
                      :sample-rate sample-rate
                      :input-data  input-data
-                     :output-data (js->clj output)))))
-    (.start source 0 0 3)))
+                     :output-data @output-data))))
+    (.start source)))

 (defn gate-test
   [state]
@@ -62,7 +57,7 @@
                 input-data
                 output-data]} @state]
     (cond
-      finished?   (plot-buffers sample-rate
+      finished?   (plot-buffers (count input-data)
                                 (gstring/format "Input (%d samples)"
                                                 (count input-data))
                                 input-data
@@ -76,14 +71,9 @@
 (defcard
   "A look-ahead gate with the following parameters, fed with a
    stream of 32768 samples linearly distributed from -1.0 to 1.0.
-   Threshold -32dB, look-ahead 0ms, hold 0ms, RMS window 10ms."
+   Threshold -12dB, look-ahead 0ms, hold 0ms, RMS window 10ms."
   (fn [state owner]
     (gate-test state))
-  {:threshold   -32.0
-   :buffer-size 4096
-   :look-ahead  0
-   :hold        0
-   :rms-window  100
-   :chunks      []
-   :data-fn     (fn [sample-rate]
-                  (into [] (repeat sample-rate 1.0)))})
+  {:worker  "gate-1.js"
+   :data-fn (fn [sample-rate]
+              (linear-distribution [-1.0 1.0] 32768))})


Change block equality to take extra attributes into account.

--- src/blocks/data.clj
+++ src/blocks/data.clj
@@ -17,12 +17,7 @@
   A block's id, size, content, and reader cannot be changed after construction,
   so clients can be relatively certain that the block's id is valid. Blocks
   _may_ have additional attributes associated with them and support metadata,
-  similar to records.
-
-  Unlike records, these extra attributes **DO NOT** affect the block's equality
-  semantics! Blocks with the same id and size will be considered equal and
-  return the same hash code. Extra attributes will affect block comparisons and
-  sort order."
+  similar to records."
   (:require
     [byte-streams :as bytes]
     [multihash.core :as multihash])
@@ -51,23 +46,17 @@

   (equals
     [this that]
-    (cond
-      (identical? this that) true
-      (instance? Block that)
-        (and (= id   (:id   that))
-             (= size (:size that)))
-      :else false))
+    (boolean
+      (or (identical? this that)
+          (when (identical? (class this) (class that))
+            (let [that ^Block that]
+              (and (= id     (.id     that))
+                   (= size   (.size   that))
+                   (= _attrs (._attrs that))))))))

   (hashCode
     [this]
-    (hash [Block id size]))
-
-
-  clojure.lang.IHashEq
-
-  (hasheq
-    [this]
-    (.hashCode this))
+    (hash [(class this) id size _attrs]))

   java.lang.Comparable
@@ -76,7 +65,7 @@
     [this that]
     (compare [id size _attrs]
              [(:id that) (:size that)
-              (when (instance? Block that)
+              (when (identical? (class this) (class that))
                 (._attrs ^Block that))]))

@@ -132,16 +121,8 @@
             result))))

   (equiv
-    [this other]
-    (boolean (or (identical? this other)
-                 (when (identical? (class this) (class other))
-                   (let [other ^Block other
-                         other-content (.content other)]
-                     (and (= id (.id other))
-                          (= size (.size other))
-                          (= _attrs (._attrs other))
-                          (not (and content other-content
-                                    (not= content other-content)))))))))
+    [this that]
+    (.equals this that))

   (containsKey
     [this k]
@@ -252,7 +233,7 @@
   "Creates a block from a reader function. Each time the function is called, it
   should return a new `InputStream` to read the block contents. The block is
   given the id and size directly, without being checked."
-  ^Block
+  ^blocks.data.Block
   [id size reader]
   (Block. id size nil reader nil nil))

@@ -260,7 +241,7 @@
 (defn literal-block
   "Creates a block by reading a source into memory. The block is given the id
   directly, without being checked."
-  ^Block
+  ^blocks.data.Block
   [id source]
   (let [content (bytes/to-byte-array source)]
     (Block. id
@@ -272,7 +253,7 @@
 (defn read-block
   "Creates a block by reading the source into memory and hashing it. This
   creates a realized block."
-  ^Block
+  ^blocks.data.Block
   [source algorithm]
   (let [hash-fn (checked-hash algorithm)
         content (bytes/to-byte-array source)]


Rename comment-field to review-comment-field

Signed-off-by: ivermac <cd640042a8f3b0ff08bacdf4feae34fdd495051d@gmail.com>


Remove debug text in entry scene

Remove debug text in entry scene

--- src/elfeed_cljsrn/android/scenes/entry.cljs
+++ src/elfeed_cljsrn/android/scenes/entry.cljs
@@ -66,7 +66,6 @@
       [rn/view {:style (:wrapper styles)}
        (when @remote-error
          [remote-error-message])
-       [rn/text @content-height]
        [rn/view {:style (:header styles)}
         [rn/text (:title @entry-content)]
         [rn/view {:style (:feed-info styles)}


refactor: directly delete extracts

refactor: directly delete extracts

--- src/main/clojure/pdok/featured/extracts.clj
+++ src/main/clojure/pdok/featured/extracts.clj
@@ -85,19 +85,19 @@

 (def ^:dynamic *process-insert-extract* (partial transform-and-add-extract config/extracts-db))

-(defn- jdbc-udpate-marked-for-deletion [db table versions]
+(defn- jdbc-delete-versions [db table versions]
   (when (seq versions)
-    (let [query (str "UPDATE " extract-schema "." table
-                     " SET marked_for_deletion = true WHERE version = ?")]
+    (let [query (str "DELETE FROM " extract-schema "." table
+                     " WHERE version = ?")]
       (try (j/execute! db (cons query (map vector versions)) :multi? true :transaction? false)
            (catch java.sql.SQLException e (j/print-sql-exception-chain e))))))

-(defn- update-extract-marked-for-deletion [db dataset feature-type extract-type versions]
+(defn- delete-extracts-with-version [db dataset feature-type extract-type versions]
   (let [table (str dataset "_" extract-type "_v0_" feature-type)]
-    (jdbc-udpate-marked-for-deletion db table versions)))
+    (jdbc-delete-versions db table versions)))

-(def ^:dynamic *process-delete-extract* (partial update-extract-marked-for-deletion config/extracts-db))
+(def ^:dynamic *process-delete-extract* (partial delete-extracts-with-version config/extracts-db))

 (defn flush-changelog [dataset]
   (do


Fix installing a plugin doesn't load new behavior- close #1970

Order of the refresh! and behaviors.reload matters because refresh!
adds the new plugins to ::plugins and behaviors.reload depends on
::plugins. Also updated update as it has the stale ::plugins issue
as install

--- src/lt/objs/plugins.cljs
+++ src/lt/objs/plugins.cljs
@@ -492,8 +492,8 @@
            (dom/prevent e)
            (dom/stop-propagation e)
            (discover-deps plugin (fn []
-                                   (cmd/exec! :behaviors.reload)
-                                   (object/raise manager :refresh!)))))
+                                   (object/raise manager :refresh!)
+                                   (cmd/exec! :behaviors.reload)))))

 (defui install-button [plugin]
   [:span.install]
@@ -501,8 +501,8 @@
            (this-as me
                     (discover-deps plugin (fn []
                                             (dom/remove (dom/parent me))
-                                            (cmd/exec! :behaviors.reload)
-                                            (object/raise manager :refresh!))))
+                                            (object/raise manager :refresh!)
+                                            (cmd/exec! :behaviors.reload))))
            (dom/prevent e)
            (dom/stop-propagation e)))


First version of ocaml compiler

First version of ocaml compiler

--- extended/compiler/compiler.clj
+++ extended/compiler/compiler.clj
@@ -1,3 +1,142 @@

-(export to-ocaml (expressions)
-        (list 108 101 116 32 114 101 99 32 109 97 105 110 32 61 32 102 117 110 32 40 41 32 45 62 32 40 73 110 116 51 50 46 111 102 95 105 110 116 32 40 52 50 41 41 59 59))
+(def compile-error () (list 42 99 111 109 112 105 108 101 32 101 114 114 111 114 42))
+(def definition-end () (list 59 59))
+(def let-rec () (list 108 101 116 32 114 101 99 32))
+(def type () (list 116 121 112 101 32))
+(def fun () (list 102 117 110 32))
+(def arrow () (list 32 45 62 32))
+(def space () (list 32))
+(def newline () (list 10))
+(def equals () (list 32 61 32))
+(def comma () (list 44 32))
+(def vertical-bar () (list 32 124 32))
+(def colon () (list 32 58 32))
+(def star () (list 32 42 32))
+
+(def join (list) (string-join Empty list))
+
+(def not-empty? (string)
+     (not (string-empty? string)))
+
+(def with-apostrophe (string)
+     (Cons 39 string))
+
+(def prefix-constructor (constructor)
+     (Cons 67 constructor))
+
+(def parse-error (error)
+     (join (list (list 112 97 114 115 101 32 101 114 114 111 114 32)
+                 (error-to-string error))))
+
+(def translate-expression (expression)
+     (match expression
+            (Lambda arguments expression _)
+                (wrap-in-brackets (translate-lambda arguments expression))
+            (FunctionApplication expressions _)
+                (match expressions
+                        (Cons first Empty)
+                                (wrap-in-brackets (join (list (translate-expression first) (space) (wrap-in-brackets Empty))))
+                        _
+                                (wrap-in-brackets (string-join (space) (list-map translate-expression expressions))))
+            (IntegerConstant integer _)
+                (wrap-in-brackets (string-concat (list 73 110 116 51 50 46 111 102 95 105 110 116 32)
+                                                 (wrap-in-brackets (string-from-int32 integer))))
+            (Identifier name _)
+                name
+            _
+                (compile-error)))
+
+(def translate-argument-list (arguments)
+     (match (list-empty? arguments)
+            True  (wrap-in-brackets Empty)
+            False (string-join (space) arguments)))
+
+(def translate-lambda (arguments expression)
+     (join (list (fun)
+                 (translate-argument-list arguments)
+                 (arrow)
+                 (translate-expression expression))))
+
+(def translate-function-definition (name arguments expression)
+     (join (list (let-rec)
+                 name
+                 (equals)
+                 (translate-lambda arguments expression)
+                 (definition-end))))
+
+(def translate-type (translate-types type)
+     (match type
+            (SimpleType name _)
+                (with-apostrophe name)
+            (ComplexType name types _)
+                ((pipe translate-types
+                       wrap-in-brackets
+                       (fn (types) (join (list types (space) name)))
+                ) types)))
+
+(def translate-types (types)
+     ((pipe (list-map (translate-type translate-types))
+            (string-join (star))
+     ) types))
+
+(def translate-constructor-definition (type constructor)
+     (match constructor
+            (SimpleConstructor name _)
+                (prefix-constructor name)
+            (ComplexConstructor name types _)
+                (join (list (prefix-constructor name) (colon) (translate-types types) (arrow) type))))
+
+(def translate-constructor-definitions (type constructors)
+     ((pipe (list-map (translate-constructor-definition type))
+            (string-join (vertical-bar))
+      ) constructors))
+
+(def translate-type-parameter (parameter)
+     (match parameter
+            (UniversalParameter name _)
+                name
+            (ExistentialParameter _ __)
+                Empty))
+
+(def translate-type-parameters (parameters)
+     ((pipe
+            (list-map translate-type-parameter)
+            (list-filter not-empty?)
+            (list-map with-apostrophe)
+            (string-join (comma))
+      ) parameters))
+
+(def translate-type-name (name parameters)
+     (match (translate-type-parameters parameters)
+            Empty
+                name
+            parameters
+                (join (list (wrap-in-brackets parameters)
+                            (space)
+                            name))))
+
+(def translate-type-definition (name parameters constructors)
+     (join (list (type)
+                 (translate-type-name name parameters)
+                 (equals)
+                 (translate-constructor-definitions (translate-type-name name parameters) constructors)
+                 (definition-end))))
+
+(def translate-definition (definition)
+     (match definition
+        (FunctionDefinition name arguments expression _)
+                (translate-function-definition name arguments expression)
+        (ExportDefinition name arguments expression _)
+                (translate-function-definition name arguments expression)
+        (TypeDefinition name parameters constructors _)
+                (translate-type-definition name parameters constructors)))
+
+(def translate-result (result)
+     (match result
+            (Result definition)
+                (translate-definition definition)
+            (Error error)
+                (parse-error error)))
+
+(export to-ocaml (definitions)
+        (string-join (newline) (list-map translate-result definitions)))


Remove direction from inbox url.

Remove direction from inbox url.

--- src/oc/storage/representations/activity.clj
+++ src/oc/storage/representations/activity.clj
@@ -12,8 +12,8 @@
 (defn- inbox-url
   ([collection-type {slug :slug}]
   (str "/orgs/" slug "/" collection-type))
-  ([collection-type {slug :slug :as org} {start :start direction :direction}]
-  (str (inbox-url collection-type org) "?start=" start "&direction=" (name direction))))
+  ([collection-type {slug :slug :as org} {start :start}]
+  (str (inbox-url collection-type org) "?start=" start)))

 (defn- dismiss-all-url [org]
   (str (inbox-url "inbox" org) "/dismiss-all"))


Fix inbox-url call.

Fix inbox-url call.

--- src/oc/storage/representations/activity.clj
+++ src/oc/storage/representations/activity.clj
@@ -71,7 +71,7 @@
   [params org collection-type sort-type activity boards user]
   (let [inbox? (is-inbox? collection-type)
         collection-url (if inbox?
-                         (inbox-url collection-type org sort-type)
+                         (inbox-url collection-type org)
                          (url collection-type org sort-type))
         recent-activity-sort? (= sort-type :recent-activity)
         other-sort-url (when-not inbox?


Set a default screen before the game loads

--- src/nightmod/screens.clj
+++ src/nightmod/screens.clj
@@ -31,6 +31,7 @@

 (defn load-project!
   [path]
+  (on-gl (set-screen! nightmod blank-screen overlay-screen))
   ; save in project-dir so the reset button works
   (reset! u/project-dir path)
   ; save in tree-projects so the up button is hidden correctly


Wordsmithing.

Wordsmithing.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -74,14 +74,14 @@
   [:div.bot-removed-instructions
     "Hi,"
     [:br] [:br]
-    "You’re receiving this note because you’re an Admin "
+    "You’re receiving this note because you’re a Carrot admin "
     (when (seq org-name)
      "for ")
     (when (seq org-name)
-      [:b (str org-name " ")])
-    "in the Carrot communication app."
+      [:b org-name])
+    "."
     [:br][:br]
-    "We just noticed that your Carrot bot for Slack was removed. If it was turned off on purpose, please ignore this email. If not, you’ll want to "
+    "We noticed your Carrot bot for Slack was removed. If it was removed on purpose, please ignore this email. If not, you’ll want to "
     [:a
      {:href integration-settings-url}
      "re-enable your bot"]
@@ -96,7 +96,7 @@
     "If you have any questions or want help turning it back on, just reply to this email."
     [:br][:br]
     "Thanks,"[:br]
-    "Team Carrot"])
+    "The Carrot Team"])

 (defn- preheader-spacer []
   (s/join (repeat 120 " ")))


Send more minimal email when over size limit.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -325,37 +325,35 @@
       (paragraph tagline)]))

 (defn- snapshot-link-content [snapshot]
-  (let [logo-url (:logo snapshot)
-        logo? (not (s/blank? logo-url))
-        company-name (:name snapshot)
+  (let [company-name (:name snapshot)
         company-name? (not (s/blank? company-name))
         title (:title snapshot)
         title? (not (s/blank? title))
+        link-title (if title? title (str company-name " Update"))
         company-slug (:company-slug snapshot)
         update-slug (:slug snapshot)
         origin-url (:origin-url snapshot)
         created-at (format/parse iso-format (:created-at snapshot))
         update-time (format/unparse link-format created-at)
         update-url (s/join "/" [origin-url company-slug "updates" update-time update-slug])]
-    [:td
-      (when logo? (spacer 20))
-      (when logo? (logo logo-url company-name))
-      (spacer 15)
-      (paragraph [:span "Check out the latest"
-                        (when company-name? (str " from " company-name))
-                        (if title? ":" "!")])
-      (when title?
-        (paragraph [:a {:href update-url} title]))
-      (spacer 15)
-      (cta-button "READ THE UPDATE ➞" update-url)]))
-
-(defn- note [snapshot]
+    [:table {:class "note"}
+      [:tr
+        [:td
+          [:table {:class "row note"}
+            [:tr
+              [:th {:class "small-12 large-12 first last columns note"}
+                "Check out the latest"
+                (when company-name? (str " from " company-name))
+                ": " [:a {:href update-url} link-title]]]]]]]))
+
+(defn- note
+  [snapshot trail-space?]
   [:table {:class "note"}
     [:tr
       [:td
-        (spacer 20 "note")
+        (spacer 15 "note")
         (message snapshot)
-        (spacer 22 "note")]]])
+        (when trail-space? (spacer 22 "note"))]]])

 (defn- footer []
   [:table {:class "footer"}
@@ -375,19 +373,22 @@
                 (spacer 28 "footer")]]]]]]])

 (defn- body [data]
-  (let [type (:type data)]
+  (let [type (:type data)
+        trail-space? (not= type :snapshot-link)]
     [:body
       [:table {:class "body"}
         [:tr
           [:td {:class "float-center", :align "center", :valign "top"}
-            (when-not (s/blank? (:note data)) (note data))
-            [:center
-              [:table {:class "container"}
-                [:tr
-                  (case type
-                    :snapshot (snapshot-content data)
-                    :snapshot-link (snapshot-link-content data)
-                    :invite (invite-content data))]]]
+            (when-not (s/blank? (:note data)) (note data trail-space?))
+            (when (and (s/blank? (:note data)) (= type :snapshot-link)) (spacer 15 "note"))
+            (if (= type :snapshot-link)
+              (snapshot-link-content data)
+              [:center
+                [:table {:class "container"}
+                  [:tr
+                    (case type
+                      :snapshot (snapshot-content data)
+                      :invite (invite-content data))]]])
             (when (= type :snapshot) (footer))]]]]))

 (defn- head [data]
@@ -489,7 +490,9 @@

   (def note "Hi all, here’s the latest info. Recruiting efforts paid off! Retention is down though, we’ll fix it. Let me know if you want to discuss before we meet next week.")
   (def snapshot (json/decode (slurp "./opt/samples/snapshots/green-labs.json")))
-  (spit "./hiccup.html" (content/snapshot-html (-> snapshot (assoc :note note) (assoc :company-slug "green-labs"))))
+  (spit "./hiccup.html" (content/snapshot-link-html (-> snapshot (assoc :note note) (assoc :company-slug "green-labs"))))
+
+  (spit "./hiccup.html" (content/snapshot-link-html (-> snapshot (assoc :note note) (assoc :company-slug "green-labs"))))

   (def note "Hi all, here’s the latest info. Recruiting efforts paid off! Retention is down though, we’ll fix it. Let me know if you want to discuss before we meet next week.")
   (def snapshot (json/decode (slurp "./opt/samples/snapshots/buff.json")))


Fix json+ld field.

Fix json+ld field.

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -368,21 +368,23 @@

 (defn- go-to-posts-script [data]
   [:script {:type "application/ld+json"}
-"{
+"
+{
   \"@context\": \"http://schema.org\",
   \"@type\": \"EmailMessage\",
   \"description\": \"" (digest-title (:org-name data) (weekly-digest? data)) "\",
   \"potentialAction\": {
-  \"@type\": \"ViewAction\",
-    \"target\": \"" (get-digest-url data) "\",
+    \"@type\": \"ViewAction\",
+    \"url\": \"" (get-digest-url data) "\",
     \"name\": \"Go to posts\"
   },
   \"publisher\": {
     \"@type\": \"Organization\",
     \"name\": \"Carrot\",
-    \"url\": \"" config/web-url "\",
+    \"url\": \"" config/web-url "\"
   }
-}"])
+}
+"])

 (defn- digest-content [digest]
   (let [logo-url (:logo-url digest)


Use unique handler key when getting server info to stop multiple concurrent info requests clobbering each other.

--- src/overtone/sc/info.clj
+++ src/overtone/sc/info.clj
@@ -55,7 +55,7 @@
                    :num-audio-buses (long nab)
                    :num-buffers (long nb)
                    :num-running-synths (long nrs)})))
-     ::server-info)
+     (keyword (str "overtone.sc.info/get-server-info_" (gensym))))
     (let [synth-id (snd-server-info)
           res (deref! prom)]
       (kill synth-id)


Fix up docstrings

Fix up docstrings

--- src/overtone/sc/info.clj
+++ src/overtone/sc/info.clj
@@ -27,6 +27,10 @@
                                             (num-running-synths)])))

 (defn server-info
+  "Fetches a bunch of useful server info. Has to trigger and poll a synth to
+  fetch data. See #'server-num-output-buses, #'server-num-input-buses,
+  #'server-num-audio-buses and #'sever-num-buffers for fast cached versions
+  of the static values in this info map."
   []
   (when (disconnected?)
     (throw (Exception. "Please connect to a server before attempting to ask for server-info.")))
@@ -55,7 +59,9 @@
       res)))

 (defn server-num-output-buses
-  "Returns the number of output buses accessible by the server. This number may change depending on host architecture but is static for a given running server for the duration of boot."
+  "Returns the number of output buses accessible by the server. This number may
+  change depending on host architecture but is static for a given running server
+  for the duration of boot."
   []
   (if-let [cnt @output-bus-count*]
     cnt
@@ -64,7 +70,9 @@
        (ref-set output-bus-count*  (:num-output-buses info))))))

 (defn server-num-input-buses
-  "Returns the number of input buses accessible by the server. This number may change depending on host architecture but is static for a given running server for the duration of boot."
+  "Returns the number of input buses accessible by the server. This number may
+  change depending on host architecture but is static for a given running
+  server for the duration of boot."
   []
   (if-let [cnt @input-bus-count*]
     cnt
@@ -73,7 +81,9 @@
        (ref-set input-bus-count*  (:num-input-buses info))))))

 (defn server-num-audio-buses
-  "Returns the number of audio buses accessible by the server. This number may change depending on host architecture but is static for a given running server for the duration of boot."
+  "Returns the number of audio buses accessible by the server. This number may
+  change depending on host architecture but is static for a given running server
+  for the duration of boot."
   []
   (if-let [cnt @audio-bus-count*]
     cnt
@@ -82,7 +92,9 @@
        (ref-set audio-bus-count*  (:num-audio-buses info))))))

 (defn server-num-buffers
-  "Returns the number of buffers accessible by the server. This number may change depending on host architecture but is static for a given running server for the duration of boot."
+  "Returns the number of buffers accessible by the server. This number may
+  change depending on host architecture but is static for a given running server
+  for the duration of boot."
   []
   (if-let [cnt @buffer-count*]
     cnt


fix stop-playing function to check if there is something to stop

--- src/parinfer/editor.cljs
+++ src/parinfer/editor.cljs
@@ -278,7 +278,8 @@

 (defn stop-playing!
   [key-]
-  (close! (get-in @vcr [key- :stop-chan])))
+  (when-let [stop-chan (get-in @vcr [key- :stop-chan])]
+    (close! stop-chan)))

 (defn print-recording!
   [key-]


Remove extra whitespaces

Remove extra whitespaces

--- src/pinpointer/core.cljc
+++ src/pinpointer/core.cljc
@@ -77,11 +77,11 @@

 (defn- print-headline [nproblems]
   (if (= nproblems 1)
-    (println " Detected 1 spec error:")
-    (println " Detected" nproblems "spec errors:")))
+    (println "Detected 1 spec error:")
+    (println "Detected" nproblems "spec errors:")))

 (defn- hline [width]
-  (->> (str " " (times (- width 2) \-) " ")
+  (->> (str (times width \-))
        (colorize :cyan)
        println))

@@ -108,13 +108,13 @@

 (defn- print-error [total value [i problem trace] opts]
   (letfn [(print-with-caption [caption s]
-            (println (str (pad-left caption 10) \:) s))
+            (println (str (pad-left caption 9) \:) s))
           (print-data [caption chunk]
             (let [val (:val (first chunk))
                   [line & lines] (format-data val chunk opts)]
               (print-with-caption caption line)
               (doseq [line lines]
-                (println "           " line))))
+                (println "          " line))))
           (print-spec [caption spec]
             (let [[line & lines] (as-> spec it
                                    (simplify-spec it)
@@ -122,21 +122,21 @@
                                    (str/split it #"\n"))]
               (print-with-caption caption line)
               (doseq [line lines]
-                (println "           " line))))]
+                (println "          " line))))]
    (let [[chunk & more] (rseq trace)]
-     (println (str " (" (inc i) "/" total ")\n"))
+     (println (str "(" (inc i) "/" total ")\n"))
      (print-data "Input" chunk)
      (print-spec "Expected" (:pred problem))
      (when-let [reason (:reason problem)]
-       (println (pad-left "Failure " 10))
+       (println (pad-left "Failure " 9))
        (print-with-caption "Reason" reason))
      (when (seq more)
        (doseq [chunk more]
-         (->> "\n    --- This comes originally from ---\n"
+         (->> "\n   --- This comes originally from ---\n"
               (colorize :cyan)
               println)
          (print-data "Original" chunk)
-         (println (pad-left "Spec" 10))
+         (println (pad-left "Spec" 9))
          (print-spec "Applied" (:spec (peek chunk))))))))

 (defn pinpoint-out
@@ -152,11 +152,10 @@
                     (catch #?(:clj Throwable :cljs :default) e e))]
        (cond (vector? traces)
              (binding [*colorize-fn* (choose-colorize-fn colorize)]
-               (newline)
                (print-headline nproblems)
                (hline width)
                (doseq [t (map vector (range) problems traces)]
-                 (print-error nproblems value t {:width width})
+                 (print-error nproblems value t {:width (max (- width 11) 0)})
                  (newline)
                  (hline width)))