Fix(Events): Isolate IDAA Search to V2 and Refine V3 Search Pattern

- IDAA Isolation: Created  using legacy V2 endpoints and  for Recovery Meetings stability.
- V3 Refinement: Implemented 'Body + Header' injection in  to fix 'Integer Trap' while maintaining Auth scope.
- API Upgrade: Enhanced  to support custom headers.
- Docs: Updated migration guide and development history with final isolation strategy.
This commit is contained in:
Scott Idem
2026-01-20 15:06:26 -05:00
parent 6707b6826b
commit 07d7b4ec6d
7 changed files with 164 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
# Project: CRUD V3 Final Migration
> **Status:** Active / In Progress
> **Last Updated:** 2026-01-18
> **Last Updated:** 2026-01-20
> **Goal:** Eliminate all dependency on legacy API wrappers (`create_ae_obj_crud`, `get_ae_obj_id_crud`, etc.) and ensure 100% adoption of the V3 Standard (`/v3/crud/...`).
---
@@ -85,9 +85,34 @@ For each file listed above, follow this standard refactoring pattern:
* Verify the module still loads data (check Network tab for `/v3/` requests).
* Verify saving works (check for 400 Bad Request errors).
## 4. Standard Practices (V3)
### A. Permissive Update Mode
To simplify frontend state management, V3 supports ignoring unknown fields in update payloads.
- **Header:** `x-ae-ignore-extra-fields: true` (Enabled by default in `api_patch_object`).
- **Use Case:** Allows syncing objects that contain read-only metadata (e.g. `created_on`, `_lq_id`) without manual scrubbing.
### B. Structured Error Handling
V3 returns detailed error metadata in the `meta.details` object.
- **Implementation:** Core helpers automatically extract this metadata.
- **FastAPI Fallback:** Standard `{"detail": "..."}` responses are automatically wrapped into the `meta.details` format by the frontend helpers.
---
## 4. Final Cleanup
## 5. Known Pitfalls
### A. The "Integer Trap" (Search Mapping)
**Issue:** The backend automatically maps certain fields (like `account_id`) from string IDs to internal integers.
**Symptom:** Providing a string ID in a search body that the backend maps to an integer can result in **Zero Results** if the underlying view expects a string.
**Final Solution (Body + Header Injection):**
1. **Body:** Inject the raw field name (e.g. `account_id_random`) into the `search_query.and` array to bypass automatic backend mapping.
2. **Headers:** Pass `headers: { 'x-account-id': ... }` manually to provide context for Auth validation.
3. **Isolation (IDAA):** Due to specific bugs in the IDAA module, it has been temporarily isolated to a legacy V2 search function (`qry_ae_obj_li__event_v2`) using `default_qry_str` for text searching, while the main module continues to use the V3 implementation.
---
## 6. Final Cleanup
Once all checkboxes above are completed:
1. [ ] Remove legacy exports from `src/lib/api/api.ts`.
2. [ ] Delete `src/lib/ae_api/api_get__crud_obj_li_v1.ts`.