AI Slop Code RIsk Monitor

MagicStack/asyncpg

A fast PostgreSQL Database Client Library for Python/asyncio.

17.4 Elevated pattern signal View on GitHub

Maintenance and Governance Review

This report summarizes scanner evidence for MagicStack/asyncpg, a Python project with 8,106 GitHub stars. SynthScan examined 28,360 lines of code across 65 source files, recording 409 pattern matches distributed across 12 syntactic categories. The legacy adjusted pattern signal is 17.4 (Elevated pattern signal); it is not an authorship estimate.

Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.

17.4
Adjusted Signal
17.4
Raw Pattern Score
100%
Time Factor
2026-10-08
Last Push
8.1K
Stars
Python
Language
28.4K
Lines of Code
65
Files
409
Pattern Hits
2026-10-12
Scan Date
0.35
HC Hit Rate

Risk Review · v3

Use each vector to guide manual verification of the underlying findings.

Cognitive Ownership Risk 45.0/100 · MEDIUM

Can maintainers explain intent, assumptions, and trade-offs? 337 finding(s).

Hallucinated Dependency & Supply Chain Risk 11.0/100 · LOW

Are imports declared and package/API names verified? 48 finding(s).

Agent Over-Engineering Ratio 33.5/100 · MEDIUM

Are wrappers, guards, and repeated structures necessary? 259 finding(s).

PR Review Velocity Impact 66.6/100 · HIGH

Which changes need focused human review? 409 finding(s).

What These Metrics Mean

Adjusted Signal
Legacy pattern score normalized per 1,000 scanned lines and multiplied by the repository-level time factor. It is not an estimate of AI authorship.
Raw Pattern Score
Sum of severity- and context-weighted pattern findings before applying the time factor.
Time Factor
A coarse multiplier based on repository last-push metadata. It does not identify when individual code was written.
Pattern Hits
Count of configured pattern findings. Review each location and surrounding code before acting.
HC Hit Rate
High- and critical-severity findings per scanned file. Severity is a configured detector weight, not proof of a vulnerability or authorship.
Lines / Files
Scan coverage denominators used by the legacy normalized score.

Pattern-Signal History

Run additional scans to build a history of the legacy pattern signal. Score changes are not a measure of AI adoption or code quality.

No multi-scan history yet — run the scanner again to build trend data.

Severity Breakdown

Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.

CRITICAL 0HIGH 23MEDIUM 49LOW 337

Directory Score Breakdown

This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.

Pattern Findings

The scanner identified 409 distinct pattern matches across 12 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.

