Skip to content

fix: high-severity bugs in incremental index, CLI entry, pr-comment, tests extractor#123

Merged
SutuSebastian merged 6 commits into
mainfrom
fix/high-bugs-batch
May 21, 2026
Merged

fix: high-severity bugs in incremental index, CLI entry, pr-comment, tests extractor#123
SutuSebastian merged 6 commits into
mainfrom
fix/high-bugs-batch

Conversation

@SutuSebastian
Copy link
Copy Markdown
Contributor

@SutuSebastian SutuSebastian commented May 21, 2026

Summary

  • Fix describe.each curried-call parentStack leak (wrong parent_index on sibling tests).
  • Parse git status --porcelain -z so spaced paths are included in incremental index deltas.
  • Resolve symlinks in isMainModule() so npm bin / symlinked entrypoints run the CLI.
  • Reject codemap pr-comment - when stdin is a TTY (no indefinite hang).

Test plan

  • bun test src/extractors/behavioral.test.ts
  • bun test src/application/get-changed-files.test.ts
  • bun test src/index-entry.test.ts
  • bun test src/cli/cmd-pr-comment.test.ts
  • bun run check

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed parsing of file paths containing spaces in git output
    • Resolved describe.each parent index corruption in test extraction
    • Fixed CLI behavior when invoked via symlink
    • Added validation to reject stdin input when running in TTY mode
  • Tests

    • Added test coverage for edge cases including symlink invocation and TTY handling

Review Change Stack

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 21, 2026

🦋 Changeset detected

Latest commit: c98251f

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

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 21, 2026

Warning

Rate limit exceeded

@SutuSebastian has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 38 minutes and 45 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bfbfc598-95b6-4c5b-83ae-b00c389d52d8

📥 Commits

Reviewing files that changed from the base of the PR and between ea0ce5c and c98251f.

📒 Files selected for processing (37)
  • .changeset/fix-high-bugs-batch.md
  • scripts/check-perf-baseline.ts
  • src/adapters/builtin.test.ts
  • src/adapters/builtin.ts
  • src/agents-init.test.ts
  • src/agents-init.ts
  • src/application/apply-engine.test.ts
  • src/application/apply-engine.ts
  • src/application/coverage-engine.ts
  • src/application/get-changed-files.test.ts
  • src/application/http-server.ts
  • src/application/impact-engine.test.ts
  • src/application/impact-engine.ts
  • src/application/index-engine.ts
  • src/application/jsx-persist.ts
  • src/application/run-index.test.ts
  • src/application/run-index.ts
  • src/benchmark-common.ts
  • src/benchmark-config.test.ts
  • src/benchmark-config.ts
  • src/cli/cmd-audit.ts
  • src/cli/cmd-query.test.ts
  • src/cli/cmd-query.ts
  • src/extractors/behavioral.test.ts
  • src/extractors/behavioral.ts
  • src/extractors/references.ts
  • src/extractors/runtime-markers.ts
  • src/extractors/type-stringify.test.ts
  • src/extractors/type-stringify.ts
  • src/git-changed.test.ts
  • src/git-changed.ts
  • src/group-by.test.ts
  • src/group-by.ts
  • src/parse-worker-core.ts
  • src/sqlite-db.ts
  • src/worker-pool.test.ts
  • src/worker-pool.ts
📝 Walkthrough

Walkthrough

This PR fixes four high-severity issues in the codemap package: git porcelain parsing for file paths with spaces using NUL-terminated output, describe.each AST handling preventing parent stack corruption, symlink-aware main module detection via canonical path resolution, and TTY stdin safety for the PR comment CLI command.

Changes

High-Severity Bug Fixes Batch

Layer / File(s) Summary
Git porcelain NUL-separated path parsing
src/application/index-engine.ts, src/application/get-changed-files.test.ts
git status --porcelain -z invocation now uses NUL-terminated output, and statusFiles parsing splits on \0 and extracts paths via slice(3). New test covers file paths containing spaces.
describe.each parent stack handling
src/extractors/tests.ts, src/extractors/behavioral.test.ts
Parent stack push refactored into explicit conditional; CallExpression:exit adds fallback parse for nested calls. Regression test confirms sibling suite parent_index remains unaffected by inner describe.each blocks.
Symlink-aware main module detection
src/index.ts, src/index-entry.test.ts
isMainModule() now imports realpathSync and compares canonical paths instead of raw paths, enabling CLI invocation via symlinks. Test verifies successful entry through symlinked src/index.ts.
PR comment TTY stdin safety guard
src/cli/cmd-pr-comment.ts, src/cli/cmd-pr-comment.test.ts
Early guard rejects inputPath: "-" when process.stdin.isTTY is true, emitting error and returning with exit code 1. Tests verify parser behavior and TTY rejection path.
Release changeset entry
.changeset/fix-high-bugs-batch.md
Documents patch version bump and lists all four high-severity bug fixes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • stainless-code/codemap#17: Both PRs modify getChangedFiles in src/application/index-engine.ts—one changes how git status --porcelain -z output is parsed for changed paths, and the other changes how candidates are filtered by comparing content hashes against the indexed DB.

Suggested labels

bug

Poem

🐰 Four little bugs that crept so deep,
Now git paths split with NUL's to keep,
Parent stacks rest, symlinks align,
And stdin won't hang on a TTY line!
Hop along, codemap shines! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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
Title check ✅ Passed The title accurately summarizes the main fixes in the changeset: high-severity bugs across four key areas (incremental index, CLI entry, pr-comment, tests extractor), matching the documented objectives.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/high-bugs-batch

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.

@SutuSebastian SutuSebastian force-pushed the fix/high-bugs-batch branch from 7dde111 to c98251f Compare May 21, 2026 09:35
@SutuSebastian SutuSebastian merged commit 54ad25a into main May 21, 2026
12 checks passed
@SutuSebastian SutuSebastian deleted the fix/high-bugs-batch branch May 21, 2026 10:41
@github-actions github-actions Bot mentioned this pull request May 21, 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