Repository navigation
feat(postgres): support direct ownership with legacy main compatibility - #614
Merged
Merged
Conversation
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.
Contributor
There was a problem hiding this comment.
🟡 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 fileinternal/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
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.
Contributor
There was a problem hiding this comment.
🟢 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 fileinternal/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.
thokra-nav
reviewed
Nov 11, 2026
thokra-nav
approved these changes
Nov 11, 2026
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.
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.


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.