Skip to content

feat(postgres): support direct ownership with legacy main compatibility - #614

Merged
frodesundby merged 6 commits into
mainfrom
feat/postgres-without-branches
Nov 11, 2026
Merged

frodesundby merged 6 commits into
mainfrom
feat/postgres-without-branches

Conversation

@frodesundby

Copy link
Copy Markdown
Contributor

Add dual-read database status, branchless access requests and stable main views for existing clients. Update inventory, issues and gRPC listing, and pin pgrator API types to the feature-branch commit so builds no longer require a local workspace.

Add dual-read database status, branchless access requests and stable main views for existing clients. Update inventory, issues and gRPC listing, and pin pgrator API types to the feature-branch commit so builds no longer require a local workspace.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Branchless access defaults to main instead of the observed active branch, potentially targeting an inactive database or failing despite an available database status.

2 open issues
2 files not reviewed
  • internal/graph/gengql/complexity.go: Generated file
  • internal/graph/gengql/postgres.generated.go: Generated file
What changed in this PR

Adds direct Postgres ownership support to Nais API while preserving legacy main branch views and identities for existing clients.

Changes:

  • Reads database status from either legacy branches or directly owned Postgres resources.
  • Adds database-level GraphQL fields and branchless access, and updates inventory, issue detection, and gRPC listing.
  • Adds compatibility tests and pins the pgrator API dependency to the feature commit.
File Description
internal/​persistence/​postgres/​queries.go Resolves compatible branch views and supports direct access references.
internal/​persistence/​postgres/​physical_status.go Adds dual-read status and virtual main views.
internal/​persistence/​postgres/​physical_status_test.go Tests status selection and ownership transitions.
internal/​persistence/​postgres/​models.go Models direct status and defaults omitted access branches.
internal/​persistence/​postgres/​delete_test.go Supplies the Postgres watcher in access tests.
internal/​persistence/​postgres/​delete_postgres.go Uses the Postgres watcher for dependent-resource clients.
internal/​persistence/​postgres/​connection.go Uses the Postgres watcher for access-resource clients.
internal/​persistence/​postgres/​configuration.go Adopts the shared upstream configuration type.
internal/​persistence/​postgres/​branch_operations.go Uses observed physical targets for restore-window lookup.
internal/​persistence/​postgres/​access_reference_test.go Tests both access-reference formats.
internal/​issue/​checker/​postgres.go Detects direct database failures with compatible issue identities.
internal/​issue/​checker/​postgres_direct_test.go Tests issue detection without branch resources.
internal/​issue/​checker/​checker.go Wires the Postgres watcher into issue checks.
internal/​grpc/​grpcdatabase/​testdata/​dev-gcp/​myteam/​postgres.yaml Converts a database fixture to direct ownership.
internal/​grpc/​grpcdatabase/​server.go Includes direct databases in compatible listings.
internal/​grpc/​grpcdatabase/​server_test.go Supplies the Postgres watcher to listing tests.
internal/​grpc/​grpc.go Passes the Postgres watcher to the database server.
internal/​graph/​schema/​postgres.graphqls Adds database fields and deprecates legacy access selection.
internal/​graph/​postgres.resolvers.go Resolves database status and new relationships.
internal/​graph/​gengql/​root_.generated.go Updates generated schema and field dispatch.
internal/​graph/​gengql/​postgres.generated.go Updates generated resolvers and input handling.
internal/​graph/​gengql/​complexity.go Accounts for paginated database issues.
internal/​cmd/​api/​api.go Wires the Postgres watcher into gRPC startup.
integration_tests/​postgres_dual_read.lua Tests GraphQL compatibility and branchless access.
integration_tests/​k8s_resources/​postgres_dual_read/​dev/​pg-dual-read-team/​resources.yaml Provides legacy and direct database fixtures.
go.sum Updates dependency checksums and removes stale entries.
go.mod Pins the direct-ownership pgrator API commit.

Review effort: Balanced

Comment thread internal/persistence/postgres/models.go Resolved
Comment thread internal/graph/postgres.resolvers.go Resolved
Resolve omitted access branches from a fresh parent's observed selection and preserve that target through creation. Bind workload Postgres relations to the already resolved parent instead of issuing duplicate Kubernetes GETs. Add regression coverage for both Copilot findings in PR #614.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the direct Postgres ownership changes.

No open issues 🎉

2 resolved since last review
2 files not reviewed
  • internal/graph/gengql/complexity.go: Generated file
  • internal/graph/gengql/postgres.generated.go: Generated file

Review effort: Balanced

Preserve direct Postgres support and Copilot fixes alongside upstream branch-mutation removal, workload gRPC listing, Team Logs, vulnerability filters and webhooks. Combine all gRPC watcher dependencies and regenerate API artifacts.
@frodesundby
frodesundby marked this pull request as ready for review November 10, 2026 14:34
@frodesundby
frodesundby requested a review from a team as a code owner November 10, 2026 14:34
Comment thread internal/graph/schema/postgres.graphqls Resolved
Remove the GraphQL clusterName field and accept logical Postgres IDs on Loki queries. Resolve legacy and direct cluster identity internally and scope log and volume queries before user pipelines. Preserve ordinary Loki proxy requests and reject unresolved database targets without querying broad logs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain to block approval.

No open issues 🎉

2 files not reviewed
  • internal/graph/gengql/complexity.go: Generated file
  • internal/graph/gengql/postgres.generated.go: Generated file

Review effort: Balanced

@frodesundby
frodesundby merged commit 2088f68 into main Nov 11, 2026
12 checks passed
@frodesundby
frodesundby deleted the feat/postgres-without-branches branch November 11, 2026 14:19
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.

3 participants