feat: [TKC-5291] Support silent_mode for Postgres repository#7403
feat: [TKC-5291] Support silent_mode for Postgres repository#7403
Conversation
Co-authored-by: vsukhin <5984962+vsukhin@users.noreply.github.com> Agent-Logs-Url: https://github.com/kubeshop/testkube/sessions/ef1db1b9-ac37-4f22-95ff-d97bc2fd54f8
Co-authored-by: vsukhin <5984962+vsukhin@users.noreply.github.com> Agent-Logs-Url: https://github.com/kubeshop/testkube/sessions/ef1db1b9-ac37-4f22-95ff-d97bc2fd54f8
There was a problem hiding this comment.
Pull request overview
Adds Postgres parity with MongoDB for silent_mode on test workflow executions by persisting the field in Postgres, wiring it through sqlc-generated models/queries, and applying the finished-executions filter to exclude silent_mode.health=true runs.
Changes:
- Add
silent_mode JSONBtotest_workflow_executionsvia a goose migration. - Update Postgres SQL queries + sqlc-generated code to read/write
silent_mode, and map it intoTestWorkflowExecutionobjects. - Update controlplane scheduling sqlc models/mappers to include
SilentMode.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| sqlc.yaml | Adds sqlc override for test_workflow_executions.silent_mode in scheduling generator. |
| pkg/repository/testworkflow/postgres/postgres.go | Serializes/deserializes SilentMode and passes it through insert/update and row-mapping. |
| pkg/database/postgres/migrations/20260323000000_silent_mode.sql | Introduces the silent_mode JSONB column. |
| pkg/database/postgres/queries/executions.sql | Adds silent_mode to selects/inserts/updates and applies GetFinished exclusion filter. |
| pkg/database/postgres/sqlc/executions.sql.go | Regenerated sqlc bindings reflecting silent_mode and updated GetFinished query. |
| pkg/database/postgres/sqlc/models.go | Regenerated model includes SilentMode field for TestWorkflowExecution. |
| pkg/database/postgres/sqlc/db.go | Regenerated sqlc boilerplate (version header). |
| pkg/database/postgres/sqlc/leases.sql.go | Regenerated sqlc boilerplate (version header). |
| pkg/database/postgres/sqlc/sequences.sql.go | Regenerated sqlc boilerplate (version header). |
| pkg/controlplane/scheduling/sqlc/models.go | Adds SilentMode to scheduling sqlc TestWorkflowExecution model. |
| pkg/controlplane/scheduling/sqlc/scheduler.sql.go | Updates RETURNING/SELECT projections and scan targets to include silent_mode. |
| pkg/controlplane/scheduling/sqlc/execution_querier.sql.go | Updates projections and scan targets to include silent_mode. |
| pkg/controlplane/scheduling/sqlc/execution_controller.sql.go | Regenerated sqlc boilerplate (version header). |
| pkg/controlplane/scheduling/sqlc/db.go | Regenerated sqlc boilerplate (version header). |
| pkg/controlplane/scheduling/common_postgres.go | Maps SilentMode from sqlc rows into API execution objects. |
| go.mod | Includes indirect dependency churn (not obviously tied to this feature). |
| go.sum | Updates checksums/versions consistent with the go.mod changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greptile SummaryThis PR adds full Confidence Score: 5/5Safe to merge; all changes are correct, well-tested, and follow established patterns. No logic bugs, data-loss risk, or broken contracts found. The only finding is a P2 style suggestion about preferring JSONB containment over text-cast in the GetFinished filter — not a blocker. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[TestWorkflowExecution.SilentMode] -->|nil| B[SQL NULL / omit from INSERT]
A -->|non-nil| C[json.Marshal → JSONB bytes]
C --> D[(silent_mode JSONB column)]
D -->|SELECT| E[SilentMode bytes from DB]
E -->|len == 0 / NULL| F[execution.SilentMode = nil]
E -->|len > 0| G[json.Unmarshal → *SilentMode]
D -->|GetFinished filter| H{silent_mode IS NULL?}
H -->|yes| I[Row included]
H -->|no| J{health key text-cast = true?}
J -->|yes| K[Row excluded]
J -->|no / absent| I
Reviews (4): Last reviewed commit: "fix: remove misleading comment" | Re-trigger Greptile |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: vsukhin <5984962+vsukhin@users.noreply.github.com> Agent-Logs-Url: https://github.com/kubeshop/testkube/sessions/67f817b6-8c9d-48da-8a15-fcb8897bf7ec
Signed-off-by: Vladislav Sukhin <vladislav@kubeshop.io>
Signed-off-by: Vladislav Sukhin <vladislav@kubeshop.io>
|
@greptile |
|
@copilot fix unit tests |
Co-authored-by: vsukhin <5984962+vsukhin@users.noreply.github.com> Agent-Logs-Url: https://github.com/kubeshop/testkube/sessions/d047718f-f98d-4028-aa02-18f5ef7c5d32
Fixed in commit a111df4. Updated all affected tests in
|
Signed-off-by: Vladislav Sukhin <vladislav@kubeshop.io> # Conflicts: # pkg/database/postgres/queries/executions.sql # pkg/database/postgres/sqlc/executions.sql.go # pkg/database/postgres/sqlc/executions.sql_test.go
|
@greptile |
Signed-off-by: Vladislav Sukhin <vladislav@kubeshop.io>
|
@greptile |
SilentModewas unimplemented in the Postgres code path (nilwith// TODO: Unimplemented!?comments) while MongoDB already supported it. This adds fullsilent_modepersistence and filtering parity with MongoDB.Pull request description
silent_mode JSONBcolumn totest_workflow_executionssilent_modeto all SELECT, INSERT, and UPDATE statements inexecutions.sqlsilent_mode @> '{"health": true}'using JSONB containment (index-friendly, no cast errors), matching MongoDB behaviortest_workflow_executions.silent_mode → *testkube.SilentModein scheduling package; regenerated all affected models/params viamake generate-sqlccommon_postgres.go: BothmapPgTestWorkflowExecutionPartialandmapPgTestWorkflowExecutionnow populateSilentModefrom the row instead of hardcodingnilpostgres.go(testworkflow repository):insertMainExecutionandupdateMainExecutionserializeSilentModeto JSONB (nil pointer produces SQL NULL);parseExecutionJSONFieldsdeserializes it on read with proper error propagationpostgres_test.go): AddedTestPostgresRepository_SilentModeInsert,TestPostgresRepository_SilentModeGet, andTestPostgresRepository_GetFinished_SilentModeto verify serialization, deserialization, and row mappingexecutions.sql_test.go): Updated all affected sqlc mock tests to include thesilent_modecolumn in query patterns, mock column lists, row values, and INSERT/UPDATE param structsChecklist (choose whats happened)
Breaking changes
Changes
Fixes
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.