Refactor/pure parsers - #18
Merged
Merged
Conversation
Kept separate from vite.config.ts so Vitest runs the unit tests without spinning up the TanStack Start / Nitro stack. Includes src/**/*.test.ts under the node environment.
Add a Test step (npm run test) after lint and format so the new unit tests gate pull requests.
Move the JSON-to-findings parser and the SEVERITIES list into findings.ts — no I/O, no provider coupling — so it can be unit-tested directly and shared by the review and scan adapters instead of being duplicated in both.
Well-formed parse, malformed JSON, missing/non-array findings, dropped entries (missing title/filePath, non-objects), unknown-severity fallback to note, and optional-field coercion.
Drop the local SEVERITIES/parseFindings and import them from ./findings; reviewDiff and RESPONSE_SCHEMA are unchanged otherwise.
Move ScanFindingCounts, emptyCounts, the ScanSummary shape, and summaryToCounts into scan-engine/summary.ts so the counts logic is I/O-free and unit-testable.
Null/undefined/non-object summaries read as zero, partial counts merge over the baseline, counts are summed without a findings array, the findings-array length wins when present, and the shared baseline isn't mutated.
Drop the duplicated SEVERITIES/parseFindings and import them from ../review-engine/findings; behavior unchanged.
Import summaryToCounts and the ScanFindingCounts/ScanSummary types from scan-engine/summary (re-exporting ScanFindingCounts for existing consumers); removes the inline copies.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
No description provided.