Skip to content

fix(parser): persist Python class decorators#643

Merged
tirth8205 merged 1 commit into
mainfrom
codex/port-python-class-decorators
Jul 17, 2026
Merged

fix(parser): persist Python class decorators#643
tirth8205 merged 1 commit into
mainfrom
codex/port-python-class-decorators

Conversation

@tirth8205

Copy link
Copy Markdown
Owner

Focused current-main replacement for the remaining class-decorator gap from #332, with Gideon Zenz attribution.

Overlap reconciliation:

  • maint: reconcile verified local and community fixes #624 already persists decorated functions and class annotations for Java, Kotlin, and C#.
  • Python class_definition nodes are children of decorated_definition, so the existing modifiers-child helper cannot see their decorators.
  • This PR ports only that missing behavior; it does not replay the cumulative source branch.

Behavior:

  • captures stacked Python class decorators in source order;
  • stores the comma-joined contract in NodeInfo.modifiers;
  • stores the list contract in NodeInfo.extra[decorators];
  • leaves undecorated classes unchanged;
  • proves parsed metadata reaches framework-entry detection and find_dead_code.

Verification:

  • 1,538 passed, 2 xpassed (full local suite)
  • focused parser and end-to-end dead-code regressions pass
  • repository lint scope passes for code_review_graph/parser.py
  • git diff --check passes

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

code-review-graph review

Overall risk: 0.40 (MEDIUM) — 7 changed function(s)/class(es), 0 affected flow(s), 5 test gap(s)

Risk-scored changes

Risk Level Symbol Location Tested
0.40 medium code_review_graph/parser.py::CodeParser code_review_graph/parser.py:983 no
0.35 low code_review_graph/parser.py::_python_decorator_names code_review_graph/parser.py:901 no
0.35 low code_review_graph/parser.py::CodeParser._extract_classes code_review_graph/parser.py:4904 no
0.30 low tests/test_parser.py::TestCodeParser.test_parse_python_class_decorators_persisted tests/test_parser.py:182 (test)
0.20 low tests/test_parser.py::TestCodeParser tests/test_parser.py:11 no
0.20 low tests/test_refactor.py::TestFindDeadCode.test_find_dead_code_excludes_parsed_python_decorated_class tests/test_refactor.py:426 (test)
0.10 low tests/test_refactor.py::TestFindDeadCode tests/test_refactor.py:109 no

Test gaps

  • code_review_graph/parser.py::_python_decorator_names (code_review_graph/parser.py:901)
  • code_review_graph/parser.py::CodeParser (code_review_graph/parser.py:983)
  • code_review_graph/parser.py::CodeParser._extract_classes (code_review_graph/parser.py:4904)
  • tests/test_parser.py::TestCodeParser (tests/test_parser.py:11)
  • tests/test_refactor.py::TestFindDeadCode (tests/test_refactor.py:109)

Token savings: this graph-backed report used ~112,151 fewer tokens (~98%) than reading every changed file in full (estimated, chars/4 approximation).


Powered by code-review-graph — local-first analysis; no code leaves the CI runner.

Keep stacked class decorators in modifiers and extra metadata so framework-entry and dead-code consumers receive the same contract as decorated functions.

Co-authored-by: Gideon Zenz <91069374+gzenz@users.noreply.github.com>
@tirth8205
tirth8205 force-pushed the codex/port-python-class-decorators branch from c953495 to efb3088 Compare July 17, 2026 16:04
@tirth8205
tirth8205 merged commit 9cc2458 into main Jul 17, 2026
11 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.

1 participant