Repository navigation
Filter runs by bug id in the hackbot API #7442
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
ayoubdiourin7
wants to merge
6
commits into
mozilla:master
Choose a base branch
from
ayoubdiourin7:ayoubdiourin7/bug-2091030-add-the-ability-to-filter-runs-based
base: master
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.
+73
−2
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
63ad93d
Filter runs by bug id in the hackbot API
ayoubdiourin7 d997c07
Store bug_id as a column on runs
ayoubdiourin7 b4ea49a
Rebase bug_id migration onto requested_via
ayoubdiourin7 d1292c6
Move runs by bug id to its own endpoint
ayoubdiourin7 c48df2b
Read bug_id from the dumped run inputs
ayoubdiourin7 059444f
Rebase bug_id migration onto accounts
ayoubdiourin7 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
34 changes: 34 additions & 0 deletions
34
services/hackbot-api/alembic/versions/d2e6b8f4a1c9_runs_bug_id.py
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,34 @@ | ||
| """Store the bug a run is for, so runs can be listed by bug id. | ||
|
|
||
| Revision ID: d2e6b8f4a1c9 | ||
| Revises: e5f1a3c7d9b2 | ||
| Create Date: 2026-11-10 00:00:00.000000 | ||
|
|
||
| """ | ||
|
|
||
| from typing import Sequence, Union | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision: str = "d2e6b8f4a1c9" | ||
| down_revision: Union[str, Sequence[str], None] = "e5f1a3c7d9b2" | ||
| branch_labels: Union[str, Sequence[str], None] = None | ||
| depends_on: Union[str, Sequence[str], None] = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| """Upgrade schema.""" | ||
| op.add_column("runs", sa.Column("bug_id", sa.Integer(), nullable=True)) | ||
| op.execute( | ||
| "UPDATE runs SET bug_id = (inputs ->> 'bug_id')::integer " | ||
| "WHERE jsonb_typeof(inputs -> 'bug_id') = 'number'" | ||
| ) | ||
| op.create_index(op.f("ix_runs_bug_id"), "runs", ["bug_id"]) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| """Downgrade schema.""" | ||
| op.drop_index(op.f("ix_runs_bug_id"), table_name="runs") | ||
| op.drop_column("runs", "bug_id") |
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
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.
I just noticed that we return the runs as they are: we might want to accommodate the expected data here, especially origin. See https://github.com/mozilla/bmo/pull/2829/changes#diff-ab09301ff998f2ccac548b78b3934dcc02b3faf312415ecbdf09aaf850994946R180-R192
The origin is guessed on Bugzilla side: https://github.com/mozilla/bmo/pull/2829/changes#diff-ab09301ff998f2ccac548b78b3934dcc02b3faf312415ecbdf09aaf850994946R160-R172
I think we should do it here instead.