Build local graphs for registry-supported files#18
Closed
Iron-Ham wants to merge 1 commit into
Closed
Conversation
|
@Iron-Ham is attempting to deploy a commit to the rs545837's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
inspect review
Triage: 10 entities analyzed | 0 critical, 0 high, 4 medium, 6 low
Verdict: standard_review
Findings (2)
- [low] In
read_content_detection_sample, seeking to a negative offset from end will fail for files smaller than CONTENT_DETECTION_SAMPLE_BYTES. The function checks if file_len <= (CONTENT_DETECTION_SAMPLE_BYTES * 2) but then seeks to -(CONTENT_DETECTION_SAMPLE_BYTES as i64) from end, which will be negative and fail for files between CONTENT_DETECTION_SAMPLE_BYTES and CONTENT_DETECTION_SAMPLE_BYTES * 2 bytes. - [low] In
read_content_detection_sample, seeking from end with negative offset can fail for files smaller than CONTENT_DETECTION_SAMPLE_BYTES. The function checks if file_len <= (CONTENT_DETECTION_SAMPLE_BYTES * 2) and reads the whole file, but for files between CONTENT_DETECTION_SAMPLE_BYTES and CONTENT_DETECTION_SAMPLE_BYTES * 2, it will try to seek to a negative position from the end that's beyond the file start.
Reviewed by inspect | Entity-level triage found 0 high-risk changes
0744543 to
25b39fb
Compare
There was a problem hiding this comment.
inspect review
Triage: 10 entities analyzed | 0 critical, 0 high, 4 medium, 6 low
Verdict: standard_review
Findings (2)
- [low] File I/O bug in read_content_detection_sample: seeking to negative offset will fail for files smaller than CONTENT_DETECTION_SAMPLE_BYTES. The function checks if file_len <= (CONTENT_DETECTION_SAMPLE_BYTES * 2) but then seeks to End(-(CONTENT_DETECTION_SAMPLE_BYTES as i64)) which will be negative for files between CONTENT_DETECTION_SAMPLE_BYTES and CONTENT_DETECTION_SAMPLE_BYTES * 2 bytes.
- [low] In
read_content_detection_sample, seeking to a negative offset from the end of the file will fail for files smaller than CONTENT_DETECTION_SAMPLE_BYTES but larger than CONTENT_DETECTION_SAMPLE_BYTES * 2. The function checks if file_len <= (CONTENT_DETECTION_SAMPLE_BYTES * 2) but then seeks to -(CONTENT_DETECTION_SAMPLE_BYTES as i64) from the end. For a file of size CONTENT_DETECTION_SAMPLE_BYTES * 2 + 1, it reads CONTENT_DETECTION_SAMPLE_BYTES from the start, then seeks to position CONTENT_DETECTION_SAMPLE_BYTES + 1 from the start, potentially reading overlapping or incorrect data.
Reviewed by inspect | Entity-level triage found 0 high-risk changes
Member
25b39fb to
fca8692
Compare
There was a problem hiding this comment.
inspect review
Triage: 17 entities analyzed | 0 critical, 0 high, 10 medium, 7 low
Verdict: standard_review
Findings (5)
- [low] In
materialize_source_files, the recursive call passesregistryparameter but the function signature in the BEFORE version doesn't have this parameter. This will cause a compilation error if any code path still uses the old signature. - [low] In
materialize_index_source, the function now filters files usingis_noise_file(path)instead of!is_source_file(path). However,is_noise_fileandis_source_fileare not inverse operations - a file could be neither noise nor a recognized source file. This changes the filtering logic and may incorrectly include files that were previously excluded. - [low] In
materialize_source_files, the condition changed fromSome(ObjectType::Blob) if is_source_file(&path)toSome(ObjectType::Blob) if !is_noise_file(&path). This is not a safe replacement because!is_noise_fileis not equivalent tois_source_file- files that are neither noise nor recognized source files will now be processed when they shouldn't be. - [low] In
content_detection_sample_from_bytes, when content length is exactlysample_bytes, the function returns the full content. However,sample_bytesis defined asCONTENT_DETECTION_SAMPLE_BYTES * 2, so files exactly that size will be fully read instead of sampled, which contradicts the sampling logic. - [low] In
read_content_detection_sample, the function seeks to-(CONTENT_DETECTION_SAMPLE_BYTES as i64)from the end, but doesn't verify that the file is large enough. If the file is exactlyCONTENT_DETECTION_SAMPLE_BYTES * 2 + 1bytes, this could seek to a position that overlaps with already-read head bytes, causing duplicate data in the sample.
Reviewed by inspect | Entity-level triage found 0 high-risk changes
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.
Summary
Closes #11
Test plan
rustfmt --check crates/inspect-core/src/analyze.rsgit diff --check --no-ext-diffcargo test -p inspect-corecargo test -p inspect-clicargo build -p inspect-cliinspect diffandinspect predictagainst a temp repo; verified graph file/entity counts, line spans, Swift dependent metadata, andcallerpredicted at risk.inspect diffandinspect predictagainst a temp repo; verified graph file/entity counts, line spans, dependent metadata, andcallerpredicted at risk.Review