Skip to main content
← Back to list
01Issue
BugClosedSwamp Club
AssigneesNone

Audit timeline misses today's entries in UTC+ timezones

Opened by swampadmin · 7/27/2025

Description

swamp audit fails to read the current day's audit JSONL file when the local timezone is east of UTC (e.g. CET/UTC+1). This causes "No audit data found" even when the .swamp/audit/commands-YYYY-MM-DD.jsonl file has data.

Steps to Reproduce

  1. Be in a UTC+ timezone (e.g. CET, UTC+1)
  2. Run several swamp or shell commands so audit data is recorded
  3. Confirm data exists: wc -l .swamp/audit/commands-$(date -u +%Y-%m-%d).jsonl
  4. Run swamp audit --hours 24 --all
  5. Observe "No audit data found"
  6. Run swamp audit --hours 168 --all — older entries from previous days appear, but today's entries are still missing

Root Cause

In src/infrastructure/persistence/jsonl_audit_repository.ts, the findByTimeRange method iterates dates using local-time midnight via setHours(0,0,0,0), then converts to a UTC date string via toISOString().split("T")[0] to construct filenames.

The append method writes files using the UTC date from entry.timestamp.split("T")[0].

This mismatch means:

  • Write path: entry at 2026-03-09T11:16:00Z → file commands-2026-03-09.jsonl
  • Read path: new Date("2026-03-09...").setHours(0,0,0,0)2026-03-09T00:00:00+01:00 (local CET) → toISOString()2026-03-08T23:00:00.000Z → filename commands-2026-03-08.jsonl

So March 9's file is never opened because the iterator generates 2026-03-08 instead of 2026-03-09 for that day.

Environment

  • swamp version: 20260308.214522.0-sha.9aa5b71a
  • OS: macOS (Darwin 25.3.0)
  • Timezone: CET (UTC+1)

Fix

The date iteration in findByTimeRange should use UTC methods (setUTCHours(0,0,0,0)) to match the UTC dates used in filenames, or derive the date strings directly from UTC components.

02Bog Flow
OPENTRIAGEDIN PROGRESSCLOSED

Closed

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.