Repository navigation
feat(server): Change Lens engine, API and srcly changes - #408
Merged
Merged
Conversation
This was referenced Nov 21, 2026
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The engine reads one first-parent history, follows each changed file through the window, and gives every changed line to the scope that holds it in that revision. It pairs base and head chunks by name, never by line number. - GET /api/change-lens and /api/change-lens/hunk - srcly changes [path], Markdown by default and --json - An acceptance repo builder with fixed dates, and tests on it Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- selection.repoRoot: payload paths are relative to it. - A file no analyzer reads gives range chunks. A whole file (added, deleted, renamed with no edit, generated) is one file chunk. - Upstream merges, the 200-commit cap and left-out files are noted. - Hunk diffs hold only the chunk's own lines. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
fixture.json and fixture.net.json are the payloads the engine returns for the acceptance repo. The ranking parity snapshot scans tests/fixtures, so it gains the new fixture builder. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
When a window holds a merge of the default branch and its base is older than that merge, the base tree takes the merge's own diff. Before values, the net diff and hunk diffs then show only the branch's own work. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A merge commit that is itself on the default branch is that branch's own history. It was dropped as an upstream merge when local main was ahead of origin/main. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…mous objects Scopes that share a qualified name in one file pair across revisions by body (identical first, then closest), so a function that only moved down is no longer read as modified. An object literal with no binding is no chunk: its lines stay with the scope around it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…her's path A file added in the window has no base and a file deleted in it has no head, even when another lineage holds the same path at that end. The files list holds each path once. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The lines right above a method were left with the class around it, because the class already owned them. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…s' lines Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Git output is read as bytes, and file text is split on "\n" alone. A lone CR, a form feed or U+2028 in a file no longer shifts line numbers or breaks the diff parse. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ction A heading reworded above the same text is one modified section with an uncertain match, not one section deleted and one added. A section's body is its own text, without its subsections. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A file that does not parse at base or head gets no symbols and no metrics: its hunks are range chunks with a reason, and a note names the file. Before, the analyzer's guesses read as confident deletes and moves. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ache - An empty added or deleted file is one file chunk in both modes. - /hunk answers 404 for a commit outside the selection and 400 for a sha under 7 characters. - since later than until is a 400 with a plain reason. - A time window that reads the 5,000-commit limit says so in a note. - A lock guards the parse cache. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…iff text The net lines of a moved or renamed symbol leave out the lines of the scopes nested in it, as its hunk diff does. Diff text drops the CR that ends each line of a CRLF file. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
byronwall
marked this pull request as ready for review
November 22, 2026 03:03
byronwall
force-pushed
the
change-lens/server
branch
from
November 22, 2026 03:03
e7102d5 to
e591e77
Compare
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.
srcly changesand a new API report the code chunks that a branch or a time window edited. Each chunk is a function, a Markdown section or a line range, with complexity before and after, the commits that touched it, and its diff. Part of #397.What you'll see
srcly changes [path]prints the resolved window, two review lists, and the edited chunks by folder. Flags:--window branch|24h|7d|custom,--mode touched|net,--base,--head,--since,--until,--no-worktree,--json.reverted. Net compares the two end snapshots, so that work is gone.not measured, never 0.GET /api/change-lensandGET /api/change-lens/hunkserve the same result to the client. No screen uses them in this layer.Proof
srcly changeson the acceptance repo thatserver/tests/fixtures/change_lens_repo.pybuilds (trimmed). It shows a function edited three times, a reverted function, a deleted function, a pure rename, and config and Markdown hunks:With
--mode net,pickNextdoes not appear (0 matches).scripts/check.sh serveron the top of the stack: 606 passed. 23 of them aretests/test_change_lens.py, one per acceptance case and one per bug below.mainthat is ahead, inventedobjectsymbols, same-named functions paired by position, a reused path after a rename, comments above a method given to the class, nested lines in a parent's diff, odd line-break characters, a renamed Markdown heading, and a syntax error at head.--window 7d(23 commits, 417 chunks) in 1.5 to 1.8 s.Limits
client/src/components/FileTypeFilter.tsxin this repo. Nobody checked whether that is a false positive.ghto find a PR base. Offline, that call can wait up to 10 s.Stack: Change Lens
What splits: The Change Lens feature from #397: the git engine and CLI, the review panel, the map view, and the join with docs.
Why it splits: The engine is the risky part and has its own tests and CLI proof. Each client layer adds files that nothing loads until the top layer, so the lower three can merge with no visible change in the app.
Why this split: Three workers built the server, the panel and the map at the same time against one contract, so these seams match file ownership and each diff reads alone. I rejected one PR (about 10,000 lines) and a split by feature (windows, then chunks, then buckets), because each feature cuts through all three parts.
srcly changes, and the acceptance fixture.Survey moves: +31 traces in
server(160 → 191; 30 partial, 1 assumed) and more stops with them, the largest beingfrontier: external-code+705. All come from the newserver/app/services/changelens/files entering the surveyed corpus; the one new assumed trace isapp/services/changelens/chunks.py#_buckets. No analysis code changed and no trace errored.🤖 Generated with Claude Code