[CDF-27845] diff_table: intra-line character-level highlighting#2971
[CDF-27845] diff_table: intra-line character-level highlighting#2971ronpal wants to merge 17 commits into
Conversation
Replace bare rich.panel.Panel usage with ToolkitPanel from ui.py, consistent with the build v2 styling improvements. Also consolidates three separate clean-mode panels into one with dynamic flag text. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove all expand=False (ToolkitPanel expands by default, consistent
with build output)
- Replace bare string border colors ("green"/"yellow") with AuraColor
constants (GREEN, AMBER) in both DeployCommand and DeployV2Command
- Add AuraColor.AMBER border to the clean-mode panel in DeployCommand
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Merge _display_startup, _display_read_dir, and _display_plan into a
single _display_setup method that prints one 'Setting up deploy'
ToolkitPanel. Wraps create_deployment_plan in try/except so failures
render an amber panel showing what was collected before re-raising.
Removes the operation_noun property from DeployOptions — all display
strings now derive directly from the operation str ('deploy'/'clean').
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Auto-wrap plain string titles in a bold Text object inside ToolkitPanel.__init__ so callers don't need [bold]...[/] markup. Strip those wrappers from all existing call sites in build_v2, deploy, and deploy_v2. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Wrap startup_section in Padding((0,0,1,0)) so there is a blank line before the 'Processed build directory' section, matching the spacing already present between that section and the Plan section. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Use the same pattern as build error output: hanging_indent with icon and marker_style instead of ToolkitTable for skipped directories, invalid directories, invalid YAML files, and skipped resources. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The panel already shows warning count and amber border when issues are detected. Printing them again via self.warn() after the panel prints them twice. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add diff_table(old_lines, new_lines) to ui.py: a two-column Rich table showing CDF (left) vs Local (right), with deleted lines in red, inserted in green, equal lines dimmed and collapsed to '…' for large unchanged blocks (context=2). Use it in _categorize_resources verbose output. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Set highlight=False to stop Rich converting file paths to hyperlinks. Color the column headers red/green to make the CDF vs Local distinction immediately obvious. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…sertions Pairing unrelated lines side-by-side with zip_longest was misleading — e.g. 'status: Failed' appeared next to 'functionPath: handler.py'. Show all old lines as a delete block first, then all new lines as an insert block, so each line gets its own row. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Swap columns so Local (desired) is on the left and CDF (current) on the right, matching the mental model of "what I want → what's there". Remove sort_keys=True so YAML keys appear in their natural order. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extract the key from each YAML line in a replace block and pair lines with the same key side-by-side (local left, CDF right). Lines with no matching key on the other side still get their own row. Adds visual unit tests runnable with pytest -s. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
_highlight_diff runs a second SequenceMatcher pass at character granularity on key-matched YAML line pairs, wrapping changed spans in [bold] so readers can spot the exact value difference (e.g. py311 → py312) without scanning the full line. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
|
covered in #2984 |
Summary
_highlight_diff(old_str, new_str)helper that runs a secondSequenceMatcherpass at character granularity on key-matched YAML line pairs[bold]so readers immediately see what changed (e.g.py**311**vspy**312**) without scanning the full linereplacehandler indiff_tableStacks on top of cdf-27845/tidy-deploy-output — merge that first.
Test plan
uv run pytest tests/test_unit/test_cdf_tk/test_commands/test_deployv2/test_diff_table.py -s -vand inspecttest_field_value_changedoutput — changed value chars should appear bold🤖 Generated with Claude Code