Feat/add status filter to workflow runs#26850
Conversation
Summary of ChangesHello @twjackysu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the monitoring and analysis capabilities for workflow runs by extending the console API. It introduces the ability to filter workflow run lists by status and provides dedicated endpoints to retrieve comprehensive count statistics, offering a clearer overview of workflow execution states. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively adds status filtering and count statistics to the workflow runs API. The changes are well-organized across the controller, service, and repository layers. My review includes suggestions for improving input validation for the new 'status' parameter, enhancing API response consistency, and refactoring some duplicated code in both the service and repository layers for better maintainability. I've also noted a small correction for a docstring to improve clarity. Overall, this is a solid contribution.
3e1fa1b to
41d27e8
Compare
|
I forgot to run reformat after applying the Gemini suggestions and adding the UT. Give me some time to fix this issue. |
1c96b8a to
21b0e02
Compare
|
Please mark this PR |
21b0e02 to
eb01b17
Compare
|
Please fix the broken tests. |
eb01b17 to
a640e59
Compare
I don't quite understand the connection between the error message and my changes. |
|
Due to the monitor's requirement, I add an optional |
There was a problem hiding this comment.
Code Review
This pull request introduces valuable new features for filtering and counting workflow runs by status and time range. The implementation is solid, with new API endpoints, service logic, and repository methods, along with comprehensive unit tests. My review focuses on improving code quality by addressing code duplication, a critical bug in dictionary handling, and enhancing maintainability and correctness. Specifically, I've suggested refactoring duplicated controller logic, using constants for repeated values, fixing a dictionary unpacking error, improving import statements, and parameterizing a hardcoded value in the service layer to ensure correct behavior across different contexts.
878b2b3 to
9f052f0
Compare
9f052f0 to
79e1e53
Compare
|
The workflow seems to be stuck for some unknown reason. Can we cancel it and rerun it? |
…-filter-to-workflow-runs
d89fbc9 to
22cc8d9
Compare
|
Thanks for the PR :) I have restored the broken CI pipeline |
Co-authored-by: Jacky Su <jacky_su@trendmicro.com>
Co-authored-by: Jacky Su <jacky_su@trendmicro.com>
Important
Fixes #<issue number>.Fixes #26849
Summary
This PR adds optional status filtering, time range filtering, and count statistics endpoints to the workflow run console API. This enhancement allows developers to:
statusparameter (running, succeeded, failed, stopped, partial-succeeded)Changes Made
API Endpoints Enhanced:
GET /console/api/apps/{app_id}/workflow-runs- Added optionalstatusquery parameterGET /console/api/apps/{app_id}/advanced-chat/workflow-runs- Added optionalstatusquery parameterGET /console/api/apps/{app_id}/workflow-runs/count- New endpoint for count statistics with optionalstatusandtime_rangefiltersGET /console/api/apps/{app_id}/advanced-chat/workflow-runs/count- New endpoint for advanced chat count statistics with optionalstatusandtime_rangefiltersNew Features:
created_attimestamp using intuitive time duration format7d(7 days),4h(4 hours),30m(30 minutes),30s(30 seconds)created_atfield to include all workflow runs regardless of statusImplementation Layers:
statusandtime_rangeparameter parsingget_workflow_runs_count()method with SQL aggregation using GROUP BYWHERE created_at >= thresholdworkflow_run_count_fieldsresponse field definitionslibs/time_parser.pyfor parsing time duration stringslibs/custom_inputs.pyfor Flask-RESTX input validationAPI Examples
List with status filter:
Get all status counts:
Get specific status count:
Get counts for recent workflow runs (last 7 days):
Use Cases
Technical Details
Database Query Optimization:
created_at,status,tenant_id,app_idBackward Compatibility:
Code Quality:
rufflinting and `basedpyrightScreenshots
Not applicable - API-only changes with no UI modifications.
Checklist
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint godsThe console API is only for self-hosting; there is no existing API documentation.