Refactor core API helpers and implement System Testing Dashboard

- Unified and hardened get, post, patch, and delete helpers with standardized retry logic, kebab-case headers, and V3 response envelope handling.
- Implemented robust 'Bootstrap Paradox' resolution logic across the API stack to handle unauthenticated site domain lookups safely.
- Enhanced API helpers to support custom fetch injection, enabling reliable server-side execution in SvelteKit.
- Upgraded /testing page into a comprehensive System Testing Dashboard for core helper and V3 search verification.
- Updated TODO.md and GEMINI.md with 2026-01-08 session learnings and 'Frontier Journals' vision.
This commit is contained in:
Scott Idem
2026-01-08 11:30:05 -05:00
parent bc56b38ec1
commit e355b7649d
8 changed files with 548 additions and 897 deletions

154
TODO.md
View File

@@ -4,128 +4,70 @@ This is a list of tasks to be completed before the next event/show/conference.
---
## Recent Accomplishments
## Current Priorities (Jan 8, 2026)
- [x] **JWT Authentication (2026-01-07):** Implemented frontend infrastructure for JWT. Standardized usage across all CRUD V3 operations, updated authentication logic to capture tokens, and enhanced API helpers to automatically inject 'Authorization' headers using standard casing.
- [x] **API Robustness (2026-01-07):** Fixed a critical 'ReferenceError' in the POST helper and resolved 500 errors by standardizing header kebab-casing and preserving standard casing for keys like 'Authorization'.
- [x] **Activity Log Management (2026-01-07):** Fully migrated to V3 CRUD. Created a standalone management page and integrated filtered activity history into the Person detail view.
- [x] **Editable Fields Whitelists (2026-01-07):** Applied the `editable_fields.ts` pattern to all remaining AE objects across Journals, Events, and Sponsorships modules.
- [x] **Core Module Migration (2026-01-06):** Fully migrated Accounts, Sites, Site Domains, People, Users, and Activity Logs to Aether API CRUD V3. Implemented standardized "API -> Processor -> DB Save" pattern and editable field whitelists.
- [x] **Core Management UI (2026-01-06):** Scaffolded the management dashboard and list/detail routes for Accounts, Sites, Users, and Lookups.
- [x] **Event Badges V3 (2026-01-06):** Completed migration of Create, Update, and Delete operations to V3 nested CRUD.
- [x] **IDAA Module Migration (2026-01-06):** Migrated Archives and Recovery Meetings (Events) to V3. Implemented local filtering workaround for 'conference' field restriction.
- [x] **Core Placeholders (2026-01-06):** Built UI and V3 logic placeholders for Addresses and Contacts.
- [x] **Journals Module Migration:** Fully migrated to V3 CRUD.
- [x] **UI Libraries Updated:** Successfully updated SkeletonLabs to v4.7.4 and Flowbite-Svelte to v4.0.1.
1. **V3 Interface Verification:** Verify the 59 TypeScript interfaces exported to `agents_sync/technical/aether_interfaces.ts`.
2. **Journals Module Audit:** Assess feasibility of a rewrite vs. rework for the "flagship" vision.
3. **Core UI Polish:** Finalize Person and Address/Contact management.
4. **Svelte 5 / Runes Migration:** Continuous refactoring.
---
## Big Picture Goals
## Frontier Journals Module (Vision 2026-01-08)
*Goal: Transform Journals into the platform flagship with premium UI/UX and robust security.*
- Everything needs to work with Svelte 5.x and SvelteKit 2.x.
- Able to cache data and mostly work offline (using Dexie/IndexedDB).
- The new Events Launcher must be able to run inside an Electron app and have access to local files and OS shell commands.
- [ ] **Phase 1: Codebase Audit & Schema**
- [ ] Audit `src/lib/ae_journals` and `src/routes/journals` for Tailwind compliance and code quality.
- [ ] Verify `db_journals.ts` schema for metadata and encryption support.
- [ ] Identify and replace non-standard CSS with Tailwind utility classes.
- [ ] Update `db_journals.ts` types using the new `agents_sync` exported interfaces.
- [ ] **Phase 2: UI/UX Excellence**
- [ ] Implement "Quick Add" for high-velocity entry.
- [ ] Add rapid append/prepend functionality to existing entries.
- [ ] Ensure full cross-platform responsiveness (Mobile -> Workstation).
- [ ] **Phase 3: Content Portability**
- [ ] Implement Structured Markdown import (with metadata).
- [ ] Implement Bulk Export (Markdown, HTML) to file or clipboard.
- [ ] Integrate Outbound Email sharing.
- [ ] **Phase 4: Security & Privacy**
- [ ] Solidify E2EE passcode system for Journals and Entries.
- [ ] Perform security audit on V3 Journal endpoints.
---
## Aether API CRUD V3 Integration
- [ ] **Core API Wrappers:**
- [x] Implement GET list and search wrappers (`get_ae_obj_li_v3`, `search_ae_obj_v3`).
- [x] Implement Create (POST) wrappers (`create_ae_obj_v3`, `create_nested_obj_v3`).
- [x] Implement Update (PATCH) wrappers (`update_ae_obj_v3`, `update_nested_obj_v3`).
- [x] Implement Delete (DELETE) wrapper (`delete_ae_obj_v3`).
- [x] Implement single object GET wrapper (`get_ae_obj_v3`).
- [x] **Authentication & Security:**
- [x] Standardize JWT usage in headers for all V3 calls.
- [x] Update file download logic to support JWT in URL parameters.
- [x] **Site Domain Search (MIGRATED):** Successfully implemented `lookup_site_domain_v3`. This resolves the Bootstrap Paradox by allowing unauthenticated lookups for site domains via the new V3 search endpoint.
- **TECHNICAL NOTE (2026-01-07):** Initial testing on `/testing` shows the search might be failing silently or returning an unexpected structure.
- **TODO (Tomorrow):**
- Refactor `post_object` in `src/lib/ae_api/api_post_object.ts` to use the custom `fetch` from `api_cfg` (matching `api_get_object.ts`).
- Update `post_object` to use `json.data !== undefined ? json.data : json` to robustly handle different V3 response envelopes.
- Verify if the `403 Forbidden` for guest search is fully resolved on the backend or if header stripping in `lookup_site_domain_v3` is sufficient.
- [ ] **Module Migration:**
- [x] **Journals:** Fully migrated to V3 CRUD.
- [x] **Events - Badges:** Fully migrated to V3 CRUD.
- [x] **Core Modules:** Fully migrated (Accounts, Sites, People, Users, Activity Log).
- [ ] **IDAA Modules:** (In progress)
- [x] Archives & Archive Content.
- [x] Recovery Meetings (Events).
- [x] Bulletin Board (Posts).
- [ ] **Agent Coordination:**
- [x] Establish identity as `frontend_svelte`.
- [x] Send test greeting to `backend_fastapi`.
- [ ] Periodically check inbox for API updates.
- [x] **Foundational Refinement:**
- [x] Refactor `post_object` in `src/lib/ae_api/api_post_object.ts` to use custom `fetch` from `api_cfg`.
- [x] Update `post_object` for robust V3 response envelope handling (`json.data` check).
- [x] Verify `lookup_site_domain_v3` on `/testing`.
- [x] Refactor all core helpers (`get`, `post`, `patch`, `delete`) to share robust pattern.
- [x] **Core API Wrappers:** ... (Completed)
- [x] **Module Migration:** ... (Journals, Events, Core, IDAA mostly completed)
---
## Core Module Improvements
### 1. Core Module Dashboard
- [x] Create a central dashboard at `/core` to provide an overview and links to all core data management pages.
- [x] Add Activity Log management card.
- [x] **Route:** Create a new route at `/core/accounts`.
- [x] **API:** Implement functions in `ae_core__account.ts` for CRUD operations on accounts.
- [x] **UI:**
- [x] Create a `+page.svelte` to list all accounts.
- [x] Create a `[account_id]` dynamic route to view and edit account details.
### 3. Site & Domain Management
- [x] **Route:** Create a new route at `/core/sites`.
- [x] **API:** Implement functions in `ae_core__site.ts` for CRUD operations on sites and domains.
- [x] **UI:**
- [x] Create a `+page.svelte` to list all sites.
- [x] Create a `[site_id]` dynamic route to view and edit site details and manage associated domains.
### 4. Person Management
- [ ] **Enhance:** Improve the existing person management components under `/core/people`.
- [ ] **UI:**
- [x] Implement searchable person list (`Comp_person_search`).
- [ ] Create a dedicated page/form for creating and editing person records.
- [x] Implement User-Person linking UI in the detail page.
- [x] Implement Linked Activity & Content section.
### 5. User Management
- [x] **Route:** Create a new route at `/core/users`.
- [x] **UI:**
- [x] Create a `+page.svelte` to list all users.
- [x] Create a `[user_id]` dynamic route to view and edit user details, including permissions.
- [x] Implement logic to link users to person records.
### 6. Shared Lookup Lists
- [x] **Route:** Create a new route at `/core/lookups`.
- [x] **UI:**
- [x] Create a simple UI to view and manage the shared lookup lists (e.g., `countries`, `time_zones`).
### 7. Address & Contact Management
- [x] **Logic:** Implement V3 CRUD wrappers and Dexie tables.
- [x] **UI:** Create placeholder list pages at `/core/addresses` and `/core/contacts`.
- [x] **Detail Pages:** Create dynamic routes for viewing and editing specific records.
- [ ] **Person Management:**
- [ ] Create dedicated page/form for creating/editing person records.
- [ ] Finalize Person-User linking.
- [ ] **Address & Contact Management:**
- [ ] Implement full V3 CRUD UI (currently placeholders).
- [ ] Create dynamic detail routes.
---
## Codebase Standardization
- [x] **Naming Conventions:** Enforce `snake_case` and consistent file naming (`ae_<module>__<concept>.ts`).
- [x] **Rich Text Editor:** Migration to CodeMirror complete.
- [x] **Editable Fields:** Apply the `ae_<module>__<object>.editable_fields.ts` pattern to all remaining objects.
---
## Technical Debt & Refactoring
## Development Workflow & Tools
- [ ] **Backend Integration Tools:**
- [ ] Integrate `schema_sync(obj_type)` for automated TS interface generation.
- [ ] Utilize `sql_query(query)` for DB state verification during debugging.
- [ ] Use `docker_restart` / `docker_logs` for environment control.
- [ ] **Refactor `api.ts` God Object:**
- [ ] Extract Lookup functions (`get_ae_obj_li_for_lu`) to `$lib/ae_api/api_get__lu.ts`.
- [ ] Extract Hosted File functions (`download_hosted_file`, `delete_hosted_file`) to `$lib/ae_api/api_hosted_files.ts`.
- [ ] Extract Legacy CRUD functions (`create_ae_obj_crud`, `update_ae_obj_id_crud`, `delete_ae_obj_id_crud`) to `$lib/ae_api/api_crud_legacy.ts`.
- [ ] Extract Utility functions (`get_data_store_obj_w_code`, `send_email`) to `$lib/ae_api/api_utils.ts`.
- [ ] Convert `api.ts` into a pure barrel file that only exports the unified `api` object for backward compatibility.
- [ ] **Svelte 5 Runes Migration:** Ongoing effort to replace legacy reactivity with `$state` and `$derived`.
- [ ] Extract Lookup, Hosted File, Legacy CRUD, and Utility functions to dedicated modules.
- [ ] Convert `api.ts` into a pure barrel file.
---
## Recent Accomplishments
... (Previous accomplishments retained)