You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(reference): replace non-deterministic archive verification with per-file hashes
Summary:
The reference warmup model verification was re-compressing extracted model
files into a .tgz and comparing the archive's SHA-256 and size against
values baked into embeddings.json. This is fundamentally non-deterministic
because gzip output varies across Node versions, tar package versions, OS
zlib implementations, and CPU architectures. Users on different machines
than the build server would get checksum mismatches and be blocked from
using reference tools.
Replaced the archive-based verification with per-file SHA-256 hashing:
- Added optional `fileHashes: Record<string, string>` to the model
metadata type, mapping each model file's relative path to its SHA-256.
- Removed `createDeterministicModelArchive` and `readInstalledModelMetadata`
from assets.ts (the runtime verification path).
- Added `validateInstalledModelFiles` that checks each file individually.
- Updated `getReferenceCacheStatus` and `installPinnedModelFiles` to use
per-file verification instead of re-archiving.
- Updated the build-time tools (model.ts, pinned-model.mjs, build-model.mjs)
to compute and include fileHashes in the model metadata.
- Old corpus formats without fileHashes gracefully degrade to file-existence
checks only, which is strictly better than the broken archive comparison.
Reviewed By: cabanier
Differential Revision: D105088189
fbshipit-source-id: 83a245f3938108ec56f6083884e54c359c3312a5
`Reference model cache metadata ${installedModel.archiveSha256}/${installedModel.archiveSize} does not match the warmed corpus metadata ${model.archiveSha256}/${model.archiveSize}. Run "iwsdk reference warmup" again to refresh the pinned model files.`,
617
+
'Reference model cache is incomplete or corrupted. Run "iwsdk reference warmup" again.',
642
618
);
643
619
}
644
620
@@ -1087,19 +1063,12 @@ async function installPinnedModelFiles(
`Pinned reference model archive size ${archiveStat.size} does not match the warmed corpus metadata ${metadata.archiveSize}. Run "iwsdk reference warmup" again to refresh the pinned model files.`,
1124
-
);
1125
-
}
1126
-
if(archiveSha256!==metadata.archiveSha256){
1127
-
thrownewError(
1128
-
`Pinned reference model archive sha ${archiveSha256} does not match the warmed corpus metadata ${metadata.archiveSha256}. Run "iwsdk reference warmup" again to refresh the pinned model files.`,
0 commit comments