Skip to content

mpg: route attach connection info through the public API - #5191

Draft
tripledoublev wants to merge 2 commits into
masterfrom
vincent/mpg-attach-public-connection-info
Draft

tripledoublev wants to merge 2 commits into
masterfrom
vincent/mpg-attach-public-connection-info

Conversation

@tripledoublev

@tripledoublev tripledoublev commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

fly mpg attach still fetches the legacy cluster response to get its base connection URI. This change builds that connection information from the public pooler endpoint and user credentials instead.

Classified 404 responses retain the legacy fallback. Other errors stop before app secrets are written. Missing pooler endpoints are rejected before fetching credentials. The public path keeps the existing fly-user and fly-db defaults, while explicit user and database selections remain supported.

Generated connection strings preserve the postgresql:// scheme used by the legacy API, including compatibility with SQLAlchemy. Attachment creation continues to use the existing public attachment endpoint.

Validation:

  • MPG/mpgutil tests, vet, full lint, and build pass.
  • Regression coverage asserts the actual DATABASE_URL written to the secrets API, including its scheme.
  • A fresh E2E run with the updated binary attached a disposable app, confirmed postgresql://, and successfully queried the database from an app Machine using the attached secret.
  • HTTP tracing confirmed public cluster and credential lookups, secret writing, and attachment creation without legacy MPG fallback. Test app, Machine, secret, and attachment were cleaned up.

@tripledoublev
tripledoublev force-pushed the vincent/mpg-attach-public-connection-info branch 2 times, most recently from 15af7e2 to c53a700 Compare September 8, 2026 20:06
Retrieve MPG attach connection information through the public API,
falling back to the legacy bundle only on classified cluster or
default-credential 404s.

Fetch default credentials only when no username is selected. Explicit
and interactively selected users use their own credentials without
being blocked by an unrelated default-user lookup.

Reject failed clusters and missing pooler hosts or ports before
requesting credentials. Preserve database and secret-name overrides,
legacy fallback behavior, and authoritative non-404 errors.

Keep the change scoped to attach and cover public success, credential
selection, fallback, readiness, and failure handling.
@tripledoublev
tripledoublev force-pushed the vincent/mpg-attach-public-connection-info branch from c53a700 to 2834f7e Compare September 8, 2026 20:23
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