Skip to content

Commit 4c05be3

Browse files
sjsyrekclaude
andcommitted
docs: update CHANGELOG with code quality fixes and improvements
Document all bug fixes, performance optimizations, and refactorings from the code quality review in the Unreleased section. Added: - XML tag validation for tag handling options Changed: - File operation performance optimizations (eliminated duplicate syscalls) - DeepL API client refactoring (extracted duplicate code) - Logging consistency (unified through Logger service) Fixed (Critical): - Fire-and-forget async pattern in watch service - Race condition in document translation polling - Silent data loss warnings in batch translation All fixes maintain 100% test pass rate (1140 tests passing). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a8e714f commit 4c05be3

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,59 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11+
- **XML Tag Validation** - Comprehensive validation for XML tag handling options
12+
- Validates `--splitting-tags`, `--non-splitting-tags`, and `--ignore-tags` parameters
13+
- Ensures tag names match XML specification (start with letter/underscore, valid characters only)
14+
- Prevents use of reserved "xml" prefix (case-insensitive)
15+
- Clear error messages guide users to correct invalid tag names
16+
- Example: `--splitting-tags="p,div,br"` is validated before sending to API
17+
- Improves user experience by catching errors early instead of API-side failures
1118

1219
### Changed
20+
- **Performance Optimization: File Operations** - Eliminated duplicate filesystem syscalls
21+
- Replaced `existsSync() + statSync()` pattern with single `statSync()` call in directory detection
22+
- Cached file size to avoid calling `statSync()` twice on the same file path
23+
- Reduces filesystem operations in `translate` command file routing logic
24+
- **Performance Impact**: Saves 2 syscalls per file translation (1 for directory check, 1 for size warning)
25+
- No behavior changes, maintains exact same functionality
26+
27+
- **Refactoring: DeepL API Client** - Eliminated code duplication
28+
- Extracted 56 lines of duplicate parameter building code into shared `buildTranslationParams()` method
29+
- Both `translate()` and `translateBatch()` now use centralized parameter construction
30+
- Eliminates risk of divergence between single and batch translation options
31+
- Easier maintenance for future API parameter additions
32+
- No behavior changes, all 1140 tests pass
33+
34+
- **Logging Consistency** - Unified logging through Logger service
35+
- Replaced `console.warn()` with `Logger.warn()` in glossary TSV/CSV parsing (5 occurrences)
36+
- Replaced `console.error()` with `Logger.error()` in watch service (3 occurrences)
37+
- Ensures all logging respects quiet mode (`--quiet` flag)
38+
- Maintains consistent logging patterns across entire codebase
39+
- Exception: Config service intentionally uses `console.error()` during bootstrap (before Logger available)
1340

1441
### Fixed
42+
- **Critical: Fire-and-forget async in watch service** - Fixed unhandled rejection risk
43+
- Watch service was using `void (async () => {...})()` pattern that could hide errors
44+
- Removed `void` operator and properly awaited async `translateFile()` in setTimeout callback
45+
- Prevents silent failures during file translation in watch mode
46+
- Error handling now properly increments error count and calls onError callback
47+
- **Impact**: Previously, translation errors in watch mode could be silently ignored
48+
- Location: `src/services/watch.ts:156-170`
49+
50+
- **Critical: Race condition in document translation polling** - Fixed concurrent execution bug
51+
- AbortSignal cleanup and timeout completion could execute simultaneously
52+
- Added `isSettled` flag to ensure only one path (resolve or reject) executes
53+
- Prevents potential memory leaks and duplicate event handler cleanup
54+
- **Impact**: Previously, aborting a document translation could cause race condition
55+
- Race occurred when: timeout fires at same moment as abort signal
56+
- Location: `src/services/document-translation.ts:195-224`
57+
58+
- **Critical: Silent data loss in batch translation** - Added user warning for failures
59+
- Batch translations could silently filter out failed translations without notification
60+
- Now logs warning when some translations fail: "⚠️ Warning: N of M translations failed silently"
61+
- Helps users identify incomplete batch operations instead of assuming success
62+
- **Impact**: Previously, users wouldn't know if 3 out of 10 translations failed
63+
- Location: `src/services/translation.ts:225-230`
1564

1665
## [0.7.0] - 2025-10-16
1766

0 commit comments

Comments
 (0)