refactor(events): harden V3 String-Only ID vision and fix Session Alert store error

- Standardized Event module logic files to strictly use random string IDs, ensuring frontend consistency and avoiding 'Integer Trap' 404s.
- Refactored 'ae_comp__event_session_alert.svelte' to accept a plain object instead of a store/observable, resolving the 'store_invalid_shape' error in list loops.
- Updated all callers of the alert component to pass unwrapped session objects.
- Cleaned up event-related UI components to remove redundant '_random' field lookups and align with V3 CRUD patterns.
- Updated project metadata (GEMINI.md, TODO.md) to reflect the new memory structure and latest hardened state.
This commit is contained in:
Scott Idem
2026-01-27 12:18:12 -05:00
parent a704779d1b
commit 30413e32d2
15 changed files with 589 additions and 473 deletions

View File

@@ -10,7 +10,7 @@ import { load_ae_obj_li__event_presentation } from '$lib/ae_events/ae_events__ev
const ae_promises: key_val = {};
// Updated 2026-01-26 (SWR Optimization)
// Updated 2026-01-27 to V3 String-Only ID Standard
export async function load_ae_obj_id__event_session({
api_cfg,
event_session_id,
@@ -76,11 +76,13 @@ async function _refresh_session_id_background({ api_cfg, event_session_id, view,
try {
const result = await api.get_ae_obj_v3({ api_cfg, obj_type: 'event_session', obj_id: event_session_id, view, log_lvl });
if (result) {
let processed_obj = result;
if (try_cache) {
const processed = await process_ae_obj__event_session_props({ obj_li: [result], log_lvl });
processed_obj = processed[0];
await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'session', obj_li: processed, properties_to_save, log_lvl });
}
return await _handle_nested_loads(result, { api_cfg, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl });
return await _handle_nested_loads(processed_obj, { api_cfg, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl });
}
} catch (e) {}
return null;
@@ -90,7 +92,8 @@ async function _refresh_session_id_background({ api_cfg, event_session_id, view,
* Helper to handle nested collection loads for a session
*/
async function _handle_nested_loads(session_obj: any, { api_cfg, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl }: any) {
const current_session_id = session_obj.event_session_id_random || session_obj.event_session_id || session_obj.id;
// String-Only ID Vision: the '_id' field IS the string ID
const current_session_id = session_obj.id || session_obj.event_session_id;
const tasks = [];
if (inc_file_li) {
@@ -111,7 +114,7 @@ async function _handle_nested_loads(session_obj: any, { api_cfg, inc_file_li, in
return session_obj;
}
// Updated 2026-01-26 (SWR Optimization)
// Updated 2026-01-27 to V3 String-Only ID Standard
export async function load_ae_obj_li__event_session({
api_cfg,
for_obj_type = 'event',
@@ -183,14 +186,15 @@ async function _refresh_session_li_background({ api_cfg, for_obj_type, for_obj_i
try {
const result_li = await api.get_ae_obj_li_v3({ api_cfg, obj_type: 'event_session', for_obj_type, for_obj_id, enabled, hidden, limit, offset, order_by_li, log_lvl });
if (result_li) {
let processed_li = result_li;
if (try_cache) {
const processed = await process_ae_obj__event_session_props({ obj_li: result_li, log_lvl });
await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'session', obj_li: processed, properties_to_save, log_lvl });
processed_li = await process_ae_obj__event_session_props({ obj_li: result_li, log_lvl });
await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'session', obj_li: processed_li, properties_to_save, log_lvl });
}
for (const s of result_li) {
for (const s of processed_li) {
await _handle_nested_loads(s, { api_cfg, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl });
}
return result_li;
return processed_li;
}
} catch (e) {}
return [];
@@ -218,27 +222,32 @@ export async function create_ae_obj__event_session({
api_cfg,
obj_type: 'event_session',
fields: {
event_id_random: event_id,
event_id,
...data_kv
},
log_lvl
});
if (result && try_cache) {
const processed_obj_li = await process_ae_obj__event_session_props({
if (result) {
const processed = await process_ae_obj__event_session_props({
obj_li: [result],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'session',
obj_li: processed_obj_li,
properties_to_save,
log_lvl
});
const processed_obj = processed[0];
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'session',
obj_li: [processed_obj],
properties_to_save,
log_lvl
});
}
return processed_obj;
}
return result;
return null;
}
// Updated 2026-01-20 to V3
@@ -300,21 +309,26 @@ export async function update_ae_obj__event_session({
log_lvl
});
if (result && try_cache) {
const processed_obj_li = await process_ae_obj__event_session_props({
if (result) {
const processed = await process_ae_obj__event_session_props({
obj_li: [result],
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'session',
obj_li: processed_obj_li,
properties_to_save,
log_lvl
});
const processed_obj = processed[0];
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'session',
obj_li: [processed_obj],
properties_to_save,
log_lvl
});
}
return processed_obj;
}
return result;
return null;
}
// Updated 2026-01-21 to Restore Full Aether Search logic
@@ -363,7 +377,7 @@ export async function search__event_session({
const search_query: any = {
q: '',
and: [{ field: 'event_id_random', op: 'eq', value: event_id }]
and: [{ field: 'event_id', op: 'eq', value: event_id }]
};
const params: key_val = {};
@@ -413,21 +427,25 @@ export async function search__event_session({
log_lvl
});
if (result_li && try_cache) {
const processed_obj_li = await process_ae_obj__event_session_props({
if (result_li) {
const processed = await process_ae_obj__event_session_props({
obj_li: result_li,
log_lvl
});
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'session',
obj_li: processed_obj_li,
properties_to_save,
log_lvl
});
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,
table_name: 'session',
obj_li: processed,
properties_to_save,
log_lvl
});
}
return processed;
}
return result_li || [];
return [];
}
export const qry__event_session = search__event_session;
@@ -553,6 +571,7 @@ async function _process_generic_props<T extends Record<string, any>>({
(processed_obj as any)[newKey] = processed_obj[key];
}
}
// String-Only ID Vision: Map [obj_type]_id_random to 'id'
const randomIdKey = `${obj_type}_id_random`;
if (processed_obj[randomIdKey]) {
(processed_obj as any).id = processed_obj[randomIdKey];