Merge pull request 'fix(memory/pgplugin): restore idx++ in PatchNamespace (OFFSEC-004)' (#832) from fix/offsec-004-patchnamespace-idx into main
Some checks failed
Block internal-flavored paths / Block forbidden paths (push) Successful in 20s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 48s
cascade-list-drift-gate / check (pull_request) Successful in 25s
CI / Detect changes (push) Successful in 1m0s
Check migration collisions / Migration version collision check (pull_request) Successful in 1m3s
CI / Detect changes (pull_request) Successful in 1m3s
Harness Replays / detect-changes (push) Successful in 13s
E2E API Smoke Test / detect-changes (push) Successful in 54s
E2E Staging Canvas (Playwright) / detect-changes (push) Successful in 52s
E2E API Smoke Test / detect-changes (pull_request) Successful in 1m1s
Handlers Postgres Integration / detect-changes (push) Successful in 57s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (pull_request) Successful in 17s
Harness Replays / detect-changes (pull_request) Failing after 45s
Harness Replays / Harness Replays (pull_request) Has been skipped
Secret scan / Scan diff for credential-shaped strings (push) Successful in 17s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 1m10s
Runtime PR-Built Compatibility / detect-changes (push) Successful in 1m8s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m10s
publish-runtime-autobump / bump-and-tag (pull_request) Has been skipped
lint-continue-on-error-tracking / lint-continue-on-error-tracking (pull_request) Successful in 2m26s
Lint pre-flip continue-on-error / Verify continue-on-error flips have run-log proof (pull_request) Successful in 2m0s
publish-runtime-autobump / pr-validate (pull_request) Successful in 50s
lint-mask-pr-atomicity / lint-mask-pr-atomicity (pull_request) Successful in 2m23s
Lint workflow YAML (Gitea-1.22.6-hostile shapes) / Lint workflow YAML for Gitea-1.22.6-hostile shapes (pull_request) Successful in 1m45s
lint-required-context-exists-in-bp / lint-required-context-exists-in-bp (pull_request) Failing after 2m12s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, local-postgres-e2
sop-checklist-gate / gate (pull_request) Successful in 28s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 1m5s
sop-tier-check / tier-check (pull_request) Successful in 17s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 1m12s
Runtime Pin Compatibility / PyPI-latest install + import smoke (pull_request) Successful in 2m0s
Ops Scripts Tests / Ops scripts (unittest) (pull_request) Successful in 1m36s
CI / Canvas (Next.js) (push) Successful in 10s
CI / Shellcheck (E2E scripts) (push) Successful in 7s
CI / Python Lint & Test (push) Successful in 9s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 24s
Harness Replays / Harness Replays (push) Successful in 6s
publish-workspace-server-image / build-and-push (push) Successful in 10m25s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (push) Successful in 8s
Handlers Postgres Integration / Handlers Postgres Integration (push) Successful in 5s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (push) Successful in 11s
E2E API Smoke Test / E2E API Smoke Test (push) Successful in 2m4s
CI / Platform (Go) (push) Failing after 4m47s
CI / Platform (Go) (pull_request) Failing after 4m46s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Failing after 4m20s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 4m42s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 2m28s
CI / Python Lint & Test (pull_request) Successful in 8m16s
CI / Canvas Deploy Reminder (push) Has been skipped
Runtime Pin Compatibility / PyPI-latest install + import smoke (push) Successful in 2m33s
CI / all-required (push) Successful in 5s
CI / Canvas (Next.js) (pull_request) Successful in 15m19s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
lint-continue-on-error-tracking / lint-continue-on-error-tracking (push) Successful in 2m12s
CI / all-required (pull_request) Successful in 5s
Sweep stale Cloudflare DNS records / Sweep CF orphans (push) Successful in 32s
ci-required-drift / drift (push) Successful in 1m33s
Railway pin audit (drift detection) / Audit Railway env vars for drift-prone pins (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
Sweep stale Cloudflare Tunnels / Sweep CF tunnels (push) Successful in 7s
Sweep stale e2e-* orgs (staging) / Sweep e2e orgs (push) Successful in 27s
Staging SaaS smoke (every 30 min) / Staging SaaS smoke (push) Successful in 5m1s
main-red-watchdog / watchdog (push) Successful in 23s
gate-check-v3 / gate-check (push) Successful in 30s
gitea-merge-queue / queue (push) Successful in 3s
status-reaper / reap (push) Successful in 52s
Continuous synthetic E2E (staging) / Synthetic E2E against staging (push) Successful in 4m46s
Some checks failed
Block internal-flavored paths / Block forbidden paths (push) Successful in 20s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 48s
cascade-list-drift-gate / check (pull_request) Successful in 25s
CI / Detect changes (push) Successful in 1m0s
Check migration collisions / Migration version collision check (pull_request) Successful in 1m3s
CI / Detect changes (pull_request) Successful in 1m3s
Harness Replays / detect-changes (push) Successful in 13s
E2E API Smoke Test / detect-changes (push) Successful in 54s
E2E Staging Canvas (Playwright) / detect-changes (push) Successful in 52s
E2E API Smoke Test / detect-changes (pull_request) Successful in 1m1s
Handlers Postgres Integration / detect-changes (push) Successful in 57s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (pull_request) Successful in 17s
Harness Replays / detect-changes (pull_request) Failing after 45s
Harness Replays / Harness Replays (pull_request) Has been skipped
Secret scan / Scan diff for credential-shaped strings (push) Successful in 17s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 1m10s
Runtime PR-Built Compatibility / detect-changes (push) Successful in 1m8s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m10s
publish-runtime-autobump / bump-and-tag (pull_request) Has been skipped
lint-continue-on-error-tracking / lint-continue-on-error-tracking (pull_request) Successful in 2m26s
Lint pre-flip continue-on-error / Verify continue-on-error flips have run-log proof (pull_request) Successful in 2m0s
publish-runtime-autobump / pr-validate (pull_request) Successful in 50s
lint-mask-pr-atomicity / lint-mask-pr-atomicity (pull_request) Successful in 2m23s
Lint workflow YAML (Gitea-1.22.6-hostile shapes) / Lint workflow YAML for Gitea-1.22.6-hostile shapes (pull_request) Successful in 1m45s
lint-required-context-exists-in-bp / lint-required-context-exists-in-bp (pull_request) Failing after 2m12s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, local-postgres-e2
sop-checklist-gate / gate (pull_request) Successful in 28s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 1m5s
sop-tier-check / tier-check (pull_request) Successful in 17s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 1m12s
Runtime Pin Compatibility / PyPI-latest install + import smoke (pull_request) Successful in 2m0s
Ops Scripts Tests / Ops scripts (unittest) (pull_request) Successful in 1m36s
CI / Canvas (Next.js) (push) Successful in 10s
CI / Shellcheck (E2E scripts) (push) Successful in 7s
CI / Python Lint & Test (push) Successful in 9s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 24s
Harness Replays / Harness Replays (push) Successful in 6s
publish-workspace-server-image / build-and-push (push) Successful in 10m25s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (push) Successful in 8s
Handlers Postgres Integration / Handlers Postgres Integration (push) Successful in 5s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (push) Successful in 11s
E2E API Smoke Test / E2E API Smoke Test (push) Successful in 2m4s
CI / Platform (Go) (push) Failing after 4m47s
CI / Platform (Go) (pull_request) Failing after 4m46s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Failing after 4m20s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 4m42s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 2m28s
CI / Python Lint & Test (pull_request) Successful in 8m16s
CI / Canvas Deploy Reminder (push) Has been skipped
Runtime Pin Compatibility / PyPI-latest install + import smoke (push) Successful in 2m33s
CI / all-required (push) Successful in 5s
CI / Canvas (Next.js) (pull_request) Successful in 15m19s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
lint-continue-on-error-tracking / lint-continue-on-error-tracking (push) Successful in 2m12s
CI / all-required (pull_request) Successful in 5s
Sweep stale Cloudflare DNS records / Sweep CF orphans (push) Successful in 32s
ci-required-drift / drift (push) Successful in 1m33s
Railway pin audit (drift detection) / Audit Railway env vars for drift-prone pins (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
Sweep stale Cloudflare Tunnels / Sweep CF tunnels (push) Successful in 7s
Sweep stale e2e-* orgs (staging) / Sweep e2e orgs (push) Successful in 27s
Staging SaaS smoke (every 30 min) / Staging SaaS smoke (push) Successful in 5m1s
main-red-watchdog / watchdog (push) Successful in 23s
gate-check-v3 / gate-check (push) Successful in 30s
gitea-merge-queue / queue (push) Successful in 3s
status-reaper / reap (push) Successful in 52s
Continuous synthetic E2E (staging) / Synthetic E2E against staging (push) Successful in 4m46s
This commit is contained in:
commit
a6c9b12d76
@ -80,6 +80,7 @@ func (s *Store) PatchNamespace(ctx context.Context, name string, body contract.N
|
||||
}
|
||||
parts = append(parts, fmt.Sprintf("metadata = $%d", idx))
|
||||
args = append(args, metadata)
|
||||
idx++ // advance so subsequent fields (if any) get correct positional index
|
||||
}
|
||||
query := fmt.Sprintf(`
|
||||
UPDATE memory_namespaces SET %s
|
||||
|
||||
@ -302,3 +302,30 @@ func TestStore_PatchNamespace_NotFound_SqlNoRows(t *testing.T) {
|
||||
t.Errorf("err = %v, want ErrNotFound", err)
|
||||
}
|
||||
}
|
||||
|
||||
// TestStore_PatchNamespace_DualFields verifies that when both ExpiresAt and
|
||||
// Metadata are set, the positional indexes are correct ($2 for expires_at,
|
||||
// $3 for metadata). Prior to ad7acd30 this was broken: the idx++ after the
|
||||
// metadata branch was removed as a golangci-lint false-positive, causing
|
||||
// metadata to be written as $2 (same slot as expires_at) and expires_at to
|
||||
// be omitted from args entirely.
|
||||
func TestStore_PatchNamespace_DualFields(t *testing.T) {
|
||||
db, mock := setupMockDB(t)
|
||||
store := NewStore(db)
|
||||
exp := time.Now().Add(time.Hour).UTC()
|
||||
// sqlmock matches by query string; we verify the query uses $2 and $3.
|
||||
mock.ExpectQuery("UPDATE memory_namespaces SET expires_at = \\$2, metadata = \\$3 WHERE name = \\$1").
|
||||
WithArgs("workspace:abc", sqlmock.AnyArg(), sqlmock.AnyArg()).
|
||||
WillReturnRows(sqlmock.NewRows([]string{"name", "kind", "expires_at", "metadata", "created_at"}).
|
||||
AddRow("workspace:abc", "workspace", exp, []byte(`{}`), time.Now()))
|
||||
got, err := store.PatchNamespace(context.Background(), "workspace:abc", contract.NamespacePatch{
|
||||
ExpiresAt: &exp,
|
||||
Metadata: map[string]interface{}{"key": "value"},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("err = %v, want nil", err)
|
||||
}
|
||||
if got.Name != "workspace:abc" {
|
||||
t.Errorf("got.Name = %q, want workspace:abc", got.Name)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user