Repository navigation
fix(server): reject a bounded context whose slug differs from its namespace - #208
Conversation
…espace Signed-off-by: Erik Nilsen <enilsen16@live.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR SummaryMedium Risk Overview Shared logic lives in Tests cover handler reject/accept paths, Reviewed by Cursor Bugbot for commit 0e1adf1. Bugbot is set up for automated code reviews on this repo. Configure here. |
Problem
Rule 11 and
strategic.protosay that the slug of a BoundedContext must equal its namespace (CONTEXT_SLUG_MISMATCH, Error). The server did not enforce this rule. Only the BoundedContext branch ofvalidate_scenariosemits the code. At put time, that function runs only for slice kinds.validate_modelandvalidate_storedo not emit the code. Thusapplyaccepted a second context in a namespace, and validation returned no finding.Change
context_slug_mismatchinvalidation.rs. It makes theCONTEXT_SLUG_MISMATCHissue.validate_scenariosnow uses it, so the message does not change.PutEntityandBatchMutatereject a BoundedContext whose slug is not its namespace. They returnINVALID_ARGUMENTwith the code in the message. The check is next tocheck_project_namespace_conflict.validate_storeemitsCONTEXT_SLUG_MISMATCHfor each stored context that does not obey the rule. ThusValidateProjectand the merge gate show contexts that were stored before this change.Question for the maintainer
The other checks in the BoundedContext branch of
validate_scenarios(REALIZES_*,RELATIONSHIP_*and the seam checks) also cannot run over RPC, for the same reason. This PR does not move them. Do you want them moved intovalidate_store? A put-time check is not correct forREALIZES_DANGLING, because it would reject a context that is put before its Subdomain.Test
cargo test -p trogon-atlas-server: new handler tests for put and batch put (mismatch is rejected, a match is accepted), and a pure test thatvalidate_storeflags only the context that does not obey the rule.cargo test -p trogon-atlas-clientcargo clippy -p trogon-atlas-server -p trogon-atlas-client --all-targets -- -D warningsCloses #89
Need help on this PR? Tag
@codesmith-botwith what you need.