Skip to content

fix(slides): enhance text overflow and occlusion detection in xml lint - #2152

Closed
ethan-zhx wants to merge 0 commit into
mainfrom
fix/text_over_flow
Closed

fix(slides): enhance text overflow and occlusion detection in xml lint#2152
ethan-zhx wants to merge 0 commit into
mainfrom
fix/text_over_flow

Conversation

@ethan-zhx

@ethan-zhx ethan-zhx commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@github-actions github-actions Bot added the size/XL Architecture-level or global-impact change label Aug 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The slide XML overlap linter adds text measurement, wrapping, overflow, occlusion, container, rotation, stacking-order, and issue-deduplication logic. Regression tests cover Unicode sizing, spacing, auto-fit growth, geometry, z-order, and error severity.

Changes

Slide overlap and overflow linting

Layer / File(s) Summary
Text measurement and overflow
skills/lark-slides/scripts/xml_text_overlap_lint.py, skills/lark-slides/scripts/xml_text_overlap_lint_test.py
Text extraction preserves spacing. Width estimation handles CJK glyphs, percentages, labels, wrapping, and trailing spaces. Paragraph-aware height estimation reports width and height overflow as errors.
Occlusion and container checks
skills/lark-slides/scripts/xml_text_overlap_lint.py, skills/lark-slides/scripts/xml_text_overlap_lint_test.py
The linter detects table, chart, image, filled-shape, container, and auto-fit collisions. Full-canvas image handling uses visibility and stacking order.
Rotation-aware geometry and result normalization
skills/lark-slides/scripts/xml_text_overlap_lint.py, skills/lark-slides/scripts/xml_text_overlap_lint_test.py
Rotated glyph bounds and spacing-aware line crossings update overlap checks. Slide linting wires in the new detectors and removes duplicate issues while retaining the highest-severity overflow result.

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

Possibly related PRs

Suggested reviewers: r0bynzhu

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the scope and changes in detail, but it omits the required Test Plan and Related Issues sections. Add the required Test Plan with verification results and include a Related Issues section, or state None.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly identifies the main change: improved text overflow and occlusion detection in the Slides XML linter.
✨ 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 fix/text_over_flow

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.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#fix/text_over_flow -y -g

@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: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
skills/lark-slides/scripts/xml_text_overlap_lint.py (1)

1954-1972: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Anchor the unclamped auto-fit box to the authored top.

shape-auto-fit now keeps raw_height even when it exceeds content_height. The vertical anchoring below still runs. With the default verticalAlign of "middle" (set in extract_elements), (content_height - visual_height) / 2 is negative, so the box is shifted up by half the excess. With "bottom" it is shifted up by the full excess.

The renderer grows a shape-auto-fit box downward from the authored top, as the docstring on detect_auto_fit_growth_collisions states. The current geometry therefore places the grown region too high:

  • detect_auto_fit_growth_collisions measures glyph["y"] + glyph["height"] - authored_bottom, which reports about half of the real downward growth for middle-aligned runs.
  • The box also extends above the authored top, which can create overlap reports against content sitting above the run.

Skip the vertical re-anchoring when the estimated height exceeds the content box.

🐛 Suggested fix
     y = element["y"] + padding_top
-    if element.get("verticalAlign") == "middle":
-        y += (content_height - visual_height) / 2
-    elif element.get("verticalAlign") == "bottom":
-        y += content_height - visual_height
+    # A grown shape-auto-fit box extends downward from the authored top, so alignment
+    # offsets only apply while the estimated block still fits the content box.
+    if visual_height <= content_height:
+        if element.get("verticalAlign") == "middle":
+            y += (content_height - visual_height) / 2
+        elif element.get("verticalAlign") == "bottom":
+            y += content_height - visual_height
🤖 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 `@skills/lark-slides/scripts/xml_text_overlap_lint.py` around lines 1954 -
1972, Update the vertical alignment logic in the text geometry calculation to
skip middle/bottom re-anchoring when shape-auto-fit uses a visual_height larger
than content_height. Keep the authored top as the y origin for the grown box,
while preserving existing vertical alignment behavior for non-grown boxes and
auto-fit cases that do not exceed the content height.
🧹 Nitpick comments (3)
skills/lark-slides/scripts/xml_text_overlap_lint.py (3)

