Skip to content

Fix local-folder content decoding and strict query scoping#36

Draft
arlanrakh wants to merge 2 commits into
mainfrom
cursor-cloud/local-folder-content-decoding-9612
Draft

Fix local-folder content decoding and strict query scoping#36
arlanrakh wants to merge 2 commits into
mainfrom
cursor-cloud/local-folder-content-decoding-9612

Conversation

@arlanrakh

@arlanrakh arlanrakh commented May 9, 2026

Copy link
Copy Markdown
Contributor

What this fixes

This PR addresses a local-folder retrieval/search regression where indexed local markdown could come back garbled and local-only queries could include public-source snippets.

Changes

  • Added local-folder ID resolution in nia search query before dispatch:
    • Resolves --local-folders / nia.json local bindings via sources.resolve(..., "local_folder")
    • Uses canonical source IDs when available for stricter backend scoping
    • Keeps unresolved identifiers as fallback for compatibility
  • Extended experimental payload builder to support explicit source IDs ({ id: ... }) alongside typed identifiers.
  • Added response normalization in CLI SDK for local-folder paths:
    • sources.content: decode base64 / encoded local content into UTF-8 text
    • sources.grep: decode encoded local-folder match text
    • search.query: decode local-folder snippet content and enforce local-only filtering when request scope is local-folder only (filters out non-local snippets/readySources/blockedSources)

Validation

  • bun run check
  • bun run check:types
  • bun test tests/services/cli-sdk.test.ts tests/commands/search.test.ts

All pass on this branch.

Open in Web Open in Cursor 

Summary by cubic

Fixes garbled local-folder content and stops non-local results from appearing in local-only searches. Adds strict scoping by resolving local-folder identifiers to canonical IDs.

  • Bug Fixes

    • Decode base64/JSON-encoded local-folder text across sources.content, sources.grep, and search.query for both experimental and legacy paths.
    • Resolve --local-folders/nia.json bindings to canonical source IDs and include them in experimental payloads via { id: ... } (fallback to identifiers if unresolved).
    • Enforce local-only filtering in search.query by dropping non-local snippets and non-local entries in readySources/blockedSources.
  • Refactors

    • Format SDK and tests to satisfy Biome lint.

Written for commit ebb7b58. Summary will update on new commits.

Co-authored-by: Arlan Rakhmetzhanov <arlanrakh@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented May 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e0b33888-c7a5-4248-9601-4b090819e2fd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor-cloud/local-folder-content-decoding-9612

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 and usage tips.

Co-authored-by: Arlan Rakhmetzhanov <arlanrakh@users.noreply.github.com>
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.

2 participants