fix: Claude Code 2.1.1 compatibility + log-level audit + path validation fixes (#614)

* Refactor CLAUDE.md and related files for December 2025 updates

- Updated CLAUDE.md in src/services/worker with new entries for December 2025, including changes to Search.ts, GeminiAgent.ts, SDKAgent.ts, and SessionManager.ts.
- Revised CLAUDE.md in src/shared to reflect updates and new entries for December 2025, including paths.ts and worker-utils.ts.
- Modified hook-constants.ts to clarify exit codes and their behaviors.
- Added comprehensive hooks reference documentation for Claude Code, detailing usage, events, and examples.
- Created initial CLAUDE.md files in various directories to track recent activity.

* fix: Merge user-message-hook output into context-hook hookSpecificOutput

- Add footer message to additionalContext in context-hook.ts
- Remove user-message-hook from SessionStart hooks array
- Fixes issue where stderr+exit(1) approach was silently discarded

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update logs and documentation for recent plugin and worker service changes

- Added detailed logs for worker service activities from Dec 10, 2025 to Jan 7, 2026, including initialization patterns, cleanup confirmations, and diagnostic logging.
- Updated plugin documentation with recent activities, including plugin synchronization and configuration changes from Dec 3, 2025 to Jan 7, 2026.
- Enhanced the context hook and worker service logs to reflect improvements and fixes in the plugin architecture.
- Documented the migration and verification processes for the Claude memory system and its integration with the marketplace.

* Refactor hooks architecture and remove deprecated user-message-hook

- Updated hook configurations in CLAUDE.md and hooks.json to reflect changes in session start behavior.
- Removed user-message-hook functionality as it is no longer utilized in Claude Code 2.1.0; context is now injected silently.
- Enhanced context-hook to handle session context injection without user-visible messages.
- Cleaned up documentation across multiple files to align with the new hook structure and removed references to obsolete hooks.
- Adjusted timing and command execution for hooks to improve performance and reliability.

* fix: Address PR #610 review issues

- Replace USER_MESSAGE_ONLY test with BLOCKING_ERROR test in hook-constants.test.ts
- Standardize Claude Code 2.1.0 note wording across all three documentation files
- Exclude deprecated user-message-hook.ts from logger-usage-standards test

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: Remove hardcoded fake token counts from context injection

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Address PR #610 review issues by fixing test files, standardizing documentation notes, and verifying code quality improvements.

* fix: Add path validation to CLAUDE.md distribution to prevent invalid directory creation

- Add isValidPathForClaudeMd() function to reject invalid paths:
  - Tilde paths (~) that Node.js doesn't expand
  - URLs (http://, https://)
  - Paths with spaces (likely command text or PR references)
  - Paths with # (GitHub issue/PR references)
  - Relative paths that escape project boundary

- Integrate validation in updateFolderClaudeMdFiles loop
- Add 6 unit tests for path validation
- Update .gitignore to prevent accidental commit of malformed directories
- Clean up existing invalid directories (~/, PR #610..., git diff..., https:)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: Implement path validation in CLAUDE.md generation to prevent invalid directory creation

- Added `isValidPathForClaudeMd()` function to validate file paths in `src/utils/claude-md-utils.ts`.
- Integrated path validation in `updateFolderClaudeMdFiles` to skip invalid paths.
- Added 6 new unit tests in `tests/utils/claude-md-utils.test.ts` to cover various rejection cases.
- Updated `.gitignore` to prevent tracking of invalid directories.
- Cleaned up existing invalid directories in the repository.

* feat: Promote critical WARN logs to ERROR level across codebase

Comprehensive log-level audit promoting 38+ WARN messages to ERROR for
improved debugging and incident response:

- Parser: observation type errors, data contamination
- SDK/Agents: empty init responses (Gemini, OpenRouter)
- Worker/Queue: session recovery, auto-recovery failures
- Chroma: sync failures, search failures (now treated as critical)
- SQLite: search failures (primary data store)
- Session/Generator: failures, missing context
- Infrastructure: shutdown, process management failures
- File Operations: CLAUDE.md updates, config reads
- Branch Management: recovery checkout failures

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: Address PR #614 review issues

- Remove incorrectly tracked tilde-prefixed files from git
- Fix absolute path validation to check projectRoot boundaries
- Add test coverage for absolute path validation edge cases

Closes review issues:
- Issue 1: ~/ prefixed files removed from tracking
- Issue 3: Absolute paths now validated against projectRoot
- Issue 4: Added 3 new test cases for absolute path scenarios

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* build assets and context

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2026-01-07 23:34:20 -05:00
committed by GitHub
parent 687146ce53
commit 2659ec3231
98 changed files with 8927 additions and 3554 deletions
+45 -118
View File
@@ -3,131 +3,58 @@
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Nov 10, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #6358 | 3:14 PM | 🔵 | SDK Agent Spatial Awareness Implementation | ~309 |
### Nov 21, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #13289 | 2:20 PM | 🟣 | Comprehensive Test Suite for Transcript Transformation | ~320 |
### Nov 23, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #14617 | 6:15 PM | 🟣 | Test Suite Successfully Passing - All 8 Tests Green | ~498 |
| #14615 | 6:14 PM | 🟣 | YAGNI-Focused Test Suite for Transcript Transformation | ~457 |
### Dec 5, 2025
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #20732 | 9:07 PM | 🔵 | Smart Install Version Marker Tests for Upgrade Detection | ~452 |
| #20399 | 7:17 PM | 🔵 | Smart install tests validate version tracking with backward compatibility | ~311 |
| #20392 | 7:15 PM | 🔵 | Memory tag stripping tests validate dual-tag system for JSON context filtering | ~404 |
| #20391 | " | 🔵 | User prompt tag stripping tests validate privacy controls for memory exclusion | ~182 |
### Jan 3, 2026
**logger-coverage.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36642 | 10:56 PM | 🔵 | Logger Coverage Test Requirements Analysis | ~483 |
| #36641 | " | 🔵 | Logger Coverage Test Suite Enforces Logging Standards | ~433 |
| #36616 | 10:42 PM | 🔵 | Logger Coverage Test Implementation Examined | ~540 |
**gemini_agent.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36639 | 10:55 PM | 🔵 | GeminiAgent Test Suite Structure | ~428 |
| #36637 | 10:47 PM | 🟣 | GeminiAgent Analysis Agent Running But Timed Out After 120 Seconds | ~521 |
| #36617 | 10:42 PM | 🔵 | GeminiAgent Test File Reveals Integration Requirements | ~506 |
**session_id_refactor.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36636 | 10:46 PM | 🟣 | Session ID Refactor Analysis Agent Completed Comprehensive Report | ~637 |
| #36615 | 10:42 PM | 🔵 | Session ID Refactor Test File Defines Expected Behavior | ~522 |
**session_store.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36635 | 10:46 PM | 🟣 | SessionStore Analysis Agent Completed Report Generation | ~545 |
| #36618 | 10:43 PM | 🔵 | SessionStore Test File Specifies Timestamp Override Feature | ~458 |
| #36485 | 9:12 PM | 🟣 | Prompts Module Test Suite Implemented | ~680 |
**session_id_usage_validation.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36625 | 10:44 PM | 🔵 | Documentation and Code Reveal Placeholder Detection Pattern | ~583 |
| #36619 | 10:43 PM | 🔵 | Session ID Validation Test Architecture Examined | ~705 |
**worker-spawn.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36570 | 9:54 PM | 🟣 | ProcessManager Infrastructure Test Suite Created | ~535 |
| #36663 | 11:06 PM | | Third Validation Test Updated: Resume Safety Check Now Uses NULL Comparison | ~417 |
| #36662 | " | | Second Validation Test Updated: Post-Capture Check Now Uses NULL Comparison | ~418 |
| #36661 | 11:05 PM | | First Validation Test Updated: Placeholder Detection Now Checks for NULL | ~482 |
| #36660 | " | ✅ | Updated Session ID Usage Validation Test Header to Reflect NULL-Based Architecture | ~588 |
| #36659 | " | ✅ | Sixth Test Fix: Updated Multi-Observation Test to Use Memory Session ID | ~486 |
| #36658 | " | | Fifth Test Fix: Updated storeSummary Tests to Use Actual Memory Session ID After Capture | ~555 |
| #36657 | 11:04 PM | ✅ | Fourth Test Fix: Updated storeObservation Tests to Use Actual Memory Session ID After Capture | ~547 |
| #36656 | " | | Third Test Fix: Updated getSessionById Test to Expect NULL for Uncaptured Memory Session ID | ~436 |
| #36655 | " | | Second Test Fix: Updated updateMemorySessionId Test to Expect NULL Before Update | ~395 |
| #36654 | " | | First Test Fix: Updated Memory Session ID Initialization Test to Expect NULL | ~426 |
| #36650 | 11:02 PM | 🔵 | Phase 1 Analysis Reveals Implementation-Test Mismatch on NULL vs Placeholder Initialization | ~687 |
| #36648 | " | 🔵 | Session ID Refactor Test Suite Documents Database Migration 17 and Dual ID System | ~651 |
| #36647 | 11:01 PM | 🔵 | SessionStore Test Suite Validates Prompt Counting and Timestamp Override Features | ~506 |
| #36646 | " | 🔵 | Session ID Architecture Revealed Through Test File Analysis | ~611 |
### Jan 4, 2026
**gemini_agent.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36924 | 2:25 AM | | Merged fix/pr-538-followups branch into main with comprehensive updates | ~481 |
| #36908 | 2:01 AM | | Regression Tests Committed Successfully | ~418 |
| #36907 | " | | Regression Test Files Staged for Commit | ~317 |
| #36842 | 1:43 AM | 🔵 | Complete Test Framework and Pattern Documentation | ~670 |
| #36836 | 1:42 AM | 🔵 | GeminiAgent Test Coverage and Mocking Patterns | ~513 |
| #36751 | 12:32 AM | 🔵 | Gemini-Related Files Located Across Project | ~242 |
**session_store.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36840 | 1:43 AM | 🔵 | SessionStore Integration Test Pattern | ~444 |
### Jan 5, 2026
**sdk-agent-resume.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #38086 | 10:42 PM | ✅ | Merged PR with comprehensive CLAUDE.md documentation system | ~478 |
**CLAUDE.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #38082 | 10:13 PM | ✅ | Merge Conflict Resolution - Kept Feature Branch Versions | ~431 |
**gemini_agent.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37819 | 6:44 PM | 🔄 | Replaced Module Mock with SpyOn Approach for SettingsDefaultsManager | ~354 |
| #37816 | " | 🔄 | Removed Module-Level Mocks from Gemini Test | ~347 |
| #37815 | " | 🔵 | Gemini Test Has Two Module-Level Mocks Defined Before Describe Block | ~375 |
| #37814 | " | 🔵 | Gemini Test Uses mock.restore() in afterEach Hook | ~319 |
| #37811 | 6:43 PM | 🔵 | SettingsDefaultsManager Tests Still Fail With Gemini Test Due to Mock | ~384 |
| #37809 | " | 🔴 | Logger Tests Now Pass When Run With Gemini Test | ~340 |
| #37800 | 6:41 PM | 🔴 | Fixed Incomplete SettingsDefaultsManager Mock in Gemini Agent Test | ~376 |
| #37799 | " | 🔵 | Gemini Test Uses mock.module to Override SettingsDefaultsManager | ~357 |
| #37798 | " | 🔵 | Gemini Agent Test Identified as Source of Module Corruption | ~351 |
**logger-coverage.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37797 | 6:41 PM | 🔴 | Logger Coverage Test Now Passes With Other Tests After Exclusion | ~311 |
| #37793 | 6:39 PM | 🔴 | Added SettingsDefaultsManager to Logger Coverage Test Exclusions | ~355 |
| #37792 | " | 🔴 | Logger Tests Pass When Run Together With Coverage Test | ~345 |
| #37790 | " | 🔵 | Logger Coverage Test Detects Console Usage in SettingsDefaultsManager | ~391 |
| #37755 | 6:22 PM | 🔵 | Score 3 Marginal Tests Verified: Mock-Heavy Tests Validate Structure, Not Behavior | ~580 |
| #37750 | 6:21 PM | 🔵 | Test Audit: logger-coverage.test.ts Enforces Logging Standards Across Codebase | ~629 |
| #37735 | 6:16 PM | ✅ | Test Suite Audit Report Generated: 41 Tests Scored and Analyzed | ~634 |
| #37629 | 5:36 PM | 🔵 | Comprehensive Testing Patterns Documentation Generated | ~629 |
| #37620 | 5:33 PM | 🔵 | Existing Logger Coverage Test Suite Structure | ~536 |
| #37617 | 5:32 PM | ⚖️ | PR #558 Review Requirements Categorized by Priority | ~637 |
**session_id_refactor.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37777 | 6:36 PM | 🔴 | Phase 1 Test Cleanup Completed - 6 Low-Quality Test Files Deleted | ~430 |
| #37764 | 6:32 PM | ✅ | Deleted 6 harmful test files causing mock pollution and testing zero runtime value | ~454 |
| #37756 | 6:22 PM | ⚖️ | Score 2 Weak Tests Verification Confirms Audit Findings | ~598 |
**cursor-hook-outputs.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37758 | 6:25 PM | ⚖️ | Integration Test Design for Four Critical Testing Gaps | ~729 |
**session_id_usage_validation.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37754 | 6:22 PM | 🔵 | Test Audit: session_id_usage_validation.test.ts Enforces Critical Session ID Architecture Invariants | ~826 |
**worker-spawn.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37752 | 6:21 PM | 🔵 | Test Audit: worker-spawn.test.ts Tests Configuration and Contracts Without Testing Actual Spawning | ~651 |
**cursor-context-update.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37706 | 6:10 PM | 🔵 | Test Audit: cursor-context-update.test.ts Validates Cursor Integration File Format | ~468 |
**validate_sql_update.test.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37705 | 6:10 PM | 🔵 | Test Audit: validate_sql_update.test.ts Validates SQL Refactor Correctness | ~374 |
| #36858 | 1:50 AM | 🟣 | Phase 1 Implementation Completed via Subagent | ~499 |
| #36854 | 1:49 AM | 🟣 | gemini-3-flash Model Tests Added to GeminiAgent Test Suite | ~470 |
| #36851 | " | 🔵 | GeminiAgent Test Structure Analyzed | ~565 |
</claude-mem-context>