1204-1213: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Precompute the glyph boxes once per text element.

estimate_text_visual_bbox runs per-character width estimation and wrapped line counting. This loop calls it once for every (shape, text) pair, and detect_auto_fit_growth_collisions repeats the same pattern for other_bbox. Build the glyph boxes once before the shape loop.

♻️ Suggested change
+    glyph_boxes = {
+        element["id"]: estimate_text_visual_bbox(element) for element in text_elements
+    }
     for shape in covering_shapes:
         for text_element in text_elements:
             if not is_drawn_in_front_of(shape, text_element):
                 continue
-            glyph = estimate_text_visual_bbox(text_element)
+            glyph = glyph_boxes[text_element["id"]]
             if glyph is None:
                 continue
🤖 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 `@skills/lark-slides/scripts/xml_text_overlap_lint.py` around lines 1204 -
1213, Precompute each text element’s glyph bounding box once before iterating
through covering_shapes, then reuse the cached result when checking shape
overlap. Apply the same caching approach to the repeated other_bbox estimation
in detect_auto_fit_growth_collisions, while preserving the existing handling for
None boxes and overlap thresholds.

1102-1102: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use an area constant for the area gate.

Line 1089 compares growth (pixels) against CONTAINER_OVERFLOW_MIN_PX, which is correct. Line 1102 compares intersection_area(...) (square pixels) against the same constant. The units differ. Both constants are 4.0 today, so behavior is unchanged, but a future tuning of the linear slack would silently move the area gate.

♻️ Suggested change
-            if intersection_area(grown_region, other_bbox) <= CONTAINER_OVERFLOW_MIN_PX:
+            if intersection_area(grown_region, other_bbox) <= SHAPE_TEXT_OCCLUSION_MIN_AREA:
                 continue
🤖 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 `@skills/lark-slides/scripts/xml_text_overlap_lint.py` at line 1102, Update the
area comparison in the overlap-checking logic around intersection_area to use a
dedicated area-threshold constant rather than CONTAINER_OVERFLOW_MIN_PX. Keep
CONTAINER_OVERFLOW_MIN_PX for the growth pixel comparison and initialize the new
area constant to preserve the current behavior.

1016-1050: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider extracting the shared occluder-scan helper.

detect_chart_text_occlusions duplicates detect_table_text_occlusions except for the element kind, issue code, message, and hint. A single parameterized helper keeps the two detectors in sync when the text filter changes.

♻️ Suggested consolidation
def detect_element_text_occlusions(
    elements: list[dict[str, Any]], kind: str, code: str, noun: str, hint: str
) -> list[dict[str, Any]]:
    issues: list[dict[str, Any]] = []
    text_elements = [
        element
        for element in elements
        if is_text_element(element) and has_text_content(element) and not is_ghost_text(element)
    ]
    occluders = [element for element in elements if element["kind"] == kind and element["alpha"] > 0]
    for text_element in text_elements:
        if is_decorative_text(text_element):
            continue
        glyph_bbox = estimate_text_visual_bbox(text_element)
        if glyph_bbox is None:
            continue
        for occluder in occluders:
            if not intersects(occluder, glyph_bbox):
                continue
            issues.append({
                "level": "error",
                "code": code,
                "elements": [occluder["id"], text_element["id"]],
                "message": f'text shape {text_element["id"]} overlaps {noun} {occluder["id"]}',
                "hint": hint,
            })
    return issues
