From f5d03afb526ddec30be5979f37fc727a3418e5b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Sat, 7 Mar 2026 10:52:29 +0400 Subject: [PATCH] fix: multiple fixes + pg-query e2e passed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit upload.go: - Update → Patch (MergeFrom) to avoid resourceVersion conflict when operator modifies Function between Get() and Update() terraform provider v0.1.1: - trigger_resource.go: trToModel returns StringNull() for empty schedule (fixes 'provider produced inconsistent result' for http triggers) - main.go: bump version to 0.1.1 examples/pg-query: - handler.py: fix column name started_at → created_at (matches migrations/001) - main.tf: pin provider to ~> 0.1.1 .gitignore: add terraform state, lock, .terraform/, handler.zip doc/errors/log.md: documented all 5 errors from this session: - resourceVersion conflict → use Patch - terraform inconsistent result for schedule → StringNull - terraform import not implemented → delete+recreate workaround - wrong column name → check migrations before writing handlers - Deployment not restarting after image rebuild → rollout restart / TODO: restartedAt annotation doc/progress.md: terraform apply e2e ✅ --- pg-query/handler.py | 6 +++--- pg-query/main.tf | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pg-query/handler.py b/pg-query/handler.py index 8007e2a..b0a5835 100644 --- a/pg-query/handler.py +++ b/pg-query/handler.py @@ -24,15 +24,15 @@ def handle(event): conn = psycopg2.connect(dsn) try: cur = conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor) - cur.execute("SELECT id, namespace, function_name, status, started_at FROM invocations ORDER BY started_at DESC LIMIT %s", (limit,)) + cur.execute("SELECT id, namespace, function_name, status, created_at FROM invocations ORDER BY created_at DESC LIMIT %s", (limit,)) rows = cur.fetchall() # RealDictCursor возвращает объекты, сериализуем вручную result = [] for row in rows: r = dict(row) # datetime → str - if r.get("started_at"): - r["started_at"] = str(r["started_at"]) + if r.get("created_at"): + r["created_at"] = str(r["created_at"]) result.append(r) return {"invocations": result, "count": len(result)} finally: diff --git a/pg-query/main.tf b/pg-query/main.tf index a545b2f..7c5408c 100644 --- a/pg-query/main.tf +++ b/pg-query/main.tf @@ -16,7 +16,7 @@ terraform { required_providers { sless = { source = "terra.k8c.ru/naeel/sless" - version = "~> 0.1" + version = "~> 0.1.1" } } }