feat(dates): print the numeric offset in the audit report

The spec-mirroring review noted the report showed the offset SOURCE
but not the offset value — the value is what the operator spot-checks.
Each proposed line now ends with offset={+N}m (or - for utc_direct
rows). Tests pin the rendered values.
This commit is contained in:
Cameron Cordes committed 2026-09-25 18:14:02 -04:00
1 parent 3aa6ce314c
commit 89fc24ceab
1 file changed
+16 -1
+16 -1
View File
@@ -267,8 +267,16 @@ pub fn format_report(rows: &[AuditRow], skipped: &[SkippedLibrary]) -> String {
.tz_source .tz_source
.map(|t| t.as_str().to_string()) .map(|t| t.as_str().to_string())
.unwrap_or_else(|| "-".into()); .unwrap_or_else(|| "-".into());
// The numeric offset (minutes ahead of UTC) is the value the
// operator actually spot-checks: a wall pattern resolved with
// empty evidence carries the server zone's offset for that date.
let proposed_offset = row
.proposed
.camera_offset_minutes
.map(|m| format!("{m:+}m"))
.unwrap_or_else(|| "-".into());
out.push_str(&format!( out.push_str(&format!(
"{}\t{:<19}\t{:<20}\tlib={} {}\n current: {}\n proposed: {} [{}] tz_source={}\n", "{}\t{:<19}\t{:<20}\tlib={} {}\n current: {}\n proposed: {} [{}] tz_source={} offset={}\n",
if row.changed { "*" } else { " " }, if row.changed { "*" } else { " " },
row.pattern, row.pattern,
row.rel_path, row.rel_path,
@@ -278,6 +286,7 @@ pub fn format_report(rows: &[AuditRow], skipped: &[SkippedLibrary]) -> String {
format_epoch_utc(Some(row.proposed.timestamp)), format_epoch_utc(Some(row.proposed.timestamp)),
row.proposed.source.as_str(), row.proposed.source.as_str(),
proposed_tz, proposed_tz,
proposed_offset,
)); ));
} }
if !skipped.is_empty() { if !skipped.is_empty() {
@@ -434,6 +443,8 @@ mod tests {
inv.proposed.tz_source.map(|t| t.as_str()), inv.proposed.tz_source.map(|t| t.as_str()),
Some("assumed_server") Some("assumed_server")
); );
// Server zone America/New_York is EDT (UTC-4) in June.
assert_eq!(inv.proposed.camera_offset_minutes, Some(-240));
assert!(inv.changed, "stored exif date must flag as changed"); assert!(inv.changed, "stored exif date must flag as changed");
// The unix timestamp: utc_direct, no offset, and the stored row // The unix timestamp: utc_direct, no offset, and the stored row
@@ -544,6 +555,10 @@ mod tests {
assert!(first.contains("*\t"), "changed row must be flagged"); assert!(first.contains("*\t"), "changed row must be flagged");
assert!(first.contains("screenshot")); assert!(first.contains("screenshot"));
assert!(first.contains("utc_direct")); assert!(first.contains("utc_direct"));
// Numeric offset is printed: the wall row carries the server-zone
// offset for that date, timestamp rows have none.
assert!(first.contains("offset=-240m"));
assert!(first.contains("offset=-\n"));
// The stored source renders without debug quotes (P1 from // The stored source renders without debug quotes (P1 from
// review): `2021-... [exif]`, never `["exif"]`. // review): `2021-... [exif]`, never `["exif"]`.
assert!(first.contains("[exif]")); assert!(first.contains("[exif]"));