-
Notifications
You must be signed in to change notification settings - Fork 5
fix: use actual experiment variant IDs for release conclude and revert #238
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
base: main
Are you sure you want to change the base?
Conversation
Changed Files
|
WalkthroughThis change introduces a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
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.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
airborne_dashboard/app/dashboard/[orgId]/[appId]/releases/[releaseId]/page.tsx (1)
217-235:⚠️ Potential issue | 🟡 MinorPotential runtime error when accessing
experimentals[0]on empty array.If
experiment_variants.experimentalsis empty, accessing index[0]will returnundefined, which will be sent as thechosen_variantin the API request. This could cause the backend to fail with an unhelpful error or behave unexpectedly.Consider adding a guard or using optional chaining with a fallback:
🛡️ Suggested defensive check
const handleConcludeRelease = async () => { setIsConcluding(true); try { + const experimentalVariant = release.experiment.experiment_variants.experimentals[0]; + if (!experimentalVariant) { + console.error("No experimental variant available to conclude"); + return; + } await apiFetch( `/releases/${encodeURIComponent(releaseId)}/conclude`, { method: "POST", - body: { chosen_variant: release.experiment.experiment_variants.experimentals[0] }, + body: { chosen_variant: experimentalVariant }, }, { token, org, app } );airborne_server/src/release.rs (1)
1629-1639:⚠️ Potential issue | 🔴 CriticalUse
updated_experiment_responseto construct the response instead of pre-updateexperiment_details.The
experiment_detailsis fetched before the Superposition API update (line 1466), soexperiment_details.variantsreturns stale variant IDs. After the update call at line 1526,updated_experiment_responsecontains the updated experiment state with current variant IDs. Thecreate_releasehandler correctly usesbuild_release_experiment_from_experiment()with the API response object (line 865–866), butupdate_releaseconstructs the response manually with pre-update data. Additionally,statusandtraffic_percentageare hard-coded instead of sourced fromupdated_experiment_response, which will also return incorrect values.Replace the manual
ReleaseExperimentconstruction with:experiment: Some(utils::build_release_experiment_from_experiment( &updated_experiment_response, pkg_version, )),
Summary by CodeRabbit
New Features
Improvements