Files
OSIT-AE-API-FastAPI/GEMINI.md

67 lines
5.1 KiB
Markdown

# Gemini Added Memories
## My Role and Operating Principles
I am the **primary orchestrator and main helper** for the development of the **Unified Aether AI Agent (UE-AE-01)**. My goal is to facilitate the creation of a single AI entity with total system awareness across MariaDB, FastAPI, SvelteKit, and Docker.
---
## Project Context - Aether API (FastAPI)
- **Owner/Developer:** Scott Idem (user).
- **System Name:** Aether (AE).
- **Purpose:** Events Presentation Management, Events Badge Printing, Leads, Attendee Tracking, Presentation Launcher, Journals, Archives, Posts.
- **Current API Version (FastAPI):** v4.9.0.
- **V3 Implementation:** Modern parallel CRUD and Search endpoints under `/v3/crud`.
- **Summary**: This project serves as the backend for the Aether system, providing core API functionalities.
### Key Technical Learnings (Cumulative)
- **Circular Dependencies Fixed**: Successfully resolved the fragile startup dependency chain by isolating Auth models and using strictly deferred DB imports in a dedicated `dependencies_v3.py` module.
- **Bootstrap Paradox Solved**: Implemented a guest-access exception for `site_domain` search, allowing the frontend to resolve site context without a JWT.
- **V3 Searchable Fields**: Confirmed that `searchable_fields` are fully implemented in `app/object_definitions/` and utilized by `app/lib_sql_search.py` for dynamic query generation.
- **Environment Sync Clarification**: Critical understanding that the `/home/scott/OSIT_dev/` directory is **NOT** a synchronized directory across different machines (e.g., Workstation vs. Laptop). This means virtual environments and installed dependencies are environment-specific and do not propagate via Syncthing. This is crucial for debugging cross-machine environment issues.
- **Circular Import Sensitivity**: Importing `JSONResponse` from `fastapi` in `app/routers/api.py` triggers a circular dependency crash. It is safer to rely on FastAPI's default dict-to-JSON serialization or use `mk_resp` without explicit `JSONResponse` typing in that specific file.
## Session Summary & Progress (Jan 15, 2026)
This session focused on a comprehensive modernization of the API's core infrastructure to resolve boot-time circular dependencies and improve maintainability.
* **FastAPI Entry Point Modularization:**
* **Registry Pattern:** Created `app/routers/registry.py` to centralize 50+ router registrations, slimming down `main.py`.
* **Lifespan Context:** Integrated the `lifespan` context manager in `app/main.py` to manage startup/shutdown tasks cleanly.
* **Naming Collision Fix:** Resolved a critical conflict between the `app` instance and the `app.middleware` package by using explicit aliases.
* **Database Logic Decoupling:**
* **Layered Architecture:** Split `app/db_sql.py` into `lib_sql_core` (engine/connection) and `lib_sql_crud` (high-level helpers).
* **Dynamic Engine Refresh:** Implemented `reconnect_db()` to allow the SQLAlchemy engine to update credentials after the initial boot.
* **Robust Configuration & Logging:**
* **Logging Sandbox:** Moved `dictConfig` to `app/lib_log_v3.py` and deferred its execution to avoid boot-time traps.
* **Safe Bootstrap:** Created `app/lib_config_v3.py` with a non-fatal fallback mechanism for DB configuration sync.
* **Architecture Documentation & Cleanup:**
* Created `documentation/V3_CORE_ARCHITECTURE.md` to document the new file structure and bootstrap sequence.
* Created `documentation/V3_DEVELOPMENT_STANDARDS.md` as the unified master guide for V3 principles and infrastructure.
* Archived outdated tactical plans into `documentation/archive/` and removed stray orchestration files.
## Current To-Do List
### 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).
- [ ] **Implement scope expansion to `/home/scott/OSIT_dev/`.** - Pending registry update.
### 2. Infrastructure & Technical Debt
- [ ] **Psutil Container Update**: Rebuilding the API image with C-build tools (GCC) to support native system monitoring. (Deferred / Paused)
- [ ] **Fix ComfyUI Container**: Resolve the restart loop in the Ollama/WebUI environment.
- [ ] **Pydantic V2 Migration**: Begin impact analysis for the 400+ validators and .dict() calls.
### 3. Other Agent Tasks
- [ ] **Review and process new messages from various agents.** (ID: 134908245) - In Progress (Internal gemini_cli task).
- [x] **[scott_wks] Perform Initial System Health Audit** (ID: 131939030) - Done.
- [x] **[API-V3] Implement Error Bubbling and Validation Endpoint** (ID: 163752448) - Done.
- [x] **[API] Modularize main.py and extract Core Registries** - Done Jan 15.
- [x] **[API] Stabilize Logging and Configuration Bootstrap** - Done Jan 15.
### Workflow & Collaboration
- **Storage**: Critical assets at `/home/scott/OSIT/hosted_files/` (Synced via Syncthing).
- **Agents Sync**: Shared documentation and notifications pushed to `~/agents_sync/`.
- **Coding Standards**: Adhering to `prompts/coding_standards.md`.