Skip to content

Feat/detect line text overlap - #2069

Merged
ethan-zhx merged 2 commits into
mainfrom
feat/detect_line_text_overlap
Jul 29, 2026
Merged

Feat/detect line text overlap#2069
ethan-zhx merged 2 commits into
mainfrom
feat/detect_line_text_overlap

Conversation

@ethan-zhx

@ethan-zhx ethan-zhx commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Improve the Slides XML layout lint gate by tightening canvas overflow reporting and adding detection for visible line elements that cross readable text glyphs.

Changes

  • Report ghost/faint text shapes when they overflow the slide canvas, while still allowing their intentional decorative overlaps.
  • Detect <line> elements that cross text glyphs and report them as bbox_overlap errors.
  • Use segment-level geometry for horizontal, vertical, and diagonal lines to avoid naive bounding-box false positives.
  • Ignore non-actionable cases such as invisible lines, frame-edge grazing, padding-only intersections, polylines, and lines outside the actual visual glyph area.
  • Add regression coverage for ghost text canvas overflow and line/text crossing edge cases.

Test Plan

  • Unit tests pass
  • Manual local verification confirms the lark-cli slides lint flow works as expected

Related Issues

  • None

Summary by CodeRabbit

  • New Features
    • Added lint checks that detect visible lines crossing text glyphs.
    • Improved detection accuracy by ignoring nearly invisible lines, frame-only contact, and near-edge grazes.
  • Bug Fixes
    • Out-of-canvas text is now reported consistently, including low-opacity text.
    • Reduced false positives for diagonal lines and lines outside visible glyph areas.
  • Tests
    • Expanded coverage for horizontal, vertical, diagonal, and exempt line/text scenarios.

@github-actions github-actions Bot added the size/L Large or sensitive change across domains or core paths label Jul 27, 2026
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds line-versus-text glyph crossing detection with visibility and grazing thresholds, preserves line endpoints and effective alpha during parsing, wires findings into slide linting, and reports low-opacity text that lies outside the canvas.

Changes

Slide lint behavior

Layer / File(s) Summary
Ghost text canvas reporting
skills/lark-slides/scripts/xml_text_overlap_lint.py, skills/lark-slides/scripts/xml_text_overlap_lint_test.py
Out-of-canvas checks now include ghost text, and tests expect shape_out_of_canvas without bbox_overlap.
Line endpoint and alpha extraction
skills/lark-slides/scripts/xml_text_overlap_lint.py
Line parsing preserves both endpoints and computes effective alpha from the line and nested border values.
Line/text crossing rule
skills/lark-slides/scripts/xml_text_overlap_lint.py, skills/lark-slides/scripts/xml_text_overlap_lint_test.py
Adds eroded glyph-rectangle segment checks, integrates detect_line_text_crossings into lint_slide, and tests crossing and ignored geometries.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SlideXML
  participant LineExtractor
  participant CrossingDetector
  participant LintSlide
  SlideXML->>LineExtractor: Parse line endpoints and effective alpha
  LineExtractor->>CrossingDetector: Provide line and text elements
  CrossingDetector->>CrossingDetector: Test segment against eroded glyph rectangle
  CrossingDetector->>LintSlide: Return bbox_overlap findings
Loading

Possibly related PRs

Suggested reviewers: liangshuo-1

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the main change: detecting line/text overlap in Slides XML linting.
Description check ✅ Passed The description matches the template with Summary, Changes, Test Plan, and Related Issues sections and covers the main scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/detect_line_text_overlap

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.

@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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@skills/lark-slides/scripts/xml_text_overlap_lint.py`:
- Around line 1682-1688: Update detect_line_text_crossings to reuse the line
elements and anonymous-ID assignment produced by extract_elements, or preserve
those IDs when parsing the XML again. Ensure each unnamed line receives the same
stable line-{...} identifier across both reporting paths and lint runs, while
leaving named line IDs unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 654f724e-7b24-4508-b1ae-b7234953c3de

📥 Commits

Reviewing files that changed from the base of the PR and between 3d2c10c and b5fac4b.

📒 Files selected for processing (2)
  • skills/lark-slides/scripts/xml_text_overlap_lint.py
  • skills/lark-slides/scripts/xml_text_overlap_lint_test.py

Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py
@github-actions

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@b5fac4b224667e008befbb9703b0283c568bd8b4

🧩 Skill update

npx skills add larksuite/cli#feat/detect_line_text_overlap -y -g

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.16%. Comparing base (56c9a2a) to head (b5fac4b).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2069   +/-   ##
=======================================
  Coverage   75.15%   75.16%           
=======================================
  Files         912      912           
  Lines       96453    96451    -2     
=======================================
+ Hits        72492    72495    +3     
+ Misses      18383    18380    -3     
+ Partials     5578     5576    -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py

@fangshuyu-768 fangshuyu-768 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The 124 existing tests pass, but targeted cases exposed four correctness issues in the new blocking line/text crossing rule.

Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py
@ethan-zhx
ethan-zhx merged commit 59237f3 into main Jul 29, 2026
51 of 62 checks passed
@ethan-zhx
ethan-zhx deleted the feat/detect_line_text_overlap branch July 29, 2026 08:21
@liangshuo-1 liangshuo-1 mentioned this pull request Jul 29, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants