Skip to content

Fix code-health matching for namespace moves and metatype macros - #235

Merged
dayfine merged 2 commits into
agentsfrom
tooling/code-health-namespace-moves
Nov 6, 2026
Merged

dayfine merged 2 commits into
agentsfrom
tooling/code-health-namespace-moves

Conversation

@dayfine

@dayfine dayfine commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Base: agents. Tooling-only prerequisite for the namespace cleanup in fork PR #234 (also consumed by #233); no code branch is merged into this branch.

Nesting Main.cpp's existing file-local helpers in PokemonAutomation changes the qualified name of its legacy run_program() function. Code health then treats that function as new debt. Its namespace-comment lexer also loses the namespace name when it follows Q_DECLARE_METATYPE(...) without a semicolon.

Match a moved function's previous metric ceilings only when its declaration text is unchanged, the file is unchanged, exactly one old/current function matches, and the old qualified symbol disappeared. Existing metric limits and growth checks remain unchanged; retained copies, ambiguity and cross-file moves get no fallback. Recognize the trailing namespace declaration after a metatype macro when checking its closing comment.

Validation: reproduced both false positives with failing tests before the fix. The complete suite now runs 116 tests successfully (one platform-dependent skip), including negative coverage for copies, ambiguous matches, cross-file moves and metric growth. Updated code health reports zero failures for #234 against main and #233 against lab/main. The C++ pre-push checks used the documented PA_AGENTS_DIR override to test this linter revision; canonical Code Health CI still depends on this PR merging into agents.

Review metrics.py/policy.py with their regression cases, then the small namespace-name fix in style.py and its contract test. This changes no application code or controller behavior.

@dayfine
dayfine marked this pull request as ready for review November 6, 2026 08:52
@dayfine
dayfine merged commit a44e0f8 into agents Nov 6, 2026
1 check passed
@dayfine
dayfine deleted the tooling/code-health-namespace-moves branch November 6, 2026 08:52
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.

1 participant