Skip to content

Refactor: Split _conversion.py into domain modules, improve naming in _helper.py#489

Open
Wolfvin wants to merge 1 commit into
mhostetter:mainfrom
Wolfvin:refactor/structural-decomposition-naming
Open

Refactor: Split _conversion.py into domain modules, improve naming in _helper.py#489
Wolfvin wants to merge 1 commit into
mhostetter:mainfrom
Wolfvin:refactor/structural-decomposition-naming

Conversation

@Wolfvin

@Wolfvin Wolfvin commented Jun 13, 2026

Copy link
Copy Markdown

Structural Refactoring with Regression Testing Proof

All changes are backward-compatible.

What was refactored

  1. _conversion.py (444 lines) split into _conversion/ package

    • _decibels.py (141 lines): db(), linear()
    • _snr.py (315 lines): All 6 SNR conversion functions
    • init.py re-exports everything
  2. _helper.py naming improvements

    • _argument_names() -> _extract_caller_argument_names()
    • verify_scalar() -> verify_and_validate_scalar()
    • verify_arraylike() -> verify_and_validate_arraylike()
    • convert_output() -> normalize_output_type()
    • convert_to_scalar() -> demote_numpy_scalar_to_native()
    • All old names kept as backward-compatible aliases
  3. _signal.py docstring improvements

Regression Testing Proof (Regrets)

18 clusters tested, 4 chains validated, 0 false positives.

All 4 verifications passed:

  1. All 18 Regrets clusters GREEN
  2. Direct output matches KEBENARAN 1 (raw ground truth)
  3. Fingerprints match KEBENARAN 2 (fingerprint ground truth)
  4. All 4 chain hashes match (multi-step flow validation)

… functions, improve _signal.py docstrings

- Split _conversion.py (444 lines) into _conversion package:
  - _conversion/_decibels.py: db(), linear() functions
  - _conversion/_snr.py: SNR conversion functions
  - _conversion/__init__.py: Re-exports all public names

- Rename functions in _helper.py with backward-compatible aliases:
  - _argument_names() -> _extract_caller_argument_names()
  - verify_scalar() -> verify_and_validate_scalar()
  - verify_arraylike() -> verify_and_validate_arraylike()
  - convert_output() -> normalize_output_type()
  - convert_to_scalar() -> demote_numpy_scalar_to_native()

- Improve _signal.py:
  - Module docstring: 'Signal generation and transformation functions...'
  - Updated Group tags from 'dsp-signal-manipulation' to specific groups
  - Updated internal references to use new canonical names
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.31298% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.20%. Comparing base (8b8b0b3) to head (4b6e39c).
⚠️ Report is 66 commits behind head on main.

Files with missing lines Patch % Lines
src/sdr/_helper.py 83.63% 9 Missing ⚠️
src/sdr/_signal.py 81.81% 4 Missing ⚠️
src/sdr/_conversion/_decibels.py 96.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #489      +/-   ##
==========================================
+ Coverage   81.81%   82.20%   +0.38%     
==========================================
  Files          63       65       +2     
  Lines        3960     4119     +159     
==========================================
+ Hits         3240     3386     +146     
- Misses        720      733      +13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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