Skip to content

Comments

Fix: Comprehensive codebase health check and cleanup#214

Merged
rwkeane merged 2 commits intoRuffAddDfrom
fix/tests-docs-ruff-sweep-c
Jun 23, 2025
Merged

Fix: Comprehensive codebase health check and cleanup#214
rwkeane merged 2 commits intoRuffAddDfrom
fix/tests-docs-ruff-sweep-c

Conversation

@rwkeane
Copy link
Owner

@rwkeane rwkeane commented Jun 23, 2025

This commit addresses multiple aspects of codebase health:

  1. Test Failures:

    • Resolved 3 failing tests in tsercom/runtime_e2etest.py related to out-of-process error propagation and handling. The fixes involved improving synchronization using multiprocessing.Event to ensure child process errors are reliably detected by the parent RuntimeManager. Affected tests:
      • test_out_of_process_error_check_for_exception
      • test_out_of_process_error_run_until_exception
      • test_out_of_process_initializer_create_error
  2. Overload Docstrings:

    • Ensured all functions using @typing.overload (aliased as @overload) have complete Google-style docstrings for each individual overload signature and for the main implementation. This involved adding or verifying docstrings in files such as:
      • tsercom/api/runtime_handle.py
      • tsercom/runtime/runtime_data_handler.py
      • tsercom/runtime/runtime_data_handler_base.py
      • tsercom/tensor/demuxer/stream_receiver.py
      • tsercom/tensor/muxer/aggregate_tensor_multiplexer.py
    • Files like tsercom/data/remote_data_aggregator.py, tsercom/data/remote_data_aggregator_impl.py, tsercom/discovery/discovery_host.py, tsercom/runtime/endpoint_data_processor.py, and tsercom/runtime/id_tracker.py, tsercom/runtime/runtime_config.py were reviewed and found to already have compliant overload documentation.
  3. Ruff Issues:

    • Added D418 (Function decorated with @overload is missing a docstring) to the ignore list in pyproject.toml as the main implementation docstrings are intentionally brief when overloads are fully documented.
    • Ran ruff check . --fix to automatically correct applicable issues.
    • Manually addressed remaining Ruff violations, including:
      • E501 (Line too long) by shortening docstrings, comments, and code lines.
      • D401 (First line of docstring should be in imperative mood).
      • Other D series docstring convention errors (D100, D101, D102, D103, D105, D107, D203, D205, D210, D211, D212, D213, D404, D413, D417).
      • W293 (Blank line contains whitespace).
    • Corrected syntax errors that were inadvertently introduced during manual E501 fixes by ensuring docstrings were properly formatted.
    • The codebase now passes ruff check . cleanly.
  4. Static Analysis and Verification:

    • Ran black . to format the code.
    • mypy tsercom/ was run; identified errors were pre-existing and not introduced by these changes.
    • The full test suite (pytest --timeout=120) was run twice successfully after all changes to ensure no regressions.

This work improves test reliability, documentation quality, and code style adherence across the tsercom/ codebase.

This commit addresses multiple aspects of codebase health:

1.  **Test Failures:**
    *   Resolved 3 failing tests in `tsercom/runtime_e2etest.py` related to out-of-process error propagation and handling. The fixes involved improving synchronization using `multiprocessing.Event` to ensure child process errors are reliably detected by the parent `RuntimeManager`. Affected tests:
        *   `test_out_of_process_error_check_for_exception`
        *   `test_out_of_process_error_run_until_exception`
        *   `test_out_of_process_initializer_create_error`

2.  **Overload Docstrings:**
    *   Ensured all functions using `@typing.overload` (aliased as `@overload`) have complete Google-style docstrings for each individual overload signature and for the main implementation. This involved adding or verifying docstrings in files such as:
        *   `tsercom/api/runtime_handle.py`
        *   `tsercom/runtime/runtime_data_handler.py`
        *   `tsercom/runtime/runtime_data_handler_base.py`
        *   `tsercom/tensor/demuxer/stream_receiver.py`
        *   `tsercom/tensor/muxer/aggregate_tensor_multiplexer.py`
    *   Files like `tsercom/data/remote_data_aggregator.py`, `tsercom/data/remote_data_aggregator_impl.py`, `tsercom/discovery/discovery_host.py`, `tsercom/runtime/endpoint_data_processor.py`, and `tsercom/runtime/id_tracker.py`, `tsercom/runtime/runtime_config.py` were reviewed and found to already have compliant overload documentation.

