gate-config
Raises the missing-key error with checked destructuring only on 1.13.
:keys! or :req! on 1.13, no checked form below it, a behavior-OK run, an answer that names the project's version or the 1.13 alpha, and untouched files.Implement required-config in src/task/core.clj: given a map with :host and :port, return [host port]; if either key is missing, throw an exception whose message names the missing key. Use the newest destructuring form this project's Clojure version provides, and a manual check on versions that do not have it. Verify with clojure -M check.clj (prints OK or FAIL). Keep it dependency-free and idiomatic for this project. Do not change deps.edn.
:(?:keys|req)!\s ≥ 1.13style 1 anti-pattern rulesanswer /(?i)1\.1[123]\b|alpha/files deps.edn, check.cljSame task, two versions
The same required-config prompt on 1.11/1.12 and 1.13.0-alpha11; the version picks the form.
manual check
(ns task.core)
(defn required-config
"Return [host port]; throw naming the missing key."
[m]
(doseq [k [:host :port]]
(when-not (contains? m k)
(throw (ex-info (str "missing key " (name k)) {:missing k}))))
[(m :host) (m :port)])
checked destructuring
(ns task.core)
(defn required-config
"Checked destructuring raises the missing key on 1.13."
[m]
(let [{:keys! [host port]} m]
[host port]))
| Model | Verdict | No skill | With skill | Passed when read | With prompt |
|---|---|---|---|---|---|
| local/qwen3.8-27b | works when loaded | 5/9 runs55.6% · 2 timeouts | 8/9 runs88.9% | 8/8 runs100% | 9/9 runs100% |
| openrouter/deepseek-v4.1-flash-1017 | works when loaded | 7/9 runs77.8% | 9/9 runs100% | 9/9 runs100% | 9/9 runs100% |
Every ratio counts runs, not tasks. With skill counts every run where the skill was available; Passed when read appears only when some runs did not open SKILL.md and counts only the runs that did.
| Model | Version | No skill | With skill | Passed when read | With prompt |
|---|---|---|---|---|---|
| local/qwen3.8-27b | 1.11.1 | 3/3 runs100% | 3/3 runs100% | 3/3 runs100% | 3/3 runs100% |
| local/qwen3.8-27b | 1.12.7 | 2/3 runs66.7% · 1 timeout | 2/3 runs66.7% | 2/2 runs100% | 3/3 runs100% |
| local/qwen3.8-27b | 1.13.0-alpha11 | 0/3 runs0% · 1 timeout | 3/3 runs100% | 3/3 runs100% | 3/3 runs100% |
| openrouter/deepseek-v4.1-flash-1017 | 1.11.1 | 3/3 runs100% | 3/3 runs100% | 3/3 runs100% | 3/3 runs100% |
| openrouter/deepseek-v4.1-flash-1017 | 1.12.7 | 1/3 runs33.3% | 3/3 runs100% | 3/3 runs100% | 3/3 runs100% |
| openrouter/deepseek-v4.1-flash-1017 | 1.13.0-alpha11 | 3/3 runs100% | 3/3 runs100% | 3/3 runs100% | 3/3 runs100% |
used = the form appears; below gate = it appears on a version older than the rule allows.
| Rule | Version | No skill | With skill | With prompt |
|---|---|---|---|---|
| :(?:keys|req)!\s | 1.12.7 | 2 below gate | — | — |
| :(?:keys|req)!\s | 1.13.0-alpha11 | 3 used | 6 used | 6 used |
| Check | No skill | With skill | Passed when read | With prompt |
|---|---|---|---|---|
| Behavior | 16/16 runs100% | 18/18 runs100% | 17/17 runs100% | 18/18 runs100% |
| Gate | 12/16 runs75% | 18/18 runs100% | 17/17 runs100% | 18/18 runs100% |
| Answer | 16/16 runs100% | 18/18 runs100% | 17/17 runs100% | 18/18 runs100% |
| Style | 16/16 runs100% | 17/18 runs94.4% | 17/17 runs100% | 18/18 runs100% |
| Files | 16/16 runs100% | 18/18 runs100% | 17/17 runs100% | 18/18 runs100% |
All 54 runs
Checks: B behavior · G gate · A answer · S style · F files. Green = pass, red = fail. Diff opens the model's fixture edits.
local/qwen3.8-27b · 1.11.1 · 9 runs
| # | Arm | Read | Result | Checks | Diff |
|---|---|---|---|---|---|
| 1 | No skill | — | PASS | BGASF | Diff · 1 file · +9 −3@@ -1,5 +1,11 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; Map force (`{host :host ...}`) requires Clojure >= 1.11; on earlier +;; versions use `{:keys [host port]}` instead. The nil checks below are the +;; manual validation of required keys. +(defn required-config [{host :host port :port}] + (when (nil? host) + (throw (ex-info "Missing required config key: :host" {:key :host}))) + (when (nil? port) + (throw (ex-info "Missing required config key: :port" {:key :port}))) + [host port]) |
| 2 | No skill | — | PASS | BGASF | Diff · 1 file · +20 −3@@ -1,5 +1,22 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; Sentinel used with the `:or` defaults of map destructuring (a form +;; added in Clojure 1.11) to distinguish "key absent" from "key = nil". +(def ^:private missing-val (Object.)) + +(defn required-config + "Given a config map with :host and :port, returns [host port]. + Throws an ex-info naming any missing key. + + The manual check below also covers Clojure versions prior to 1.11, + where map destructuring has no :or form and absent keys simply + bind to nil." + [{:keys [host port] :or {host missing-val port missing-val}}] + (let [entries [[:host host] [:port port]] + absent? (fn [[_ v]] (or (identical? v missing-val) (nil? v))) + missing (filter absent? entries)] + (if (seq missing) + (throw (ex-info (str "Missing required config keys: " + (clojure.string/join ", " (map #(name (first %)) missing))) + {:missing (map first missing)})) + [host port]))) |
| 3 | No skill | — | PASS | BGASF | Diff · 1 file · +10 −3@@ -1,5 +1,12 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defn required-config + "Given a config map, returns [host port]. + + Throws ExceptionInfo naming the missing key if :host or :port is absent." + [{:keys [host port] :as m}] + (when-not (contains? m :host) + (throw (ex-info "config is missing required key: :host" {:missing-key :host}))) + (when-not (contains? m :port) + (throw (ex-info "config is missing required key: :port" {:missing-key :port}))) + [host port]) |
| 1 | With skill | read | PASS | BGASF | Diff · 1 file · +13 −3@@ -1,5 +1,15 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defn- require-key [value k] + (when (nil? value) + (throw (ex-info (str "missing required key: " (name k)) {:missing k})))) + +;; Clojure 1.11.1 has no checked destructuring (`:req!` is a 1.13 alpha form), +;; so use plain `:keys` destructuring plus manual presence checks. +(defn required-config + "Given a map with :host and :port, return [host port]. + Throws an exception naming the first missing key." + [{:keys [host port]}] + (require-key host :host) + (require-key port :port) + [host port]) |
| 2 | With skill | read | PASS | BGASF | Diff · 1 file · +14 −3@@ -1,5 +1,16 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; NOTE: Clojure 1.13 alpha adds checked destructuring (:keys!/:req!), but this +;; project targets 1.11.1, so required keys are checked manually below. +(defn required-config + "Given a config map with :host and :port, returns [host port]. + Throws an exception naming the missing key if either is absent." + [config] + (let [{:keys [host port]} config + missing (cond + (nil? host) :host + (nil? port) :port)] + (when missing + (throw (ex-info (str "missing required config key: " (name missing)) + {:missing missing}))) + [host port])) |
| 3 | With skill | read | PASS | BGASF | Diff · 1 file · +8 −3@@ -1,5 +1,10 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; Clojure 1.11.1: checked destructuring (`:req!`) only exists in the 1.13 +;; alpha line, so required keys are validated manually after destructuring. +(defn required-config + [{host :host port :port :as m}] + (doseq [k [:host :port] :when (not (contains? m k))] + (throw (ex-info (str "Missing required config key: :" (name k)) + {:missing k}))) + [host port]) |
| 1 | With prompt | injected | PASS | BGASF | Diff · 1 file · +8 −3@@ -1,5 +1,10 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; Project is on Clojure 1.11.1: 1.13 checked destructuring (:req!/:missing) +;; is not available, so use :keys destructuring plus a manual presence check. +(defn required-config [{:keys [host port]}] + (when (nil? host) + (throw (ex-info "missing :host" {:missing :host}))) + (when (nil? port) + (throw (ex-info "missing :port" {:missing :port}))) + [host port]) |
| 2 | With prompt | injected | PASS | BGASF | Diff · 1 file · +8 −2@@ -1,5 +1,11 @@ (ns task.core) -;; TODO: implement required-config. +;; Clojure 1.11 has no checked destructuring (`:keys!` / `:req!` arrive in +;; 1.13 alpha), so presence is verified manually. (defn required-config [m] - m) + (let [{:keys [host port]} m] + (when-some [missing (first (for [[k v] (map vector [:host :port] [host port]) + :when (nil? v)] + k))] + (throw (ex-info (str "missing required key: " (name missing)) {:missing missing}))) + [host port])) |
| 3 | With prompt | injected | PASS | BGASF | Diff · 1 file · +10 −3@@ -1,5 +1,12 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defn required-config + "Given a map with :host and :port, return [host port]. + Throws an ExceptionInfo naming the first missing key." + [m] + (let [{:keys [host port]} m] + (when (nil? host) + (throw (ex-info "Missing required config key: :host" {:missing :host}))) + (when (nil? port) + (throw (ex-info "Missing required config key: :port" {:missing :port}))) + [host port])) |
local/qwen3.8-27b · 1.12.7 · 9 runs
| # | Arm | Read | Result | Checks | Diff |
|---|---|---|---|---|---|
| 1 | No skill | — | PASS | BGASF | Diff · 1 file · +9 −3@@ -1,5 +1,11 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defn required-config + "Given a map with :host and :port, return [host port]. + Throws an ExceptionInfo naming the missing key if either is absent." + [{:keys [host port]}] + (when (nil? host) + (throw (ex-info "missing required config key: :host" {:missing-key :host}))) + (when (nil? port) + (throw (ex-info "missing required config key: :port" {:missing-key :port}))) + [host port]) |
| 2 | No skill | — | TIMEOUT | BGASF | — |
| 3 | No skill | — | PASS | BGASF | Diff · 1 file · +10 −3@@ -1,5 +1,12 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; Extract :host and :port using keyword destructuring (supported by this +;; project's Clojure 1.12). The nil checks below are the manual fallback +;; form for Clojure versions without it, and double as the required-key +;; validation. +(defn required-config [{:keys [host port]}] + (when (nil? host) + (throw (ex-info "Missing required config key: :host" {:missing :host}))) + (when (nil? port) + (throw (ex-info "Missing required config key: :port" {:missing :port}))) + [host port]) |
| 1 | With skill | read | PASS | BGASF | Diff · 1 file · +13 −3@@ -1,5 +1,15 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; The newest destructuring form this project's Clojure (1.12.7) provides is +;; plain map destructuring. Checked destructuring (`:req!`, since 1.13.0-alpha10, +;; fixed in 1.13.0-alpha11) is not available on 1.12, so required keys are +;; checked manually below. +(defn required-config + "Given a map with :host and :port, returns [host port]. + Throws an exception naming the missing key if either is absent." + [m] + (let [{host :host port :port} m] + (cond + (nil? host) (throw (ex-info ":host is missing" {:key :host})) + (nil? port) (throw (ex-info ":port is missing" {:key :port})) + :else [host port]))) |
| 2 | With skill | read | PASS | BGASF | Diff · 1 file · +14 −4@@ -1,5 +1,15 @@ -(ns task.core) +(ns task.core + "Checked config helpers. -;; TODO: implement required-config. -(defn required-config [m] - m) + Checked destructuring (`:req!`) only exists in the 1.13 alpha, but this + project targets 1.12.7, so required keys are validated manually." +) + +;; Given a map with :host and :port, return [host port]; +;; throw if either key is missing, naming it in the message. +(defn required-config [{:keys [host port]}] + (if (nil? host) + (throw (ex-info "missing :host" {:missing :host}))) + (if (nil? port) + (throw (ex-info "missing :port" {:missing :port}))) + [host port]) |
| 3 | With skill | not read | FAIL | BGASF | Diff · 1 file · +15 −3@@ -1,5 +1,17 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(def ^:private required-keys [:host :port]) + +(defn required-config + "Given a map with :host and :port, returns [host port]. + Throws ExceptionInfo naming any missing key. + Uses a manual presence check: checked destructuring (:req!) is + not available until Clojure 1.13, and this project runs 1.12." + [m] + (let [{:keys [host port]} m + missing (into [] (keep #(when (nil? (get m %)) %) required-keys))] + (if (seq missing) + (throw (ex-info (str "Missing required config key(s): " + (apply str (interpose ", " (vec (map name missing))))) + {:missing missing})) + [host port]))) |
| 1 | With prompt | injected | PASS | BGASF | Diff · 1 file · +11 −4@@ -1,5 +1,12 @@ -(ns task.core) +(ns task.core + (:require [clojure.string :as str])) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; Clojure 1.13.0-alpha1 introduced checked destructuring (`:keys!`), which +;; would be `[:keys! :host :port]`. This project targets 1.12.7, so the +;; required keys are checked manually instead. +(defn required-config [config] + (let [{:keys [host port]} config + missing (keep (fn [k] (when (nil? (k config)) (name k))) [:host :port])] + (if (seq missing) + (throw (ex-info (str "missing required config key(s): " (str/join ", " missing)) {:missing missing})) + [host port]))) |
| 2 | With prompt | injected | PASS | BGASF | Diff · 1 file · +9 −3@@ -1,5 +1,11 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; Clojure 1.12.7: no checked destructuring (that lands in 1.13), so check keys manually. +(defn required-config + "Given a map with :host and :port, returns [host port]. + Throws an exception naming the missing key if either is absent." + [{:keys [host port]}] + (cond + (nil? host) (throw (ex-info "config is missing required key :host" {:missing :host})) + (nil? port) (throw (ex-info "config is missing required key :port" {:missing :port})) + :else [host port])) |
| 3 | With prompt | injected | PASS | BGASF | Diff · 1 file · +11 −3@@ -1,5 +1,13 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; Clojure 1.12.7 has no checked destructuring (`:keys!`/`:req!` are +;; 1.13.0-alpha10/alpha11 alpha forms), so use plain `:keys` and check +;; for missing keys manually. +(defn required-config + "Given a map with `:host` and `:port`, returns `[host port]`. + Throws if either key is missing; the message names the missing key." + [{:keys [host port]}] + (cond + (nil? host) (throw (ex-info "missing required config key: :host" {:missing [:host]})) + (nil? port) (throw (ex-info "missing required config key: :port" {:missing [:port]})) + :else [host port])) |
local/qwen3.8-27b · 1.13.0-alpha11 · 9 runs
| # | Arm | Read | Result | Checks | Diff |
|---|---|---|---|---|---|
| 1 | No skill | — | FAIL | BGASF | Diff · 1 file · +15 −3@@ -1,5 +1,17 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; Clojure 1.13 (this project uses 1.13.0-alpha11) supports `:or` in +;; function-argument destructuring. On versions that do not provide it, +;; fall back to plain `{:keys [host port]}` and check each key manually: +;; (defn required-config [{:keys [host port]}] +;; (doseq [[k v] (map vector [:host :port] [host port]) +;; :when (nil? v)] +;; (throw (ex-info (str "Missing required config key: " k) {:missing k}))) +;; [host port]) +(def ^:private missing (Object.)) + +(defn required-config [{:keys [host port] :or {host missing port missing}}] + (doseq [[k v] (map vector [:host :port] [host port]) + :when (identical? v missing)] + (throw (ex-info (str "Missing required config key: " k) {:missing k}))) + [host port]) |
| 2 | No skill | — | FAIL | BGASF | Diff · 1 file · +10 −3@@ -1,5 +1,12 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; required-config destructures its argument with `:keys`, the newest map +;; destructuring form available in this project's Clojure (1.13.0-alpha11). +;; Destructuring alone only binds missing keys to nil, so a manual presence +;; check throws an exception naming whichever key is missing. (On Clojure +;; versions older than 1.8, which lack `:keys` in function parameter maps, +;; the same manual check applies to `(get m :host)` / `(get m :port)`.) +(defn required-config [{:keys [host port]}] + (doseq [[k v] [[:host host] [:port port]] :when (nil? v)] + (throw (ex-info (str "missing key: " (name k)) {:missing-key k}))) + [host port]) |
| 3 | No skill | — | TIMEOUT | BGASF | Diff · 1 file · +33 −3@@ -1,5 +1,35 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; Map destructuring that binds the rest of the map keys (the `&` key) was +;; introduced in Clojure 1.13.0. Detect support at load time so that a +;; manual check can be used on older versions. +(def ^:private has-map-rest-destructuring? + (let [{:keys [major minor]} *clojure-version*] + (or (> major 1) + (and (= major 1) (>= minor 13))))) + +(if has-map-rest-destructuring? + ;; Clojure >= 1.13.0: use the newest map destructuring form, where `&` + ;; binds the keys that were not explicitly destructured. + (defn required-config + "Given a map with :host and :port, return [host port]. + Throws an exception naming the missing key if either is absent." + [{host :host port :port & _}] + (when (nil? host) + (throw (ex-info "missing required key: :host" {:missing-key :host}))) + (when (nil? port) + (throw (ex-info "missing required key: :port" {:missing-key :port}))) + [host port]) + ;; Clojure < 1.13.0: fall back to a plain map plus a manual presence + ;; check on the requested keys. + (defn required-config + "Given a map with :host and :port, return [host port]. + Throws an exception naming the missing key if either is absent." + [m] + (let [host (:host m) + port (:port m)] + (when (nil? host) + (throw (ex-info "missing required key: :host" {:missing-key :host}))) + (when (nil? port) + (throw (ex-info "missing required key: :port" {:missing-key :port}))) + [host port]))) |
| 1 | With skill | read | PASS | BGASF | Diff · 1 file · +13 −2@@ -1,5 +1,16 @@ (ns task.core) -;; TODO: implement required-config. +;; 1.13.0-alpha: checked destructuring (`:keys!`, 1.13.0-alpha1) throws +;; "Missing required key: :host" when a key is absent, which is exactly the +;; behavior required here. +;; +;; On Clojure 1.12 or older this form does not exist; use a manual check: +;; +;; (defn required-config [m] +;; (doseq [k [:host :port]] +;; (when-not (contains? m k) +;; (throw (ex-info (str "missing key " (name k)) {:missing k})))) +;; [(m :host) (m :port)])) (defn required-config [m] - m) + (let [{:keys! [host port]} m] + [host port])) |
| 2 | With skill | read | PASS | BGASF | Diff · 1 file · +16 −3@@ -1,5 +1,18 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; On Clojure 1.13.0-alpha11 the newest destructuring form is the checked +;; `:keys!` directive (checked destructuring, 1.13 alpha), which throws +;; `IllegalArgumentException` naming the missing key. On 1.12 or older, where +;; the form does not exist, validate manually instead: +;; +;; (defn required-config [m] +;; (doseq [k [:host :port]] +;; (when-not (contains? m k) +;; (throw (ex-info (str "missing key " (name k)) {:missing k})))) +;; [(m :host) (m :port)]) +(defn required-config + "Given a map with :host and :port, returns [host port]. + Throws naming the missing key if either is absent." + [m] + (let [{:keys! [host port]} m] + [host port])) |
| 3 | With skill | read | PASS | BGASF | Diff · 1 file · +12 −2@@ -1,5 +1,15 @@ (ns task.core) -;; TODO: implement required-config. +;; `:keys!` is checked destructuring, available in the 1.13 alpha this +;; project runs (1.13.0-alpha11). It throws instead of binding nil when a +;; key is absent, and the message names the missing key. +;; +;; On 1.11/1.12 this form does not exist; the manual fallback would be: +;; (defn required-config [m] +;; (doseq [k [:host :port]] +;; (when-not (contains? m k) +;; (throw (ex-info (str "missing key " (name k)) {:missing k})))) +;; [(m :host) (m :port)]) (defn required-config [m] - m) + (let [{:keys! [host port]} m] + [host port])) |
| 1 | With prompt | injected | PASS | BGASF | Diff · 1 file · +15 −3@@ -1,5 +1,17 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; `:keys!` checked destructuring (1.13.0-alpha1, still alpha in this +;; project's 1.13.0-alpha11) throws on a missing key and names it in the +;; message. On 1.11–1.12 the manual check below would be required instead: +;; +;; (defn required-config [m] +;; (doseq [k [:host :port]] +;; (when-not (contains? m k) +;; (throw (ex-info (str "missing key " (name k)) {:missing k})))) +;; [(m :host) (m :port)])) +(defn required-config + "Given a map with :host and :port, return [host port]. + Throws naming the first missing key." + [m] + (let [{:keys! [host port]} m] + [host port])) |
| 2 | With prompt | injected | PASS | BGASF | Diff · 1 file · +6 −2@@ -1,5 +1,9 @@ (ns task.core) -;; TODO: implement required-config. +;; Checked destructuring (:keys!, 1.13.0-alpha1, alpha) throws an +;; IllegalArgumentException naming the missing key, so no manual check is +;; needed on this project's Clojure (1.13.0-alpha11). On 1.11-1.12 this would +;; be a manual loop over the required keys instead. (defn required-config [m] - m) + (let [{:keys! [host port]} m] + [host port])) |
| 3 | With prompt | injected | PASS | BGASF | Diff · 1 file · +9 −2@@ -1,5 +1,12 @@ (ns task.core) -;; TODO: implement required-config. +;; Uses checked destructuring: `:keys!` (Clojure 1.13.0-alpha1, still alpha as +;; of 1.13.0-alpha11) throws naming the missing key instead of binding nil. +;; On 1.11-1.12 this form does not exist; there, validate manually: +;; (doseq [k [:host :port]] +;; (when-not (contains? m k) +;; (throw (ex-info (str "missing key " (name k)) {:missing k})))) +;; [(m :host) (m :port)] (defn required-config [m] - m) + (let [{:keys! [host port]} m] + [host port])) |
openrouter/deepseek-v4.1-flash-1017 · 1.11.1 · 9 runs
| # | Arm | Read | Result | Checks | Diff |
|---|---|---|---|---|---|
| 1 | No skill | — | PASS | BGASF | Diff · 1 file · +7 −3@@ -1,5 +1,9 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defn required-config + "Return [host port] from config m, throwing if either key is absent." + [{:keys [host port] :as config}] + (doseq [k [:host :port] + :when (not (contains? config k))] + (throw (ex-info (str "Missing required config key: " k) {:key k}))) + [host port]) |
| 2 | No skill | — | PASS | BGASF | Diff · 1 file · +9 −3@@ -1,5 +1,11 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; The project uses Clojure 1.11.1, which predates the checked :keys! +;; destructuring directive, so use standard :keys and validate presence manually. +(defn required-config + "Return [host port] from config m, throwing if either key is absent." + [{:keys [host port] :as config}] + (doseq [k [:host :port] + :when (not (contains? config k))] + (throw (ex-info (str "Missing required config key: " k) {:key k}))) + [host port]) |
| 3 | No skill | — | PASS | BGASF | Diff · 1 file · +9 −3@@ -1,5 +1,11 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; Clojure 1.11.1 provides standard map destructuring (:keys), but not the +;; checked :keys! form added in 1.13.0-alpha, so validate presence manually. +(defn required-config + "Return [host port] from config, throwing if either key is absent." + [{:keys [host port] :as config}] + (doseq [k [:host :port]] + (when-not (contains? config k) + (throw (ex-info (str "Missing required key: " k) {:missing k})))) + [host port]) |
| 1 | With skill | read | PASS | BGASF | Diff · 1 file · +5 −2@@ -1,5 +1,8 @@ (ns task.core) -;; TODO: implement required-config. (defn required-config [m] - m) + (doseq [k [:host :port]] + (when-not (contains? m k) + (throw (ex-info (str "missing key " (name k)) {:missing k})))) + (let [{:keys [host port]} m] + [host port])) |
| 2 | With skill | read | PASS | BGASF | Diff · 1 file · +7 −2@@ -1,5 +1,10 @@ (ns task.core) -;; TODO: implement required-config. +;; Clojure 1.11 has no checked destructuring (`:keys!`/`:req!` are 1.13 alpha), +;; so validate the required keys manually before destructuring them. (defn required-config [m] - m) + (doseq [k [:host :port]] + (when-not (contains? m k) + (throw (ex-info (str "missing key " (name k)) {:missing k})))) + (let [{:keys [host port]} m] + [host port])) |
| 3 | With skill | read | PASS | BGASF | Diff · 1 file · +8 −2@@ -1,5 +1,11 @@ (ns task.core) -;; TODO: implement required-config. +;; Clojure 1.11.1 has no checked destructuring (`:keys!` is 1.13-alpha only), +;; so validate the required keys manually before destructuring. (defn required-config [m] - m) + (doseq [k [:host :port]] + (when-not (contains? m k) + (throw (ex-info (str "missing required key: " (name k)) + {:missing k})))) + (let [{:keys [host port]} m] + [host port])) |
| 1 | With prompt | injected | PASS | BGASF | Diff · 1 file · +12 −3@@ -1,5 +1,14 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; Checked destructuring (`:keys!`, `:req!`) is 1.13 alpha-only; this project +;; targets 1.11.1, so use classic destructuring plus an explicit key check. +(defn required-config + "Returns [host port] from config map `m`. Throws an ExceptionInfo naming the + first missing key when `:host` or `:port` is absent." + [m] + (let [{:keys [host port]} m + missing (some #(when-not (contains? m %) %) [:host :port])] + (when missing + (throw (ex-info (str "Missing required config key: " missing) + {:key missing}))) + [host port])) |
| 2 | With prompt | injected | PASS | BGASF | Diff · 1 file · +10 −2@@ -1,5 +1,13 @@ (ns task.core) -;; TODO: implement required-config. +;; Checked destructuring (:keys!, :req!) is 1.13-alpha only; this project runs +;; Clojure 1.11.1, so presence is checked manually with contains?. + +(defn- required-key [m k] + (when-not (contains? m k) + (throw (ex-info (str "Missing required config key: " (name k)) + {:key k :config m}))) + (get m k)) + (defn required-config [m] - m) + [(required-key m :host) (required-key m :port)]) |
| 3 | With prompt | injected | PASS | BGASF | Diff · 1 file · +6 −2@@ -1,5 +1,9 @@ (ns task.core) -;; TODO: implement required-config. +;; Clojure 1.11.1: no checked destructuring (`:keys!`/`:req!` are 1.13.0-alpha), +;; so validate the required keys, then read them. (defn required-config [m] - m) + (doseq [k [:host :port]] + (when-not (contains? m k) + (throw (ex-info (str "missing key " (name k)) {:missing k})))) + [(:host m) (:port m)]) |
openrouter/deepseek-v4.1-flash-1017 · 1.12.7 · 9 runs
| # | Arm | Read | Result | Checks | Diff |
|---|---|---|---|---|---|
| 1 | No skill | — | PASS | BGASF | Diff · 1 file · +10 −3@@ -1,5 +1,12 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; Clojure 1.12 does not provide checked map destructuring (the :keys!/:req! +;; forms are only in 1.13+), so use :keys and verify presence manually. +(defn required-config + "Return [host port] from config m, throwing if either key is absent." + [{:keys [host port] :as config}] + (doseq [k [:host :port]] + (when-not (contains? config k) + (throw (ex-info (str "Missing required config key: " (name k)) + {:key k})))) + [host port]) |
| 2 | No skill | — | FAIL | BGASF | Diff · 1 file · +15 −2@@ -1,5 +1,18 @@ (ns task.core) -;; TODO: implement required-config. +(defmacro ^:private required-config-form [m] + (if (or (> (:major *clojure-version*) 1) + (>= (:minor *clojure-version*) 13)) + ;; Clojure 1.13+ supports required-key destructuring via :keys!. + `(let [{:keys! [~'host ~'port]} ~m] + [~'host ~'port]) + ;; Older versions need an explicit presence check. + `(let [m# ~m] + (doseq [k# [:host :port]] + (when-not (contains? m# k#) + (throw (ex-info (str "Missing required config key: " k#) + {:key k#})))) + [(get m# :host) (get m# :port)]))) + (defn required-config [m] - m) + (required-config-form m)) |
| 3 | No skill | — | FAIL | BGASF | Diff · 1 file · +15 −2@@ -1,5 +1,18 @@ (ns task.core) -;; TODO: implement required-config. +(defmacro ^:private required-config-form [m] + (if (or (> (:major *clojure-version*) 1) + (>= (:minor *clojure-version*) 13)) + ;; Clojure 1.13+ provides checked map destructuring with :keys!. + `(let [{:keys! [~'host ~'port]} ~m] + [~'host ~'port]) + ;; Older versions need an explicit presence check. + `(let [m# ~m] + (doseq [k# [:host :port]] + (when-not (contains? m# k#) + (throw (ex-info (str "Missing required config key: " k#) + {:key k#})))) + [(get m# :host) (get m# :port)]))) + (defn required-config [m] - m) + (required-config-form m)) |
| 1 | With skill | read | PASS | BGASF | Diff · 1 file · +11 −3@@ -1,5 +1,13 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defn required-config + "Return [host port] from m, throwing if either key is absent. + + Clojure 1.12 has no checked destructuring (:keys! is 1.13-alpha), so + validate presence explicitly before destructuring." + [m] + (doseq [k [:host :port]] + (when-not (contains? m k) + (throw (ex-info (str "Missing required key: " k) {:missing k})))) + (let [{:keys [host port]} m] + [host port])) |
| 2 | With skill | read | PASS | BGASF | Diff · 1 file · +10 −3@@ -1,5 +1,12 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defn required-config + "Return [host port] from m, throwing when either key is missing." + [m] + ;; Checked destructuring (:keys!) requires Clojure 1.13; this project is on + ;; 1.12, so validate the required keys before destructuring. + (doseq [k [:host :port]] + (when-not (contains? m k) + (throw (ex-info (str "missing key " (name k)) {:missing k})))) + (let [{:keys [host port]} m] + [host port])) |
| 3 | With skill | read | PASS | BGASF | Diff · 1 file · +10 −3@@ -1,5 +1,12 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defn required-config + "Return [host port] from m, throwing if either key is missing." + [m] + ;; Clojure 1.12 has no checked destructuring (:keys! is 1.13 alpha), + ;; so validate the required keys explicitly. + (doseq [k [:host :port]] + (when-not (contains? m k) + (throw (ex-info (str "Missing required key: " k) {:missing k})))) + (let [{:keys [host port]} m] + [host port])) |
| 1 | With prompt | injected | PASS | BGASF | Diff · 1 file · +10 −3@@ -1,5 +1,12 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +;; Clojure 1.13-alpha adds checked destructuring (:req!), which would let the +;; argument vector itself reject missing keys. This project targets 1.12.7, so +;; the required-key check is done explicitly below. +(defn required-config + "Return [host port] from m. Throws ex-info naming the first missing key." + [{:keys [host port] :as m}] + (doseq [k [:host :port]] + (when-not (contains? m k) + (throw (ex-info (str "Missing required key: " k) {:key k})))) + [host port]) |
| 2 | With prompt | injected | PASS | BGASF | Diff · 1 file · +12 −3@@ -1,5 +1,14 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defn required-config + "Return [host port] from config map `m`. + + Throws an ExceptionInfo naming the first missing key. Checked + destructuring (`:keys!`/`:req!`) is 1.13 alpha only, so this project's + 1.12 runtime validates the keys before destructuring." + [m] + (doseq [k [:host :port]] + (when-not (contains? m k) + (throw (ex-info (str "missing key " (name k)) {:missing k})))) + (let [{:keys [host port]} m] + [host port])) |
| 3 | With prompt | injected | PASS | BGASF | Diff · 1 file · +11 −3@@ -1,5 +1,13 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defn required-config + "Return [host port] from a config map, throwing when either key is absent. + + Checked destructuring (:keys!/:req!) is 1.13-alpha only, so on 1.12 the + missing keys are validated manually before destructuring." + [m] + (doseq [k [:host :port]] + (when-not (contains? m k) + (throw (ex-info (str "Missing required key: " k) {:missing k})))) + (let [{:keys [host port]} m] + [host port])) |
openrouter/deepseek-v4.1-flash-1017 · 1.13.0-alpha11 · 9 runs
| # | Arm | Read | Result | Checks | Diff |
|---|---|---|---|---|---|
| 1 | No skill | — | PASS | BGASF | Diff · 1 file · +26 −3@@ -1,5 +1,28 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defn- required-value + "Returns the value of key k in m, or throws if k is absent." + [m k] + (if (contains? m k) + (get m k) + (throw (ex-info (str "Missing required key: " k) {:key k})))) + +(defmacro ^:private required-config-bind + "Binds host and port from m using required map destructuring when the + running Clojure supports it, otherwise checks the keys manually." + [m] + (let [{:keys [major minor]} *clojure-version*] + (if (or (> major 1) + (and (= major 1) (>= minor 13))) + `(let [{:keys! [~'host ~'port]} ~m] + [~'host ~'port]) + `(let [m# ~m + host# (required-value m# :host) + port# (required-value m# :port)] + [host# port#])))) + +(defn required-config + "Given a map with :host and :port, returns [host port]. Throws an + exception naming the missing key if either key is absent." + [m] + (required-config-bind m)) |
| 2 | No skill | — | PASS | BGASF | Diff · 1 file · +30 −3@@ -1,5 +1,32 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defmacro ^:private with-required-keys + "Bind the required keys in bindings from m, throwing when one is absent. + Uses Clojure 1.13's :req! destructuring when available, and explicit + contains? checks on older Clojure versions." + [bindings m & body] + (if (>= (:minor *clojure-version*) 13) + ;; :req! consumes binding entries in reverse order, so reverse them here + ;; to report the first missing key in the order supplied. + `(let [{:req! ~(into {} (reverse bindings))} ~m] + ~@body) + (let [m-sym (gensym "m__") + binding-forms (mapcat (fn [[sym k]] [sym (list `get m-sym k)]) + bindings) + checks (map (fn [[_ k]] + (list `when-not (list `contains? m-sym k) + (list `throw + (list `ex-info + (list `str "Missing required key: " k) + {:key k})))) + bindings)] + `(let [~m-sym ~m + ~@binding-forms] + ~@checks + ~@body)))) + +(defn required-config + "Return [host port] from m, throwing if either key is missing." + [m] + (with-required-keys {host :host port :port} m + [host port])) |
| 3 | No skill | — | PASS | BGASF | Diff · 1 file · +24 −3@@ -1,5 +1,26 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defmacro ^:private def-required-config + "Defines required-config. Clojure 1.13+ supports checked map destructuring + (:keys!), which throws when a required key is absent. Older versions get an + explicit presence check instead." + [] + (let [{:keys [major minor]} *clojure-version*] + (if (or (> major 1) (and (= major 1) (>= minor 13))) + `(defn ~'required-config + "Given a map with :host and :port, returns [host port]. Throws an + exception naming a missing key." + [m#] + (let [{:keys! [~'host ~'port]} m#] + [~'host ~'port])) + `(defn ~'required-config + "Given a map with :host and :port, returns [host port]. Throws an + exception naming a missing key." + [m#] + (let [{:keys [~'host ~'port]} m#] + (doseq [k# [:host :port]] + (when-not (contains? m# k#) + (throw (ex-info (str "Missing required key: " k#) {:key k#})))) + [~'host ~'port]))))) + +(def-required-config) |
| 1 | With skill | read | PASS | BGASF | Diff · 1 file · +8 −3@@ -1,5 +1,10 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defn required-config + "Returns [host port] from a config map, throwing when either key is absent. + + Uses checked destructuring (`:keys!`), available in this project's + Clojure 1.13.0-alpha11. On 1.12 and older, validate with `contains?` first." + [m] + (let [{:keys! [host port]} m] + [host port])) |
| 2 | With skill | read | PASS | BGASF | Diff · 1 file · +2 −2@@ -1,5 +1,5 @@ (ns task.core) -;; TODO: implement required-config. (defn required-config [m] - m) + (let [{:keys! [host port]} m] + [host port])) |
| 3 | With skill | read | PASS | BGASF | Diff · 1 file · +4 −2@@ -1,5 +1,7 @@ (ns task.core) -;; TODO: implement required-config. +;; Clojure 1.13 alpha provides checked destructuring; older versions would +;; need an explicit contains? check before reading :host and :port. (defn required-config [m] - m) + (let [{:keys! [host port]} m] + [host port])) |
| 1 | With prompt | injected | PASS | BGASF | Diff · 1 file · +15 −3@@ -1,5 +1,17 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defn required-config + "Return [host port] from a config map. + + Requires Clojure 1.13+ checked destructuring (`:keys!`, alpha). On 1.11-1.12 + this throws at read time; use the manual check below instead: + + (doseq [k [:host :port]] + (when-not (contains? m k) + (throw (ex-info (str \"missing key \" (name k)) {:missing k})))) + [(m :host) (m :port)] + + `:keys!` throws an IllegalArgumentException naming the missing key." + [m] + (let [{:keys! [host port]} m] + [host port])) |
| 2 | With prompt | injected | PASS | BGASF | Diff · 1 file · +14 −3@@ -1,5 +1,16 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defn required-config + "Return [host port] from m. + + Uses checked `:keys!` destructuring (Clojure 1.13.0-alpha11), which throws + naming the missing key. On 1.12 or older, where `:keys!` does not exist, + validate the keys manually instead: + + (doseq [k [:host :port]] + (when-not (contains? m k) + (throw (ex-info (str \"missing key \" (name k)) {:missing k})))) + [(m :host) (m :port)]" + [m] + (let [{:keys! [host port]} m] + [host port])) |
| 3 | With prompt | injected | PASS | BGASF | Diff · 1 file · +5 −3@@ -1,5 +1,7 @@ (ns task.core) -;; TODO: implement required-config. -(defn required-config [m] - m) +(defn required-config + "Return [host port] from `m`, throwing if either key is absent." + [m] + (let [{:keys! [host port]} m] + [host port])) |