fix(v3-vision): prevent process hang on lu_ tables missing id_random
This commit is contained in:
16
.ae_brief
16
.ae_brief
@@ -1,23 +1,15 @@
|
||||
# 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
|
||||
|
||||
## 🛠️ What I Just Did
|
||||
1. Fixed nested CRUD router 404s by implementing registry-based table name resolution for aliases.
|
||||
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.
|
||||
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.
|
||||
|
||||
## 🚧 Current Blockers
|
||||
None. Backend is stabilized for the Tuesday demo.
|
||||
None. V3.1 roadmap is clear.
|
||||
|
||||
## ➡️ Exact Next Steps
|
||||
1. Finalize Audit of remaining ~60 models for ID Vision compliance.
|
||||
2. Audit full file action lifecycle (Upload/Link/Download/Delete) for potential regressions.
|
||||
3. Refactor monolithic person_methods.py and api_crud_v2.py.
|
||||
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.
|
||||
|
||||
---
|
||||
*Generated by ae_brief*
|
||||
|
||||
@@ -112,13 +112,27 @@ def get_id_random(
|
||||
"""
|
||||
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)
|
||||
|
||||
# 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 }
|
||||
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 record_id_random := select_results.get('id_random'):
|
||||
return str(record_id_random)
|
||||
|
||||
@@ -68,7 +68,6 @@ class Event_File_Base(BaseModel):
|
||||
('event_presenter_id', 'event_presenter'),
|
||||
('event_session_id', 'event_session'),
|
||||
('event_track_id', 'event_track'),
|
||||
('lu_file_purpose_id', 'lu_file_purpose'),
|
||||
]
|
||||
|
||||
# 2a. Handle specific relational fields
|
||||
|
||||
Reference in New Issue
Block a user