mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-11 03:38:07 +00:00
Implement error check for staged embeddings during sync
Add error handling for syncing embeddings with staged checkpoints.Address PR #3463: embeddings sync cannot recover staged vectors, so reject a recovery-bearing checkpoint under the index lock before detaching a shared graph, opening the writable database, or spending embedding work. Direct users to gitnexus analyze first.
This commit is contained in:
parent
c420f6981b
commit
dd900bb771
1 changed files with 9 additions and 0 deletions
|
|
@ -56,6 +56,15 @@ export const embeddingsSyncCommand = async (inputPath?: string): Promise<void> =
|
|||
lock,
|
||||
`Cannot acquire the index lock at ${metaDir}; refusing an unlocked embeddings sync.`,
|
||||
);
|
||||
// Sync writes the published graph and cannot recover a staged generation.
|
||||
// Reject even malformed receipts before detaching a shared graph or writing.
|
||||
const recoveryCheckpoint = (await loadMeta(metaDir))?.embeddingCheckpoint;
|
||||
if (recoveryCheckpoint && Object.hasOwn(recoveryCheckpoint, 'recovery')) {
|
||||
throw new Error(
|
||||
'Cannot sync embeddings: the index checkpoint references staged embeddings. ' +
|
||||
'Run `gitnexus analyze` to recover them first.',
|
||||
);
|
||||
}
|
||||
if (!(await ensurePrivateSharedGraph(metaDir, (m) => console.log(` ${m}`)))) {
|
||||
throw new Error('The shared graph this checkout reads is gone. Run gitnexus analyze first.');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue