Skip to content

perf: supply validated diff statistics to ACP clients - #501

Open
nikita-ashihmin wants to merge 3 commits into
mainfrom
nikita.ashikhmin/diff-statistics
Open

perf: supply validated diff statistics to ACP clients#501
nikita-ashihmin wants to merge 3 commits into
mainfrom
nikita.ashikhmin/diff-statistics

Conversation

@nikita-ashihmin

@nikita-ashihmin nikita-ashihmin commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Supply added and removed line counts through _meta.jetbrains.air.diffStats so clients can display file cards without comparing full texts again.

For updates, count + and - operations in the parsed patch. The calculator receives no file texts and computes no navigation coordinates. The existing patch application still constructs and validates the ACP content. For creation and deletion, count lines in the supplied content. Preserve _meta.kind.

The AIR diff statistics specification defines the envelope, count semantics, and fallback behavior. No capability negotiation is required.

Validation: local type checking, build, and all 609 active tests passed; 26 tests were skipped. Tests cover line endings, malformed hunks, multiple hunks, large coordinates, reverse application, and relocated patches. The local suite ran in the working branch; CI checks this PR against main.

A synthetic patch with 20 additions and 30 deletions took about one microsecond per calculation. The result was unchanged at line one and line one million. This measures only statistics, excluding patch parsing, application, file IO, and GUI work.

Clients compared full file texts again to display line counts. Supply counts
and the first changed line through com.intellij/diffStats metadata.
Parse each update patch once and reuse it for application and statistics.
Validate hunk coordinates and content before publishing the counts.
Omit statistics when validation fails so clients can compare the texts.

Type checking, the build, and all 610 active tests pass; 26 tests are skipped.
The new coverage includes 34 statistics and file event cases.
A real Codex history imported through ACP provides statistics for all 277 diffs.
Publish diff statistics at _meta.jetbrains.air.diffStats through the existing
AIR metadata helper. Preserve the diff kind and the versioned envelope.
Document the wire format, count semantics, navigation, and fallback behavior.

Type checking, the build, and all 610 active tests pass; 26 tests are skipped.
Use the parsed patch as the source of added and removed counts.
Remove navigation coordinates and duplicate validation of complete file texts.
Keep the existing patch application responsible for constructing ACP content.
Count created and deleted files from the content already supplied by Codex.

Update the extension specification and regression tests for counts-only metadata.
Type checking, the build, and the full local test suite pass.
A patch with 20 additions and 30 deletions takes about one microsecond to count.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant