Refactor Gemini/Antigravity log parsing and unify indentation helpers#36568
Closed
Copilot wants to merge 3 commits into
Closed
Refactor Gemini/Antigravity log parsing and unify indentation helpers#36568Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
8 tasks
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor semantic function clustering in Antigravity/Gemini engine clone
Refactor Gemini/Antigravity log parsing and unify indentation helpers
Jun 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces duplication by centralizing (1) Gemini/Antigravity line-delimited JSON log metrics parsing into a shared workflow helper and (2) multiple ad-hoc indentation utilities into pkg/stringutil, while adding focused unit tests to lock in the shared behaviors.
Changes:
- Added a shared
parseSingleJSONResponseLogMetricshelper and routed both Gemini and Antigravity engines to use it. - Introduced
stringutil.LeadingWhitespaceandstringutil.IndentLines, then updated call sites to delegate to these helpers. - Added unit tests covering the new shared parser behavior and the new string utilities.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/single_json_response_logs.go | New shared parser for line-delimited single-JSON-response style engine logs. |
| pkg/workflow/single_json_response_logs_test.go | Tests that Gemini/Antigravity metrics parsing remains equivalent after refactor. |
| pkg/workflow/gemini_logs.go | Removes duplicated parsing logic; delegates metrics parsing to the shared helper. |
| pkg/workflow/antigravity_logs.go | Removes duplicated parsing logic; delegates metrics parsing to the shared helper. |
| pkg/stringutil/stringutil.go | Adds shared indentation helpers (LeadingWhitespace, IndentLines). |
| pkg/stringutil/stringutil_test.go | Adds tests validating the new indentation helpers. |
| pkg/parser/frontmatter_hash.go | Switches indentation calculation to use stringutil.LeadingWhitespace. |
| pkg/cli/yaml_frontmatter_utils.go | Replaces local indentation extraction with stringutil.LeadingWhitespace. |
| pkg/cli/codemod_network_firewall.go | Replaces local indentLines with stringutil.IndentLines. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 9/9 changed files
- Comments generated: 2
Comment on lines
10
to
11
| // Gemini CLI outputs a single JSON response when using --output-format json. | ||
| // We parse the last valid JSON line (most complete response) and aggregate stats. |
Comment on lines
10
to
11
| // Antigravity CLI outputs a single JSON response when using --output-format json. | ||
| // We parse the last valid JSON line (most complete response) and aggregate stats. |
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 issue identified avoidable duplication across Gemini/Antigravity engine log parsing and scattered indentation utilities. This PR consolidates the shared logic into reusable helpers while preserving existing engine behavior and call-site semantics.
Engine log parsing deduplication
parseSingleJSONResponseLogMetrics(...)inpkg/workflow/single_json_response_logs.go.GeminiEngine.ParseLogMetricsandAntigravityEngine.ParseLogMetricsto delegate to the shared parser.gemini_logs.goandantigravity_logs.go.Indentation helper consolidation
stringutil.LeadingWhitespaceandstringutil.IndentLinesinpkg/stringutil/stringutil.go.pkg/parser/frontmatter_hash.go(indentationOf)pkg/cli/codemod_network_firewall.go(removed localindentLines)pkg/cli/yaml_frontmatter_utils.go(getIndentationnow delegates to shared helper)Focused coverage for new shared behavior
pkg/workflow/single_json_response_logs_test.goto validate equivalent Gemini/Antigravity metrics parsing.LeadingWhitespaceandIndentLinesinpkg/stringutil/stringutil_test.go.