refactor(foundations): exception hierarchy, constants, enriched metrics - #36
Merged
Merged
Conversation
…ed metrics model - Add HasqlError, PoolManagerClosedError, NoAvailablePoolError, UnexpectedDatabaseResponseError, PoolManagerClosingError - Add DEFAULT_ACQUIRE_TIMEOUT, DEFAULT_REFRESH_DELAY, DEFAULT_REFRESH_TIMEOUT, DEFAULT_MASTER_AS_REPLICA_WEIGHT, DEFAULT_STOPWATCH_WINDOW_SIZE constants - Enrich metrics model: PoolRole, PoolStats, PoolMetrics, HasqlGauges, CalculateMetrics; retain DriverMetrics for backward compat - Add Makefile with uv-based develop/ruff/mypy/test targets Stack 1/4 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 tasks
packaging is still imported by hasql/asyncpg.py on master. It will be removed in PR4 (refactor/4-drivers) when the driver switches to a manual version parser. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Metrics(drivers=..., hasql=...) must work until PR3 replaces base.py. New PoolMetrics/HasqlGauges types are pure additions; Metrics will be updated to use them in PR3 (refactor/3-core). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
test_metrics.py from the PR branch uses _pool_state which doesn't exist until PR3. Keep master's version here; PR3 will bring the updated tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
AI-assisted: true
AI-assisted: true
AI-assisted: true
AI-assisted: true
AI-assisted: true
refactor(compat): preserve legacy import paths
refactor(drivers): extract drivers into hasql/driver/ package
refactor(core): split base.py into pool_state, pool_manager, health
refactor(contracts): PoolDriver ABC, acquire contexts, balancer refactoring
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stack 1/7 — foundations required by later refactor layers, without changing pool-manager behavior.
HasqlErrorexception hierarchy.DriverMetricscompatibility.Stack
Base:
masterNext: #37
Verification