Skip to content

fix(backend): pass zoekt index args without shell#1376

Merged
brendan-kellam merged 2 commits into
mainfrom
brendan/fix-SOU-1462
Jun 28, 2026
Merged

fix(backend): pass zoekt index args without shell#1376
brendan-kellam merged 2 commits into
mainfrom
brendan/fix-SOU-1462

Conversation

@brendan-kellam

@brendan-kellam brendan-kellam commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Fixes SOU-1462

Summary

  • Pass zoekt index parameters via argv instead of a composed command string.
  • Add backend coverage for revision names with punctuation.

Tests

  • yarn workspace @sourcebot/backend test
  • yarn workspace @sourcebot/backend build

Summary by CodeRabbit

  • Bug Fixes

    • Fixed Zoekt indexing so revision names with punctuation and special characters are preserved correctly.
    • Improved how indexing parameters are passed to avoid issues caused by shell command parsing.
  • Tests

    • Added coverage for Zoekt indexing to verify the expected arguments are sent during repository indexing.

@github-actions

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

indexGitRepository in zoekt.ts switches from building a shell command string with exec to constructing an explicit args array with execFile. A new test file verifies the resulting argument list, including preservation of branch names with punctuation. A changelog entry documents the fix.

Changes

exec → execFile refactor with test

Layer / File(s) Summary
Switch indexGitRepository from exec to execFile
packages/backend/src/zoekt.ts
Imports execFile instead of exec; replaces shell-string command assembly with a discrete args array passed to execFile('zoekt-git-index', args, { signal }, ...).
Test execFile argument correctness with special-character branches
packages/backend/src/zoekt.test.ts, CHANGELOG.md
New test suite mocks execFile and helpers, then asserts indexGitRepository passes the exact expected argument array to zoekt-git-index, including a branch name with punctuation. Changelog entry documents the fix.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • sourcebot-dev/sourcebot#773: Modifies the same indexGitRepository subprocess argument construction in zoekt.ts, specifically around ALWAYS_INDEX_FILE_PATTERNS quoting and -large_file argument handling.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: backend Zoekt index arguments now go through argv instead of a shell string.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch brendan/fix-SOU-1462

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/backend/src/zoekt.ts`:
- Line 22: The branch list handling in zoekt.ts still serializes revisions with
a comma delimiter, which breaks refs that contain literal commas. Update the
logic around the revisions.join(',') usage in the zoekt-git-index argument
builder to either encode values so commas round-trip safely or explicitly reject
comma-containing refs before invoking the command, and add a regression test
covering a ref like refs/heads/release,1 to lock in the behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 16a6eede-626d-439f-a4af-cb2bed44d19b

📥 Commits

Reviewing files that changed from the base of the PR and between d546511 and 86b0746.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • packages/backend/src/zoekt.test.ts
  • packages/backend/src/zoekt.ts

Comment thread packages/backend/src/zoekt.ts
@brendan-kellam brendan-kellam merged commit 82b5c1f into main Jun 28, 2026
11 checks passed
@brendan-kellam brendan-kellam deleted the brendan/fix-SOU-1462 branch June 28, 2026 00:05
DivyamTalwar added a commit to DivyamTalwar/sourcebot that referenced this pull request Jun 28, 2026
Merge upstream main after sourcebot-dev#1376 changed the same Unreleased changelog block, keeping both release-note entries.

Constraint: GitHub reported PR sourcebot-dev#1380 as dirty against current main.\nRejected: Rewriting the open PR branch | Avoids force-pushing an existing review branch.\nConfidence: high\nScope-risk: narrow\nDirective: This merge commit should only resolve the changelog ordering conflict.\nTested: git diff --check\nNot-tested: Targeted regression test rerun follows after the merge commit.
DivyamTalwar added a commit to DivyamTalwar/sourcebot that referenced this pull request Jun 28, 2026
Merge upstream main after sourcebot-dev#1376 changed the same Unreleased changelog block, keeping both release-note entries.

Constraint: GitHub reported PR sourcebot-dev#1377 as dirty against current main.\nRejected: Rewriting the open PR branch | Avoids force-pushing an existing review branch.\nConfidence: high\nScope-risk: narrow\nDirective: This merge commit should only resolve the changelog ordering conflict.\nTested: git diff --check\nNot-tested: Targeted regression test rerun follows after the merge commit.
DivyamTalwar added a commit to DivyamTalwar/sourcebot that referenced this pull request Jun 28, 2026
Merge upstream main after sourcebot-dev#1376 changed the same Unreleased changelog block, keeping both release-note entries.

Constraint: GitHub reported PR sourcebot-dev#1381 as dirty against current main.\nRejected: Rewriting the open PR branch | Avoids force-pushing an existing review branch.\nConfidence: high\nScope-risk: narrow\nDirective: This merge commit should only resolve the changelog ordering conflict.\nTested: git diff --check\nNot-tested: Targeted regression test rerun follows after the merge commit.
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.

1 participant