From 556a395a3e29c6718fa95365d9eac9af0a530f6c Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Wed, 11 Mar 2026 11:41:42 -0400 Subject: [PATCH] fix: always default hash_prefix_length to 2, never preserve stale localStorage value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/routes/+layout.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index d948a83e..908951b4 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -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