Repository navigation
feat(ask): make the ask heading configurable - #2823
IsmaelMartinez merged 7 commits into
Conversation
PR Summary by QodoMake top-level /ask headings configurable
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1.
|
67491c1 to
d99fcef
Compare
|
Code review by qodo was updated up to the latest commit d99fcef |
|
Code review by qodo was updated up to the latest commit 9d6bede |
|
Code review by qodo was updated up to the latest commit 64cf0bd |
|
Code review by qodo was updated up to the latest commit 3b7ceb9 |
IsmaelMartinez
left a comment
There was a problem hiding this comment.
Nearly there, one thing to fix. Thanks for turning parts 2 and 3 round this fast.
A heading that ends in punctuation still loses its bold. I put seven through GitHub's own markdown API: five come back with literal asterisks, including your own Architecture **Question** example, plus Ask!, Ask (v2), C++ and C#. Plain Ask and Q&A are fine.
A space before the emoji fixes all seven. It is not a one-liner though, and I measured why: two source lines plus twelve exact-string assertions in tests/unittest/test_pr_questions_helpers.py. Detail inline.
The provider split is a good answer to the escape leak and the Gerrit round-trip holds. Two unrelated one-liners inline, both clickable. CI is red on one timing test that has nothing to do with this change, so it wants a re-run.
| heading = _get_configured_heading("pr_questions.ask_heading", "Ask") | ||
| if escape_markdown: | ||
| heading = heading.translate(_MARKDOWN_PUNCTUATION_ESCAPE_TABLE) | ||
| return f"### **{heading}**❓" |
There was a problem hiding this comment.
Here is the measurement. Each heading went through GitHub's markdown API, checking whether a <strong> tag comes back:
| heading | today | with a space |
|---|---|---|
Ask |
bold | bold |
Q&A |
bold | bold |
Ask! |
literal ** |
bold |
Ask (v2) |
literal ** |
bold |
C++ |
literal ** |
bold |
C# |
literal ** |
bold |
Architecture **Question** |
literal ** |
bold |
The closing ** ends up between punctuation and a non-space character, so it never closes. That also makes the line in ask.md about keeping "the surrounding formatting and ❓ emoji fixed" not quite true yet.
No suggestion attached, on purpose. Changing this line on its own turns CI red: _ASK_HEADING_SUFFIX in the Gerrit converter has to move with it, or the heading stops matching and falls back to the generic stripper. I ran both edits against your branch merged onto main: 12 tests fail, all exact-string assertions in tests/unittest/test_pr_questions_helpers.py, and they need the new spacing too.
| extra_instructions = "Do not answer questions that ask to rate PR quality on a scale of 1 to 10." | ||
| ``` | ||
|
|
||
| The heading above renders as <code>### **Architecture Question**❓</code>. |
There was a problem hiding this comment.
The ** inside <code> is still processed, so this line renders as ### <strong>Architecture Question</strong>❓ rather than the literal form you are documenting. Backticks keep it verbatim.
| The heading above renders as <code>### **Architecture Question**❓</code>. | |
| The heading above renders as `### **Architecture Question**❓`. |
| [pr_questions] | ||
| ask_heading = "Ask" | ||
|
|
||
| [github_app] |
There was a problem hiding this comment.
This file's header says it is read by Qodo's hosted bot, not by the pr-agent in this repo, and the value is the default anyway, so these three lines do nothing. #2797 left review_heading out of it for the same reason. #2820 has the same three lines to drop.
| [pr_questions] | |
| ask_heading = "Ask" | |
| [github_app] | |
| [github_app] |
3b7ceb9 to
624f33e
Compare
|
Code review by qodo was updated up to the latest commit 624f33e |
|
Code review by qodo was updated up to the latest commit a2d2cfc |
IsmaelMartinez
left a comment
There was a problem hiding this comment.
All fixed, approving.
The bold now survives every case I tested: Ask!, Ask (v2), C++, C# and Architecture **Question** all come back with real emphasis from GitHub's renderer, and the Gerrit suffix moved with it.
The splitlines() guard is a nice catch and better than what I asked for. It rejects U+2028, U+2029, \v, \f and \x85, which the old \n/\r check let through. I probed eleven legitimate headings including tabs and non-Latin text and none is wrongly rejected.
One thing before this can go in, and it is my doing rather than yours: I merged #2820 a moment ago and it has put this into conflict in pr_agent/algo/utils.py. Both hunks are additive, so please do not take either side wholesale. Main now carries a second copy of _get_configured_heading with the old \n/\r check, and yours with the splitlines() guard is the one to keep. The other hunk wants both functions, format_pr_code_suggestions_header from main and your format_pr_questions_header.
Rebase and I will merge. Happy to do the rebase myself if you would rather, just say so, as you seem to be mid-push and I did not want to force-push over you.
a2d2cfc to
15ba4a2
Compare
|
Code review by qodo was updated up to the latest commit 15ba4a2 |
|
addressed comments and rebased PR. It seems clean now. |
|
merged. Thanks again! |
Fixes #2038 (Part 3)
Summary
pr_questions.ask_headingfor top-level/askanswersAnswersection and/ask_linereplies unchanged/reviewand/improvechangesResult
ask_heading = "Architecture Question"renders:### **Architecture Question** ❓Testing