Skip to content

Update: preserve deps viewer layout for edge modes#1321

Merged
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
indigo1973:dep_0710
Jul 10, 2026
Merged

Update: preserve deps viewer layout for edge modes#1321
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
indigo1973:dep_0710

Conversation

@indigo1973

Copy link
Copy Markdown
Contributor
  • Keep all edges in the HTML Graphviz layout for reduced and omitted modes, hiding unselected edges with the page background color instead of removing them before layout.

  • Keep text output as a filtered edge-set view and update deps_viewer documentation/tests for the split rendering behavior.

- Keep all edges in the HTML Graphviz layout for reduced and omitted modes, hiding unselected edges with the page background color instead of removing them before layout.

- Keep text output as a filtered edge-set view and update deps_viewer documentation/tests for the split rendering behavior.
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The dependency viewer now preserves full HTML graph layouts while visually de-emphasizing unselected edges for reduced and omitted modes. DOT and HTML APIs carry hidden-edge styling and visible counts, with updated CLI documentation and tests.

Changes

Edge visibility rendering

Layer / File(s) Summary
Hidden-edge rendering pipeline
simpler_setup/tools/deps_viewer.py
DOT rendering accepts hidden edges and applies background styling; HTML rendering forwards this state and reports the visible-edge count.
Edge-mode CLI integration
simpler_setup/tools/deps_viewer.py, simpler_setup/tools/README.md
HTML reduced and omitted modes retain all layout edges while hiding unselected ones; text mode continues filtering edges and annotations, with updated help and examples.
Rendering and mode coverage
tests/ut/py/test_deps_viewer.py
Tests cover hidden DOT edges, HTML edge-mode state, updated HTML call signatures, and transitive-reduction behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant emit_html
  participant emit_dot
  participant HTML
  CLI->>emit_html: pass hidden edges and visible count
  emit_html->>emit_dot: render full edge set with hidden styling
  emit_dot-->>emit_html: generate full graph layout
  emit_html->>HTML: render layout and visible-edge count
Loading

Possibly related PRs

Poem

I’m a rabbit with graphs in my burrow tonight,
Hidden hops fade softly, while layouts stay right.
Reduced paths gleam, omitted ones hide,
Counts tell the visible edges beside.
Hop, hop—HTML keeps every route in stride!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: preserving deps viewer layout for edge modes.
Description check ✅ Passed The description accurately matches the change set by describing HTML layout preservation and filtered text output.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the dependency viewer tool to preserve the full-graph layout in HTML output when using transitive reduction modes (reduced or omitted). Instead of omitting edges from the layout, unselected edges are kept in the Graphviz layout but hidden. The review feedback suggests a key improvement: using Graphviz's standard style="invis" attribute to hide edges rather than hardcoding a background color (#eef2f7). This avoids coupling the Python logic to the HTML template's CSS, prevents visual glitches on the gradient grid background, and remains robust if a dark mode is introduced. Corresponding updates to tests, CLI help text, docstrings, and the README are also recommended to maintain consistency.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread simpler_setup/tools/deps_viewer.py
Comment thread tests/ut/py/test_deps_viewer.py
Comment thread simpler_setup/tools/deps_viewer.py
Comment thread simpler_setup/tools/deps_viewer.py
Comment thread simpler_setup/tools/deps_viewer.py
Comment thread simpler_setup/tools/README.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
tests/ut/py/test_deps_viewer.py (1)

422-467: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Fix unused loop variables and add strict=True to zip().

Ruff flags two issues in this test:

  • B007: expected_hidden and expected_visible_count are unpacked but unused in the first loop (line 447). Prefix with _ to suppress.
  • B905: zip(captures, cases) at line 462 lacks an explicit strict= parameter. Since len(captures) == len(cases) is already asserted, strict=True is the natural choice.
♻️ Proposed fixes for B007 and B905
     for mode, _expected_hidden, _expected_visible_count in cases:
         rc = deps_viewer.main(
             [
                 str(deps_path),
                 "--format",
                 "html",
                 "--edge-mode",
                 mode,
                 "-o",
                 str(tmp_path / f"{mode}.html"),
             ]
         )
         assert rc == 0

     assert len(captures) == len(cases)
-    for captured, (_mode, expected_hidden, expected_visible_count) in zip(captures, cases):
+    for captured, (_mode, expected_hidden, expected_visible_count) in zip(captures, cases, strict=True):
         assert captured["edges"] == sorted(all_edges)
         assert set(captured["annotations"]) == set(all_edges)
         assert captured["hidden_edges"] == expected_hidden
         assert captured["visible_edge_count"] == expected_visible_count
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/ut/py/test_deps_viewer.py` around lines 422 - 467, In
test_main_html_edge_modes_keep_full_layout_and_hide_unselected_edges, rename the
unused expected_hidden and expected_visible_count unpacked in the first cases
loop with underscore-prefixed names, and update the later zip(captures, cases)
call to pass strict=True.

Source: Linters/SAST tools

simpler_setup/tools/deps_viewer.py (1)

774-812: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

hidden_edge_attrs() called redundantly for annotated hidden edges.

At line 783, hidden_attrs is computed for every edge. In the annotated path (lines 791–813), this value is unused — hidden_edge_attrs() is called again at line 799. For hidden annotated edges, this creates two identical lists. Consider reusing hidden_attrs in the annotated path instead of calling hidden_edge_attrs() again.

♻️ Reuse precomputed hidden_attrs in annotated path
         edge_attrs = []
         if hidden:
-            edge_attrs.extend(hidden_edge_attrs())
+            edge_attrs.extend(hidden_attrs)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@simpler_setup/tools/deps_viewer.py` around lines 774 - 812, Reuse the
precomputed hidden_attrs value inside the annotated edge loop instead of calling
hidden_edge_attrs() again. Update the hidden branch that extends edge_attrs to
extend with hidden_attrs, while preserving the existing behavior for visible and
unannotated edges in the edge rendering loop.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@simpler_setup/tools/deps_viewer.py`:
- Around line 774-812: Reuse the precomputed hidden_attrs value inside the
annotated edge loop instead of calling hidden_edge_attrs() again. Update the
hidden branch that extends edge_attrs to extend with hidden_attrs, while
preserving the existing behavior for visible and unannotated edges in the edge
rendering loop.

In `@tests/ut/py/test_deps_viewer.py`:
- Around line 422-467: In
test_main_html_edge_modes_keep_full_layout_and_hide_unselected_edges, rename the
unused expected_hidden and expected_visible_count unpacked in the first cases
loop with underscore-prefixed names, and update the later zip(captures, cases)
call to pass strict=True.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1d98ab8b-7218-409d-9b7f-4378dc98ff94

📥 Commits

Reviewing files that changed from the base of the PR and between cbbdfd4 and fb40f0c.

📒 Files selected for processing (3)
  • simpler_setup/tools/README.md
  • simpler_setup/tools/deps_viewer.py
  • tests/ut/py/test_deps_viewer.py

@ChaoWao ChaoWao merged commit 4ee4b73 into hw-native-sys:main Jul 10, 2026
16 checks passed
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.

2 participants