🤖 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 `@skills/lark-slides/scripts/xml_text_overlap_lint.py` around lines 1016 -
1050, Extract the shared scanning logic from detect_table_text_occlusions and
detect_chart_text_occlusions into a parameterized detect_element_text_occlusions
helper. Pass the occluder kind, issue code, noun, and hint for each detector,
while preserving the existing filtering, intersection checks, and issue output.
🤖 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 1152-1163: Update the container-overflow handling around the
overflow gate to align with the documented scope of CONTAINER_OVERFLOW_MIN_PX:
either apply that tolerance to this authored text-frame check, or revise the
constant’s comment to explicitly state that it only gates
detect_auto_fit_growth_collisions. Preserve the existing tests’ behavior that
reports a 4px frame overhang.
- Around line 2602-2611: Introduce one element-id-keyed glyph-bbox cache scoped
to lint_slide and pass it through the detectors, so each element’s
estimate_text_visual_bbox result is reused. In
skills/lark-slides/scripts/xml_text_overlap_lint.py#L2602-L2611, resolve left
and right glyph boxes from the shared cache before should_flag_overlap instead
of re-estimating per pair. In
skills/lark-slides/scripts/xml_text_overlap_lint.py#L1204-L1213, update
detect_shape_text_occlusions and detect_auto_fit_growth_collisions to read
cached boxes for each shape/text pair and other_bbox, preserving existing
detector behavior.
- Around line 1836-1850: Update the width-wrap filtering loop around the
existing single-line and short-label checks to skip any element recognized by
is_vertical_text, including all accepted vertical-run values. Keep vertical text
out of the width-based overflow calculation while preserving existing filtering
for horizontal text.
- Around line 2516-2525: Update the crossing-box adjustment around the
glyph_bbox handling to skip the vertical re-anchoring when the text run is
rotated, preserving the rotated bounds returned by estimate_text_visual_bbox.
Keep the existing unrotated vertical-align calculations for non-rotated text,
and ensure rotated runs do not mix rotated x/width with recomputed unrotated
y/height.

---

Outside diff comments:
In `@skills/lark-slides/scripts/xml_text_overlap_lint.py`:
- Around line 1954-1972: Update the vertical alignment logic in the text
geometry calculation to skip middle/bottom re-anchoring when shape-auto-fit uses
a visual_height larger than content_height. Keep the authored top as the y
origin for the grown box, while preserving existing vertical alignment behavior
for non-grown boxes and auto-fit cases that do not exceed the content height.

---

Nitpick comments:
In `@skills/lark-slides/scripts/xml_text_overlap_lint.py`:
- Around line 1204-1213: Precompute each text element’s glyph bounding box once
before iterating through covering_shapes, then reuse the cached result when
checking shape overlap. Apply the same caching approach to the repeated
other_bbox estimation in detect_auto_fit_growth_collisions, while preserving the
existing handling for None boxes and overlap thresholds.
- Line 1102: Update the area comparison in the overlap-checking logic around
intersection_area to use a dedicated area-threshold constant rather than
CONTAINER_OVERFLOW_MIN_PX. Keep CONTAINER_OVERFLOW_MIN_PX for the growth pixel
comparison and initialize the new area constant to preserve the current
behavior.
- Around line 1016-1050: Extract the shared scanning logic from
detect_table_text_occlusions and detect_chart_text_occlusions into a
parameterized detect_element_text_occlusions helper. Pass the occluder kind,
issue code, noun, and hint for each detector, while preserving the existing
filtering, intersection checks, and issue output.
🪄 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: 239a59f1-92ef-45f9-980b-00a67f3d8699

📥 Commits

Reviewing files that changed from the base of the PR and between 427cbd6 and e7cd03b.

📒 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 Outdated
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py Outdated
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py Outdated
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.72%. Comparing base (3b66d47) to head (5a12147).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2152      +/-   ##
==========================================
+ Coverage   75.70%   75.72%   +0.01%     
==========================================
  Files         944      944              
  Lines      100288   100355      +67     
==========================================
+ Hits        75926    75994      +68     
  Misses      18565    18565              
+ Partials     5797     5796       -1     

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

@ethan-zhx
ethan-zhx force-pushed the fix/text_over_flow branch from fec80e5 to ad0651a Compare August 3, 2026 12:19

@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

🧹 Nitpick comments (2)
skills/lark-slides/scripts/xml_text_overlap_lint.py (2)

980-1050: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Extract a shared occluder-versus-text detector.

detect_table_text_occlusions and detect_chart_text_occlusions differ only in the element kind, the issue code, the message, and the hint. The filtering, glyph-box estimation, and intersection logic are identical. A future change to the shared logic must be applied twice.

