Repository navigation
rules: replacing a planned rule cannot grow its size; a rule may not rank itself - #11
Conversation
… not rank itself - rule add --replaces on a planned rule: a larger --size is refused by ID (and clamped when the old rule is matched by a piece of its text), so a revision cannot postpone an outstanding check. Review finding on #10. - with require_enforcer off, replacing a planned rule while naming no enforcer no longer raises - rule_spec: a rule text that calls itself highest or TOP PRIORITY is refused (quoted words do not count) Tests: 436 passed; privacy scan 0 hits. Agent: claude-code Co-authored-by: MaxonT <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af049571be
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if _SELF_RANK.search(_QUOTED.sub(" ", body)): | ||
| out.append("calls itself highest / TOP PRIORITY / 最高优先级 (R-358): say what it does; quoted words do not count") |
There was a problem hiding this comment.
Limit rejection to claims about the rule's own priority
With rule_spec = true, an ordinary operational rule such as When: selecting a release. Do: choose the highest compatible version. is now rejected by rule_add, even though it makes no claim about its own precedence. Searching the entire body for these words also marks such existing rules invalid in lint and prevents rewriting them. Restrict the check to self-ranking claims rather than rejecting unrelated uses of highest or top priority.
Useful? React with 👍 / 👎.
| _META = re.compile(r"^Meta rule[.:]?\s+") | ||
| _FIELD = re.compile(r"(?:(?<=\s)|^)(When|Do|Not):\s*") | ||
| _SELF_RANK = re.compile(r"highest|top priority|最高优先级", re.I) # R-358: a rule does not rank itself | ||
| _QUOTED = re.compile(r"“[^”]*”|\"[^\"]*\"|「[^」]*」|‘[^’]*’|'[^']*'") |
There was a problem hiding this comment.
Distinguish apostrophes from quotation delimiters
When a rule contains two apostrophes in contractions or possessives, _QUOTED removes everything between them as though it were quoted text. For example, When: two rules conflict. Do: don't demote this highest rule's precedence. returns no problems because the self-ranking claim disappears between don't and rule's. Recognize actual quote boundaries so ordinary English punctuation cannot bypass the new enforcement.
Useful? React with 👍 / 👎.
…s own rank Both review findings on this PR: - an ordinary rule such as 'choose the highest compatible version' is no longer refused: the check wants a claim about the rule itself (the highest rule, this rule has top priority, the label TOP PRIORITY) - apostrophes in don't ... rule's are no longer read as a pair of quotes Also: the claim is read in When and Do; Not names what is forbidden, so a rule that forbids self-ranking passes its own check. Tests: 436 passed; privacy scan 0 hits. Agent: claude-code Co-authored-by: MaxonT <[email protected]>
|
Both findings addressed in the latest commit: the self-rank check now matches only a claim about the rule's own rank, read in When and Do, and a single quote opens only after a space or bracket. Tests cover the two examples from the review. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Follow-up to #10.
rule add --replaceson a planned rule kept its start day but accepted a larger size, which moved the due day with no reason on record. By ID the add is now refused and names the size to keep; when the old rule is matched by a piece of its text the size is clamped. Moving the due day stays possible afterwards withrule enforce --reason, which records it.require_enforceroff, replacing a planned rule while naming no enforcer raised an AttributeError; fixed, with a test.rule_spec: a rule text that calls itself highest or TOP PRIORITY is refused (quoted words do not count).436 tests pass locally; privacy scan 0 hits.