-
Notifications
You must be signed in to change notification settings - Fork 21
Amend ADR 8: Clarify CQS Terminology #719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Claude finished @eliykat's task —— View job PR Review: Amend ADR 8 - Clarify CQS Terminology
OverviewThis PR successfully clarifies the terminology from CQRS (Command Query Responsibility Segregation) to CQS (Command Query Separation), which better reflects the actual implementation in the Bitwarden server codebase. The changes are well-motivated and align the documentation with current practices. Key Changes
Review Feedback✅ Strengths
📝 Observations & Discussion PointsBased on the review thread, I can see several points have been discussed: Regarding the command/query distinction (line 17): Regarding prescriptiveness: Regarding repository methods as queries (line 68):
🎨 Minor Suggestions
|
|
Great job! No new security vulnerabilities introduced in this pull request |
Deploying contributing-docs with
|
| Latest commit: |
6246617
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b56223b9.contributing-docs.pages.dev |
| Branch Preview URL: | https://adr0028-cqs-terminology.contributing-docs.pages.dev |
withinfocus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you made these changes to ADR 8 instead of a new one, could that work? I could be convinced otherwise but maybe it's best just to improve the original ADR given the refinement; it's not really a significant change in direction to me.
| status: Superseded | ||
| date: 2022-07-15 | ||
| tags: [server] | ||
| superseded_by: "0028" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎨 Can we improve this at the template level? Similar to #626, just have the details here and in a structured format so it's rendered consistently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ADR is no longer superseded so I don't think this change is needed here; let me know if you disagree.
Updates ADR-0008 to use CQS terminology and removes the separate ADR-0028. Also fixes references in server/index.md and angular.md.
| @enduml | ||
| ``` | ||
| ## Reactivity ([ADR-0003](../../../architecture/adr/0003-observable-data-services.md) & ADR-0028) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Broken reference that was caught as part of this work. There is no ADR 28, this was presumably meant to reference the Signals ADR here: #632 however that has not been merged yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd omit this personally as it's not part of this PR's scope. This mention has been sitting for a bit because the Angular docs are a work-in-progress.
theMickster
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with adjust the existing ADR, but I do respectfully request a few changes.
docs/architecture/server/index.md
Outdated
| `CreateCipher`). In the future, this may enable other benefits such as enqueuing commands for | ||
| execution, but for now the focus is on having smaller, reusable chunks of code. | ||
| `CipherService`, which handles everything to do with a cipher) and move towards smaller classes | ||
| based on discrete actions (e.g. `CreateCipherCommand`, which handles only creating a cipher). This |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎨 I don't think that this sentence is needed because it detracts from the main goal of CQS.
This results in smaller classes with fewer interdependencies that are easier to change and test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this sentence belongs now, because the paragraph is discussing our motivation rather than the pattern itself. Let me know what you think.
docs/architecture/server/index.md
Outdated
| based on discrete actions (e.g. `CreateCipherCommand`, which handles only creating a cipher). This | ||
| results in smaller classes with fewer interdependencies that are easier to change and test. | ||
|
|
||
| :::note |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of people have seen/used the CQRS language by now. I was concerned that developers would either be confused about the change in terminology, or miss why it's significant and keep referring to CQRS.
Publicizing it in the #architecture channel can help with this though, and that way we don't have a historical note on this page forever. I'll remove it.
docs/architecture/server/index.md
Outdated
| repositories, and this is not what we're concerned about here.) However, more complex queries can | ||
| require additional logic around the repository call, which will require their own class. Commands | ||
| always need their own class. | ||
| Teams have wide discretion in how they structure their commands and queries. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓🤔 Curious, why do teams have wide discretion in structuring commands and queries? Shouldn't we strive for more homogenous flow and structure so our application feels like one application instead of many applications?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"wide" is overstating it. But the first version of this document was very prescriptive, and we ended up breaking all of the rules in practice, and it became out of date very quickly. So my goal here is to sketch out some guidance without being overly prescriptive; that necessarily leaves it to teams to fill in the blanks. We can become more prescriptive, but that needs someone to review our current practices and requirements across teams, and then work with tech leads to align them.
Either way - I do think this sentence is superfluous so I'll remove it.
|
@theMickster I've worked through your feedback. Our command/query structure is a bit weird and not necessarily consistent throughout our codebase, so I'm open to discussing it separately if you want to dig into it. |
withinfocus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice clarification. There are a fair number of references to this ADR, especially with AI tooling lately, so while the path is technically incorrect now we should leave it.
One ⛏️ for something out of scope but not truly necessary to resolve.
| @enduml | ||
| ``` | ||
| ## Reactivity ([ADR-0003](../../../architecture/adr/0003-observable-data-services.md) & ADR-0028) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd omit this personally as it's not part of this PR's scope. This mention has been sitting for a bit because the Angular docs are a work-in-progress.

🎟️ Tracking
N/A
📔 Objective
ADR 8 adopted CQRS for our server repository. There wasn't much other documentation at the time, so I wrote the server architecture page with examples and rules for this pattern.
However, in practice we have not followed CQRS architecture or the examples and rules that I wrote in the architecture page. This is for various reasons, but mostly, it seems like we never wanted to go full CQRS to begin with. We have previously discussed this in some long threads in the architecture channel and it has mostly caused confusion.
This PR started as a rewrite of the server architecture page to more closely align with our current practices. However, as this is effectively modifying the language of the previous ADR (although not so much the intent), I have paired it with a proposed ADR to record the decision.
These changes focus on what we do in practice today, but leaves more discretion to teams in how exactly they write their commands and queries. The goal is to make it more accurate and useful, while allowing teams to iterate on their own patterns.
⏰ Reminders before review
team
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmedissue and could potentially benefit from discussion
:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes