Skip to content

fix(platform): normalize graph relative paths to posix on Windows and… - #1356

Open
Kritika11052005 wants to merge 1 commit into
CodeGraphContext:mainfrom
Kritika11052005:main
Open

fix(platform): normalize graph relative paths to posix on Windows and…#1356
Kritika11052005 wants to merge 1 commit into
CodeGraphContext:mainfrom
Kritika11052005:main

Conversation

@Kritika11052005

Copy link
Copy Markdown

Description

This PR resolves cross-platform path inconsistencies on Windows that were causing integration test regressions, fixes a process hang on exit with KuzuDB, registers missing language query toolkits, and updates the regression goldens.

Key Changes

  1. Path Normalization (Windows Regression Fix):
    • Updated writer.py and graph_builder.py to use .as_posix() for relative path calculation. This ensures relative paths are saved using forward slashes (/) in the graph database, maintaining cross-platform consistency.
  2. KuzuDB Exit Hang Fix:
    • Updated database_embedded_kuzu.py to safely verify the is_closed attribute of the Kùzu connection before invoking .close(), preventing background threads from hanging on process exit.
  3. Language Toolkit Registration:
    • Registered ScalaToolkit, SwiftToolkit, and HaskellToolkit in advanced_language_query_tool.py to complete support for all 16 languages.
  4. Test & Goldens Update:
    • Re-generated the 21 integration test goldens (--update-goldens) to reflect the normalized posix relative paths and parser improvements.
    • Added test_advanced_language_query_toolkits.py unit tests to verify proper registration and instantiation of all 16 toolkits.

Verification

  • All unit test suites pass successfully.
  • All 21 language parser integration tests in test_parser_goldens.py now pass.

Labels Request

Could the maintainers please add the following labels to this PR:

  • gssoc:approved
  • A difficulty label (e.g., difficulty:medium)
  • A type label (e.g., type:bugfix)
Screenshot 2026-07-09 030747 Screenshot 2026-07-09 030930 Screenshot 2026-07-09 030924 Screenshot 2026-07-09 030919 Screenshot 2026-07-09 030912 Screenshot 2026-07-09 030904 Screenshot 2026-07-09 030856 Screenshot 2026-07-09 030843 Screenshot 2026-07-09 030835 Screenshot 2026-07-09 030829 Screenshot 2026-07-09 030822 Screenshot 2026-07-09 030814 Screenshot 2026-07-09 030755

@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

@Kritika11052005 is attempting to deploy a commit to the shashankss1205's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Shashankss1205

Copy link
Copy Markdown
Collaborator

👋 Thanks for contributing to CodeGraphContext! Since this PR was opened, main has moved forward significantly (we just shipped v0.5.2 and merged ~50 PRs), so this one now has merge conflicts. Could you please rebase onto the latest main and resolve the conflicts? Once it is conflict-free and CI is green, we will review and merge it. Really appreciate your work — thank you! 🙏

@Shashankss1205

Copy link
Copy Markdown
Collaborator

Triage update: part of what this fixes has since landed — startup sync now compares POSIX-normalized paths (#1433), which was the headline Windows deletion bug. The branch also carries a large amount of unrelated churn (+13k/−11k), which makes it unreviewable as-is. @Kritika11052005 if there are Windows normalization gaps remaining beyond #1433, could you rebase and trim this down to just those sites? A focused diff will get a fast review. 🙏

@Shashankss1205

Copy link
Copy Markdown
Collaborator

Keeping this open — the underlying fix matters — but it cannot be merged in this shape.

The diff is 92 files, +13199/-11671. The stated purpose is normalising graph relative paths to POSIX on Windows, which should touch a handful of files. A change of this size cannot be reviewed for correctness, and it is currently conflicting with main.

Most of the volume looks incidental — please check for these before re-pushing:

  • line-ending churn (a CRLF/LF flip across the tree will produce exactly this shape)
  • regenerated lock files or golden fixtures committed alongside the source change
  • an editor reformatting files the change didn't need to touch

git diff --stat origin/main on your branch should show only the files whose behaviour you meant to change.

The bug is real and worth fixing. Path normalisation is load-bearing: the graph stores paths via Path.resolve().as_posix(), and several query paths compare against that. If you can reduce this to the files that actually implement the normalisation — plus a test that fails on main under Windows path semantics — it will be straightforward to review and merge.

If it helps, .gitattributes with * text=auto eol=lf will stop the line-ending churn from recurring.

@Shashankss1205

Copy link
Copy Markdown
Collaborator

Thanks for tackling the Windows path normalisation — that's a real problem worth fixing. I can't merge this as it stands, though: the branch touches 92 files with +13,199/-11,671 and produces 85 conflict regions against current main.

Looking at the file list (c_toolkit.py, cpp_toolkit.py, csharp_toolkit.py, dart_toolkit.py, go_toolkit.py, haskell_toolkit.py, advanced_language_query_tool.py, cgc_bundle.py, …), most of that volume looks incidental rather than related to posix path normalisation. A diff that large can't be reviewed meaningfully, and the conflict count means a rebase would effectively be a rewrite.

Could you open a fresh branch from current main containing only the path-normalisation change? Concretely, that's the as_posix() / separator handling in the graph write path and whatever tests cover it. My guess is that's a few dozen lines, not 13,000.

If some of the other 90 files contain changes you want to keep, they'd be much easier to land as separate focused PRs.

Two things worth knowing before you rebase:

  • main now writes paths via Path(...).resolve().as_posix() in tools/indexing/persistence/writer.py — part of that normalisation may already be done, so it's worth re-checking what still reproduces.
  • add_file_to_graph moved from graph_builder.py to writer.py and was rewritten to use batched UNWIND queries.

Happy to look at a focused version quickly. If you can share the specific Windows symptom you hit (a path that comes out wrong in the graph), I can help confirm whether it still reproduces on main first — that would save you the rebase if it's already fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog tasks

Development

Successfully merging this pull request may close these issues.

2 participants