Skip to content

fix(local-backend): #1178 skip vector index query on unsupported pla…#1181

Merged
magyargergo merged 1 commit into
abhigyanpatwari:mainfrom
Morieity:main
Apr 30, 2026
Merged

fix(local-backend): #1178 skip vector index query on unsupported pla…#1181
magyargergo merged 1 commit into
abhigyanpatwari:mainfrom
Morieity:main

Conversation

@Morieity

Copy link
Copy Markdown
Contributor

Summary

This PR makes the local MCP semantic search path respect the existing VECTOR platform capability guard.

GitNexus already treats LadybugDB VECTOR as unsupported on win32 via isVectorExtensionSupportedByPlatform(). The core embedding pipeline uses that guard before attempting to load or use VECTOR. However, src/mcp/local/local-backend.ts still had one direct CALL QUERY_VECTOR_INDEX(...) path that did not check the same capability first.

This PR fixes that remaining inconsistency by skipping the VECTOR index fast path on unsupported platforms and letting the existing exact-scan fallback run.

Background

On Windows, @ladybugdb/core can terminate the process with a native access violation when executing:

LOAD EXTENSION VECTOR

Observed exit code:


0xC0000005 / -1073741819

This is a native crash, so JavaScript try/catch cannot reliably recover from it once the unsafe native path is entered.

The current main branch already has the primary guard:

  • src/core/platform/capabilities.ts

    • isVectorExtensionSupportedByPlatform('win32') === false
  • src/core/lbug/lbug-adapter.ts

    • loadVectorExtension() checks platform support before calling into LadybugDB VECTOR loading

The local MCP backend should follow the same capability policy.

Problem

LocalBackend.semanticSearch() in src/mcp/local/local-backend.ts directly attempted:

CALL QUERY_VECTOR_INDEX(...)

without checking whether VECTOR is supported on the current platform.

On Windows this usually falls back after query failure, because the pool path does not load the VECTOR extension by default. However, it is still inconsistent with the rest of the codebase:

  • core embedding semantic search checks VECTOR availability first

  • local MCP semantic search attempted the vector index query directly

  • unsupported platforms should go straight to exact-scan fallback

Change

This PR updates LocalBackend.semanticSearch() to reuse:

isVectorExtensionSupportedByPlatform()

Behavior after this change:

  • Supported platforms:

    • unchanged

    • still try CALL QUERY_VECTOR_INDEX(...)

    • fall back to exact scan if the vector query fails or returns no chunks

  • Unsupported platforms:

    • skip CALL QUERY_VECTOR_INDEX(...)

    • go directly to the existing exact-scan fallback

This does not disable semantic search. It only skips the LadybugDB VECTOR index fast path on platforms where VECTOR is already marked unsupported.

Why this approach

This follows the existing project architecture instead of introducing a new policy.

I intentionally did not call loadVectorExtension() from local-backend.ts, because local backend uses the repo-scoped pool-adapter connection model, while loadVectorExtension() belongs to the singleton lbug-adapter path. Mixing those connection models would make the change larger and riskier.

I also did not add a new environment variable or change extension install policy. This PR only makes the local backend respect the existing platform capability helper.

Tests

Added a regression test in test/unit/calltool-dispatch.test.ts verifying that when VECTOR is unsupported by the platform:

  • LocalBackend does not send a QUERY_VECTOR_INDEX query

  • the code proceeds to the exact-scan CodeEmbedding query path

Validation run locally:

npx vitest run --project default "test/unit/platform-capabilities.test.ts"

npx vitest run --project default "test/unit/calltool-dispatch.test.ts"

npx tsc --noEmit

Results:


platform-capabilities.test.ts: 2 tests passed

calltool-dispatch.test.ts: 67 tests passed

TypeScript check: passed

Scope

This PR does not attempt to fix the underlying LadybugDB native crash itself. That should be addressed upstream in @ladybugdb/core.

This PR only ensures that GitNexus' local MCP semantic search path does not bypass the existing platform capability guard.

