Repository navigation
feat(postgres): expose workload Postgres uses with branches - #560
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The implementation is consistent with existing behavior and has focused coverage for branch selection and error cases.
0 open findings
What changed in this PR
Adds resolved Postgres branch usages to application and job workloads while preserving existing fields.
Changes:
- Adds
Workload.postgresUsagesand supporting models/resolvers. - Centralizes explicit, observed-active, and fallback branch selection.
- Covers branch resolution and failure cases with unit and integration tests.
| File | Description |
|---|---|
internal/persistence/postgres/queries.go |
Resolves workload Postgres usages and branches. |
internal/persistence/postgres/queries_test.go |
Tests duplicate-use handling. |
internal/persistence/postgres/models.go |
Adds the usage relationship model. |
internal/persistence/postgres/delete_test.go |
Tests resolved usage branches. |
internal/graph/schema/postgres.graphqls |
Exposes the new GraphQL field and type. |
internal/graph/postgres.resolvers.go |
Resolves usages for applications and jobs. |
internal/graph/gengql/root_.generated.go |
Updates generated root schema code. |
internal/graph/gengql/postgres.generated.go |
Adds generated usage serialization. |
internal/graph/gengql/jobs.generated.go |
Adds generated job field handling. |
internal/graph/gengql/applications.generated.go |
Adds generated application field handling. |
integration_tests/postgres_workloads.lua |
Tests workload usage results. |
integration_tests/postgres_branch_selection.lua |
Tests selection and missing-branch behavior. |
Files not reviewed (3)
- internal/graph/gengql/applications.generated.go: Generated file
- internal/graph/gengql/jobs.generated.go: Generated file
- internal/graph/gengql/postgres.generated.go: Generated file
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Spørsmål til denne. Skulle vi hatt en Mtp at flere ting skal inn der, så kanskje vi skal samle det? |
|
@thokra-nav Godt poeng. Jeg jobber med saken i rom 5 :D |
|
@thokra-nav Oppdatering: jeg fjernet workload-feltet |
There was a problem hiding this comment.
🟡 Changes recommended
It removes a public field without deprecation and resolves resources outside the requested page.
2 open findings
Files not reviewed (4)
- internal/graph/gengql/applications.generated.go: Generated file
- internal/graph/gengql/complexity.go: Generated file
- internal/graph/gengql/jobs.generated.go: Generated file
- internal/graph/gengql/postgres.generated.go: Generated file
🧠 Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
The public schema breaks existing clients, omits promised configured fields, and has inconsistent pagination validation.
6 open findings
Changing postgreses return type breaks existing clients · New Validate pagination before returning for empty uses · New Expose raw branch and rename resolved branch field · New Resolve only referenced resources within the requested page Preserve postgreses field with deprecation during migration Move helper out of generated resolver file · New
Files not reviewed (4)
- internal/graph/gengql/applications.generated.go: Generated file
- internal/graph/gengql/complexity.go: Generated file
- internal/graph/gengql/jobs.generated.go: Generated file
- internal/graph/gengql/postgres.generated.go: Generated file
🧠 Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
The existing public GraphQL field is changed incompatibly without a deprecated compatibility path.
0 open findings
6 resolved since last review
Changing postgreses return type breaks existing clients Expose raw branch and rename resolved branch field Validate pagination before returning for empty uses Resolve only referenced resources within the requested page Preserve postgreses field with deprecation during migration Move helper out of generated resolver file
Files not reviewed (4)
- internal/graph/gengql/applications.generated.go: Generated file
- internal/graph/gengql/complexity.go: Generated file
- internal/graph/gengql/jobs.generated.go: Generated file
- internal/graph/gengql/postgres.generated.go: Generated file
🧠 Review effort: Balanced



Summary
Workload.postgresesto a paginatedPostgresUsesConnectionfor Application and Job.PostgresUseincludesenvPrefix, effectiverole, the referencedpostgres, andbranchas the resolvedPostgresBranch.mainuntil an active branch is observed.Tests
postgres_workloads,postgres_branch_selection, andpostgres_branchesLua integration suites.go test ./internal/graph.