gitnexus 1.6.10-rc.90 → 1.6.10-rc.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,7 @@ import { getNodeLabel as deriveNodeLabel } from './rel-pair-routing.js';
15
15
  import { EMBEDDABLE_LABELS } from '../embeddings/types.js';
16
16
  import { extensionManager, resolveAnalyzeInstallPolicy, } from './extension-loader.js';
17
17
  import { classifyDeleteAllError, closeLbugConnection, HANDLE_RELEASE_PROBE_ATTEMPTS, HANDLE_RELEASE_PROBE_DELAY_MS, isDbBusyError, isOpenRetryExhausted, isWalCorruptionError, bufferPoolExhaustionRemedy, openLbugConnection, sleep, toNativeSafePath, resolveNativeSafeStorageDir, WAL_RECOVERY_SUGGESTION, waitForWindowsHandleRelease, } from './lbug-config.js';
18
- import { finalizeLbugSidecarsAfterClose, guardWalQuarantine, isMissingShadowSidecarError, isReadOnlyShadowReplayError, lbugLockRemediation, preflightLbugSidecars, quarantineWalForMissingShadow, renameFailureMessage, shadowSidecarRecoveryMessage, } from './sidecar-recovery.js';
18
+ import { cleanQuarantinedMissingShadowWals, finalizeLbugSidecarsAfterClose, guardWalQuarantine, isMissingShadowSidecarError, isReadOnlyShadowReplayError, lbugLockRemediation, preflightLbugSidecars, quarantineWalForMissingShadow, renameFailureMessage, shadowSidecarRecoveryMessage, sidecarPreflightDisabled, } from './sidecar-recovery.js';
19
19
  import { logger } from '../logger.js';
20
20
  /**
21
21
  * Split a relationship CSV into per-label-pair files on disk.
@@ -688,6 +688,26 @@ const doInitLbug = async (dbPath, readOnly = false) => {
688
688
  // -------------------------------------------------------------------------
689
689
  const releaseInitLock = await acquireInitLock(dbPath);
690
690
  try {
691
+ // Reclaim missing-shadow WAL quarantines from a PRIOR crash (#2637).
692
+ // LadybugDB renames an unrecoverable WAL aside as
693
+ // `${dbPath}.wal.missing-shadow.<ts>-<rand>` (quarantineWalForMissingShadow)
694
+ // instead of deleting it. Once quarantined it is permanently detached from
695
+ // the live store and never reopened, so reclaiming it is safe regardless of
696
+ // whether the main DB file exists this run — unlike the orphan-sidecar
697
+ // cleanup below, this must NOT be gated on "main DB missing": a quarantine
698
+ // event and a healthy main DB are independent facts. Never let a reclaim
699
+ // failure (e.g. a transient EBUSY from an antivirus scan) block DB startup.
700
+ if (!sidecarPreflightDisabled()) {
701
+ try {
702
+ const reclaimed = await cleanQuarantinedMissingShadowWals(dbPath);
703
+ for (const file of reclaimed) {
704
+ logger.warn(`GitNexus: reclaimed quarantined WAL ${path.basename(file)} from a prior crash`);
705
+ }
706
+ }
707
+ catch (err) {
708
+ logger.warn(`GitNexus: failed to reclaim missing-shadow WAL quarantines: ${summarizeError(err)}`);
709
+ }
710
+ }
691
711
  // Crash-recovery cleanup: if the main DB file is missing, stale sidecars
692
712
  // from an interrupted run can block fresh opens indefinitely.
693
713
  try {
@@ -26,6 +26,7 @@ export interface SidecarRecoveryLogger {
26
26
  }
27
27
  export declare const TINY_ORPHAN_WAL_BYTES: number;
28
28
  export declare const isMissingFsError: (err: unknown) => boolean;
29
+ export declare const sidecarPreflightDisabled: () => boolean;
29
30
  export declare const statIfExists: (filePath: string) => Promise<{
30
31
  size: number;
31
32
  } | null>;
@@ -35,7 +35,7 @@ const ordinal = (n) => {
35
35
  };
36
36
  export const isMissingFsError = (err) => err?.code === 'ENOENT';
37
37
  const missing = isMissingFsError;
38
- const sidecarPreflightDisabled = () => /^(1|true|yes|on)$/i.test(process.env.GITNEXUS_DISABLE_LBUG_SIDECAR_PREFLIGHT ?? '');
38
+ export const sidecarPreflightDisabled = () => /^(1|true|yes|on)$/i.test(process.env.GITNEXUS_DISABLE_LBUG_SIDECAR_PREFLIGHT ?? '');
39
39
  export const statIfExists = async (filePath) => {
40
40
  try {
41
41
  const statFn = fs.stat;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitnexus",
3
- "version": "1.6.10-rc.90",
3
+ "version": "1.6.10-rc.91",
4
4
  "description": "Graph-powered code intelligence for AI agents. Index any codebase, query via MCP or CLI.",
5
5
  "author": "Abhigyan Patwari",
6
6
  "license": "PolyForm-Noncommercial-1.0.0",