Copilot AI review requested due to automatic review settings April 29, 2026 03:09
@vercel

vercel Bot commented Apr 29, 2026

Copy link
Copy Markdown

@Morieity is attempting to deploy a commit to the NexusCore Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ensures the local MCP backend’s semantic search respects the existing platform capability guard for LadybugDB VECTOR, avoiding the vector index query on unsupported platforms (notably Windows) and relying on the existing exact-scan fallback.

Changes:

  • Gate CALL QUERY_VECTOR_INDEX(...) behind isVectorExtensionSupportedByPlatform() in LocalBackend.semanticSearch().
  • Add a regression unit test asserting the vector index query is skipped when VECTOR is unsupported.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
gitnexus/src/mcp/local/local-backend.ts Adds a platform capability guard to skip the VECTOR index query path and fall back to exact-scan behavior on unsupported platforms.
gitnexus/test/unit/calltool-dispatch.test.ts Introduces a unit test and mocks platform capabilities to validate the guard behavior (needs a stronger assertion for the fallback path).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +209 to +211
expect(queries.some((cypher: string) => cypher.includes('MATCH (e:CodeEmbedding)'))).toBe(
true,
);

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test’s assertion that the exact-scan fallback ran is too weak: queries.some(cypher.includes('MATCH (e:CodeEmbedding)')) will already be true because the initial table existence check uses the same substring (MATCH (e:CodeEmbedding) RETURN COUNT(*)...). As written, the test could pass even if the exact-scan query never executes. Make the assertion target the exact-scan query more specifically (e.g., check for RETURN e.nodeId AS nodeId / e.embedding AS embedding), or assert call ordering/count (COUNT(*) query first, then the full embedding scan query).

Suggested change
expect(queries.some((cypher: string) => cypher.includes('MATCH (e:CodeEmbedding)'))).toBe(
true,
);
expect(
queries.some(
(cypher: string) =>
cypher.includes('RETURN e.nodeId AS nodeId') &&
cypher.includes('e.embedding AS embedding'),
),
).toBe(true);

