Fix Person creation issues and enhance V3 CRUD robustness.

- Added Pydantic validators to Person_Base to handle null values for given_name and allow_auth_key, ensuring database NOT NULL constraints are met.
- Updated api_crud_v3.py (POST and PATCH) to filter out virtual *_id_random fields from data payloads before database operations to prevent "Unknown column" errors.
- Updated GEMINI.md with session progress.
This commit is contained in:
Scott Idem
2026-01-09 14:30:45 -05:00
parent d32304c50a
commit 29b4d5ae4b
3 changed files with 34 additions and 3 deletions

View File

@@ -23,25 +23,34 @@ I am the **primary orchestrator and main helper** for the development of the **U
## Session Summary & Progress (Jan 8, 2026) ## Session Summary & Progress (Jan 8, 2026)
This session focused on debugging, task management, and communication protocols within the Aether AI Agent network. This session focused on debugging, task management, and communication protocols within the Aether AI Agent network.
* **Task Management Bug Resolved:** The `add_task` tool bug (duplicate IDs) was identified, reported, and fixed by the Manager/Coordinator agent. The fix introduced microsecond precision for IDs in task management. * **Task Management Bug Resolved:** The `add_task` tool bug (duplicate IDs) was identified, reported, and fixed by the Manager/Coordinator agent. The fix introduced microsecond precision for IDs in task management.
* **Agent Bridge Restoration Verified:** `app/routers/agent_bridge.py` was inspected; `psutil` handling was confirmed robust. Docker container logs for FastAPI (green/red) showed no crashes related to `agent_bridge.py` or `psutil`. The task was marked as Done. * **Agent Bridge Restoration Verified:** `app/routers/agent_bridge.py` was inspected; `psutil` handling was confirmed robust. Docker container logs for FastAPI (green/red) showed no crashes related to `agent_bridge.py` or `psutil`. The task was marked as Done.
* **Docker Registry Sync Audit Completed:** An audit of `ae_api_dev_green` and `ae_api_dev_red` against `docker-compose.yml` confirmed consistency in environment variables, volumes, ports, images, and extra hosts. No critical configuration drift was identified. The task was marked as Done. * **Docker Registry Sync Audit Completed:** An audit of `ae_api_dev_green` and `ae_api_dev_red` against `docker-compose.yml` confirmed consistency in environment variables, volumes, ports, images, and extra hosts. No critical configuration drift was identified. The task was marked as Done.
* **Frontend Interface Validation Successful:** The `frontend` agent confirmed full validation and successful unified type migration for 59 TypeScript interfaces. The task was marked as Done. * **Frontend Interface Validation Successful:** The `frontend` agent confirmed full validation and successful unified type migration for 59 TypeScript interfaces. The task was marked as Done.
* **AE Person Creation Fixes:**
* Identified that `given_name` was failing due to `null` values violating database `NOT NULL` constraints.
* Added Pydantic validators to `Person_Base` to default `given_name` to `""` and `allow_auth_key` to `True` if `None` is provided.
* Modified `app/routers/api_crud_v3.py` to strip virtual `*_id_random` fields (like `account_id_random`) from payloads before database insertion/update. This prevents "Unknown column" errors when the frontend sends convenience lookup fields.
* **`ae_obj_info` Dependency Resolved:** * **`ae_obj_info` Dependency Resolved:**
* Initial investigation confirmed `pytz` was installed in the Workstation's host venv, contradicting an `mcp_agent` message. * Initial investigation confirmed `pytz` was installed in the Workstation's host venv, contradicting an `mcp_agent` message.
* Further clarification revealed `OSIT_dev` is not synced between Workstation and Laptop, causing environment discrepancies. * Further clarification revealed `OSIT_dev` is not synced between Workstation and Laptop, causing environment discrepancies.
* The `mcp_agent` provided a traceback from the Laptop, confirming `pytz` was indeed missing from the *Laptop's* host venv. * The `mcp_agent` provided a traceback from the Laptop, confirming `pytz` was indeed missing from the *Laptop's* host venv.
* User (Scott Idem) confirmed manual installation of `pytz` in the Laptop's host venv, resolving the issue. The task was marked as Done. * User (Scott Idem) confirmed manual installation of `pytz` in the Laptop's host venv, resolving the issue. The task was marked as Done.
* **New MCP Tool Announcements:** `read_reference` tool introduced for technical stubs. * The source code for `ae_obj_info` is confirmed to be at `agents_sync/scripts/ae_object_info.py`.
* **New MCP Tool Announcements:**
* `read_reference` tool introduced for technical stubs.
* `delete_task` and `git_smart_commit` tools are now live, enhancing task management and version control.
* **Codebase Investigator Report:** The report for Aether extension and journal management is pending `gemini_cli`'s instruction; further review is blocked until notification. Task `155435511` is completed for this phase.
## Current To-Do List ## Current To-Do List
### 1. High Priority & Urgent (UE-AE-01 Orchestration) ### 1. High Priority & Urgent (UE-AE-01 Orchestration)
- [ ] **Review codebase investigator report for Aether extension and journal management.** (ID: 155435511) - In Progress (awaiting report from codebase_investigator via gemini_cli). - [ ] **Review codebase investigator report for Aether extension and journal management.** (ID: 155435511) - In Progress (awaiting report from codebase_investigator via gemini_cli).
- [x] **Fix AE Person Creation (Backend/API)** - Completed (Validators added and router filtering implemented).
### 2. Infrastructure & Technical Debt ### 2. Infrastructure & Technical Debt
- [ ] **Psutil Container Update**: Rebuilding the API image with C-build tools (GCC) to support native system monitoring. (Deferred / Paused) - [ ] **Psutil Container Update**: Rebuilding the API image with C-build tools (GCC) to support native system monitoring. (Deferred / Paused)

