fix: remove unnecessary disk I/O + fix test cleanup

- isChecked() no longer calls saveState() — read-only operation
  should not write to disk (was causing 3x writes per tool call)
- Test cleanup uses fs.rmSync(recursive) instead of fs.rmdirSync
  which failed with ENOTEMPTY when .tmp files remained

9/9 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
seto
2026-04-13 15:41:58 +09:00
parent 67256194a0
commit 5540282dcb
2 changed files with 1 additions and 3 deletions

View File

@@ -84,7 +84,6 @@ function markChecked(key) {
function isChecked(key) { function isChecked(key) {
const state = loadState(); const state = loadState();
saveState(state);
return state.checked.includes(key); return state.checked.includes(key);
} }

View File

@@ -308,10 +308,9 @@ function runTests() {
})) passed++; else failed++; })) passed++; else failed++;
// Cleanup: remove test-isolated state directory // Cleanup: remove test-isolated state directory
clearState();
try { try {
if (fs.existsSync(stateDir)) { if (fs.existsSync(stateDir)) {
fs.rmdirSync(stateDir); fs.rmSync(stateDir, { recursive: true, force: true });
} }
} catch (err) { } catch (err) {
console.error(` [cleanup] failed to remove ${stateDir}: ${err.message}`); console.error(` [cleanup] failed to remove ${stateDir}: ${err.message}`);