Ring: preserve requirements through advanced agent edits
Work through Clojure examples of real application boundaries: Keep Ring mutation permissions at the request handler; Release Clojure file resources when parsing an order fails. Each recipe includes implementation code, integration prerequisites, failure-path tests to add, a Perch rule, and the captured broken/fixed source checks.
Download the Ring rule pack ZIP · Inspect the YAML rules
Clojure
Ring represents a request as data, but that does not make every field trusted. A verified session may establish the actor; path and body values still describe what the caller requests. Apply the write permission in the handler and send trusted scope to the persistence function.
Broken edit flagged · corrected edit passes
Clojure
line-seq is lazy and depends on an open reader. Realize the needed result inside with-open, then return independent data. A lazy result returned after closing the reader fails later; a reader never closed leaks descriptors on exceptions.
Broken edit flagged · corrected edit passes
Use a correction as a saved requirement
Choose the failure you need to prevent, add the scoped rule to your repository, and check both the broken and corrected implementation. Ask your agent to inspect the finding, repair the code and recheck the same rule. Keep framework tests beside the model check.
Perch keeps the requirement beside the code. Reuse the named check during the agent’s next edit and in CI, with cached answers free on unchanged requests.
Official Ring documentation · All language and framework recipes