Skip to content

Commit 934a3bc

Browse files
committed
[Change] JSON list schema 1.1: rename stopped_hr to stopped for started/stopped symmetry
[Change] Schema 1.1 consistency follow-up: stopped[] JSON field stopped_hr renamed to stopped, matching the suffix-less hr form already used by started (started/started_epoch pair becomes symmetric with stopped/stopped_epoch). Internal scan.meta and scan.checkpoint field names stay stopped_hr; only the user-facing JSON output field is renamed. [Change] tests/31-json-report.bats test 32 assertion tightened from loose `--partial '"stopped_hr"'` (which would have matched the array opener `"stopped": [`) to a regex-anchored field match that requires `"stopped": "<hr string>"`.
1 parent 417e558 commit 934a3bc

File tree

4 files changed

+23
-17
lines changed

4 files changed

+23
-17
lines changed

CHANGELOG

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,14 @@ v2.0.1 | Mar 25 2026:
140140
[Change] --json-report list schema 1.1: top-level scanner block ({name, version,
141141
sig_version}) and host block ({hostname, host_id}) mirror per-scan
142142
JSON schema; field renames for parity with per-scan JSON — hashtype
143-
→ hash_type, hits → total_hits, elapsed → elapsed_seconds; active[]/
144-
stopped[] add quarantine_enabled (boolean, from scan.meta) and null
145-
total_cleaned/total_quarantined (post-scan actions not yet determined
146-
mid-scan); stopped[] adds engine + sig_version parity with active[];
147-
reports[] adds sig_version + quarantine_enabled (null for pre-bump
148-
rows and legacy plaintext sessions)
143+
→ hash_type, hits → total_hits, elapsed → elapsed_seconds; stopped[]
144+
stopped_hr → stopped for symmetry with started/started_epoch pattern
145+
(internal meta/checkpoint field names unchanged); active[]/stopped[]
146+
add quarantine_enabled (boolean, from scan.meta) and null total_cleaned/
147+
total_quarantined (post-scan actions not yet determined mid-scan);
148+
stopped[] adds engine + sig_version parity with active[]; reports[]
149+
adds sig_version + quarantine_enabled (null for pre-bump rows and
150+
legacy plaintext sessions)
149151
[Change] scan.meta: new quarantine_enabled field written by _lifecycle_write_meta
150152
from $quarantine_hits; _lifecycle_read_meta parses into
151153
_meta_quarantine_enabled

CHANGELOG.RELEASE

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,14 @@ v2.0.1 | Mar 25 2026:
140140
[Change] --json-report list schema 1.1: top-level scanner block ({name, version,
141141
sig_version}) and host block ({hostname, host_id}) mirror per-scan
142142
JSON schema; field renames for parity with per-scan JSON — hashtype
143-
→ hash_type, hits → total_hits, elapsed → elapsed_seconds; active[]/
144-
stopped[] add quarantine_enabled (boolean, from scan.meta) and null
145-
total_cleaned/total_quarantined (post-scan actions not yet determined
146-
mid-scan); stopped[] adds engine + sig_version parity with active[];
147-
reports[] adds sig_version + quarantine_enabled (null for pre-bump
148-
rows and legacy plaintext sessions)
143+
→ hash_type, hits → total_hits, elapsed → elapsed_seconds; stopped[]
144+
stopped_hr → stopped for symmetry with started/started_epoch pattern
145+
(internal meta/checkpoint field names unchanged); active[]/stopped[]
146+
add quarantine_enabled (boolean, from scan.meta) and null total_cleaned/
147+
total_quarantined (post-scan actions not yet determined mid-scan);
148+
stopped[] adds engine + sig_version parity with active[]; reports[]
149+
adds sig_version + quarantine_enabled (null for pre-bump rows and
150+
legacy plaintext sessions)
149151
[Change] scan.meta: new quarantine_enabled field written by _lifecycle_write_meta
150152
from $quarantine_hits; _lifecycle_read_meta parses into
151153
_meta_quarantine_enabled

files/internals/lmd_alert.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ _lmd_render_json_list() {
807807
local _jl_sworkers="${_meta_workers:-0}"; [ "$_jl_sworkers" = "-" ] && _jl_sworkers=0
808808
local _jl_squar_bool
809809
if [ "${_meta_quarantine_enabled:-0}" = "1" ]; then _jl_squar_bool="true"; else _jl_squar_bool="false"; fi
810-
printf '\n {"scan_id": "%s", "stage": "%s", "ppid": %s, "path": "%s", "started": "%s", "started_epoch": %s, "stopped_hr": "%s", "stopped_epoch": %s, "elapsed_seconds": %s, "engine": "%s", "hash_type": "%s", "workers": %s, "sig_version": "%s", "quarantine_enabled": %s, "total_files": %s, "total_hits": %s, "total_cleaned": null, "total_quarantined": null}' \
810+
printf '\n {"scan_id": "%s", "stage": "%s", "ppid": %s, "path": "%s", "started": "%s", "started_epoch": %s, "stopped": "%s", "stopped_epoch": %s, "elapsed_seconds": %s, "engine": "%s", "hash_type": "%s", "workers": %s, "sig_version": "%s", "quarantine_enabled": %s, "total_files": %s, "total_hits": %s, "total_cleaned": null, "total_quarantined": null}' \
811811
"$_jl_stopped_sid" "$_jl_sstage" "$_jl_sppid" "$_jl_sp" \
812812
"$_jl_sstarted_hr" "$_jl_sstarted_ep" \
813813
"$_jl_shr" "$_jl_sstopped_ep" "$_jl_selapsed" \

tests/31-json-report.bats

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -625,9 +625,10 @@ EOF
625625

626626
# --- Test 32: stopped[] carries started + started_epoch + stopped_epoch ---
627627
# Regression guard for issue #483 parity extension: stopped[] must expose
628-
# machine-readable start AND stop timestamps (stopped_hr stays for backward
629-
# compat). Fabricate a stopped scan with matching checkpoint file so
630-
# _lifecycle_detect_state returns "stopped" and the entry is emitted.
628+
# machine-readable start AND stop timestamps. Schema 1.1 renamed stopped_hr
629+
# → stopped for parity with started (both hr strings use suffix-less names;
630+
# epoch companions use _epoch). Fabricate a stopped scan with matching
631+
# checkpoint file so _lifecycle_detect_state returns "stopped".
631632
@test "--json-report list stopped[] entries include started_epoch and stopped_epoch" {
632633
local sessdir="$LMD_INSTALL/sess"
633634
local sid="260418-2358.77772"
@@ -671,7 +672,8 @@ EOF
671672
assert_output --partial "\"$sid\""
672673
assert_output --partial '"started"'
673674
assert_output --partial '"started_epoch"'
674-
assert_output --partial '"stopped_hr"'
675+
# Match the FIELD specifically, not the array opener "stopped": [
676+
[[ "$output" =~ \"stopped\":[[:space:]]+\" ]]
675677
assert_output --partial '"stopped_epoch"'
676678
[[ "$output" =~ \"started_epoch\":[[:space:]]+$_started_epoch ]]
677679
[[ "$output" =~ \"stopped_epoch\":[[:space:]]+$_stopped_epoch ]]

0 commit comments

Comments
 (0)