Add ->command helper fn#14
Open
bpringe wants to merge 3 commits into
Open
Conversation
bpringe
commented
May 30, 2026
| :query/timestamp (time/now) | ||
| :query/id (random-uuid)})) | ||
| :query/result)) | ||
| @(def counters |
Contributor
Author
There was a problem hiding this comment.
Added @ for convenience - so the value of counters is returned when this form is evaluated.
There was a problem hiding this comment.
Pull request overview
Adds a cp/->command helper to standardize command construction by ensuring :command/id and :command/timestamp are present, and updates the example/demo and server-side decoding to use it.
Changes:
- Introduces
ai.obney.grain.command-processor-v2.interface/->command(backed bycore/->command) to fill missing:command/idand:command/timestamp. - Updates the command request handler to drop any client-supplied
:command/id/:command/timestampand regenerate them server-side via->command. - Updates the example app demo and adds unit tests covering
->commandbehavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| development/src/example_app_demo.clj | Uses cp/->command in REPL/demo snippets and cleans up trailing comment return forms. |
| components/command-request-handler-v2/src/ai/obney/grain/command_request_handler_v2/core.clj | Regenerates command id/timestamp server-side via cp/->command after dropping client-supplied values. |
| components/command-processor-v2/test/ai/obney/grain/command_processor_v2/interface_test.clj | Refactors command test helper to use cp/->command and adds focused tests for ->command. |
| components/command-processor-v2/src/ai/obney/grain/command_processor_v2/interface.clj | Exposes the new public ->command helper in the interface namespace. |
| components/command-processor-v2/src/ai/obney/grain/command_processor_v2/core.clj | Implements ->command to populate defaults using random-uuid and time/now. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #9
I tested the example app demo code after the changes.