Skip to content

fix: config overrides, resolver paths, diff preview, impact, FTS delete#114

Merged
SutuSebastian merged 2 commits into
mainfrom
fix/index-config-resolver-diff-impact
May 20, 2026
Merged

fix: config overrides, resolver paths, diff preview, impact, FTS delete#114
SutuSebastian merged 2 commits into
mainfrom
fix/index-config-resolver-diff-impact

Conversation

@SutuSebastian
Copy link
Copy Markdown
Contributor

@SutuSebastian SutuSebastian commented May 20, 2026

Summary

  • Honor explicit empty include / excludeDirNames in .codemap/config.ts (replaces defaults when set, including []).
  • Resolver: map resolved paths with prefix-safe containment (/repo/app vs /repo/application no longer misclassified).
  • Diff preview: accept empty after_pattern so deletion rows appear in format=diff / diff-json.
  • Impact: deterministic file_path at minimum depth (ROW_NUMBER over callers).
  • deleteFileData: also deletes matching source_fts rows.

Test plan

  • bun test on touched test files
  • lint-staged (format, lint, typecheck, tests)

Summary by CodeRabbit

  • New Features

    • Diff previews now support deletion and pattern-change rows with empty patterns.
    • Configuration now respects empty arrays to explicitly override defaults.
  • Bug Fixes

    • Impact engine caller selection is now deterministically ordered when multiple candidates exist at the same depth.
    • Resolver paths are now validated for strict project containment rather than string-prefix matching.
    • File deletion now properly cleans up full-text search index entries.

Review Change Stack

- Honor explicit empty include / excludeDirNames in config
- Reject resolver targets outside project root (prefix-safe)
- Allow empty after_pattern in diff preview (deletions)
- Pick deterministic impact call-site file_path at min depth
- deleteFileData also removes source_fts rows
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 20, 2026

🦋 Changeset detected

Latest commit: eee7ad3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@stainless-code/codemap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e7db7e6f-587e-4443-aa83-5cffedf2f435

📥 Commits

Reviewing files that changed from the base of the PR and between 126066d and eee7ad3.

📒 Files selected for processing (12)
  • .changeset/fix-index-config-resolver-diff-impact.md
  • src/application/impact-engine.test.ts
  • src/application/impact-engine.ts
  • src/application/output-formatters.test.ts
  • src/application/output-formatters.ts
  • src/application/path-containment.test.ts
  • src/application/path-containment.ts
  • src/config.test.ts
  • src/config.ts
  • src/db.test.ts
  • src/db.ts
  • src/resolver.ts

📝 Walkthrough

Walkthrough

This PR delivers five independent bug fixes to the codemap indexing engine: config arrays are now treatable as explicit empty overrides, diff patterns support empty strings for deletion hunks, file deletion includes FTS5 cleanup, resolver paths are validated for project containment, and impact engine caller selection is made deterministic via SQL windowing.

Changes

Codemap Bug Fixes

Layer / File(s) Summary
Config empty array override behavior
src/config.ts, src/config.test.ts
resolveCodemapConfig now treats explicit include: [] and excludeDirNames: [] as user overrides (using !== undefined checks) instead of falling back to defaults. Tests verify both empty cases are preserved.
Diff empty pattern support for deletions
src/application/output-formatters.ts, src/application/output-formatters.test.ts
buildDiffJson accepts empty after_pattern values via new readDiffAfterPattern helper to enable deletion-style hunks. Test verifies unified diff output includes the removed line prefix and resulting content.
FTS cleanup on file deletion
src/db.ts, src/db.test.ts
deleteFileData now explicitly removes corresponding source_fts FTS5 rows before deleting the file row. Test confirms both the files and source_fts tables are cleared.
Path containment validation in resolver
src/application/path-containment.ts, src/application/path-containment.test.ts, src/resolver.ts
New projectRelativePathFromResolved helper enforces resolved paths are contained within the project root (not just string-prefix matches). resolveImports and resolveModuleSpecifier skip or return null for out-of-project paths. Tests verify containment checking and rejection of sibling paths.
Deterministic caller selection in impact engine
src/application/impact-engine.ts, src/application/impact-engine.test.ts
walkCalls SQL query uses ROW_NUMBER() windowing partitioned by node, ordered by depth and file_path, to deterministically select one row per symbol when multiple callers exist at the same depth. Test verifies caller list ordering.
Release notes
.changeset/fix-index-config-resolver-diff-impact.md
Patch version entry summarizing all five fixes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • stainless-code/codemap#50: Introduced the impact engine findImpact/walkCalls logic that is now refined with deterministic caller selection in this PR.

Suggested labels

bug

Poem

🐰 Empty arrays, now respected with pride,
Paths checked to confirm they're inside,
FTS rows swept clean with care,
Diffs that delete go everywhere,
Impact calls sorted—no more surprise! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: config overrides, resolver paths, diff preview, impact, FTS delete' accurately summarizes the main changes: config override handling, resolver path containment, diff preview deletion support, impact determinism, and FTS cleanup.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 fix/index-config-resolver-diff-impact

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

Re-add parse/load/resolve coverage from main; keep empty include/exclude tests.
@SutuSebastian SutuSebastian merged commit ae54ce0 into main May 20, 2026
12 checks passed
@SutuSebastian SutuSebastian deleted the fix/index-config-resolver-diff-impact branch May 20, 2026 13:46
@github-actions github-actions Bot mentioned this pull request May 20, 2026
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