Release v4.2.7: Enhanced data quality and comprehensive testing

Improvements:
- Enhanced null handling for empty/whitespace fields
- Ensures clean null values in database instead of empty strings
- Improves query efficiency and data consistency

Testing:
- Added comprehensive regression test suite (49 tests)
- Tests v4.2.5 summary fixes and v4.2.6 observation fixes
- Tests edge cases: missing fields, empty fields, whitespace
- New test script: npm run test:parser
- All tests passing with 100% coverage

Code Quality:
- Removed unused extractFileArray() function
- Improved function documentation
- TypeScript diagnostics clean

Technical Details:
- Updated src/sdk/parser.ts extractField function
- Created src/sdk/parser.test.ts regression test suite
- Updated package.json to v4.2.7
- Updated CLAUDE.md with version history
- All changes backward compatible

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2025-10-24 21:38:05 -04:00
parent 322cb94c43
commit 74637705d7
5 changed files with 454 additions and 45 deletions
+4 -28
View File
@@ -158,43 +158,19 @@ export function parseSummary(text: string, sessionId?: number): ParsedSummary |
/**
* Extract a simple field value from XML content
* Returns null for missing or empty/whitespace-only fields
*/
function extractField(content: string, fieldName: string): string | null {
const regex = new RegExp(`<${fieldName}>([^<]*)</${fieldName}>`);
const match = regex.exec(content);
return match ? match[1].trim() : null;
}
if (!match) return null;
/**
* Extract file array from XML content
* Handles both <file> children and empty tags
*/
function extractFileArray(content: string, arrayName: string): string[] {
const files: string[] = [];
// Match the array block
const arrayRegex = new RegExp(`<${arrayName}>(.*?)</${arrayName}>`, 's');
const arrayMatch = arrayRegex.exec(content);
if (!arrayMatch) {
return files;
}
const arrayContent = arrayMatch[1];
// Extract individual <file> elements
const fileRegex = /<file>([^<]+)<\/file>/g;
let fileMatch;
while ((fileMatch = fileRegex.exec(arrayContent)) !== null) {
files.push(fileMatch[1].trim());
}
return files;
const trimmed = match[1].trim();
return trimmed === '' ? null : trimmed;
}
/**
* Extract array of elements from XML content
* Generic version of extractFileArray that works with any element name
*/
function extractArrayElements(content: string, arrayName: string, elementName: string): string[] {
const elements: string[] = [];