View File

@@ -216,10 +216,22 @@ class Person_Base(BaseModel):
log.debug(locals()) log.debug(locals())
if isinstance(v, int) and v > 0: return v if isinstance(v, int) and v > 0: return v
elif id_random := values.get('user_id_random'): elif id_random := values.get('id_random'):
return redis_lookup_id_random(record_id_random=id_random, table_name='user') return redis_lookup_id_random(record_id_random=id_random, table_name='user')
return None return None
@validator('given_name', always=True)
def given_name_validator(cls, v):
if v is None:
return ""
return v
@validator('allow_auth_key', always=True)
def allow_auth_key_validator(cls, v):
if v is None:
return True
return v
class Config: class Config:
underscore_attrs_are_private = True underscore_attrs_are_private = True
allow_population_by_field_name = True allow_population_by_field_name = True

View File

@@ -427,6 +427,11 @@ async def post_obj(
data_to_insert = validated_obj.dict(exclude_unset=True) data_to_insert = validated_obj.dict(exclude_unset=True)
# Filter out virtual _id_random fields (e.g., account_id_random) that are not in the DB table
keys_to_remove = [k for k in data_to_insert.keys() if k.endswith('_id_random') and k != 'id_random']
for k in keys_to_remove:
del data_to_insert[k]
if sql_insert_result := sql_insert(data=data_to_insert, table_name=table_name_insert): if sql_insert_result := sql_insert(data=data_to_insert, table_name=table_name_insert):
new_obj_id = sql_insert_result new_obj_id = sql_insert_result
new_obj_id_random = get_id_random(record_id=new_obj_id, table_name=obj_name) new_obj_id_random = get_id_random(record_id=new_obj_id, table_name=obj_name)
@@ -479,6 +484,11 @@ async def patch_obj(
else: else:
return mk_resp(data=False, status_code=404, response=response, status_message=f"Object with ID '{obj_id}' not found in database.") return mk_resp(data=False, status_code=404, response=response, status_message=f"Object with ID '{obj_id}' not found in database.")
# Filter out virtual _id_random fields (e.g., account_id_random) that are not in the DB table
keys_to_remove = [k for k in obj_data.keys() if k.endswith('_id_random') and k != 'id_random']
for k in keys_to_remove:
del obj_data[k]
if sql_update(data=obj_data, table_name=table_name_update, record_id=record_id): if sql_update(data=obj_data, table_name=table_name_update, record_id=record_id):
if return_obj: if return_obj:
if sql_select_result := sql_select(table_name=table_name_select, record_id=record_id): if sql_select_result := sql_select(table_name=table_name_select, record_id=record_id):