Skip to content

Fix reference line context upserts - #2639

Merged
Widthdom merged 1 commit into
mainfrom
fix-issue1755
May 24, 2026
Merged

Fix reference line context upserts#2639
Widthdom merged 1 commit into
mainfrom
fix-issue1755

Conversation

@Widthdom

Copy link
Copy Markdown
Owner

Summary

  • Key reference_lines by file_id, line, and context so same-line references with different contexts are preserved.
  • Replace the destructive reference-line upsert with idempotent insert behavior.
  • Add migration coverage for legacy UNIQUE(file_id, line) indexes and writer coverage for distinct same-line contexts.

Validation

  • dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj --filter "FullyQualifiedName~DatabaseTests.InitializeSchema_MigratesReferenceLinesToContextKey|FullyQualifiedName~DatabaseTests.InsertReferences"
  • dotnet run --project tools/CodeIndex.Changelog -- check
  • dotnet build CodeIndex.sln -c Release -p:UseSharedCompilation=false
  • dotnet test
  • dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll status --check --json

Documentation and changelog

  • Added changelog fragment: changelog.d/unreleased/1755.fixed.md
  • No documentation changes were needed beyond the changelog fragment because this preserves intended database writer behavior without changing CLI/MCP usage.

Review

  • Adversarial review: no blocking/actionable issues found.
  • codex exec adversarial review was attempted, but the Codex CLI returned a usage-limit error before producing a review.

Fixes #1755

@Widthdom
Widthdom merged commit 2f288d3 into main May 24, 2026
10 checks passed
@Widthdom
Widthdom deleted the fix-issue1755 branch May 24, 2026 14:14
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.

reference_lines ON CONFLICT DO UPDATE loses rows under concurrent writers

1 participant