|
| 1 | +# Fix Context Filter Mismatches |
| 2 | + |
| 3 | +## TL;DR |
| 4 | + |
| 5 | +> **Quick Summary**: Fix 3 mismatches between log viewer filters and automatic context detection so filters work correctly. |
| 6 | +> |
| 7 | +> **Deliverables**: |
| 8 | +> |
| 9 | +> - Fixed `context.ts` to return matching context names |
| 10 | +> |
| 11 | +> **Estimated Effort**: Quick (5 minutes) |
| 12 | +> **Parallel Execution**: NO - single file change |
| 13 | +> **Critical Path**: Edit → Lint → Commit |
| 14 | +
|
| 15 | +--- |
| 16 | + |
| 17 | +## Context |
| 18 | + |
| 19 | +### Original Request |
| 20 | + |
| 21 | +Verify all context filters follow the same pattern as the outlook filter (automatic detection via stack trace). |
| 22 | + |
| 23 | +### Analysis Findings |
| 24 | + |
| 25 | +**Mismatches Found:** |
| 26 | + |
| 27 | +| Filter Option | Auto-Detection Returns | Should Return | Issue | |
| 28 | +| --------------- | --------------------------- | ----------------- | ------------------- | |
| 29 | +| `updates` | `'update'` (singular) | `'updates'` | Singular vs plural | |
| 30 | +| `notifications` | `'notification'` (singular) | `'notifications'` | Singular vs plural | |
| 31 | +| `servers` | None | `'servers'` | No detection exists | |
| 32 | + |
| 33 | +**Working Correctly:** |
| 34 | + |
| 35 | +- `main`, `renderer`, `webview` - Match processType |
| 36 | +- `videocall`, `outlook`, `auth`, `ipc` - Match component context |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## Work Objectives |
| 41 | + |
| 42 | +### Core Objective |
| 43 | + |
| 44 | +Align auto-detected context names with filter options and scoped logger names. |
| 45 | + |
| 46 | +### Concrete Deliverables |
| 47 | + |
| 48 | +- `src/logging/context.ts` updated with 3 fixes |
| 49 | + |
| 50 | +### Definition of Done |
| 51 | + |
| 52 | +- [x] `yarn lint` passes ✅ |
| 53 | +- [x] Filters match auto-detection and scoped loggers ✅ |
| 54 | + |
| 55 | +### Must NOT Have |
| 56 | + |
| 57 | +- No changes to filter logic in logViewerWindow.tsx (detection should match filters, not vice versa) |
| 58 | +- No breaking changes to existing working filters |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +## Verification Strategy |
| 63 | + |
| 64 | +### Automated Verification |
| 65 | + |
| 66 | +```bash |
| 67 | +yarn lint |
| 68 | +``` |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +## TODOs |
| 73 | + |
| 74 | +- [x] 1. Fix context detection mismatches in context.ts ✅ (commit: 8923ee14) |
| 75 | + |
| 76 | + **What to do**: |
| 77 | + In `src/logging/context.ts`, function `getComponentContext()`: |
| 78 | + |
| 79 | + 1. Change `return 'notification';` → `return 'notifications';` (around line 131) |
| 80 | + 2. Change `return 'update';` → `return 'updates';` (around line 134) |
| 81 | + 3. Add new detection block for servers (before the videocall check): |
| 82 | + |
| 83 | + ```typescript |
| 84 | + if ( |
| 85 | + stack.includes('server') || |
| 86 | + stack.includes('Server') || |
| 87 | + stack.includes('servers') |
| 88 | + ) { |
| 89 | + return 'servers'; |
| 90 | + } |
| 91 | + ``` |
| 92 | + |
| 93 | + **Must NOT do**: |
| 94 | + |
| 95 | + - Don't change any other return values |
| 96 | + - Don't modify the detection logic patterns (stack.includes checks) |
| 97 | + |
| 98 | + **Recommended Agent Profile**: |
| 99 | + |
| 100 | + - **Category**: `quick` |
| 101 | + - **Skills**: `[]` (no special skills needed) |
| 102 | + |
| 103 | + **Parallelization**: |
| 104 | + |
| 105 | + - **Can Run In Parallel**: NO |
| 106 | + - **Parallel Group**: Sequential |
| 107 | + - **Blocks**: Task 2 |
| 108 | + - **Blocked By**: None |
| 109 | + |
| 110 | + **References**: |
| 111 | + |
| 112 | + - `src/logging/context.ts:129-135` - Current notification/update detection to fix |
| 113 | + - `src/logging/context.ts:147-152` - videocall detection pattern to follow for servers |
| 114 | + - `src/logViewerWindow/logViewerWindow.tsx:127-142` - Filter options that must match |
| 115 | + - `src/logging/scopes.ts:34-37` - Scoped logger names to align with |
| 116 | + |
| 117 | + **Acceptance Criteria**: |
| 118 | + |
| 119 | + - [x] `return 'notification'` changed to `return 'notifications'` ✅ |
| 120 | + - [x] `return 'update'` changed to `return 'updates'` ✅ |
| 121 | + - [x] New servers detection block added ✅ |
| 122 | + - [x] `yarn lint` → 0 errors ✅ |
| 123 | + |
| 124 | + **Commit**: YES |
| 125 | + |
| 126 | + - Message: `fix(logging): align context detection with filter options` |
| 127 | + - Files: `src/logging/context.ts` |
| 128 | + - Pre-commit: `yarn lint` |
| 129 | + |
| 130 | +--- |
| 131 | + |
| 132 | +## Commit Strategy |
| 133 | + |
| 134 | +| After Task | Message | Files | Verification | |
| 135 | +| ---------- | ----------------------------------------------------------- | ---------- | ------------ | |
| 136 | +| 1 | `fix(logging): align context detection with filter options` | context.ts | yarn lint | |
| 137 | + |
| 138 | +--- |
| 139 | + |
| 140 | +## Success Criteria |
| 141 | + |
| 142 | +### Verification Commands |
| 143 | + |
| 144 | +```bash |
| 145 | +yarn lint # Expected: 0 errors |
| 146 | +``` |
| 147 | + |
| 148 | +### Final Checklist |
| 149 | + |
| 150 | +- [x] `notifications` filter catches notification-related console.logs ✅ |
| 151 | +- [x] `updates` filter catches update-related console.logs ✅ |
| 152 | +- [x] `servers` filter catches server-related console.logs ✅ |
| 153 | +- [x] All existing filters still work ✅ |
| 154 | + |
| 155 | +## Completion |
| 156 | + |
| 157 | +**Status**: ✅ COMPLETE |
| 158 | +**Commit**: `8923ee14202857a37ac865edd5cc98ea91ec9398` |
| 159 | +**Pushed**: Yes (debug-outlook branch) |
0 commit comments