From 1440b65b9a4df56026d8a5c4ddbb9ce0a3487f05 Mon Sep 17 00:00:00 2001 From: Tomas Kracmar Date: Wed, 29 Jul 2026 11:52:58 +0200 Subject: [PATCH] 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 --- Update-KHDB.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Update-KHDB.ps1 b/Update-KHDB.ps1 index 50b62ca..674c78f 100644 --- a/Update-KHDB.ps1 +++ b/Update-KHDB.ps1 @@ -264,8 +264,11 @@ function Validate-Manifest { if (-not $seen.Add($name)) { throw "Manifest contains duplicate shard name '$name'." } } - if ($Manifest.shardSize -and [int]$Manifest.shardSize -ne 2) { - throw "Manifest shardSize $($Manifest.shardSize) is not supported. Expected shardSize 2." + # Merge-ShardsToFile reads shard files purely by name/content and doesn't use shardSize for + # 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)." } }