Skip to content

docs(rules): put the rule table back in matching order, and hold it there - #1902

Merged
lizhengfeng101 merged 2 commits into
alibaba:mainfrom
abhisheksharma2411:docs/rule-table-matching-order
Nov 12, 2026
Merged

lizhengfeng101 merged 2 commits into
alibaba:mainfrom
abhisheksharma2411:docs/rule-table-matching-order

Conversation

@abhisheksharma2411

Copy link
Copy Markdown
Contributor

Description

The rule table in review-rules.md is introduced as listing every pattern in relative matching order. In all five locales, two rows are not:

  • **/*.R sits among the compiled languages, where it should follow **/*.jl;
  • the shader row (**/*.{glsl,hlsl,wgsl,metal}) sits before the RTL rows, where it should follow **/*.rego.

That ordering is the only thing on the page that tells a reader which of two overlapping globs wins — **/*.m resolving to matlab.md rather than objc.md is a question of position, not of anything written in the row. Nothing resolves differently because of these two: neither overlaps what it jumped. But the page states a property it does not have, and the next drift might not be harmless.

So this moves the two rows (two lines each, five locales) and adds a guard so the claim stays true.

#1785's TestReviewRulesGuideListsEverySystemRulePattern checks membership and the rule-document filename, and says in so many words that order is not asserted. This extends that same file rather than adding a second one, which is what @NanaseInori suggested on #1857:

TestReviewRulesGuideListsPatternsInMatchingOrder walks each locale's rows and reports any pattern listed after one that matches later, naming both and their match positions. Only relative order is checked, so the non-glob rows stay presentation and the table can still be grouped however reads best.

This is the one residual from #1857, which I closed as superseded by #1785.

Type of Change

  • Documentation update

How Has This Been Tested?

go test ./internal/config/rules/ -run TestReviewRulesGuide -v

Both guards pass across all five locales (en, zh, ja, ko, ru).

Mutation-checked rather than assumed: moving the **/*.R row back to where it was fails the new test with

pages/src/content/docs/en/review-rules.md lists "**/*.proto" (match position 32)
after "**/*.R" (match position 38); the table is introduced as being in relative
matching order

so it names both patterns and their positions rather than just reporting a mismatch. Run in a throwaway worktree so the checked-out tree was never dirty.

Checklist

  • My code follows the project's coding style (go fmt, go vet)
  • I have performed a self-review of my code
  • I have added a test that proves the fix is effective
  • New and existing unit tests pass locally with my changes
  • Documentation updated — this is the documentation

AI/LLM Disclosure

Claude assisted with the investigation, the change, the test and this description. The test runs and the mutation check are from my own machine.

Related Issues

Follow-up to #1857 (closed as superseded). Extends the guard added in #1785.

…here

The table is introduced as listing every pattern "in relative matching
order", and in all five locales two rows are not: `**/*.R` sits among
the compiled languages instead of after `**/*.jl`, and the shader row
sits before the RTL rows instead of after `**/*.rego`.

That ordering is the only thing on the page that tells a reader which of
two overlapping globs wins. `**/*.m` resolving to matlab.md rather than
objc.md is a question of position, not of anything written in the row.
Nothing resolves differently because of these two -- neither overlaps what
it jumped -- but the page states a property it does not have, and the next
drift might not be harmless.

alibaba#1785's guard checks membership and the rule-document name, and says in so
many words that order is not asserted. This extends that file rather than
adding a second one, as NanaseInori suggested on alibaba#1857:
TestReviewRulesGuideListsPatternsInMatchingOrder walks each locale's rows
and reports any pattern listed after one that matches later, naming both
and their match positions. Only relative order is checked, so the
non-glob rows stay presentation.

Verified by reverting the rows: the guard fails naming exactly those two
per locale.

Signed-off-by: Abhishek Sharma <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

✅ OpenCodeReview: Review skipped: no items were selected.

@lizhengfeng101 lizhengfeng101 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lizhengfeng101
lizhengfeng101 merged commit 1d7cc44 into alibaba:main Nov 12, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants