Repository navigation
feat: offline before/after project comparison - #4
Merged
Merged
Conversation
The URL-driven fetch lived in an effect that also called setError and setLoading synchronously, which the current react-hooks plugin flags. Split PrView into a wrapper that remounts the inner reader with key=url and derive the missing-URL error during render instead.
New POST /api/project/compare plus a /compare page: drop the folder as delivered and the folder that came back, and CodeABC shows which files were added, deleted or modified with a bounded unified diff, plus the delta in static risk warnings. Matching is by relative path; a path filtered out on either side (dependency dirs, binaries, over limits) is reported as not compared rather than as a deletion. Security findings are matched as a multiset on (file, category, snippet) so a line shift does not manufacture a resolved/new pair. Snapshots cap at 500 files and 5 MiB of text; no source is executed and no LLM is called.
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.
What
Adds an offline before/after comparison to CodeABC:
POST /api/project/compare— accepts two uploaded snapshots (max 500 files / 5 MiB of text each), matches files by relative path, and reports added / deleted / modified files with a bounded unified diff (80 lines / 8000 chars, skipped for files over 2000 source lines)./comparepage (linked from the home page) with two drop zones and a plain-language result view: what changed, byte deltas, and the diff preview per file.(file, category, snippet), so inserting a line above a warning does not manufacture a fake "resolved + new" pair.Design decisions
notesarray saying exactly that, plus "no source is executed and no language model is called".complete: falseon the security section when either side hits the 5000-finding cap, so the UI never presents a partial delta as authoritative.Also fixes the pre-existing
react-hooks/set-state-in-effectlint failure inPrView(wrapper +key={url}remount, missing-URL error derived during render).Verification
pytest tests/test_comparison.py: 16 passed (classification, excluded-path handling, diff bounds, security multiset matching, caps, route 400s).hardcoded_secretfinding all verified over HTTP.ruff checkclean; new filesruff format-clean.npm run lintandnpm run buildpass (lint was previously red on the PrView rule).