Repository navigation
fix(detect): bounded package.json read, BOM strip, skip non-JS trees (PHARN-15) - #209
Merged
Merged
Conversation
…on-JS trees (PHARN-15) Archetype detection read package.json with existsSync + readFileSync: a FIFO hung init, a symlink to /dev/zero read without bound, and a UTF-8 BOM made JSON.parse fail so a Next.js app detected as `lib`. It now opens once (O_NONBLOCK), requires a regular file, reads at most 4 MiB, and strips a leading BOM. SKIP_DIRS gains .venv, venv, __pycache__, vendor, target and .yarn so a large non-JS tree cannot exhaust the walk budget. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TvcuVhk8hTeDskp5pAJhnc
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Archetype detection read
package.jsonviaexistsSync+readFileSync, which caused four failures:init;/dev/zerowas read without any limit;JSON.parsefail, so a Next.js app was detected aslib;.venvused up the scan budget before the walk reachedsrc/.Fix
package.jsonis opened once withO_NONBLOCKand checked withfstat().isFile()on that same descriptor.packageJsonFound: false, and nothing throws.SKIP_DIRSnow also skips.venv,venv,__pycache__,vendor,targetand.yarn.docs/commands/init.mdanddocs/troubleshooting.md.Tests
package.json, a symlink that is still followed, and/dev/zero..dev/features/bounded-package-json/.🤖 Generated with Claude Code
https://claude.ai/code/session_01TvcuVhk8hTeDskp5pAJhnc
Generated by Claude Code