fix(Update-KHDB): accept manifest's full supported shardSize range

Validate-Manifest hardcoded shardSize -ne 2 as an error, but
Prepare-KHDBStorage.ps1's -ShardSize parameter validly accepts 1-8.
Merge-ShardsToFile doesn't use shardSize for anything structural - it
reads shard files purely by name/content - so the check added no
safety, only rejected manifests produced with any supported shard
size other than 2. Widened the check to the same 1-8 range instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-29 11:52:58 +02:00
parent 5691463bd3
commit 1440b65b9a
+5 -2
View File
@@ -264,8 +264,11 @@ function Validate-Manifest {
if (-not $seen.Add($name)) { throw "Manifest contains duplicate shard name '$name'." } if (-not $seen.Add($name)) { throw "Manifest contains duplicate shard name '$name'." }
} }
if ($Manifest.shardSize -and [int]$Manifest.shardSize -ne 2) { # Merge-ShardsToFile reads shard files purely by name/content and doesn't use shardSize for
throw "Manifest shardSize $($Manifest.shardSize) is not supported. Expected shardSize 2." # anything structural, so any prefix length Prepare-KHDBStorage.ps1 can produce (1-8, see its
# -ShardSize ValidateRange) is fine here - only reject something outside that supported range.
if ($Manifest.shardSize -and ([int]$Manifest.shardSize -lt 1 -or [int]$Manifest.shardSize -gt 8)) {
throw "Manifest shardSize $($Manifest.shardSize) is out of the supported range (1-8)."
} }
} }