♻️ Proposed consolidation
+def detect_element_text_occlusions(
+    elements: list[dict[str, Any]], kind: str, code: str, hint: str
+) -> list[dict[str, Any]]:
+    issues: list[dict[str, Any]] = []
+    text_elements = [
+        element
+        for element in elements
+        if is_text_element(element) and has_text_content(element) and not is_ghost_text(element)
+    ]
+    occluders = [element for element in elements if element["kind"] == kind and element["alpha"] > 0]
+    for text_element in text_elements:
+        if is_decorative_text(text_element):
+            continue
+        glyph_bbox = estimate_text_visual_bbox(text_element)
+        if glyph_bbox is None:
+            continue
+        for occluder in occluders:
+            if not intersects(occluder, glyph_bbox):
+                continue
+            issues.append({
+                "level": "error",
+                "code": code,
+                "elements": [occluder["id"], text_element["id"]],
+                "message": f'text shape {text_element["id"]} overlaps {kind} {occluder["id"]}',
+                "hint": hint,
+            })
+    return issues

detect_table_text_occlusions and detect_chart_text_occlusions then become thin wrappers that keep their docstrings and pass the kind, code, and hint.

🤖 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 `@skills/lark-slides/scripts/xml_text_overlap_lint.py` around lines 980 - 1050,
Extract the duplicated filtering, glyph-bounding-box estimation, and
intersection logic from detect_table_text_occlusions and
detect_chart_text_occlusions into a shared helper that accepts the occluder
kind, issue code, message context, and hint. Convert both existing functions
into thin wrappers that preserve their docstrings and pass their table- or
chart-specific values while retaining the current issue structure and behavior.

1102-1103: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use an area constant for the area gate.

Line 1102 compares an intersection area in px² against CONTAINER_OVERFLOW_MIN_PX, which lines 76-79 document as linear pixels of slack. The neighbouring detector already has an area-scoped constant with the same value, SHAPE_TEXT_OCCLUSION_MIN_AREA. Reuse it here so the units match the comparison.

♻️ Proposed change
-            if intersection_area(grown_region, other_bbox) <= CONTAINER_OVERFLOW_MIN_PX:
+            if intersection_area(grown_region, other_bbox) <= SHAPE_TEXT_OCCLUSION_MIN_AREA:
                 continue
