fix(experiments): support result and creator list ordering#22
Open
justinsunyt wants to merge 4 commits into
Open
fix(experiments): support result and creator list ordering#22justinsunyt wants to merge 4 commits into
justinsunyt wants to merge 4 commits into
Conversation
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
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.
Problem
Sorting the Experiments list by Result sent
order=conclusion, which the API rejected, and sorting by Created by could raise a server error while building the database ordering expression.Fixes PostHog#63621
Changes
conclusion/-conclusionas experiment list order fields and sort them in the same display order as the UI.created_byordering use an explicit string output field and fall back to an empty value when the creator is missing.How did you test this code?
As an agent, I tested this with:
ruff format products/experiments/backend/experiment_service.py products/experiments/backend/presentation/views.py products/experiments/backend/test/test_presentation_api.pyruff check products/experiments/backend/experiment_service.py products/experiments/backend/presentation/views.py products/experiments/backend/test/test_presentation_api.py --fixhogli test products/experiments/backend/test/test_presentation_api.py --maxfail=1 -q -k "test_can_order_experiments_by_conclusion or test_can_order_experiments_by_created_by"withSANDBOX_PROVIDERunset for the local test environmentAutomatic notifications
Docs update
No docs update needed; this fixes API sorting behavior for an existing UI.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Captain Capy implemented the fix after reproducing the invalid
conclusionorder error and tracing the existingcreated_byordering expression. The change keeps sorting server-side so paginated Experiment list requests remain consistent with the table headers.Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.