fix(conventions): ignore non-code duplicate export matches #5780

Merged
MrMha merged 1 commit from upstream-pr/5780 into main 2026-10-18 02:57:49 +00:00
MrMha commented 2026-10-14 10:18:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MrMha on 2026-10-14T10:18:39Z.


What

The duplicate-export checker can match an APS5_VABI declaration inside a comment or string and report a real export as a duplicate. Mask non-code tokens before matching each source line and inspecting its function body. Keep line numbers intact, including Unicode separators, and cache the masked source per file.

The branch is based on main 47a266cf975f00f7fba94013467d03bfa5e355e9. The masking is applied inside main's existing hits loop after its batched self.read(...); the batch-read behavior is retained.

Tested

macOS 27.0.1 arm64, Python 3.12.14: all 109 tests in the convention suites pass, including batched-read coverage and all 10 wrapped-declaration cases. The 10 wrapped-declaration cases also pass on Python 3.9.6.

Negative control: with unchanged main's checker and this branch's tests, 5 wrapped-declaration cases fail and 5 pass. The failures reproduce the comment, raw-string and source-line bugs that this change fixes. The trusted main checker accepts the committed patch, title and template; whitespace checks pass. No runtime or GPU behavior changes.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; silent stubs are documented where required
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (OpenAI Codex)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4856384205 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5780). Originally posted by [MrMha](https://github.com/MrMha) on 2026-10-14T10:18:39Z. --- ### What The duplicate-export checker can match an `APS5_VABI` declaration inside a comment or string and report a real export as a duplicate. Mask non-code tokens before matching each source line and inspecting its function body. Keep line numbers intact, including Unicode separators, and cache the masked source per file. The branch is based on main `47a266cf975f00f7fba94013467d03bfa5e355e9`. The masking is applied inside main's existing `hits` loop after its batched `self.read(...)`; the batch-read behavior is retained. ### Tested macOS 27.0.1 arm64, Python 3.12.14: all 109 tests in the convention suites pass, including batched-read coverage and all 10 wrapped-declaration cases. The 10 wrapped-declaration cases also pass on Python 3.9.6. Negative control: with unchanged main's checker and this branch's tests, 5 wrapped-declaration cases fail and 5 pass. The failures reproduce the comment, raw-string and source-line bugs that this change fixes. The trusted main checker accepts the committed patch, title and template; whitespace checks pass. No runtime or GPU behavior changes. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; silent stubs are documented where required - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (OpenAI Codex)
adriadam10 commented 2026-10-15 12:51:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T12:51:36Z.

Review: DISMISSED


The approach looks right: cpp_text keeps newlines, so line numbers still match git grep, and the new cases in tools/tests/test_check_conventions_wrapped_declarations.py pass on this head (9 tests).

One blocker: the PR conflicts with main in tools/check_conventions.py. duplicates() on main now reads blobs in one batch (self.read(...) and hits), so the masking has to be re-applied on top of that loop. I can't push a rebase to your branch (maintainer edits are disabled), so please rebase and re-run the five convention suites, plus the negative control against main's checker.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5533370408 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5780#pullrequestreview-5533370408). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-15T12:51:36Z. **Review:** DISMISSED --- The approach looks right: `cpp_text` keeps newlines, so line numbers still match `git grep`, and the new cases in `tools/tests/test_check_conventions_wrapped_declarations.py` pass on this head (9 tests). One blocker: the PR conflicts with `main` in `tools/check_conventions.py`. `duplicates()` on `main` now reads blobs in one batch (`self.read(...)` and `hits`), so the masking has to be re-applied on top of that loop. I can't push a rebase to your branch (maintainer edits are disabled), so please rebase and re-run the five convention suites, plus the negative control against `main`'s checker.
MrMha commented 2026-10-15 13:24:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MrMha on 2026-10-15T13:24:11Z.


@adriadam10 Rebased onto main 2e5dd5aa144af1bf90a214a6341bf3e1b4e6d47a as 89db679b980ae372eb3d4ce2327f4baa1e281f8b. The fix retains main's hits collection and self.read(...) batch, then masks/caches each source within that loop.

Fresh macOS 27.0.1 arm64 / Python 3.12.14 checks:

  • ctest --test-dir <relinker-only-build> -R '^conventions_' --output-on-failure --parallel 2: 14/14 registrations pass, covering all current convention suites, including batch-read process counts and the 9 wrapped-declaration cases.
  • Negative control with this head's tests and unchanged main's checker: 5 failures / 4 passes in the wrapped-declaration suite. The five failures reproduce the original comment/raw-string/Unicode-separator bugs.
  • Trusted main checker and branch checker accept the committed change and revised PR template; whitespace checks pass.

The description now records the fresh results. Manually reviewed the bot's remaining shared checker patches: #6078's environment rule and #6268's Unknown-NID rule do not implement this masking; no combined-tree test is claimed. #5766 is already merged in the new base.

AI-assisted: yes (OpenAI Codex).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6193139014 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5780#issuecomment-6193139014). Originally posted by [MrMha](https://github.com/MrMha) on 2026-10-15T13:24:11Z. --- @adriadam10 Rebased onto main `2e5dd5aa144af1bf90a214a6341bf3e1b4e6d47a` as `89db679b980ae372eb3d4ce2327f4baa1e281f8b`. The fix retains main's `hits` collection and `self.read(...)` batch, then masks/caches each source within that loop. Fresh macOS 27.0.1 arm64 / Python 3.12.14 checks: - `ctest --test-dir <relinker-only-build> -R '^conventions_' --output-on-failure --parallel 2`: **14/14 registrations pass**, covering all current convention suites, including batch-read process counts and the 9 wrapped-declaration cases. - Negative control with this head's tests and unchanged main's checker: **5 failures / 4 passes** in the wrapped-declaration suite. The five failures reproduce the original comment/raw-string/Unicode-separator bugs. - Trusted main checker and branch checker accept the committed change and revised PR template; whitespace checks pass. The description now records the fresh results. Manually reviewed the bot's remaining shared checker patches: #6078's environment rule and #6268's Unknown-NID rule do not implement this masking; no combined-tree test is claimed. #5766 is already merged in the new base. AI-assisted: yes (OpenAI Codex).
github-actions[bot] commented 2026-10-16 18:34:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T18:34:27Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 6447 tools/check_conventions.py
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6222206906 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5780#issuecomment-6222206906). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T18:34:27Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 6447](https://www.github.com/boykopovar/AnyPS5/pull/6447) | `tools/check_conventions.py` |
oneandonlydean commented 2026-10-18 02:53:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-18T02:53:00Z.


Picking this up while @adriadam10 is away: we will merge it once full CI and an independent review pass on this head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6244917510 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5780#issuecomment-6244917510). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-18T02:53:00Z. --- Picking this up while @adriadam10 is away: we will merge it once full CI and an independent review pass on this head.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!5780
No description provided.