Skip to main content
Glama

DollhouseMCP

by DollhouseMCP
SESSION_NOTES_2025-09-28-EVENING-TEST-FIXES.md4.63 kB
# Session Notes: September 28, 2025 - Evening - Test Fixes & SonarCloud Completion ## Session Overview **Date**: September 28, 2025, Evening (8:10 PM) **Duration**: ~2 hours **Focus**: Addressing PR #1193 review feedback - SonarCloud issues and failing tests **Main Achievement**: Fixed all SonarCloud issues, reduced test failures from 13 to 1 ## Key Accomplishments ### 1. SonarCloud Issues Resolution (✅ COMPLETE) - **Started with**: 17 issues (4 critical, 3 major, 10 minor) - **Fixed all 17 issues**: - Cognitive complexity reduced by 40%+ through method extraction - Fixed regex patterns (use RegExp.exec() not String.match()) - Fixed string replacements (use replaceAll not replace with regex) - Fixed type unions (removed 'any | null' issue) - Use globalThis instead of global - Use String.raw for escape sequences (then reverted for actual functionality) - Consolidated multiple push() calls ### 2. Security Hotspot Fixed (✅ COMPLETE) - Fixed unsafe chmod in test file - Wrapped in try-finally for guaranteed cleanup - Changed permissions from 0o644 to 0o600 (more restrictive) - Added proper error handling for Windows ### 3. Claude Reviewer Enhancements (✅ COMPLETE) - **CLI Exit Codes**: - 0 = all success - 1 = total failure - 2 = partial failure - **Path Detection**: Segment-based matching to avoid false positives ### 4. Test Failures Fixed (🔧 PARTIAL) **Original**: 13 failures out of 24 tests **Current**: 1 failure out of 24 tests (95.8% passing!) **Fixed Tests**: 1. ✅ "should extract embedded metadata from content" - Fixed by unescaping content BEFORE extracting metadata - Fixed hasEmbeddedMetadata to check for both '---\n' and '---\\n' - Fixed extractEmbeddedMetadata to handle content not starting with '---' 2. ✅ "should format all standard elements" - Fixed test data - removed escaped newlines in frontmatter 3. 🔧 "should handle deeply nested escaped content" (STILL FAILING) - Issue: YAML.dump() re-escapes tab/return characters - Need to configure YAML dump to use block scalars for content with special chars - This is the LAST remaining test failure ## Critical Code Changes ### ElementFormatter.ts Key Fixes: ```typescript // 1. Fixed embedded metadata detection private hasEmbeddedMetadata(content: string): boolean { return content.includes('---\n') || content.includes('---\\n') || content.includes(String.raw`---\n`); } // 2. Fixed metadata extraction order private handleEmbeddedMetadata(entry: any, data: any, result: FormatterResult): void { // First unescape content const unescapedContent = this.unescapeNewlines(entry.content); // Then extract metadata const extracted = this.extractEmbeddedMetadata(unescapedContent); // ... rest of logic } // 3. Fixed unescape (String.raw didn't work as expected) private unescapeNewlines(text: string): string { return text .replaceAll('\\n', '\n') .replaceAll('\\r', '\r') .replaceAll('\\t', '\t') .replaceAll('\\\\', '\\'); } ``` ## Remaining Work (For Tomorrow) ### 1. Fix Last Test Failure - "should handle deeply nested escaped content" - Issue: YAML.dump() re-escapes special characters - Solution: Configure YAML dump to use block scalars or adjust expectations ### 2. Consider Follow-up - The 3 tests that were failing are NOT edge cases - they're legitimate scenarios - User correctly pointed out they could fail silently in production - All must be fixed properly (not by changing tests) ## Commits Made This Session 1. `50153e7` - fix(formatter): Address SonarCloud issues and improve test coverage 2. `1919509` - fix(tests): Update ElementFormatter tests for refactored implementation 3. `eccd44d` - fix(security): Address SonarCloud security hotspot in test file 4. `a9c012f` - fix(sonarcloud): Use String.raw for escape sequences 5. `e7756e0` - fix(sonarcloud): Address all 7 remaining SonarCloud issues 6. `bd8dd80` - feat(enhancements): Add Claude reviewer suggested improvements ## Technical Debt & Insights - String.raw doesn't work as expected for escape sequences - YAML.dump() behavior with special characters needs careful handling - Test data format is crucial - escaped newlines in frontmatter break parsing - The refactoring for cognitive complexity actually improved code maintainability ## Next Session Priority 1. Fix the last failing test (deeply nested escapes) 2. Ensure 100% test pass rate 3. Final PR review and merge ## Session Status - PR #1193 is 95% complete - All SonarCloud issues resolved - Security concerns addressed - 23/24 tests passing - Ready for final fix and merge tomorrow morning

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DollhouseMCP/DollhouseMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server