fix: always default hash_prefix_length to 2, never preserve stale localStorage value

The event_device table has no hash_prefix_length column, so incoming_dev.hash_prefix_length
is always undefined from the API. The old merge logic preserved whatever was in localStorage,
which had a stale value of 1 from earlier testing — causing the background file sync to create
1-char cache subdirectories instead of the correct 2-char SHA-256 prefix dirs.

Background sync now consistently creates 2-char dirs matching launch_from_cache behavior.
If the API ever returns a hash_prefix_length, it will be used; otherwise the floor is 2.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-03-11 11:41:42 -04:00
parent 319b935cc5
commit 556a395a3e

View File

@@ -182,7 +182,8 @@ export async function load({ fetch, params, parent, route, url }) {
check_event_device_loop_period: (existing_dev as any).check_event_device_loop_period || incoming_dev.check_event_device_loop_period,
check_event_location_loop_period: (existing_dev as any).check_event_location_loop_period || incoming_dev.check_event_location_loop_period,
check_event_session_loop_period: (existing_dev as any).check_event_session_loop_period || incoming_dev.check_event_session_loop_period,
hash_prefix_length: (existing_dev as any).hash_prefix_length || incoming_dev.hash_prefix_length
// Use API value if present; default to 2 (never preserve from localStorage — stale values cause orphaned cache dirs)
hash_prefix_length: incoming_dev.hash_prefix_length || 2
};
// Map specific operational paths