From 2743cc2a34df989a052b4a8f98451f8197e64b39 Mon Sep 17 00:00:00 2001 From: belowzeroff Date: Sun, 27 Sep 2026 12:33:06 -0400 Subject: [PATCH] fix(log): reject arguments to close --- docs/docs/namespaces/log.md | 2 +- src/ops/journal.c | 3 ++- test/rfl/journal/ops_journal_wrappers.rfl | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/docs/namespaces/log.md b/docs/docs/namespaces/log.md index 7a366e971..b392250c5 100644 --- a/docs/docs/namespaces/log.md +++ b/docs/docs/namespaces/log.md @@ -18,7 +18,7 @@ The journal is intentionally minimal: there's no per-entry timestamp or transact | [`.log.roll`](#log-roll) | nullary | restricted | Close the active segment and start a new one. | | [`.log.replay`](#log-replay) | unary | restricted | Replay a journal file; return entry count. | | [`.log.validate`](#log-validate) | unary | — | Scan a journal file; return `(chunks valid_bytes)`. | -| [`.log.close`](#log-close) | variadic | restricted | Flush and close the active journal. | +| [`.log.close`](#log-close) | nullary | restricted | Flush and close the active journal. | | [`.log.purge`](#log-purge) | nullary | restricted | Close the active journal and delete all its files. | ## `.log.open` { #log-open } diff --git a/src/ops/journal.c b/src/ops/journal.c index 2495014cc..34074284c 100644 --- a/src/ops/journal.c +++ b/src/ops/journal.c @@ -218,7 +218,8 @@ ray_t* ray_log_sync_fn(ray_t** args, int64_t n) { } ray_t* ray_log_close_fn(ray_t** args, int64_t n) { - (void)args; (void)n; + (void)args; + if (n != 0) return ray_error("arity", ".log.close takes no arguments"); return err_to_ray(ray_journal_close(), "io"); } diff --git a/test/rfl/journal/ops_journal_wrappers.rfl b/test/rfl/journal/ops_journal_wrappers.rfl index 9592562fd..8d9f8633b 100644 --- a/test/rfl/journal/ops_journal_wrappers.rfl +++ b/test/rfl/journal/ops_journal_wrappers.rfl @@ -43,6 +43,7 @@ ;; left a journal open would make our .log.open fail with "already open". ;; Close defensively first (no-op + RAY_OK if already closed). (nil? (.log.close)) -- true +(.log.close 1) !- arity (.sys.exec "rm -f /tmp/rfl_ops_journal_wrap.log /tmp/rfl_ops_journal_wrap.qdb /tmp/rfl_ops_journal_wrap.qdb.tmp /tmp/rfl_ops_journal_wrap.*.log") ;; ════════════════════════════════════════════════════════════════════════