Self-Referential Comments48 hits · 143 pts
SeverityFileLineSnippetContext
MEDIUMsetup.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtools/generate_exceptions.py6# This module is part of asyncpg and is released underCOMMENT
MEDIUMtools/generate_type_map.py6# This module is part of asyncpg and is released underCOMMENT
MEDIUMtools/generate_type_map.py63 '# This module is part of asyncpg and is released under\n'CODE
MEDIUMasyncpg/compat.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/transaction.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/__init__.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/types.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/serverversion.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/prepared_stmt.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/connection.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/utils.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/cluster.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/connect_utils.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/introspection.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/connresource.py5# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/pool.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/cursor.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/_testbase/__init__.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/_testbase/fuzzer.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/protocol/__init__.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMasyncpg/exceptions/_base.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_transaction.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_utils.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_connect.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_record.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_test.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_timeout.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_scram.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_subinterpreters.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test__sourcecode.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_copy.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_exceptions.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/__init__.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_execute.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_cursor.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_adversity.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test__environment.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_cancellation.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_introspection.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_listeners.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_cache_invalidation.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_cache_invalidation.py338 # Create the same schema in the "testdb", fetch data which cachesCOMMENT
MEDIUMtests/test_prepare.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_codecs.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_pool.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUMtests/test_types.py4# This module is part of asyncpg and is released underCOMMENT
MEDIUM.github/release_log.py6# This module is part of asyncpg and is released underCOMMENT
Hyper-Verbose Identifiers224 hits · 131 pts
SeverityFileLineSnippetContext
LOWasyncpg/serverversion.py32def split_server_version_string(version_string: str) -> ServerVersion:CODE
LOWasyncpg/connection.py224 def remove_termination_listener(self, callback):CODE
LOWasyncpg/connection.py1728 def _call_termination_listeners(self):CODE
LOWasyncpg/connection.py1823 def _drop_local_statement_cache(self):CODE
LOWasyncpg/connection.py1826 def _drop_global_statement_cache(self):CODE
LOWasyncpg/connection.py2731def _detect_server_capabilities(server_version, connection_settings):STRING
LOWasyncpg/cluster.py434 def trust_local_replication_by(self, user):CODE
LOWasyncpg/cluster.py462 def _connection_addr_from_pidfile(self):CODE
LOWasyncpg/connect_utils.py143def _read_password_from_pgpass(CODE
LOWasyncpg/connect_utils.py282def _parse_connect_dsn_and_args(*, dsn, host, port, user,CODE
LOW⚡asyncpg/pool.py321 def _maybe_cancel_inactive_callback(self) -> None:CODE
LOW⚡asyncpg/pool.py326 def _deactivate_inactive_connection(self) -> None:CODE
LOWasyncpg/pool.py542 def _schedule_min_size_maintenance(self):CODE
LOWasyncpg/_testbase/__init__.py31def silence_asyncio_long_exec_warning():CODE
LOWasyncpg/_testbase/__init__.py513 def get_cluster_connection_spec(cls, cluster, kwargs={}):STRING
LOWasyncpg/_testbase/fuzzer.py130 def trigger_connectivity_loss(self):CODE
LOWasyncpg/_testbase/fuzzer.py133 def _trigger_connectivity_loss(self):CODE
LOWasyncpg/exceptions/_base.py74 def get_message_class_for_sqlstate(mcls, code):CODE
LOWtests/test_transaction.py113 async def test_transaction_interface_errors(self):STRING
LOWtests/test_transaction.py162 async def test_transaction_within_manual_transaction(self):STRING
LOWtests/test_transaction.py214 async def test_nested_isolation_level(self):STRING
LOWtests/test_connect.py260 async def test_auth_password_cleartext(self):CODE
LOWtests/test_connect.py273 async def test_auth_password_cleartext_without_password(self):CODE
LOWtests/test_connect.py278 async def test_auth_password_cleartext_callable(self):CODE
LOWtests/test_connect.py297 async def test_auth_password_cleartext_callable_coroutine(self):CODE
LOWtests/test_connect.py316 async def test_auth_password_cleartext_callable_awaitable(self):CODE
LOWtests/test_connect.py448 async def test_auth_gssapi_bad_srvname(self):CODE
LOWtests/test_connect.py456 async def test_auth_gssapi_bad_user(self):CODE
LOWtests/test_connect.py1224 def test_test_connect_params_environ(self):CODE
LOWtests/test_connect.py1251 def test_test_connect_params_run_testcase(self):CODE
LOWtests/test_connect.py1270 def test_connect_connection_service_file(self):CODE
LOW⚡tests/test_connect.py2787 async def test_nossl_handshake_fallback(self):STRING
LOW⚡tests/test_connect.py2797 async def test_nossl_connection_sslmode(self):STRING
LOW⚡tests/test_connect.py2807 async def test_nossl_connection_prefer_cancel(self):STRING
LOWtests/test_connect.py1375 def test_connect_pgpass_regular(self):STRING
LOWtests/test_connect.py1549 def test_connect_pgpass_badness_mode(self):STRING
LOWtests/test_connect.py1573 def test_connect_pgpass_badness_non_file(self):STRING
LOWtests/test_connect.py1594 def test_connect_pgpass_nonexistent(self):STRING
LOWtests/test_connect.py1612 def test_connect_pgpass_inaccessible_file(self):STRING
LOWtests/test_connect.py1633 def test_connect_pgpass_inaccessible_directory(self):STRING
LOWtests/test_connect.py1657 async def test_connect_args_validation(self):STRING
LOWtests/test_connect.py1674 async def test_connect_terminates_rejected_connections(self):STRING
LOWtests/test_connect.py1727 async def test_rejected_host_cannot_time_out_selected_connection(self):STRING
LOWtests/test_connect.py1763 async def test_connection_cancelled_during_transport_setup(self):STRING
LOWtests/test_connect.py1785 async def test_connection_isinstance(self):STRING
LOWtests/test_connect.py1790 async def test_connection_use_after_close(self):STRING
LOWtests/test_connect.py1822 async def test_connection_ssl_to_no_ssl_server(self):STRING
LOWtests/test_connect.py1833 async def test_connection_sslmode_no_ssl_server(self):STRING
LOWtests/test_connect.py1871 async def test_connection_implicit_host(self):STRING
LOWtests/test_connect.py1880 async def test_connection_no_home_dir(self):STRING
LOWtests/test_connect.py2100 async def _test_cancellation_recovery(self, con):STRING
LOWtests/test_connect.py2145 async def _test_connect_interruption(self, *, ready, cancel, **conn_args):STRING
LOWtests/test_connect.py2209 async def test_ssl_startup_retry_boundary(self):STRING
LOWtests/test_connect.py2244 async def test_ssl_post_authentication_server_error(self):STRING
LOWtests/test_connect.py2255 async def test_ssl_fallback_error_cause(self):STRING
LOWtests/test_connect.py2269 async def test_ssl_cannot_connect_now_failover(self):STRING
LOWtests/test_connect.py2315 async def test_sslrequest_errors_are_terminal(self):STRING
LOWtests/test_connect.py2337 async def test_ssl_declined_and_disconnect_attempt_counts(self):STRING
LOWtests/test_connect.py2357 async def test_ssl_connect_timeout_and_cancellation(self):STRING
LOWtests/test_connect.py2371 async def test_ssl_handshake_failure_cause(self):STRING
164 more matches not shown…
Empty Error Handlers16 hits · 80 pts
SeverityFileLineSnippetContext
HIGHasyncpg/compat.py50except ConnectionResetError:CODE
HIGHasyncpg/serverversion.py46except (TypeError, ValueError):CODE
HIGHasyncpg/connection.py1696except asyncio.CancelledError:CODE
HIGHasyncpg/connection.py1686except ConnectionResetError:CODE
HIGHasyncpg/connect_utils.py137except IOError:CODE
HIGHasyncpg/connect_utils.py792except (FileNotFoundError, NotADirectoryError):CODE
HIGHasyncpg/connect_utils.py760except (CODE
HIGHasyncpg/_testbase/fuzzer.py218except ConnectionError:CODE
HIGHasyncpg/_testbase/fuzzer.py332except ConnectionError:CODE
HIGHasyncpg/_testbase/fuzzer.py358except ConnectionError:CODE
HIGHtests/test_connect.py240except asyncpg.ConnectionDoesNotExistError:CODE
HIGHtests/test_timeout.py205except asyncio.TimeoutError:CODE
HIGHtests/test_subinterpreters.py14except ImportError:CODE
HIGHtests/test_listeners.py339except Exception:CODE
HIGHtests/test_cache_invalidation.py182except UserWarning:CODE
HIGHtests/test_cache_invalidation.py233except UserWarning:CODE
Unused Imports41 hits · 41 pts
SeverityFileLineSnippetContext
LOWasyncpg/compat.py7CODE
LOWasyncpg/compat.py60CODE
LOWasyncpg/compat.py64CODE
LOWasyncpg/compat.py66CODE
LOWasyncpg/compat.py70CODE
LOWasyncpg/compat.py72CODE
LOWasyncpg/compat.py75CODE
LOWasyncpg/compat.py79CODE
LOWasyncpg/compat.py88CODE
LOWasyncpg/_version.py13CODE
LOWasyncpg/__init__.py7CODE
LOWasyncpg/__init__.py9CODE
LOWasyncpg/__init__.py9CODE
LOWasyncpg/__init__.py10CODE
LOWasyncpg/__init__.py11CODE
LOWasyncpg/__init__.py11CODE
LOWasyncpg/__init__.py12CODE
LOWasyncpg/__init__.py13CODE
LOWasyncpg/__init__.py16CODE
LOWasyncpg/types.py7CODE
LOWasyncpg/types.py11CODE
LOWasyncpg/types.py11CODE
LOWasyncpg/types.py11CODE
LOWasyncpg/types.py11CODE
LOWasyncpg/types.py11CODE
LOWasyncpg/types.py11CODE
LOWasyncpg/types.py11CODE
LOWasyncpg/types.py11CODE
LOWasyncpg/serverversion.py7CODE
LOWasyncpg/connect_utils.py7CODE
LOWasyncpg/introspection.py7CODE
LOWasyncpg/pool.py7CODE
LOWasyncpg/_asyncio_compat.py7CODE
LOWasyncpg/protocol/__init__.py9CODE
LOWasyncpg/protocol/__init__.py11CODE
LOWasyncpg/protocol/__init__.py11CODE
LOWasyncpg/protocol/__init__.py11CODE
LOWasyncpg/protocol/__init__.py12CODE
LOWasyncpg/exceptions/__init__.py4CODE
LOWtests/test__sourcecode.py21CODE
LOWtests/test__sourcecode.py44CODE
Deep Nesting37 hits · 37 pts
SeverityFileLineSnippetContext
LOWsetup.py160CODE
LOWtools/generate_exceptions.py39CODE
LOWtools/generate_exceptions.py68CODE
LOWasyncpg/transaction.py96CODE
LOWasyncpg/connection.py1165CODE
LOWasyncpg/cluster.py100CODE
LOWasyncpg/cluster.py508CODE
LOWasyncpg/cluster.py563CODE
LOWasyncpg/connect_utils.py100CODE
LOWasyncpg/connect_utils.py196CODE
LOWasyncpg/connect_utils.py282CODE
LOWasyncpg/connect_utils.py982CODE
LOWasyncpg/connect_utils.py1265CODE
LOWasyncpg/pool.py509CODE
LOWasyncpg/pool.py550CODE
LOWasyncpg/_testbase/fuzzer.py313CODE
LOWasyncpg/_testbase/fuzzer.py339CODE
LOWtests/test_transaction.py183CODE
LOWtests/test_transaction.py214CODE
LOWtests/test_connect.py1674CODE
LOWtests/test_connect.py1763CODE
LOWtests/test_connect.py2209CODE
LOWtests/test_connect.py2269CODE
LOWtests/test_connect.py2532CODE
LOWtests/test_connect.py2657CODE
LOWtests/test_timeout.py115CODE
LOWtests/test_timeout.py300CODE
LOWtests/test_timeout.py312CODE
LOWtests/test_prepare.py37CODE
LOWtests/test_codecs.py484CODE
LOWtests/test_codecs.py733CODE
LOWtests/test_codecs.py1533CODE
LOWtests/test_codecs.py1987CODE
LOWtests/test_pool.py878CODE
LOWtests/test_pool.py905CODE
LOWtests/test_pool.py952CODE
LOWtests/test_pool.py1133CODE
Cross-Language Confusion7 hits · 25 pts
SeverityFileLineSnippetContext
HIGHasyncpg/connection.py892 null=null, header=header, quote=quote, escape=escape,CODE
HIGHasyncpg/connection.py951 null=null, header=header, quote=quote, escape=escape,CODE
HIGHasyncpg/connection.py1041 null=null, header=header, quote=quote, escape=escape,CODE
HIGHasyncpg/pool.py837 null=null,STRING
HIGHasyncpg/pool.py879 null=null,STRING
HIGHasyncpg/pool.py929 null=null,STRING
HIGHtests/test_codecs.py2003 for val in ['"null"', '22', 'null', '[2]', '{"a": null}']:STRING
Over-Commented Block15 hits · 15 pts
SeverityFileLineSnippetContext
LOWasyncpg/_version.py1# This file MUST NOT contain anything but the __version__ assignment.COMMENT
LOWasyncpg/prepared_stmt.py141 query += ') 'COMMENT
LOWasyncpg/connection.py2081 await self.reload_schema_state()COMMENT
LOWasyncpg/connection.py2541 self._loop = loopCOMMENT
LOWasyncpg/_asyncio_compat.py41 # The special case for timeout <= 0 is for the following case:COMMENT
LOWasyncpg/protocol/record/pythoncapi_compat.h1// Header file providing new C API functions to old Python versions.COMMENT
LOWasyncpg/protocol/record/pythoncapi_compat.h21#include <Python.h>COMMENT
LOWasyncpg/protocol/record/pythoncapi_compat.h41# if (defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L) \COMMENT
LOWasyncpg/protocol/record/pythoncapi_compat.h121# define Py_IsNone(x) Py_Is(x, Py_None)COMMENT
LOWasyncpg/protocol/record/pythoncapi_compat.h481COMMENT
LOWasyncpg/protocol/record/pythoncapi_compat.h541#if PY_VERSION_HEX < 0x030B00C1 && !defined(PYPY_VERSION)COMMENT
LOWasyncpg/protocol/record/pythoncapi_compat.h1221# define PyHASH_IMAG _PyHASH_IMAGCOMMENT
LOWasyncpg/protocol/record/pythoncapi_compat.h1921#if PY_VERSION_HEX < 0x030C00A3COMMENT
LOWasyncpg/protocol/record/pythoncapi_compat.h1941COMMENT
LOWtests/test_connect.py861 # {COMMENT
AI Structural Patterns11 hits · 11 pts
SeverityFileLineSnippetContext
LOWasyncpg/prepared_stmt.py178CODE
LOWasyncpg/connection.py2116CODE
LOWasyncpg/connection.py829CODE
LOWasyncpg/connection.py901CODE
LOWasyncpg/connection.py963CODE
LOWasyncpg/connection.py1165CODE
LOWasyncpg/pool.py1201CODE
LOWasyncpg/pool.py800CODE
LOWasyncpg/pool.py845CODE
LOWasyncpg/pool.py887CODE
LOWasyncpg/_testbase/__init__.py270CODE
Excessive Try-Catch Wrapping6 hits · 6 pts
SeverityFileLineSnippetContext
MEDIUMasyncpg/connection.py1194def _copy_out(self, copy_stmt, output, timeout):CODE
LOWasyncpg/connection.py1700 except Exception:CODE
LOWasyncpg/cluster.py44 except Exception:CODE
LOWasyncpg/pool.py567 except Exception:CODE
LOWasyncpg/_testbase/__init__.py204 except Exception as ex:CODE
LOWtests/test_listeners.py339 except Exception:STRING
Modern Structural Boilerplate2 hits · 2 pts
SeverityFileLineSnippetContext
LOWasyncpg/pool.py25logger = logging.getLogger(__name__)CODE
LOW⚡asyncpg/pool.py312 def _setup_inactive_callback(self) -> None:CODE
AI Slop Vocabulary1 hit · 2 pts
SeverityFileLineSnippetContext
LOWasyncpg/compat.py27 # We cannot simply use expanduser() as that returns the user'sCOMMENT
Redundant / Tautological Comments1 hit · 0 pts
SeverityFileLineSnippetContext
LOWasyncpg/connection.py2620 # Check if the cache is bigger than max_size and trim itSTRING