🤖 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 `@skills/lark-slides/scripts/xml_text_overlap_lint.py` around lines 1102 -
1103, Update the area threshold in the intersection check around
intersection_area(grown_region, other_bbox) to use SHAPE_TEXT_OCCLUSION_MIN_AREA
instead of CONTAINER_OVERFLOW_MIN_PX, preserving the existing comparison and
control flow.
🤖 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_test.py`:
- Around line 1177-1179: Update the comment above the assertions in
test_lint_xml_reports_wrap_false_text_wider_than_box to remove the claim that
wrap="false" opts a run out; state instead that no-wrap-label is not flagged
because its estimated width exceeds the heuristic risk band but remains within
the exact available-width tolerance, while comfortable fits normally.

---

Nitpick comments:
In `@skills/lark-slides/scripts/xml_text_overlap_lint.py`:
- Around line 980-1050: Extract the duplicated filtering, glyph-bounding-box
estimation, and intersection logic from detect_table_text_occlusions and
detect_chart_text_occlusions into a shared helper that accepts the occluder
kind, issue code, message context, and hint. Convert both existing functions
into thin wrappers that preserve their docstrings and pass their table- or
chart-specific values while retaining the current issue structure and behavior.
- Around line 1102-1103: Update the area threshold in the intersection check
around intersection_area(grown_region, other_bbox) to use
SHAPE_TEXT_OCCLUSION_MIN_AREA instead of CONTAINER_OVERFLOW_MIN_PX, preserving
the existing comparison and control flow.
🪄 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: d41aff56-d416-4ade-a24b-28ac38aa7fc5

📥 Commits

Reviewing files that changed from the base of the PR and between e7cd03b and ad0651a.

📒 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_test.py Outdated
@ethan-zhx ethan-zhx changed the title fix(slides): detect text overflow and occlusions fix(slides): enhance text overflow and occlusion detection in xml lint Aug 3, 2026
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py Outdated
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py Outdated
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py Outdated
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py

@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 1033-1041: Update the innerRadius handling in the visible
chart-radius calculation to enforce the documented 0..1 fraction range: reject
or clamp values above 1 before multiplying by pie_radius, while preserving the
existing behavior for missing or non-positive values. Ensure the resulting hole
radius never exceeds the pie radius used by bbox_within_circle.
🪄 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: 6329e495-306f-4fe3-991f-b8eef8c3ba2d

📥 Commits

Reviewing files that changed from the base of the PR and between ad0651a and a4f0aec.

📒 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 Outdated

@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

🧹 Nitpick comments (2)
skills/lark-slides/scripts/xml_text_overlap_lint.py (2)

1159-1172: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Compare the overlap area against an area constant.

Line 1159 compares a length (growth, px) against CONTAINER_OVERFLOW_MIN_PX. Line 1172 compares an area (px²) against the same constant. The two gates now share one number with two different units. If someone retunes CONTAINER_OVERFLOW_MIN_PX for the growth threshold, the area gate changes silently.

Use a dedicated area threshold for line 1172, for example the existing SHAPE_TEXT_OCCLUSION_MIN_AREA.

♻️ Proposed change
-            if intersection_area(grown_region, other_bbox) <= CONTAINER_OVERFLOW_MIN_PX:
+            if intersection_area(grown_region, other_bbox) <= SHAPE_TEXT_OCCLUSION_MIN_AREA:
                 continue
🤖 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 `@skills/lark-slides/scripts/xml_text_overlap_lint.py` around lines 1159 -
1172, Use a dedicated area threshold for the intersection check in the
overflow-detection loop around grown_region and intersection_area, replacing
CONTAINER_OVERFLOW_MIN_PX with the existing SHAPE_TEXT_OCCLUSION_MIN_AREA while
leaving the growth-length threshold unchanged.

1391-1407: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

is_full_canvas_background_image duplicates is_canvas_sized_background_shape.

Both functions compute the same value: the intersection with the canvas divided by the canvas area, compared against FULL_CANVAS_BACKGROUND_COVERAGE_RATIO (lines 1186-1194). Only the docstrings and parameter names differ. Keep one predicate, for example covers_full_canvas(element, slide_width, slide_height), and call it from both sites so the two rules cannot drift apart.

🤖 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 `@skills/lark-slides/scripts/xml_text_overlap_lint.py` around lines 1391 -
1407, Consolidate the duplicated full-canvas coverage predicate by introducing
or reusing a shared helper such as covers_full_canvas(element, slide_width,
slide_height). Replace the logic in both is_full_canvas_background_image and
is_canvas_sized_background_shape with calls to that helper, preserving the
existing canvas-area validation and FULL_CANVAS_BACKGROUND_COVERAGE_RATIO
threshold.
🤖 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 1876-1887: Update short_line_passive_wrap_width to return None for
elements where is_vertical_text is true, matching the existing guard in
detect_text_may_wrap_shapes. Keep vertical runs out of passive-wrap
reclassification so they are not assigned overflow_axis "width" or a shape-width
remediation hint.

---

Nitpick comments:
In `@skills/lark-slides/scripts/xml_text_overlap_lint.py`:
- Around line 1159-1172: Use a dedicated area threshold for the intersection
check in the overflow-detection loop around grown_region and intersection_area,
replacing CONTAINER_OVERFLOW_MIN_PX with the existing
SHAPE_TEXT_OCCLUSION_MIN_AREA while leaving the growth-length threshold
unchanged.
- Around line 1391-1407: Consolidate the duplicated full-canvas coverage
predicate by introducing or reusing a shared helper such as
covers_full_canvas(element, slide_width, slide_height). Replace the logic in
both is_full_canvas_background_image and is_canvas_sized_background_shape with
calls to that helper, preserving the existing canvas-area validation and
FULL_CANVAS_BACKGROUND_COVERAGE_RATIO threshold.
🪄 Autofix

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: 92243a19-56cd-4294-8942-5d28ef3ae9b6

📥 Commits

Reviewing files that changed from the base of the PR and between 54ca7d3 and 5d603d1.

📒 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 Outdated
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py Outdated
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py Outdated
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py Outdated
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py Outdated
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py Outdated
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py Outdated
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py Outdated
@ethan-zhx
ethan-zhx force-pushed the fix/text_over_flow branch from 5d603d1 to 5a12147 Compare August 4, 2026 14:19
@ethan-zhx ethan-zhx closed this Aug 6, 2026
@ethan-zhx
ethan-zhx force-pushed the fix/text_over_flow branch from 2c3518d to 3b66d47 Compare August 6, 2026 08:54
@ethan-zhx
ethan-zhx deleted the fix/text_over_flow branch August 6, 2026 08:56
@larksuite larksuite locked and limited conversation to collaborators Aug 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size/XL Architecture-level or global-impact change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants