diff --git a/.jules/bolt.md b/.jules/bolt.md index ee124e69..0bd9636f 100644 --- a/.jules/bolt.md +++ b/.jules/bolt.md @@ -62,3 +62,6 @@ ## 2026-08-11 - Array의 toMutableList 할당 오버헤드 최적화 **학습:** 배열을 정렬하기 위해 `.toMutableList()`를 호출하면 새로운 `ArrayList` 객체와 내부 배열 객체가 할당되어 대규모 디렉토리를 순회할 때 가비지 컬렉션(GC) 부하를 유발합니다. 배열 복제가 필요한 경우 `.clone()`을 사용하면 하나의 배열 객체만 새로 할당되므로 더 효율적입니다. **조치:** 디렉토리 파일 배열을 정렬하기 전에 복사할 때 `.toMutableList()` 대신 `.clone()`을 사용하여 불필요한 중간 컬렉션 할당을 제거하고 성능을 향상시켰습니다. +## 2026-09-27 - 고정 민감 확장자 순회 구조 +**학습:** `Constants`는 file-private 구현 세부사항이므로 외부 Java API 호환성 주장은 적용되지 않습니다. 배열과 파생 리스트를 함께 유지하면 동일한 값을 중복 보관하고 single-writer 경계를 흐립니다. 배열 순회가 실제 제품 경로의 GC나 지연을 개선하는지는 JaCoCo coverage로 입증할 수 없습니다. +**조치:** 민감 확장자는 하나의 private 고정 배열로 유지하고, 대용량 디렉터리의 실제 순회 경로에서 warm-up·표본·failure denominator·할당량·GC·median·p95를 측정하기 전에는 성능 개선을 주장하지 않습니다. 행동 계약은 대소문자가 섞인 `.pem`·`.key`·`.p12` 제외와 안전 파일 보존을 검증합니다. diff --git a/CHANGELOG.md b/CHANGELOG.md index c442b3b1..5edd873a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to this project are documented in this file. ### Changed +- Keep sensitive-extension matching behind one private fixed table and preserve case-insensitive `.pem`, `.key`, and `.p12` exclusion with a focused behavioral contract. No directory-crawl performance improvement is claimed until a reproducible allocation/GC and median/p95 benchmark exists. - Improve generated directory-index readability with adjacent-row separators, explicit light and dark empty-state text colors, and text-only hover/focus underlining while retaining the full interactive target's focus outline. diff --git a/src/main/kotlin/html4tree/main.kt b/src/main/kotlin/html4tree/main.kt index 0972fa2c..7f7e97f3 100644 --- a/src/main/kotlin/html4tree/main.kt +++ b/src/main/kotlin/html4tree/main.kt @@ -503,8 +503,8 @@ private object Constants { val defaultSensitiveFileNamesLowercase = defaultSensitiveFiles.map { it.toLowerCase(java.util.Locale.ROOT) }.toSet() - @JvmField - val defaultSensitiveExtensions = listOf( + // ⚡ Bolt Performance Optimization: Use arrayOf to avoid Iterator allocation on hot path + val defaultSensitiveExtensions = arrayOf( ".pem", ".key", ".p12", diff --git a/src/test/kotlin/html4tree/HiddenFileSecurityTest.kt b/src/test/kotlin/html4tree/HiddenFileSecurityTest.kt index 3bee2a13..6549ec42 100644 --- a/src/test/kotlin/html4tree/HiddenFileSecurityTest.kt +++ b/src/test/kotlin/html4tree/HiddenFileSecurityTest.kt @@ -33,4 +33,21 @@ class HiddenFileSecurityTest { directory.deleteRecursively() } } + @Test + fun sensitiveExtensionsRemainExcludedCaseInsensitively() { + val directory = Files.createTempDirectory("html4tree-sensitive-").toFile() + try { + val names = arrayOf("server.PEM", "client.key", "archive.P12", "report.txt") + + val excluded = process_ignore_file(directory, names) + + assertTrue("server.PEM" in excluded) + assertTrue("client.key" in excluded) + assertTrue("archive.P12" in excluded) + assertFalse("report.txt" in excluded) + } finally { + directory.deleteRecursively() + } + } + }