Kaynağa Gözat

feat: 0.17.0 - both processes now state which run-log retention they use

Two settings trim one run log and neither process can see the other's config:
the server's functions.runs_kept governs HTTP runs, the runner's
function_runs_kept governs cron and job runs. runner/src/main.cpp said so in a
comment - "Should match the server's functions.runs_kept, or the two trim one
log to two depths" - with nothing enforcing it.

It cost a wrong answer today. I raised the server's value, verified 500 through
the API, and told a consumer it was fixed; their cron functions went on being
trimmed at 50 by the runner for twenty more minutes. A true reading of the
wrong component. Their discriminator is the one to keep: a count cannot
separate "trimming at 50" from "50 rows under a ceiling of 500", and the OLDEST
RETAINED ROW can - it slides under trimming and stands still otherwise. They
then confirmed the fix that way: 56 rows and the oldest stationary, with the
arithmetic reconciling to the minute.

Each process now logs its effective value at startup and NAMES the other
setting, so a divergence is one grep across two journals instead of a
measurement. That is weaker than what it should be and is labelled as such:
the consumer's own preference, which I agree with, is a WARNING when the two
disagree - the failure was not that two numbers exist but that nothing
announced they had diverged, so a true reading of one certified the other.
Neither process can see the other's config today, so that needs a mechanism
(the server publishing its effective value where the runner already reads
settings) and it is filed rather than rushed into this release.

Also in 0.17.0, both committed earlier today: PUT refusing ?ttl_seconds= rather
than storing a permanent row with a 201, and an absent function registry
reading as "no functions" instead of warning every 20 seconds.

1349/1349 pass. VERSION and openapi info.version both 0.17.0, sync check green.
fszontagh 1 ay önce
ebeveyn
işleme
9edb6e2ac9
4 değiştirilmiş dosya ile 23 ekleme ve 2 silme
  1. 1 1
      VERSION
  2. 1 1
      api/openapi.json
  3. 8 0
      runner/src/main.cpp
  4. 13 0
      src/main.cpp

+ 1 - 1
VERSION

@@ -1 +1 @@
-0.16.0
+0.17.0

+ 1 - 1
api/openapi.json

@@ -2,7 +2,7 @@
   "openapi": "3.1.0",
   "info": {
     "title": "smartbotic-vectorapi",
-    "version": "0.16.0",
+    "version": "0.17.0",
     "description": "General-purpose REST API fronting smartbotic-database. Supports multi-project namespacing and multi-key authorization with per-project grants."
   },
   "components": {

+ 8 - 0
runner/src/main.cpp

@@ -603,6 +603,14 @@ int main(int argc, char** argv) {
     // Off unless jobs.enabled, so a runner upgrade never starts draining a
     // queue in a deployment whose server has no scheduler.
     svapi::FunctionRunLogStore jobRunLog(db, cfg.functionRunsKept);
+    // The mirror of the server's line - see src/main.cpp. This value trims CRON
+    // AND JOB runs; the server's functions.runs_kept trims HTTP runs. An
+    // operator comparing the two journals can see a divergence immediately,
+    // which is what nobody could do when this cost a wrong answer.
+    spdlog::info("job worker keeps {} run(s) per function (function_runs_kept, for CRON AND JOB "
+                 "runs); HTTP runs are trimmed by the server's own functions.runs_kept in "
+                 "config.json - if the two differ, one log is trimmed to two depths",
+                 cfg.functionRunsKept);
     WorkerQueuePort workerQueue(jobQueue);
     WorkerRunLogPort workerLog(jobRunLog);
     std::unique_ptr<svapi::runner::JobWorker> worker;

+ 13 - 0
src/main.cpp

@@ -89,6 +89,19 @@ int main(int argc, char** argv) {
 
     svapi::FunctionRegistry functions(db);
     svapi::FunctionRunLogStore functionRuns(db, cfg.functionRunsKept);
+    // STATE THE EFFECTIVE VALUE, AND NAME THE OTHER ONE. Two settings trim this
+    // one log: this (`functions.runs_kept`, for HTTP-triggered runs) and the
+    // RUNNER's `function_runs_kept` in runner.json, for cron and job runs.
+    // Neither process can see the other's config, so a divergence is invisible
+    // - and on 2026-10-22 it cost a wrong answer to a consumer: this value was
+    // raised to 500 and verified through the API, while their cron functions
+    // went on being trimmed at 50 by the runner for twenty more minutes. A true
+    // reading of the wrong component. Logging both makes the mismatch one grep
+    // rather than a measurement.
+    spdlog::info("function run log keeps {} run(s) per function here (functions.runs_kept, for "
+                 "HTTP runs); CRON AND JOB runs are trimmed by the runner's own "
+                 "function_runs_kept in runner.json - if the two differ, one log is trimmed to "
+                 "two depths", cfg.functionRunsKept);
     // Same reason CollectionRegistry::bootstrap exists: the database only
     // surfaces a collection through find() once it has been opened in this
     // process, so without this every project's function registry reads back