-
Notifications
You must be signed in to change notification settings - Fork 10
fix: move tasks to experimental module and undo notifier tauploadcontext #512
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
Open
joseph-sentry
wants to merge
1
commit into
main
Choose a base branch
from
joey/fix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Experimental Test Analytics Tasks | ||
|
|
||
| This module contains an experimental pipeline that mirrors an aspirational Test Analytics (TA) flow. The code is **not** production-ready—each task exists solely for exploration and will evolve substantially before promotion. | ||
|
|
||
| ## Task Topology | ||
|
|
||
| 1. `IngestTestruns` | ||
| - Parses raw test-result uploads and writes normalized rows via the timeseries helpers. | ||
| - Creates `TAUpload` placeholders when the repository is eligible, queueing work for downstream tasks. | ||
| 2. `DetectFlakes` | ||
| - Claims queued `TAUpload` rows and updates both `Testrun` and `Flake` state to reflect newly-detected flaky behavior. | ||
| - Reschedules itself while the queue has pending uploads, acting as the flake-processing loop. | ||
| 3. `TestAnalyticsNotifierTask` | ||
| - Hydrates a `TestResultsNotifier` with the processed summaries and posts draft PR commentary where configured. | ||
| - Uses fencing tokens and redis locks to deduplicate concurrent notifications. | ||
|
|
||
| All tasks are registered with Celery but intentionally sequestered beneath the `experimental` namespace to prevent accidental inclusion in default worker imports. | ||
|
|
||
| ## Coordinating the Pipeline | ||
|
|
||
| Within `apps/codecov-api/services/task/task.py`, the `TaskService` remains the entry point for scheduling. A prospective orchestration flow might resemble: | ||
|
|
||
| ```python | ||
| service.detect_flakes(repo_id) # ensures the processing loop is active | ||
| service.schedule_task( | ||
| celery_config.ingest_testruns_task_name, | ||
| kwargs={"repoid": repo_id, "upload_context": context}, | ||
| apply_async_kwargs={"countdown": 0}, | ||
| ) | ||
| ``` | ||
|
|
||
| Downstream notifications would be triggered either by ingest completion hooks or explicit API routes once the ingest/detect stages succeed. As we iterate, we will introduce dedicated service methods that chain the experimental tasks; for now, invoke the Celery signatures directly via the `TaskService` helpers when running local experiments. | ||
|
|
||
| ## Running Locally | ||
|
|
||
| - Ensure the worker environment has access to Redis, the Django ORM, and any storage backends referenced by the upload context. | ||
| - Because these tasks are prototypes, expect migrations or data contracts to change. Clear related test data frequently during iteration. | ||
|
|
||
| Please share findings in the TA pipeline RFC and surface blockers to the Data Platform crew. | ||
Empty file.
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,6 +55,12 @@ class TestAnalyticsNotifierTask( | |
| """ | ||
| Send test analytics notifications while ensuring compliance with Sentry's | ||
| data retention policies. | ||
|
|
||
| --- | ||
| Experimental note: this notifier remains an untested concept that depends on | ||
| the experimental ingest and detect-flakes tasks. Its purpose is to provide a | ||
| sandboxed flow for future TA pipeline development, and it should not be used | ||
| in production environments yet. | ||
| """ | ||
|
|
||
| def run_impl( | ||
|
|
@@ -282,7 +288,7 @@ def notification_preparation( | |
|
|
||
| notifier = TestResultsNotifier( | ||
| repo, | ||
| upload_context, | ||
| upload_context, # TODO: this won't work because test results notifier doesn't currently support the TAUpload Context | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you elaborate on "this won't work" Should we just comment out the whole param to avoid the footgun? |
||
| commit_yaml, | ||
| _pull=pull, | ||
| _repo_service=repo_service, | ||
|
|
||
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.
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.
can you add this was generated by claude