3.  **Ruff Issues:**
    *   Added `D418` (Function decorated with @overload is missing a docstring) to the ignore list in `pyproject.toml` as the main implementation docstrings are intentionally brief when overloads are fully documented.
    *   Ran `ruff check . --fix` to automatically correct applicable issues.
    *   Manually addressed remaining Ruff violations, including:
        *   `E501` (Line too long) by shortening docstrings, comments, and code lines.
        *   `D401` (First line of docstring should be in imperative mood).
        *   Other `D` series docstring convention errors (D100, D101, D102, D103, D105, D107, D203, D205, D210, D211, D212, D213, D404, D413, D417).
        *   `W293` (Blank line contains whitespace).
    *   Corrected syntax errors that were inadvertently introduced during manual E501 fixes by ensuring docstrings were properly formatted.
    *   The codebase now passes `ruff check .` cleanly.

4.  **Static Analysis and Verification:**
    *   Ran `black .` to format the code.
    *   `mypy tsercom/` was run; identified errors were pre-existing and not introduced by these changes.
    *   The full test suite (`pytest --timeout=120`) was run twice successfully after all changes to ensure no regressions.

This work improves test reliability, documentation quality, and code style adherence across the `tsercom/` codebase.
This commit addresses multiple aspects of codebase health:

1.  **Test Failures:**
    *   Resolved 3 failing tests in `tsercom/runtime_e2etest.py` related to out-of-process error propagation and handling. The fixes involved improving synchronization using `multiprocessing.Event` to ensure child process errors are reliably detected by the parent `RuntimeManager`. Affected tests:
        *   `test_out_of_process_error_check_for_exception`
        *   `test_out_of_process_error_run_until_exception`
        *   `test_out_of_process_initializer_create_error`

2.  **Overload Docstrings:**
    *   Ensured all functions using `@typing.overload` (aliased as `@overload`) have complete Google-style docstrings for each individual overload signature and for the main implementation. This involved adding or verifying docstrings in files such as:
        *   `tsercom/api/runtime_handle.py`
        *   `tsercom/runtime/runtime_data_handler.py`
        *   `tsercom/runtime/runtime_data_handler_base.py`
        *   `tsercom/tensor/demuxer/stream_receiver.py`
        *   `tsercom/tensor/muxer/aggregate_tensor_multiplexer.py`
    *   Files like `tsercom/data/remote_data_aggregator.py`, `tsercom/data/remote_data_aggregator_impl.py`, `tsercom/discovery/discovery_host.py`, `tsercom/runtime/endpoint_data_processor.py`, and `tsercom/runtime/id_tracker.py`, `tsercom/runtime/runtime_config.py` were reviewed and found to already have compliant overload documentation.

3.  **Ruff Issues:**
    *   Added `D418` (Function decorated with @overload is missing a docstring) to the ignore list in `pyproject.toml` as the main implementation docstrings are intentionally brief when overloads are fully documented.
    *   Ran `ruff check . --fix` to automatically correct applicable issues.
    *   Manually addressed remaining Ruff violations, including:
        *   `E501` (Line too long) by shortening docstrings, comments, and code lines.
        *   `D401` (First line of docstring should be in imperative mood).
        *   Other `D` series docstring convention errors (D100, D101, D102, D103, D105, D107, D203, D205, D210, D211, D212, D213, D404, D413, D417).
        *   `W293` (Blank line contains whitespace).
    *   Corrected syntax errors that were inadvertently introduced during manual E501 fixes by ensuring docstrings were properly formatted.
    *   The codebase now passes `ruff check .` cleanly.

4.  **Static Analysis and Verification:**
    *   Ran `black .` to format the code.
    *   Configured `mypy` in `pyproject.toml` to ignore missing stubs for `grpc_health.v1._async`, `lz4.frame`, `lz4`, and `ntplib`. Removed corresponding `unused-ignore` comments. Added `no-untyped-call` ignores for `share_memory_()` calls. `mypy tsercom/` now passes without errors.
    *   The full test suite (`pytest --timeout=120`) was run twice successfully after all changes to ensure no regressions.

This work improves test reliability, documentation quality, and code style adherence across the `tsercom/` codebase.
@rwkeane rwkeane merged commit ab2bdeb into RuffAddD Jun 23, 2025
2 checks passed
@rwkeane rwkeane deleted the fix/tests-docs-ruff-sweep-c branch June 23, 2025 21:57
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