Centralize Changed File projections#74
Merged
Merged
Conversation
…election functions
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.
This pull request introduces a set of improvements and refactorings to the path policy and AI review modules, focusing on more precise handling of changed files, especially around live (non-deleted) files and changed line metrics. The changes add new helper utilities for selecting live files, counting changed text lines, and projecting file paths, and they update both internal logic and documentation to reflect these enhancements.
Path policy and changed file utilities:
src/path-policy/filtering.tsfor selecting live changed files (selectLiveChangedFiles), projecting their paths (selectLiveChangedFilePaths), and counting changed text lines (countChangedTextLines). These utilities improve accuracy and code clarity when working with changed files. [1] [2]selectToolChangedFilePathsto use the newselectLiveChangedFilePathshelper, ensuring only live files are considered for tool commands.AI review and guardrails integration:
src/ai/guardrails.tsandsrc/ai/review-context.tsto usecountChangedTextLinesandselectLiveChangedFiles, ensuring binary and deleted files are handled correctly in AI guardrail checks and when collecting full-file context. [1] [2] [3] [4] [5]Policy enforcement improvements:
src/runner/policies.tsto use the new helpers for counting changed lines and filtering live files, improving accuracy and consistency in diff size and forbidden path checks. [1] [2] [3]Documentation updates:
docs/architecture/modules.mdto document the new projections, metrics, and helper functions, reflecting the expanded capabilities of the path policy module. [1] [2] [3]Testing enhancements:
test/path-policy.test.tsto cover the new helpers and ensure correct behavior for live file selection and changed line counting. [1] [2]test/ai.test.tsto align with new logic.