Copilot uses AI. Check for mistakes.
try {
bestChunks = await collectBestChunks(limit, async (fetchLimit) => {
const vectorQuery = `
if (isVectorExtensionSupportedByPlatform()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could output a message in verbose mode when the vector extension doesn't supported.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right! I hadn't fully considered the observability aspect. I've implemented the necessary changes—could you please take another look?

Repository owner deleted a comment from github-actions Bot Apr 29, 2026
@github-actions

github-actions Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

CI Report

All checks passed

Pipeline Status

Stage Status Details
✅ Typecheck success tsc --noEmit
✅ Tests success unit tests, 3 platforms
✅ E2E success gitnexus-web changes only

Test Results

Tests Passed Failed Skipped Duration
7670 7667 0 1 695s

✅ All 7667 tests passed

1 test(s) skipped — expand for details
  • withTestLbugDB(lock-retry) > withLbugDb retry behaviour > propagates non-BUSY errors immediately without retrying
  • withTestLbugDB(lock-retry) > withLbugDb retry behaviour > throws after max retry attempts
  • buildTypeEnv > known limitations (documented skip tests) > Ruby block parameter: users.each { |user| } — closure param inference, different feature

Code Coverage

Tests

Metric Coverage Covered Base Delta Status
Statements 76.99% 22703/29485 76.99% = 0.0 🟢 ███████████████░░░░░
Branches 65.93% 14625/22180 65.93% = 0.0 🟢 █████████████░░░░░░░
Functions 81.97% 2211/2697 81.97% = 0.0 🟢 ████████████████░░░░
Lines 79.84% 20483/25653 79.84% = 0.0 🟢 ███████████████░░░░░

📋 View full run · Generated by CI

@github-actions

github-actions Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Claude finished @magyargergo's task in 2m 37s —— View job


PR #1181 Review — fix(local-backend): skip vector index query on unsupported platforms

Tasks

  • Post initial comment
  • Read DoD.md, GUARDRAILS.md, TESTING.md
  • Read local-backend.ts (semanticSearch guard)
  • Read capabilities.ts (platform policy)
  • Read test file (calltool-dispatch.test.ts)
  • Inspect exact-scan fallback path
  • Analyze findings
  • Post full review

Review bar for this PR

  • LocalBackend.semanticSearch() must not issue CALL QUERY_VECTOR_INDEX(...) on unsupported platforms.
  • On unsupported platforms, semantic search must proceed to the real exact-scan CodeEmbedding query path (not just the preliminary count query).
  • On supported platforms, the vector-index fast path must be unchanged, including fallback on failure or empty results.
  • The guard must use isVectorExtensionSupportedByPlatform() from the canonical platform module — no new policy or env var.
  • No new loadVectorExtension() call or extension lifecycle change in the local backend.
  • Tests must prove the exact-scan query ran (distinguishable from the count query), not merely that some CodeEmbedding query was issued.
  • tsc --noEmit and npm test must both be green in CI before merge.

Understanding of the change

Issue #1178 identified that LocalBackend.semanticSearch() issued CALL QUERY_VECTOR_INDEX(...) without first checking isVectorExtensionSupportedByPlatform(). The core embedding pipeline (lbug-adapter.ts) already guarded against this. On Windows, once the native VECTOR path is entered it can terminate the process with 0xC0000005 — a native access violation that try/catch cannot intercept reliably.

The fix wraps the entire CALL QUERY_VECTOR_INDEX(...) block inside an if (isVectorExtensionSupportedByPlatform()) guard. On unsupported platforms, bestChunks stays empty, and the existing if (bestChunks.size === 0) block at line 1105 continues to the exact-scan path. The exact-scan path itself — the embedding count query, the getExactScanLimit() gate, the full MATCH (e:CodeEmbedding) RETURN ... e.embedding AS embedding query, and rankExactEmbeddingRows() — is unchanged. On supported platforms, behavior is identical to main.

Out of scope: fixing the underlying LadybugDB native crash, changing extension install policy, or unifying pool-adapter and lbug-adapter connection models.


Findings

[HIGH] CI TypeCheck failure — hard DoD block

  • Category: Validation / Build gate
  • Files: CI pipeline (ci-quality.yml)
  • Issue: The CI report embedded in this PR shows ❌ Typecheck | failure | tsc --noEmit. The PR description claims TypeScript passed locally, but CI disagrees. The PR cannot be considered production-ready while typecheck is red.
  • Why it matters here: DoD §4.2 requires cd gitnexus && npx tsc --noEmit to pass before merge. DoD §6 ("Not Done" Signals) lists bypassing typecheck without justification as a hard blocker, even when all tests pass. The 7667 passing tests are irrelevant if the compiled output has type errors.
  • Recommended fix: Resolve the TypeScript error that CI is catching (it may be a transient dependency build issue or a real type error in the diff — the author must reproduce and fix before merge). Paste updated CI results in the PR.

[HIGH] Weak exact-scan fallback assertion — Copilot flag unresolved

  • Category: Test correctness (DoD §2.7)
  • Files: gitnexus/test/unit/calltool-dispatch.test.ts line 209
  • Issue: The assertion checking that the exact-scan fallback ran is:
    expect(queries.some((cypher: string) => cypher.includes('MATCH (e:CodeEmbedding)'))).toBe(true);
    MATCH (e:CodeEmbedding) appears in both the preliminary count query (MATCH (e:CodeEmbedding) RETURN COUNT(*) AS cnt LIMIT 1) and the full scan query (MATCH (e:CodeEmbedding) RETURN e.nodeId AS nodeId, ... e.embedding AS embedding). This assertion is satisfied the moment the count query runs — the full scan can be silently removed or bypassed and the test stays green. This is the exact weakness Copilot flagged; it remains unfixed.
  • Why it matters here: DoD §2.7 requires that "tests cover the real changed path — they would fail if behavior, wiring, or contracts were broken." A regression that prevents the full scan from executing would not be caught. The test cannot serve as the regression guard the PR claims it is.
  • Recommended fix: Assert the unique projection that only appears in the full scan query:
    expect(
      queries.some(
        (cypher: string) =>
          cypher.includes('RETURN e.nodeId AS nodeId') &&
          cypher.includes('e.embedding AS embedding'),
      ),
    ).toBe(true);
    This distinguishes count from scan and would fail if the fallback path were removed. Fix this →

[LOW] No observability on skipped VECTOR path

  • Category: Observability (DoD §2.8)
  • Files: gitnexus/src/mcp/local/local-backend.ts line 1077
  • Issue: When isVectorExtensionSupportedByPlatform() returns false, the skip is silent. There is no verbose-mode log or debug output indicating that the vector index was intentionally bypassed. The magyargergo reviewer comment on line 1077 raises exactly this.
  • Why it matters here: When debugging unexpected semantic search quality on a machine where VECTOR should be available, a missing log makes diagnosis unnecessarily hard. The rest of the codebase uses getRuntimeCapabilities() to expose this state via MCP status resources, but the local backend fast-path bypass has no per-call indication.
  • Recommended fix: This is a follow-up, not a merge blocker. A single debug-level log (if a verbose/debug mode exists in the local backend) or a comment referencing the platform capability is sufficient. The PR description could also note this as a known limitation. Do not add production noise for the common case.

Definition of Done check

DoD item Status
CALL QUERY_VECTOR_INDEX(...) not issued on unsupported platforms satisfied — guard is correctly placed and imports from the canonical module
Unsupported platforms proceed to real exact-scan CodeEmbedding path partially satisfied — code path is correct, but the test does not prove the full scan query ran (only that some CodeEmbedding query ran)
Supported platform vector-index behavior unchanged satisfiedbeforeEach resets mock to true; no code changed in the if block for supported platforms
Guard uses canonical isVectorExtensionSupportedByPlatform(), no new policy satisfied — imported from ../../core/platform/capabilities.js, identical to lbug-adapter usage
No new loadVectorExtension() or extension lifecycle change satisfied — local backend does not call extension load
Tests prove the exact-scan query ran (not just count query) not satisfied — Copilot's comment unresolved; assertion is indistinguishable from the count query match
tsc --noEmit and npm test both green in CI not satisfied — CI TypeCheck is ❌ failure

Validation assessment

Tests added/updated: One new test 'skips vector index query when VECTOR is unsupported by the platform' in calltool-dispatch.test.ts. Mock wiring for isVectorExtensionSupportedByPlatform is correct; vi.clearAllMocks() + beforeEach reset ensures no cross-test pollution.

Validation claimed by PR:

  • platform-capabilities.test.ts: 2 passed (local run)
  • calltool-dispatch.test.ts: 67 passed (local run)
  • tsc --noEmit: passed (local run)

Validation verified from CI:

  • ✅ 7667 tests passed across 3 platforms
  • ❌ TypeCheck (tsc --noEmit) failed in CI

Missing / not verifiable:

  1. The TypeCheck failure in CI is unexplained and unresolved — this blocks the PR.
  2. The exact-scan fallback assertion weakness means the 67-test pass result does not prove fallback actually executed.
  3. No supported-platform test explicitly asserts that QUERY_VECTOR_INDEX IS called — existing tests cover it only implicitly through the happy-path 'dispatches query tool' test, which does not inspect query text.

Does missing validation block production readiness? Yes. The CI typecheck failure is a hard DoD block. The weak assertion is a material test correctness gap.


Final verdict

not production-ready

The code change itself is correct and minimal — the guard is placed in the right location, imports from the canonical capability module, and does not alter extension lifecycle or connection models. However, CI TypeCheck is failing, which is a hard DoD block regardless of test results. Additionally, the new regression test's fallback assertion is too weak to catch a broken exact-scan path (it is satisfied by the preliminary count query alone), which is the same issue Copilot raised and which was not addressed before this review. Both must be fixed: resolve the TypeScript error CI is catching, and tighten the assertion to check for RETURN e.nodeId AS nodeId and e.embedding AS embedding. With those two items addressed, the change is small, correct, and proportionate.


@magyargergo

Copy link
Copy Markdown
Collaborator

@Morieity can you please look into these findings? 🙏

@Morieity

Copy link
Copy Markdown
Contributor Author

@magyargergo
Hi there! I’ve looked into the review results from Copilot and Claude and re-ran the CI process locally. It turns out the CI failure was caused by encoding format differences. The failures in the other groups were due to Windows path separator discrepancies leading to docker-server errors; this is outside the scope of this PR, and I’m not entirely certain about it yet.

Regarding the observability of the fallback strategy, I’ve implemented changes based on Claude’s review and the project’s logging policy, and I’ve updated the unit tests for my revised assertion strategy. This is my first time contributing to such a large-scale project, and I realize I missed some details. Thank you for your friendly guidance!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1104 to +1111
// Rare diagnostic: surface why we fell back to the exact scan path so
// operators can see at a glance that the VECTOR extension is missing on
// this runtime (e.g. Windows builds without the optional native
// dependency). Kept always-on to match the `logQueryTiming` convention
// in this file — the message fires at most once per semantic search.
console.error(
'GitNexus [query:vector]: VECTOR index unavailable for this runtime; using exact scan fallback',
);

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unsupported-platform branch logs a console.error on every semantic search. On platforms where VECTOR is intentionally disabled (e.g. win32), this is expected to happen on every query call and can flood stderr / telemetry and make MCP stderr noisy. Consider making this a one-shot warning (e.g. cache a boolean on LocalBackend, similar to warnedSiblingDrift), or gate it behind an opt-in env flag while still skipping the vector fast path.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the code is placed within an else block, the logic is only triggered when an error occurs (assuming a platform-controlled fallback). Therefore, I don't believe it will result in excessive logging. If the fallback is triggered manually, I think it’s necessary to provide a log entry indicating what actually happened.
Even if we used a single boolean to toggle the display, it would still produce output in the terminal. In my view, there isn't much of a practical difference between the two approaches.

@github-actions

github-actions Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Claude finished @magyargergo's task in 3m 30s —— View job


PR #1181 Review — fix(local-backend): skip vector index query on unsupported platforms

Tasks

  • Post initial comment
  • Read DoD.md, AGENTS.md, GUARDRAILS.md, TESTING.md
  • Read local-backend.ts (semanticSearch guard, logging conventions)
  • Read capabilities.ts (platform policy)
  • Read test file (calltool-dispatch.test.ts)
  • Inspect exact-scan fallback path
  • Inspect diagnostic behavior and logging conventions
  • Analyze CI results and validation
  • Post full review

Review bar for this PR

  • On unsupported VECTOR platforms, LocalBackend.semanticSearch() must not issue CALL QUERY_VECTOR_INDEX(...) — crash avoidance is the primary goal.
  • On unsupported platforms, semantic search must proceed to the real exact-scan CodeEmbedding query (not merely the count query).
  • On supported platforms, the vector-index fast path and fallback behavior must be unchanged.
  • The guard must use isVectorExtensionSupportedByPlatform() from capabilities.ts — no new policy, no new env var.
  • No new loadVectorExtension() call or extension lifecycle change in the local backend.
  • Diagnostics must go to stderr (not stdout), must not corrupt MCP JSON-RPC, and must be proportionate per DoD §2.8.
  • Tests must prove the actual exact-scan query ran (distinguishable from the count query by projection fields).
  • tsc --noEmit and npm test green in CI before merge.

Understanding of the change

Issue #1178: LocalBackend.semanticSearch() issued CALL QUERY_VECTOR_INDEX(...) unconditionally, without checking isVectorExtensionSupportedByPlatform(). On Windows, the LadybugDB VECTOR extension can cause a native access violation (0xC0000005) that terminates the process — try/catch cannot intercept this after the native path has been entered. The core embedding pipeline (lbug-adapter.ts) already guarded against this; the local MCP backend did not.

How this differs from the core path: lbug-adapter.ts guards before calling loadVectorExtension() (singleton path). The local backend uses a pool-adapter connection model and never calls loadVectorExtension() — the VECTOR path only surfaces in the CALL QUERY_VECTOR_INDEX(...) query itself. The guard belongs at the query site, not at extension load.

Behavior change on unsupported platforms: CALL QUERY_VECTOR_INDEX(...) is skipped entirely. bestChunks remains empty. The existing if (bestChunks.size === 0) block runs the preliminary count check, then issues the full MATCH (e:CodeEmbedding) RETURN e.nodeId, ... e.embedding scan query and ranks results via rankExactEmbeddingRows(). A console.error diagnostic is emitted to stderr.

Supported platforms: No change. Same guard wraps the same try/catch block; the else branch is dead code on supported platforms.

Out of scope: Fixing the underlying LadybugDB native crash, changing extension install policy, or unifying pool-adapter and lbug-adapter connection models.


Findings

[MEDIUM] Always-on console.error fires on every semantic search on Windows — author's explanation is incorrect

  • Category: Observability / DoD §2.8

  • Files: gitnexus/src/mcp/local/local-backend.ts:1109

  • Issue: The comment at line 1107 states the diagnostic "fires at most once per semantic search." This is literally true but misleading: isVectorExtensionSupportedByPlatform() is a static platform check (process.platform !== 'win32'). On Windows, it returns false on every call, so the console.error fires on every invocation of semanticSearch() — which is every user query. The author's PR comment ("the logic is only triggered when an error occurs") misunderstands the control flow: the else branch fires whenever the platform check returns false, not only on error.

    The warnedSiblingDrift pattern already exists in LocalBackend (line 227) for exactly this scenario — a per-instance one-shot warning. logQueryTiming fires per query and carries per-query variable data (query text, timings). The vector-skip diagnostic carries no per-query variable data — it is the same fixed string every time. That is the key difference that makes this noisy rather than informative.

    On a developer machine running GitNexus MCP on Windows with repeated queries, stderr will accumulate identical lines:

    GitNexus [query:vector]: VECTOR index unavailable for this runtime; using exact scan fallback
    GitNexus [query:vector]: VECTOR index unavailable for this runtime; using exact scan fallback
    ...
    
  • Why it matters here: DoD §2.8 requires "Logging is proportionate — no noisy debug logs left in hot paths." The semantic search path is called on every query tool invocation. Per DoD §2.8 this is a logging proportionality failure. It does not corrupt MCP stdout (stderr is correctly used per the comment at lines 173–179), but it does add noise to every query on affected platforms.

  • Recommended fix: Gate behind the warnedSiblingDrift one-shot pattern, or deduplicate at the instance level with a private warnedVectorUnsupported = false flag:

    if (!this.warnedVectorUnsupported) {
      this.warnedVectorUnsupported = true;
      console.error(
        'GitNexus [query:vector]: VECTOR index unavailable for this runtime; using exact scan fallback',
      );
    }

    This emits the diagnostic once per LocalBackend instance lifetime and silences the hot-path repetition. Fix this →


Definition of Done check

DoD item Status
CALL QUERY_VECTOR_INDEX(...) not issued on unsupported platforms satisfied — guard is correctly placed and wraps the entire fast path
Unsupported platforms proceed to real exact-scan CodeEmbedding query satisfied — code path verified: bestChunks stays empty → count check → full scan query executes
Supported platform vector-index behavior unchanged satisfiedbeforeEach resets mock to true; existing happy-path test still exercises the vector path
Guard uses canonical isVectorExtensionSupportedByPlatform() from capabilities.ts, no new policy satisfied — imported alongside the already-used getExactScanLimit from the same module
No new loadVectorExtension() or extension lifecycle change satisfied — local backend does not call extension load
Diagnostics safe for MCP output (stderr, not stdout) satisfiedconsole.error goes to stderr per established convention (lines 173–179)
Logging proportionate per DoD §2.8 partially satisfied — diagnostic fires once per call (not per process), which is noisy on Windows; one-shot pattern is available in the same class
Tests prove vector-query skipped AND exact-scan query ran satisfied — assertion now checks RETURN e.nodeId AS nodeId AND e.embedding AS embedding, which is distinct from the count query
tsc --noEmit and npm test green in CI satisfied — latest CI run shows ✅ Typecheck and ✅ Tests (7667 passed, 0 failed)

Validation assessment

Tests added/updated: One new test — 'skips vector index query when VECTOR is unsupported by the platform' in calltool-dispatch.test.ts.

Mock wiring: isVectorExtensionSupportedByPlatform is mocked via vi.hoisted and the capabilities.js module mock, which correctly intercepts the import in local-backend.ts. beforeEach resets to true, preventing cross-test contamination. console.error is spied on and restored in finally. All clean.

Assertion quality: The old weak assertion (cypher.includes('MATCH (e:CodeEmbedding)')) has been replaced with a compound check for RETURN e.nodeId AS nodeId AND e.embedding AS embedding. The count query (RETURN COUNT(*) AS cnt LIMIT 1) does not contain either of those projection fields. The full scan query contains both. This is a meaningful regression guard. The Copilot concern is resolved.

Validation claimed by PR:

  • platform-capabilities.test.ts: 2 passed (local)
  • calltool-dispatch.test.ts: 67 passed (local)
  • tsc --noEmit: passed (local)

Validation verified from CI:

  • ✅ Typecheck (tsc --noEmit) — passes (the earlier TypeCheck failure from the previous review iteration is resolved)
  • ✅ Unit tests, 3 platforms — 7667 passed, 0 failed
  • ✅ E2E — passes

Missing / not-verifiable:

  • No test explicitly asserts that a supported-platform call does issue QUERY_VECTOR_INDEX. The existing happy-path 'dispatches query tool' test covers this implicitly through the beforeEach mock reset. Acceptable for a small guard change.
  • No Windows smoke test with real LadybugDB VECTOR (unit mock only). This is acceptable — the native crash cannot be reproduced in CI without Windows + real native binary, and the mock correctly validates the guard logic.
  • The always-on diagnostic has test coverage (consoleError assertion), but the test only calls once so it does not expose the repetition behavior.

Does missing validation block production readiness? No. CI is green. The critical test correctness gap from the prior review (weak fallback assertion) is resolved. The remaining concern (logging proportionality) is medium severity.


Final verdict

production-ready with minor follow-ups

The core change is correct and minimal: the guard is in the right place, imports from the canonical capability module, does not alter extension lifecycle, and the previously-weak test assertion has been tightened to check for the actual scan projection (RETURN e.nodeId AS nodeId + e.embedding AS embedding). CI is fully green. The only material outstanding concern is that console.error fires on every semantic search on Windows rather than once per instance — the warnedSiblingDrift pattern exists in the same class and is the straightforward fix. This does not block merge given the logQueryTiming precedent for per-query stderr output, but the author's stated rationale ("triggered only when an error occurs") is factually incorrect and should be corrected before this becomes a documentation debt. The one-shot deduplication is recommended as a follow-up.


@magyargergo

Copy link
Copy Markdown
Collaborator

@Morieity can you please address this console.log reporting issue in this PR? 🙏

@Morieity

Copy link
Copy Markdown
Contributor Author

Yes,i can

…unsupported platforms

Co-authored-by: Copilot <copilot@github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Morieity

Copy link
Copy Markdown
Contributor Author

@magyargergo I have been solve this console.log problem

@magyargergo

Copy link
Copy Markdown
Collaborator

Note: this pr doesn't solve to root cause of the issue, as this was pointed out by one of our community members, we need to upgrade the @ladybug/core version to 0.16.0. We will need to do some preliminary works in order to migrate to the new version.

@magyargergo magyargergo merged commit 9cd8c36 into abhigyanpatwari:main Apr 30, 2026
21 of 23 checks passed
@magyargergo magyargergo mentioned this pull request May 10, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants