REQ-STOR-008: Append-only JSONL audit log with rotation and untruncated payloads

← Requirements

What it requires

  1. Given an enabled logger, When initialize() is called, Then audit.jsonl exists at log_path(); When record() is called, Then exactly one parseable JSON line is appended carrying tool_name, caller_id, sequence, session_id and timestamp.
  2. Given multiple records, Then sequence numbers are monotonic and entry_count() equals the number of record() calls.
  3. Given many threads recording concurrently, Then every line is complete valid JSON and no sequence number is duplicated.
  4. Given an existing audit.jsonl, When a new logger initializes, Then prior lines are preserved and new ones appended.
  5. Given max_file_size exceeded, Then the file rotates and the number of retained rotated files respects max_files.
  6. Given oversized params/result strings, When serialized and read back, Then they are byte-identical to the input.
  7. Given enabled=false, When record() is called, Then no file is created.
tier
NOT_RUN

Where it lives

  • src/storage12
  • src/facade3

See it on the map

How it is met

implemented byresults (41 tests)audit_entry_from_jsonaudit_entry_to_jsonentropic_audit_countentropic_audit_flushentropic_audit_readentry_countextract_parent_idflushhook_callbackinitializelog_pathparse_result_fieldspopulate_from_hook_contextrecordwrite_line41 absent41 tests, a summary by result: every test is in the tests table below

Show on the map

Implemented by

Tests (41)

Reached through calls

41 tests: 41 absent

testresultlinked byimplementers exercisedcalls away
Audit entry is recorded when a tool call executesabsentinferred7 of 151
AuditLogger entry_count matches record callsabsentinferred5 of 151
AuditLogger flush forces write to diskabsentinferred5 of 151
Disabled AuditLogger creates no fileabsentinferred5 of 151
AuditEntry from_json ignores extra fieldsabsentinferred4 of 15: audit_entry_from_json, audit_entry_to_json, extract_parent_id, parse_result_fields1
AuditEntry preserves large params without truncationabsentinferred4 of 15: audit_entry_from_json, audit_entry_to_json, extract_parent_id, parse_result_fields1
AuditEntry preserves large result contentabsentinferred4 of 15: audit_entry_from_json, audit_entry_to_json, extract_parent_id, parse_result_fields1
AuditEntry round-trips through JSONabsentinferred4 of 15: audit_entry_from_json, audit_entry_to_json, extract_parent_id, parse_result_fields1
AuditLogger appends to existing fileabsentinferred4 of 15: audit_entry_to_json, initialize, record, write_line1
AuditLogger concurrent writes produce no duplicatesabsentinferred4 of 15: audit_entry_to_json, initialize, record, write_line1
AuditLogger flush_interval batches writesabsentinferred4 of 15: audit_entry_to_json, initialize, record, write_line1
AuditLogger records a single JSONL lineabsentinferred4 of 15: audit_entry_to_json, initialize, record, write_line1
AuditLogger records multiple entriesabsentinferred4 of 15: audit_entry_to_json, initialize, record, write_line1
AuditLogger rotates at max_file_sizeabsentinferred4 of 15: audit_entry_to_json, initialize, record, write_line1
AuditLogger rotation respects max_filesabsentinferred4 of 15: audit_entry_to_json, initialize, record, write_line1
AuditLogger sequence numbers are monotonicabsentinferred4 of 15: audit_entry_to_json, initialize, record, write_line1
Concurrent writes produce complete JSON linesabsentinferred4 of 15: audit_entry_to_json, initialize, record, write_line1
AuditEntry from_json fails on missing required fieldabsentinferred3 of 15: audit_entry_from_json, extract_parent_id, parse_result_fields1
Audit count on engine with no loggerabsentinferred2 of 15: entropic_audit_count, entry_count1
entropic_audit_count on NULL handle returns INVALID_HANDLEabsentinferred2 of 15: entropic_audit_count, entry_count1
entropic_audit_count with NULL out pointer returns INVALID_ARGUMENTabsentinferred2 of 15: entropic_audit_count, entry_count1
entropic_audit_flush on NULL handle returns INVALID_HANDLEabsentinferred2 of 15: entropic_audit_flush, flush1
entropic_audit_flush on a handle with no audit_logger is a no-opabsentinferred2 of 15: entropic_audit_flush, flush1
entropic_audit_flush rejects NULL handleabsentinferred2 of 15: entropic_audit_flush, flush1
AuditEntry serializes all fields to JSONabsentinferred1 of 15: audit_entry_to_json1
AuditEntry serializes directive array correctlyabsentinferred1 of 15: audit_entry_to_json1
AuditEntry serializes empty directives as empty arrayabsentinferred1 of 15: audit_entry_to_json1
AuditEntry serializes null parent_conversation_idabsentinferred1 of 15: audit_entry_to_json1
AuditLogger creates file on initializeabsentinferred1 of 15: initialize1
AuditLogger log_path returns correct pathabsentinferred1 of 15: log_path1
Per-handle log scope routes session.log writes per handle absentinferred1 of 15: flush1
entropic_audit_count on configured handle returns 0absentinferred1 of 15: entropic_audit_count1
entropic_audit_count on fresh handle returns 0 (no logger)absentinferred1 of 15: entropic_audit_count1
entropic_audit_count rejects NULL handleabsentinferred1 of 15: entropic_audit_count1
entropic_audit_count rejects NULL out-pointerabsentinferred1 of 15: entropic_audit_count1
entropic_audit_read of a populated JSONL file returns each lineabsentinferred1 of 15: entropic_audit_read1
entropic_audit_read of an empty JSONL file returns an empty arrayabsentinferred1 of 15: entropic_audit_read1
entropic_audit_read on NULL handle returns INVALID_HANDLEabsentinferred1 of 15: entropic_audit_read1
entropic_audit_read with NULL args returns INVALID_ARGUMENTabsentinferred1 of 15: entropic_audit_read1
entropic_audit_read with a missing file returns IOabsentinferred1 of 15: entropic_audit_read1
setup_session + register_handle_log don't double-write absentinferred1 of 15: flush1