Skip to content

Modernize runtime contracts, structure, and lint coverage - #7

Merged
by275 merged 26 commits into
masterfrom
pylint-remediation
Aug 28, 2026
Merged

by275 merged 26 commits into
masterfrom
pylint-remediation

Conversation

@by275

@by275 by275 commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Overview

This pull request modernizes the project on top of the current master branch while preserving the established command-line workflow, public protocol names, legacy cipher availability, and supported transport behavior.

The work focuses on making the runtime contracts explicit, improving maintainability, and adding targeted correctness checks without changing the project’s intended operating model.

What changed

Correctness and lifecycle safety

  • Removed duplicate local callback definitions in the CLI startup path and gave each listener type an explicit callback contract.
  • Fixed deferred callback closure capture so each test case retains its own fixture values.
  • Preserved asyncio.CancelledError propagation while narrowing exception handling at connection, protocol, TLS, WebSocket, and optional-backend boundaries where appropriate.
  • Made connection, listener, shutdown, and task ownership behavior explicit across direct, chained, reverse, TLS, HTTP/2, QUIC, H3, SSH, and WebSocket paths.
  • Added or strengthened malformed-input, lifecycle, optional-runtime, and resource-leak coverage.

Protocol and transport structure

  • Clarified the async return contracts for connection and server setup methods.
  • Isolated private asyncio/aioquic integration behind a small adapter boundary.
  • Added explicit TLS transport behavior for the asyncio transport surface used by the project.
  • Split H2 event dispatch and connection read-loop responsibilities.
  • Split stream upstream setup and relay stages while preserving protocol dispatch, statistics callbacks, cleanup, and error mapping.
  • Decomposed URI/backend construction and CLI startup/shutdown into focused helpers.

Cipher and compatibility behavior

  • Declared runtime attributes and backend hooks for accelerated and pure-Python cipher implementations.
  • Preserved generated cipher registry names and legacy cipher compatibility.
  • Made packet and stream cipher state ownership explicit without replacing or rewriting the existing algorithms.
  • Kept compatibility aliases and callback signatures where they are part of the existing public or protocol-facing surface.

Documentation and tooling

  • Added focused docstrings and type information around public APIs, protocol adapters, lifecycle boundaries, and test/benchmark modules.
  • Added a scoped Pylint correctness gate for high-risk findings and separate informational reports for production and test/benchmark code.
  • Kept syntax/undefined-name checks and the existing test/build validation in CI.
  • Updated the development dependency set so the lint policy can be reproduced locally.

Compatibility considerations

The established CLI entry points, supported protocol identifiers, public compatibility aliases, legacy cipher registry entries, and optional adapter behavior are retained. The changes are intended to be behavior-preserving for normal callers; the internal implementation is now more explicit about awaitable lifecycle methods and resource ownership.

Validation

The branch was validated with the optional runtime dependencies installed:

  • Python 3.12.3
  • 82 unittest tests passed
  • 82 optimized unittest tests passed
  • pytest: 82 passed, 7 subtests passed
  • Ruff E9/F821 checks passed
  • compileall passed
  • Selected Pylint correctness gate passed
  • Full Pylint scan: 0 warning/error-level messages; remaining convention/refactor findings are informational
  • Pylint score improved from 7.06/10 on the baseline to 9.23/10
  • Proxy setup and relay smoke benchmarks completed successfully

Performance check

The modernization was not treated as a performance rewrite. The pyperf comparison against the baseline showed a geometric mean of approximately 1.00x, with no statistically meaningful broad regression or improvement. Loopback connection setup and relay measurements remained within normal run-to-run variation, so dedicated optimization can be evaluated separately with workload-specific profiling.

Review focus

Please pay particular attention to:

  • lifecycle and cancellation behavior across optional transports;
  • preservation of protocol callback and compatibility contracts;
  • the boundary around private runtime integration;
  • the CI lint scope and informational reporting behavior.

@by275
by275 merged commit f9ada54 into master Aug 28, 2026
10 checks passed
@by275
by275 deleted the pylint-remediation branch August 28, 2026 17:50
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