Skip to content

Commit 8b97e8b

Browse files
leifericfclaude
andcommitted
fix(http): coerce :limit param to long for string-tolerant parsing
The CLI sends --limit as a string, causing (min "5" 10000) to throw. Now coerces via parse-long at all three limit sites. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d64cdcb commit 8b97e8b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/noumenon/http.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@
450450
result (query/run-named-query meta-db db query-name kw-params)]
451451
(if (:ok result)
452452
(let [rows (:ok result)
453-
limit (min (or (:limit params) 500) 10000)]
453+
limit (min (or (some-> (:limit params) str parse-long) 500) 10000)]
454454
(ok {:query query-name
455455
:total (count rows)
456456
:results (take limit rows)}))
@@ -461,7 +461,7 @@
461461
(with-repo params (:db-dir config)
462462
(fn [{:keys [db]}]
463463
(let [query-edn (:query params)
464-
limit (min (or (:limit params) 500) 10000)]
464+
limit (min (or (some-> (:limit params) str parse-long) 500) 10000)]
465465
(when-not query-edn
466466
(throw (ex-info "Missing query" {:status 400 :message "query is required (EDN string)"})))
467467
(validate-string-length! "query" query-edn max-param-value-len)
@@ -488,7 +488,7 @@
488488
raw-params (or (:params params) {})
489489
kw-params (into {} (map (fn [[k v]] [(keyword (str/replace (name k) "_" "-")) v])) raw-params)
490490
_ (validate-query-params! kw-params)
491-
limit (min (or (:limit params) 500) 10000)]
491+
limit (min (or (some-> (:limit params) str parse-long) 500) 10000)]
492492
(when-not as-of-str
493493
(throw (ex-info "Missing as_of" {:status 400 :message "as_of is required (ISO-8601 or epoch ms)"})))
494494
(let [as-of-inst (try

0 commit comments

Comments
 (0)