Repository navigation
Description
Production code currently accommodates objects and state that exist only because of unit-test fixtures. This adds alternative execution paths to the driver and lets tests exercise weaker contracts than real requests use.
For example, response-future tests supply strings instead of Host instances, while request execution conditionally skips host locking and lifecycle checks for non-Host values:
There are also explicit production fallbacks for tests constructing Session without running its initializer:
Scope
Audit cassandra/ for branches, attribute defaults, lazy initialization, and type checks whose only purpose is to accommodate test fixtures, mocks, or partially initialized objects. Remove each confirmed case through focused child issues and update the corresponding fixtures to satisfy the production contract.
Start with:
- Non-
Hosthandling inResponseFuture._query()and request selection. - Session pool bookkeeping initialized lazily specifically for tests that bypass
Session.__init__. - An audit of other production accommodations for missing fixture attributes or incomplete mock objects; verify their purpose before scheduling removal.
Acceptance criteria
- Inventory confirmed test-only accommodations and track their removal in child issues.
- Refactor fixtures to provide valid object types, ownership, locks, and initialized state.
- Remove all confirmed test-only production paths identified by the audit.
- Preserve supported public behavior, including cached
Hostresolution by ID, and retain endpoint/pool ownership, lifecycle, timeout, retry, and concurrency protections. - Preserve legitimate compatibility and runtime fallbacks, including pure-Python implementations; a defensive check alone is not evidence of test-only handling.
- Keep meaningful behavioral coverage and run the relevant unit suites against pure-Python and rebuilt Cython modules where applicable.
This epic is complete when the audit and its cleanup issues are complete. It does not require a live-cluster reproducer: the initial evidence is the source and test-fixture contracts above.
Activity