fix: import SearchFilter in api_crud_v3.py to resolve NameError
This commit is contained in:
49
GEMINI.md
49
GEMINI.md
@@ -49,42 +49,39 @@ I am an interactive CLI agent assisting with software engineering tasks for One
|
||||
|
||||
## Session Learnings & Progress (Jan 2-7, 2026)
|
||||
|
||||
### Agent Bridge & Docker Integration (Jan 7, 2026)
|
||||
- **Agent Bridge Implementation**: Developed `app/routers/agent_bridge.py` to provide administrative insight into the Docker runtime environment.
|
||||
- Endpoints include `/status`, `/system/usage`, `/logs`, `/logs/list`, `/processes`, and `/container/metadata`.
|
||||
- Implemented `is_admin` helper for consistent security across administrative tools.
|
||||
- Added support for listing and tailing various log files, with path sanitization.
|
||||
- **MCP Docker Explorer**: Created `mcp_docker_explorer.py` as a standalone client to test the Model Context Protocol (MCP) Docker server integration. This script uses `npx` to run `@modelcontextprotocol/server-docker`.
|
||||
- **Authentication Exceptions**:
|
||||
- Acknowledged that `x_no_account_id` is used intentionally in some contexts, though a more robust solution will be needed later.
|
||||
- **Direct Download Links**: Noted that Hosted Files and Event Files often require direct download links that cannot include custom headers, as they are often shared directly with users.
|
||||
### V3 API Security Hardening (Jan 7, 2026) - MILESTONE
|
||||
- **Mandatory JWT Authentication**: Successfully implemented strict multi-tenant isolation across all V3 CRUD and Search endpoints.
|
||||
- All requests (except context resolution) now require a valid JWT `Authorization: Bearer <token>` or `?jwt=<token>`.
|
||||
- **Account Isolation**: results are automatically filtered by `account_id` from the JWT.
|
||||
- **Documentation**: Updated `V3_FRONTEND_API_GUIDE.md` with explicit instructions and security requirements for the frontend agent.
|
||||
|
||||
### Agent Bridge & Docker Integration
|
||||
- **Agent Bridge Implementation**: Developed `app/routers/agent_bridge.py` for environment diagnostics.
|
||||
- **Dependency Management**: Noted `psutil` is missing from the container, causing system usage metrics to fail.
|
||||
- **Decision**: Holding off on adding `psutil` to minimize extra dependencies; the code fails gracefully for now.
|
||||
- **MCP Docker Explorer**: Created `mcp_docker_explorer.py` to test MCP server integration.
|
||||
|
||||
### V3 CRUD Infrastructure & Search
|
||||
- **Modular Object Definitions**: Refactored `ae_obj_types_def.py` into modular domain files in `app/object_definitions/`.
|
||||
- **Advanced Search Fixes**:
|
||||
- Resolved account listing and search issues by implementing `get_supported_filters` in `api_crud_v3.py`. This helper automatically adjusts `status_filter` (enabled/hidden) based on model field support (e.g., handles tables missing the `hide` column).
|
||||
- Improved standardized full-text search (`q` parameter) in `sql_search_qry_part` with a dry-run check for the `default_qry_str` column. It now falls back to a `LIKE` search across all searchable fields if the column is missing.
|
||||
- Added support for the `%` wildcard in `q`, allowing it to bypass filtering and return all records.
|
||||
- **Data Integrity & Aliasing**: Fixed a critical issue where aliased fields (like `account_id_random`) were returned as `null` by adding `allow_population_by_field_name = True` to Pydantic models (updated `Account_Base`, `Site_Domain_Base`, etc.).
|
||||
- **Consolidated V3 Router**: Systematically cleaned up `api_crud_v3.py`, removing duplicate endpoint definitions and standardizing logic across all CRUD and Search routes.
|
||||
- **Robust Error Handling**: Updated V3 routers to return 500 status codes on database failures instead of masking errors with empty result sets.
|
||||
- Resolved account listing and search issues by implementing `get_supported_filters` in `api_crud_v3.py`.
|
||||
- Improved standardized full-text search (`q` parameter) with fallback logic for missing columns.
|
||||
- **Data Integrity & Aliasing**: Fixed aliased field population by enabling `allow_population_by_field_name` in Pydantic models.
|
||||
|
||||
### Database Schema Insights
|
||||
- Verified schema for core tables (`account`, `event`, `person`, `user`, `data_store`, `site`, `site_domain`).
|
||||
- Noted that `site_domain` lacks a `hide` column, and `hosted_file_link` lacks both `hide` and `enable`.
|
||||
- Most major tables now have a standardized `hide` column (added to `account` on Jan 6, 2026).
|
||||
### Tool Stability & Recovery Note (Jan 7, 2026)
|
||||
- **Frequent Hangs:** The agent experienced multiple hangs (18+) when using shell commands or `list_directory`.
|
||||
- **Recovery Action:** A `NameError: name 'SearchFilter' is not defined` in `app/routers/api_crud_v3.py` was fixed by adding the missing import. This error was triggered by the new account isolation logic in the search endpoint.
|
||||
- **Verification:** The fix was applied, but verification was interrupted by a tool hang. Verification resumes in the next session.
|
||||
|
||||
## Current To-Do List
|
||||
|
||||
1. **Docker MCP Integration (Priority: High)**: Proceed with integrating the Docker MCP server into the Gemini CLI environment for direct container management.
|
||||
2. **Security - Field Allowlists (Priority: Done)**: Finished populating `searchable_fields` for all object definitions (Core, CMS, Events, Membership, Orders, Other).
|
||||
3. **Refactoring - Modularize `db_sql.py` (Priority: Done/Low)**: Successfully implemented a facade pattern, moving search builders and Redis helpers to modular files. This reduced `db_sql.py` by nearly 500 lines while preserving stability. Further modularization of core CRUD should only be attempted if stability risks are mitigated.
|
||||
1. **Frontend Integration (Priority: High)**: Coordinate with the frontend agent to ensure they adopt the mandatory JWT authentication pattern.
|
||||
2. **Routing - Nginx (Priority: High)**: Resolve 404 errors on `/v3/` and `/agent/` routes (Port 8888) by updating the Nginx configuration.
|
||||
3. **Docker MCP Integration (Priority: Medium)**: Proceed with integrating the Docker MCP server into the Gemini CLI environment.
|
||||
4. **Specialized Endpoints (Priority: Medium)**: Plan modernization of custom logic (importing, websockets) to match V3 patterns.
|
||||
5. **Security - Authentication (Priority: High)**: Continue refining and enforcing JWT-based authentication across all V3 endpoints, while respecting the need for header-less direct download links for certain file types.
|
||||
6. **Account ID Handling (Priority: Low)**: Address the `x_no_account_id` usage with a more permanent and secure architecture.
|
||||
5. **Account ID Handling (Priority: Low)**: Address the `x_no_account_id` usage with a more permanent architecture.
|
||||
|
||||
### Workflow & Collaboration
|
||||
- **`GEMINI.md` Strategy:** The user is creating `GEMINI.md` files in key project directories. Their understanding is that context flows from the current directory up the tree, with `~/.gemini/GEMINI.md` serving as a global catch-all for general memories.
|
||||
- **Agents Sync (rsync):** Shared documentation, notes, and architectural updates are pushed to the `agents_sync` directory using `rsync`. This allows real-time coordination between different specialized agents (e.g., FastAPI backend and Svelte frontend agents).
|
||||
- **Home Server:** The user self-hosts a Proxmox server for services like Nextcloud.
|
||||
|
||||
- **Home Server:** The user self-hosts a Proxmox server for services like Nextcloud.
|
||||
Reference in New Issue
Block a user