mirror of
https://github.com/penpot/penpot.git
synced 2026-10-29 14:00:37 +00:00
🐛 Fix audit-log-archive cron submit and nitrate wiring (#12321)
After the unified jobs migration, cron submitted empty params that failed validation because the job schema still required Integrant system keys. Narrow the schema to optional REPL overrides, wire :app.nitrate/client onto the archive job-def, and drop the unused ::jobs/defs ref from nitrate that created an Integrant cycle. AI-assisted-by: composer
This commit is contained in:
parent
1ebb4f3866
commit
ba81f2f8bb
@ -256,12 +256,10 @@
|
||||
(declare execute-audit-log-archive)
|
||||
|
||||
(def schema:audit-log-archive-params
|
||||
"Optional overrides for the repl invocation defaults."
|
||||
"Optional overrides for the repl invocation defaults.
|
||||
Cron submits {}; system deps (pool, shared-keys, http) live on the
|
||||
job-def cfg closed over by the handler, not in job params."
|
||||
[:map
|
||||
::db/pool
|
||||
::setup/shared-keys
|
||||
::http/client
|
||||
[:app.nitrate/client {:optional true} [:maybe :map]]
|
||||
[:enabled {:optional true} :boolean]
|
||||
[:uri {:optional true} ::sm/uri]])
|
||||
|
||||
|
||||
@ -543,7 +543,8 @@
|
||||
|
||||
:app.nitrate/client
|
||||
{::http.client/client (ig/ref ::http.client/client)
|
||||
::jobs/defs (ig/ref ::jobs/defs)
|
||||
;; No ::jobs/defs: nitrate never submits jobs, and archive-task's
|
||||
;; job-def needs this client — that would cycle through jobs/defs.
|
||||
::setup/shared-keys (ig/ref ::setup/shared-keys)}
|
||||
|
||||
:app.rpc/management-methods
|
||||
@ -679,10 +680,11 @@
|
||||
::mtx/metrics (ig/ref ::mtx/metrics)}
|
||||
|
||||
:app.loggers.audit.archive-task/job-def
|
||||
{::db/pool (ig/ref ::db/pool)
|
||||
{::db/pool (ig/ref ::db/pool)
|
||||
::http.client/client (ig/ref ::http.client/client)
|
||||
::setup/shared-keys (ig/ref ::setup/shared-keys)
|
||||
::mtx/metrics (ig/ref ::mtx/metrics)}
|
||||
::setup/shared-keys (ig/ref ::setup/shared-keys)
|
||||
:app.nitrate/client (ig/ref :app.nitrate/client)
|
||||
::mtx/metrics (ig/ref ::mtx/metrics)}
|
||||
|
||||
:app.loggers.audit.gc-task/job-def
|
||||
{::db/pool (ig/ref ::db/pool)
|
||||
|
||||
@ -7,12 +7,15 @@
|
||||
(ns backend-tests.loggers-audit-archive-task-test
|
||||
(:require
|
||||
[app.common.json :as json]
|
||||
[app.common.schema :as sm]
|
||||
[app.common.time :as ct]
|
||||
[app.common.uri :as u]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cf]
|
||||
[app.db :as db]
|
||||
[app.http.client :as-alias http]
|
||||
[app.jobs :as jobs]
|
||||
[app.loggers.audit.archive-task :as archive]
|
||||
[app.setup :as-alias setup]
|
||||
[backend-tests.helpers :as th]
|
||||
[clojure.test :as t]
|
||||
@ -348,3 +351,11 @@
|
||||
(t/is (= (:name team) (:team-name props))))
|
||||
(let [rows (th/db-exec! ["select * from audit_log where archived_at is not null"])]
|
||||
(t/is (= 2 (count rows))))))))
|
||||
|
||||
(t/deftest archive-params-accept-empty-cron-props
|
||||
;; Cron always submits (or props {}) — system deps live on the
|
||||
;; job-def cfg, not in params. Requiring them here blocks every tick.
|
||||
(let [valid? (sm/validator archive/schema:audit-log-archive-params)]
|
||||
(t/is (true? (valid? {})))
|
||||
(t/is (true? (valid? {:enabled true})))
|
||||
(t/is (true? (valid? {:uri (u/uri archive-uri)})))))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user