Skip to content

Credential guard tracebacks on a non-integer POSTGRES_PORT instead of reporting it #92

Open

Description

@getdownandcode

Problem

scripts/check_deploy_credentials.py promises "one line per problem" and reports malformed DATABASE_URL / DATABASE_READONLY_URL / REDIS_URL values instead of raising (see PR #90 / #90 review fix 713735b). The same guard still crashes with a traceback when the datastore is configured via components and POSTGRES_PORT is not an integer:

export POSTGRES_PASSWORD=app_password_9f3a
export POSTGRES_READONLY_PASSWORD=ro_password_7c21
export REDIS_PASSWORD=cache_password_4b18
export POSTGRES_PORT=abc            # typo
unset DATABASE_URL DATABASE_READONLY_URL

python scripts/check_deploy_credentials.py
# ValueError: POSTGRES_PORT must be an integer, got 'abc'.

audit_credentials() calls agentkit.config.resolve_postgres_url() (twice) without guarding it, and that function raises ValueError for a non-integer POSTGRES_PORT (agentkit/config.py, documented under "Raises"). Both the application (Settings) and the guard hit the same exception; the result is a traceback in the compose migrations service instead of the actionable problem line the rest of the audit produces.

Impact

Suggested fix

Wrap the two resolve_postgres_url() calls in audit_credentials() with a small helper that catches the ValueError and appends POSTGRES_PORT is not a valid integer. to problems, in the same style as _parse_url() / _resolve_redis_url(). Settings keeps its fail-fast behavior (a ValidationError at startup is fine there); only the guard needs the stable message. Add a regression test with POSTGRES_PORT=abc in component mode.

Relates to #86 (guard correctness follow-ups from the PR #84 review).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions