Skip to content

Fix DbPathResolver query test isolation - #2969

Merged
Widthdom merged 2 commits into
mainfrom
fix-issue2951
Jun 2, 2026
Merged

Fix DbPathResolver query test isolation#2969
Widthdom merged 2 commits into
mainfrom
fix-issue2951

Conversation

@Widthdom

@Widthdom Widthdom commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add an internal active-workspace loader hook to DbPathResolver.ResolveDataDirForQuery so tests can control ambient active workspace state without mutating process-global config.
  • Update DbPathResolverTests query data-dir cases to opt out of ambient active workspace state, and add coverage for injected active-workspace precedence.

Validation

  • dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll status --check --json
  • dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj -p:UseSharedCompilation=false --filter "FullyQualifiedName~CodeIndex.Tests.DbPathResolverTests.ResolveDataDirForQuery"
  • CDIDX_ACTIVE_WORKSPACE=/tmp/cdidx_ambient_active/.cdidx/codeindex.db dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj --no-build --no-restore -p:UseSharedCompilation=false --filter "FullyQualifiedName~CodeIndex.Tests.DbPathResolverTests.ResolveDataDirForQuery"
  • dotnet run --project tools/CodeIndex.Changelog -- check
  • dotnet build CodeIndex.sln -c Release -p:UseSharedCompilation=false -m:1
  • dotnet format CodeIndex.sln --verify-no-changes --no-restore
  • dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj -c Release --no-build --no-restore -p:UseSharedCompilation=false --filter "FullyQualifiedName~CodeIndex.Tests.DbPathResolverTests.ResolveDataDirForQuery|FullyQualifiedName=CodeIndex.Tests.WorkspaceCommandRunnerTests.ActiveWorkspace_AffectsQueryResolutionButNotIndexResolution"
  • CDIDX_ACTIVE_WORKSPACE=/tmp/cdidx_ambient_active/.cdidx/codeindex.db dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj -c Release --no-build --no-restore -p:UseSharedCompilation=false --filter "FullyQualifiedName~CodeIndex.Tests.DbPathResolverTests.ResolveDataDirForQuery"
  • Codex adversarial review: No blocking/actionable issues found.

Documentation and changelog

  • Added changelog fragment: changelog.d/unreleased/2951.fixed.md
  • No docs update required; this changes test isolation only and preserves production query resolution precedence.

Follow-up candidates

  • None.

Fixes #2951

@Widthdom
Widthdom marked this pull request as ready for review June 2, 2026 20:47
@Widthdom
Widthdom merged commit 5e07bf0 into main Jun 2, 2026
10 checks passed
@Widthdom
Widthdom deleted the fix-issue2951 branch June 3, 2026 23:00
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.

DbPathResolver query tests should isolate ambient workspace state

1 participant