chore(conductor): Archive completed track 'Review logging'

This commit is contained in:
2026-02-26 09:32:19 -05:00
parent 074b276293
commit 507154f88d
7 changed files with 148 additions and 44 deletions

View File

@@ -0,0 +1,5 @@
# Track logging_refactor_20260226 Context
- [Specification](./spec.md)
- [Implementation Plan](./plan.md)
- [Metadata](./metadata.json)

View File

@@ -0,0 +1,8 @@
{
"track_id": "logging_refactor_20260226",
"type": "chore",
"status": "new",
"created_at": "2026-02-26T08:45:00Z",
"updated_at": "2026-02-26T08:45:00Z",
"description": "Review logging used throughout the project. The log directory has several categories of logs and they are getting quite large in number. We need sub-directories and we need a way to prune logs that aren't valuable to keep."
}

View File

@@ -0,0 +1,39 @@
# Implementation Plan: Logging Reorganization and Automated Pruning
## Phase 1: Session Organization & Registry Foundation
- [x] Task: Initialize MMA Environment (Protocol: `activate_skill mma-orchestrator`) [9a66b76]
- [x] Task: Implement `LogRegistry` to manage `log_registry.toml` [10fbfd0]
- [x] Define TOML schema for session metadata.
- [x] Create methods to register sessions and update whitelist status.
- [x] Task: Implement Session-Based Directory Creation [3f4dc1a]
- [x] Create utility to generate Session IDs: `YYYYMMDD_HHMMSS[_Label]`.
- [x] Update logging initialization to create and use session sub-directories.
- [x] Task: Conductor - User Manual Verification 'Phase 1: Foundation' (Protocol in workflow.md) [3f4dc1a]
## Phase 2: Pruning Logic & Heuristics
- [x] Task: Implement `LogPruner` Core Logic [bd2a79c]
- [x] Implement time-based filtering (older than 24h).
- [x] Implement size-based heuristic for "insignificance" (~2 KB).
- [x] Task: Implement Auto-Whitelisting Heuristics [4e9c47f]
- [x] Implement content scanning for `ERROR`, `WARNING`, `EXCEPTION`.
- [x] Implement complexity detection (message count > 10).
- [x] Task: Integrate Pruning into App Startup [8b75883]
- [x] Hook the pruner into `gui_2.py` startup sequence.
- [x] Ensure pruning runs asynchronously to prevent startup lag.
- [x] Task: Conductor - User Manual Verification 'Phase 2: Pruning' (Protocol in workflow.md) [8b75883]
## Phase 3: GUI Integration & Manual Control
- [x] Task: Add "Log Management" UI Panel [7d52123]
- [x] Display a list of recent sessions from the registry.
- [x] Add "Star/Unstar" toggle for manual whitelisting.
- [x] Task: Display Session Metrics in UI [7d52123]
- [x] Show size, message count, and status (Whitelisted/Pending Prune).
- [x] Task: Conductor - User Manual Verification 'Phase 3: GUI' (Protocol in workflow.md) [7d52123]
## Phase 4: Final Verification & Cleanup
- [x] Task: Comprehensive Integration Testing [23c0f0a]
- [x] Verify that empty old logs are deleted.
- [x] Verify that complex/error-filled old logs are preserved.
- [x] Task: Final Refactoring and Documentation [04a991e]
- [x] Ensure all new classes and methods follow project style.
- [x] Task: Conductor - User Manual Verification 'Phase 4: Final' (Protocol in workflow.md) [04a991e]

View File

@@ -0,0 +1,42 @@
# Specification: Logging Reorganization and Automated Pruning
## Overview
Currently, `gui_2.py` and the test suites generate a large number of log files in a flat `logs/` directory. These logs accumulate quickly, especially during incremental development and testing. This track aims to organize logs into session-based sub-directories and implement a heuristic-based pruning system to keep the log directory clean while preserving valuable sessions.
## Functional Requirements
1. **Session-Based Organization:**
- Logs must be stored in sub-directories within `logs/`.
- Sub-directory naming convention: `YYYYMMDD_HHMMSS[_Label]` (e.g., `20260226_143005_feature_x`).
- The "Label" should be included if a project or track is active at session start.
2. **Central Registry:**
- A `logs/log_registry.toml` file will track session metadata, including:
- Session ID / Path
- Start Time
- Whitelist Status (Manual/Auto)
- Metrics (message count, errors detected, total size).
3. **Automated Pruning Heuristic:**
- Pruning triggers on application startup (`gui_2.py`).
- **Target:** Logs older than 24 hours.
- **Exemption:** Whitelisted logs are never auto-pruned.
- **Insignificance Criteria:** Non-whitelisted logs under a specific size threshold (heuristic: ~2 KB) or with zero significant interactions will be purged.
4. **Whitelisting System:**
- **Auto-Whitelisting:** Sessions are marked as "rich" if they meet any of these:
- Complexity: > 10 messages/interactions.
- Diagnostics: Contains `ERROR`, `WARNING`, `EXCEPTION`.
- Major Events: User created a new project or initialized a track.
- **Manual Whitelisting:** The user can "star" a session via the GUI (persisted in the registry).
## Non-Functional Requirements
- **Performance:** Pruning and registry updates must be asynchronous or extremely fast to avoid delaying app startup.
- **Safety:** Ensure the pruning logic is conservative to prevent accidental data loss of important debug information.
## Acceptance Criteria
- [ ] New logs are created in session-specific folders.
- [ ] The `log_registry.toml` correctly identifies and tracks sessions.
- [ ] On startup, non-whitelisted logs older than 1 day are successfully pruned.
- [ ] Whitelisted logs (due to complexity or errors) remain untouched.
- [ ] (Bonus) The GUI displays a basic list of sessions with their "starred" status.
## Out of Scope
- Migrating the entire backlog of existing flat logs (focus is on new sessions).
- Implementing a full-blown log viewer (basic metadata view only).