fix: sandbox creation blocked by retention validation gap and Kafka trigger cloning#4439
Open
fix: sandbox creation blocked by retention validation gap and Kafka trigger cloning#4439
Conversation
Use get_field instead of get_change in validate_dataclip_retention_period so the cross-field check runs even when only history_retention_period is changed. Also fix the sandbox form error branch to preserve form state and show a flash message on backend validation errors.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4439 +/- ##
==========================================
- Coverage 89.37% 89.31% -0.07%
==========================================
Files 425 425
Lines 20149 20154 +5
==========================================
- Hits 18009 18001 -8
- Misses 2140 2153 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Redirect to sandboxes page with flash on backend changeset error instead of keeping modal open (flash was hidden behind modal) - Convert KafkaConfiguration struct to map before passing to cast_embed during trigger cloning (fixes sandbox creation for projects with Kafka triggers)
Sets dataclip_retention_period = history_retention_period for projects where dataclip_retention_period > history_retention_period. Three projects on prod are currently in this invalid state due to the validation gap fixed in a63b140.
Log changeset errors server-side when sandbox creation fails so operators can diagnose issues. Expand changelog to cover all three fixes (retention validation, Kafka trigger cloning, silent form error).
2 tasks
stuartc
approved these changes
Feb 20, 2026
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.
Description
This PR fixes several issues blocking sandbox creation:
Retention validation gap -
validate_dataclip_retention_period/1usedget_change/2which only returns a value when the field is modified. When a user changes onlyhistory_retention_period, the cross-field check is skipped, allowingdataclip_retention_period > history_retention_periodto be saved. This invalid state then blocks sandbox creation because the cloned settings get rejected by validation. Fixed by usingget_field/2instead.Kafka trigger cloning crash - Sandbox creation crashes with
Ecto.CastErrorfor any project with a Kafka trigger. The cloning code passes the loaded%KafkaConfiguration{}struct directly toTrigger.changeset/2, butcast_embedexpects a plain map. Fixed by converting the struct to a map before passing it.Silent form failure - When sandbox creation fails due to a backend validation error, the form failed silently (no error message, name field emptied). Fixed by closing the modal and redirecting with a flash error, consistent with how the limiter error is handled.
Data migration - Aligns
dataclip_retention_periodtohistory_retention_periodfor projects currently in the invalid state.Closes #4385
Closes #4440
Validation steps
qa-workflowsand create a new sandbox, it should succeed (this project previously had inconsistent retention settings that blocked sandbox creation).Additional notes for the reviewer
AI Usage
Pre-submission checklist
/reviewwith Claude Code):owner,:admin,:editor,:viewer)