-
Notifications
You must be signed in to change notification settings - Fork 2
fix: resolve issue #284 #285
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ Incorrect command syntax | |
| {% endblock %} | ||
|
|
||
| {% block message %} | ||
| It seems that your command syntax is incorrect. The correct usage is: | ||
| It seems that your command syntax is incorrect.{% if extra_message %} {{ extra_message }}{% endif %} The correct usage is: | ||
|
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. 🔵 Minor — Users see confusing internal Python error text in bot replies. The template now renders 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. The template now checks extra_message with a plain if-test, but Jinja2 StrictUndefined raises UndefinedError when the variable is not passed at all. The existing path in commands.py:272 raises IncorrectCommandSyntax without extra_message, so this template change will crash there. Use 'if extra_message is defined and extra_message' instead. — Claude Code |
||
|
|
||
| ``` | ||
| @{{ robot }} option[=argument] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,8 @@ | |
| from bert_e.job import handler, CommitJob, PullRequestJob, QueuesJob | ||
| from bert_e.lib.cli import confirm | ||
| from bert_e.lib.simplecmd import CommandError | ||
| from bert_e.reactor import Reactor, NotFound, NotPrivileged, NotAuthored | ||
| from bert_e.reactor import (Reactor, NotFound, NotPrivileged, NotAuthored, | ||
| IncorrectSyntax) | ||
| from ..git_utils import push, clone_git_repo | ||
| from ..pr_utils import find_comment, notify_user | ||
| from .branches import ( | ||
|
|
@@ -360,6 +361,13 @@ def handle_comments(job): | |
| active_options=job.active_options, command=err.keyword, | ||
| author=author, self_pr=(author == pr_author), comment=text | ||
| ) from err | ||
| except IncorrectSyntax as err: | ||
| raise messages.IncorrectCommandSyntax( | ||
|
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. 🟡 Warning — The usage hint in the new error reply leaves out the bot name. The new |
||
| extra_message="'%s' is an option, not a command; use " | ||
| "'%s=<value>' instead." % ( | ||
| err.keyword, err.keyword), | ||
| active_options=job.active_options | ||
| ) from err | ||
|
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. The template uses robot variable but this handler does not pass robot. With StrictUndefined in template_loader.py, this will crash at render time when /after_pull_request 1509 is used. Add robot=job.settings.robot to the kwargs. — Claude Code |
||
|
|
||
|
|
||
| def check_commit_diff(job): | ||
|
|
||
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.
🔴 Critical — Correct
key=valueand multi-option comments now block every PR that uses them.The
if args:guard also fires on option comments that are valid. The command regex(?P<command>[A-Za-z_]+[^= ,])(?P<args>.*)stops the key before=, a space or a comma, soargsis non-empty for every option that has a value or is followed by another option. I ran it:@bert-e after_pull_request=1509,/after_pull_request=12,@bert-e approve wait,@bert-e: approve, waitand/approve /waitall raise IncorrectSyntax now. Before this change they returned silently. The docstring documents exactly these forms as valid ({prefix}option1=val1 option2). handle_comments turns the exception into IncorrectCommandSyntax, which blocks the PR. Any user who posts the documentedkey=valuesyntax, or several options in one comment, gets an error reply and the PR does not progress. The check should only fire when the key is followed by whitespace and then a bare token without=, e.g. by checking that the remainder after the key does not start with=and that no token is itself a registered option.