Repository navigation
Post frontend-triage questions for the reporter with a needinfo on them, even when the diagnosis is held #7323
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
msujaws
wants to merge
1
commit into
mozilla:master
Choose a base branch
from
msujaws:frontend-triage-needinfo-reporter
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.
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
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,69 @@ | ||
| """Tests for the question to the reporter that a run posts whatever its confidence. | ||
|
|
||
| hackbot-api applies `bugzilla.request_info` even when the rest of the run is held, so | ||
| what gets recorded here is what reaches the bug unattended. | ||
| """ | ||
|
|
||
| from hackbot_agents.frontend_triage.agent import ( | ||
| MAX_REPORTER_QUESTION_CHARS, | ||
| FrontendTriageResult, | ||
| parse_plan, | ||
| record_reporter_question, | ||
| ) | ||
| from hackbot_runtime.actions import ActionsRecorder | ||
|
|
||
| BUG_ID = 1968342 | ||
| REPORTER = "reporter@example.com" | ||
| QUESTION = "Does this still happen in a new profile?" | ||
|
|
||
|
|
||
| def _result(question: str | None = QUESTION) -> FrontendTriageResult: | ||
| return FrontendTriageResult( | ||
| bug_id=BUG_ID, num_turns=1, total_cost_usd=0.0, reporter_question=question | ||
| ) | ||
|
|
||
|
|
||
| def test_parse_plan_reads_the_reporter_question(): | ||
| def plan(body: str) -> dict: | ||
| return parse_plan(f"```json\n{body}\n```") | ||
|
|
||
| assert plan(f'{{"reporter_question": " {QUESTION} "}}')["reporter_question"] == ( | ||
| QUESTION | ||
| ) | ||
| for body in ( | ||
| '{"reporter_question": null}', | ||
| '{"reporter_question": " "}', | ||
| '{"reporter_question": ["a list"]}', | ||
| "{}", | ||
| ): | ||
| assert plan(body)["reporter_question"] is None, body | ||
|
|
||
|
|
||
| def test_the_question_needinfos_the_reporter(): | ||
| recorder = ActionsRecorder() | ||
| record_reporter_question(recorder, _result(), f" {REPORTER} ") | ||
|
|
||
| [action] = recorder.actions | ||
| assert action["type"] == "bugzilla.request_info" | ||
| assert action["params"]["bug_id"] == BUG_ID | ||
| assert action["params"]["requestee"] == REPORTER | ||
| assert action["params"]["text"].startswith(QUESTION + "\n\n---\n\n") | ||
|
|
||
|
|
||
| def test_nothing_is_recorded_without_a_question_or_a_reporter(): | ||
| for result, reporter in ( | ||
| (_result(None), REPORTER), | ||
| (_result(), None), | ||
| (_result(), ""), | ||
| (_result(), {"email": REPORTER}), | ||
| ): | ||
| recorder = ActionsRecorder() | ||
| assert record_reporter_question(recorder, result, reporter) is None | ||
| assert recorder.actions == [] | ||
|
|
||
|
|
||
| def test_an_overlong_question_is_dropped_rather_than_cut_off(): | ||
| recorder = ActionsRecorder() | ||
| question = "x" * (MAX_REPORTER_QUESTION_CHARS + 1) | ||
| assert record_reporter_question(recorder, _result(question), REPORTER) is None | ||
| assert recorder.actions == [] |
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
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.
We could use
bugzilla.update_bugto add a needinfo. Is there a reason why that would not work here?