fix(v3-vision): prevent process hang on lu_ tables missing id_random

This commit is contained in:
Scott Idem
2026-02-10 17:30:38 -05:00
parent 68e883ba98
commit 6d5633dc86
3 changed files with 20 additions and 15 deletions

View File

@@ -1,23 +1,15 @@
# Aether Project Brief: aether_api_fastapi # Aether Project Brief: aether_api_fastapi
**Last Updated:** 2026-02-06 18:14:30 **Last Updated:** 2026-02-09 19:09:01
**Current Agent:** mcp_agent **Current Agent:** mcp_agent
## 🛠️ What I Just Did ## 🛠️ What I Just Did
1. Fixed nested CRUD router 404s by implementing registry-based table name resolution for aliases. Hardened Data Store search security (account isolation), ensured ID Vision compliance in Data Store search results, refactored and standardized the Data Store E2E test suite, and updated tests/README.md with suite-wide standards.
2. Standardized demo-critical models (Badge, Exhibit, Tracking, Event File) to the ID Vision standard.
3. Implemented 'Heal-on-Read' fallback logic in root_validators to resolve missing string IDs from database integers automatically.
4. Implemented specialized 'from_hosted_file' action route for Event Files.
5. Updated Frontend API Guide with Alias support and new action routes.
6. Created E2E Demo Parity test suite with 100% pass rate and regression targets.
7. Fixed Field parameter conflicts and NameErrors in Pydantic models.
## 🚧 Current Blockers ## 🚧 Current Blockers
None. Backend is stabilized for the Tuesday demo. None. V3.1 roadmap is clear.
## ➡️ Exact Next Steps ## ➡️ Exact Next Steps
1. Finalize Audit of remaining ~60 models for ID Vision compliance. Begin [V3.1] ID Vision alignment for Person and Organization modules. Mark legacy V2 routers as [DEPRECATED] to streamline removal for the v3.1 release.
2. Audit full file action lifecycle (Upload/Link/Download/Delete) for potential regressions.
3. Refactor monolithic person_methods.py and api_crud_v2.py.
--- ---
*Generated by ae_brief* *Generated by ae_brief*

View File

@@ -112,13 +112,27 @@ def get_id_random(
""" """
Looks up the 'id_random' for a given internal integer ID. Looks up the 'id_random' for a given internal integer ID.
""" """
from app.db_sql import sql_select from app.db_sql import sql_select, get_last_sql_error
log.setLevel(log_lvl) log.setLevel(log_lvl)
# Hardened check: Skip lookups for tables known to not have random IDs (e.g. lu_ tables)
if not table_name or table_name.startswith('lu_') or table_name.startswith('v_lu_'):
return None
data = { 'id': record_id } data = { 'id': record_id }
sql = f"SELECT id_random FROM `{table_name}` AS `table` WHERE `table`.id = :id;" sql = f"SELECT id_random FROM `{table_name}` AS `table` WHERE `table`.id = :id;"
if select_results := sql_select(sql=sql, data=data): select_results = sql_select(sql=sql, data=data)
# Check for "Unknown column 'id_random'" error if sql_select failed
if select_results is False:
err = str(get_last_sql_error())
if "1054" in err and "id_random" in err:
log.info(f"Table '{table_name}' does not have an 'id_random' column. Skipping.")
return None
return False
if select_results:
if isinstance(select_results, dict): if isinstance(select_results, dict):
if record_id_random := select_results.get('id_random'): if record_id_random := select_results.get('id_random'):
return str(record_id_random) return str(record_id_random)

View File

@@ -68,7 +68,6 @@ class Event_File_Base(BaseModel):
('event_presenter_id', 'event_presenter'), ('event_presenter_id', 'event_presenter'),
('event_session_id', 'event_session'), ('event_session_id', 'event_session'),
('event_track_id', 'event_track'), ('event_track_id', 'event_track'),
('lu_file_purpose_id', 'lu_file_purpose'),
] ]
# 2a. Handle specific relational fields # 2a. Handle specific relational fields