Skip to content

refactor(shared): merge expression_names into expression_registry (drop the one over-split)#83

Merged
yilibinbin merged 1 commit into
mainfrom
fix/merge-expression-names
Jul 3, 2026
Merged

refactor(shared): merge expression_names into expression_registry (drop the one over-split)#83
yilibinbin merged 1 commit into
mainfrom
fix/merge-expression-names

Conversation

@yilibinbin

@yilibinbin yilibinbin commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Drop the one genuine over-split: merge expression_names into expression_registry

An over-split audit of the whole package (docs/OVER_SPLIT_AUDIT_2026.md,
6 dimensions, MERGE recommendations 2-skeptic verified) found the codebase is
healthy — not over-split. Of 15 candidate splits, exactly one was a
genuine over-split worth consolidating; everything else is a legitimate layer
boundary / single-source-of-truth / compatibility contract (documented in the
report's "keep these" list).

The one merge: shared/expression_names.py was a 12-line behavior-free
re-export — reserved_expression_names() just forwarded to
expression_registry, and is_reserved_expression_name() was byte-identical to
the registry's own. Both already live in shared/expression_registry.py.

  • Not a layer boundary (same package), not an import firewall (the registry is
    itself stdlib-only + guarded lightweight), not a compatibility contract (its
    only test asserted value-equality with the registry — confirming its own
    redundancy).
  • Delete the module; repoint its two importers
    (shared/input_normalization.py, shared/computation_inputs.py) to
    shared.expression_registry; update tests/test_expression_registry.py
    (drop the deleted module from the lightness guard + the redundant assertion).
  • Also archives the audit report.

Test plan

  • ruff clean; 83 registry/consumer/constants-editor tests pass; the
    registry import-lightness guard still holds.
  • Full suite: 3817 passed, 9 skipped, 0 failed.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Added an audit note summarizing the current module split guidance and the one recommended consolidation.
  • Refactor

    • Consolidated name-checking logic behind a single shared source.
    • Removed an unnecessary standalone helper module and updated related imports.
  • Tests

    • Updated coverage to reflect the new shared name-validation path and verify import behavior remains lightweight.

…op over-split)

An over-split audit of the whole package (docs/OVER_SPLIT_AUDIT_2026.md) found
the codebase is healthy — exactly ONE genuine over-split. shared/expression_names.py
was a 12-line behavior-free re-export: reserved_expression_names() just forwarded
to expression_registry, and is_reserved_expression_name() was byte-identical to
the registry's own. Both already live in shared/expression_registry.py.

It was not a layer boundary (same package), not an import firewall
(expression_registry is itself stdlib-only and guarded lightweight), and not a
compatibility contract (its only test asserted value-equality with the registry,
i.e. confirmed its own redundancy). Merging removes one import hop with zero
target-file growth.

- Delete shared/expression_names.py.
- Repoint the two production importers (shared/input_normalization.py,
  shared/computation_inputs.py) to shared.expression_registry.
- Update test_expression_registry.py: drop the deleted module from the
  import-lightness guard and the redundant value-equality assertion; the
  registry-level assertions remain.

Also archives the over-split audit report. ruff clean; 83 registry/consumer/
constants-editor tests pass; the registry lightness guard still holds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c0cde79-087f-4a59-b4da-b687919d2340

📥 Commits

Reviewing files that changed from the base of the PR and between 7f5e037 and f58b0c5.

📒 Files selected for processing (5)
  • docs/OVER_SPLIT_AUDIT_2026.md
  • shared/computation_inputs.py
  • shared/expression_names.py
  • shared/input_normalization.py
  • tests/test_expression_registry.py
💤 Files with no reviewable changes (1)
  • shared/expression_names.py

📝 Walkthrough

Walkthrough

The module shared/expression_names.py, a thin re-export of two helper functions, is removed. Its consumers (shared/computation_inputs.py, shared/input_normalization.py) and a test (tests/test_expression_registry.py) now import those functions from shared/expression_registry.py instead. A new audit doc documents the rationale.

Changes

Expression registry consolidation

Layer / File(s) Summary
Remove expression_names and repoint consumers
shared/expression_names.py, shared/computation_inputs.py, shared/input_normalization.py
Deletes the re-export module and updates import sources for is_reserved_expression_name to shared.expression_registry.
Update tests for new import source
tests/test_expression_registry.py
Adjusts import-weight test to check only expression_registry and switches consumer-matching test to use reserved_expression_names from expression_registry.
Audit documentation
docs/OVER_SPLIT_AUDIT_2026.md
Adds an over-split audit document recommending the consolidation, listing modules to leave unchanged, and noting an optional cleanup.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

Not applicable for this change.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main refactor: merging expression_names into expression_registry and removing the over-split module.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/merge-expression-names

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yilibinbin yilibinbin merged commit 4aa10ea into main Jul 3, 2026
6 checks passed
@yilibinbin yilibinbin deleted the fix/merge-expression-names branch July 3, 2026 05:03
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