Skip to content

fix(slides): bind lint issues to source XML nodes - #2179

Open
BD-ZERO wants to merge 12 commits into
mainfrom
fix/slides-lint-xml-path
Open

fix(slides): bind lint issues to source XML nodes#2179
BD-ZERO wants to merge 12 commits into
mainfrom
fix/slides-lint-xml-path

Conversation

@BD-ZERO

@BD-ZERO BD-ZERO commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Preserve source XML indices when lint extraction filters elements.
  • Bind lint issues to elements by xml_path instead of user-provided IDs.
  • Report blocking duplicate_element_id errors for duplicate IDs.
  • Decode XML entities in returned element IDs.
  • Stop exposing synthetic IDs for elements with missing or empty IDs.

Validation

  • 196/196 Slides lint Python tests passed.
  • GOTOOLCHAIN=go1.23.0 make unit-test passed.
  • Validated all 87 regression slides:
    • 203 related objects checked
    • 0 missing or invalid XML paths
    • 0 ID or kind mismatches
    • 0 pages with lint-code drift

Summary by CodeRabbit

  • Bug Fixes

    • Improved automated slide layout validation with stable references to relevant slide elements.
    • Diagnostics now include source XML paths for related images, lines, tables, and containers.
    • Improved handling of encoded, missing, and duplicate element identifiers, including duplicates across slides.
    • Improved consistency across overlap, overflow, density, line, icon, and layout checks.
  • Documentation

    • Updated validation guidance to explain XML paths and path-based troubleshooting for sparse container content.

@coderabbitai

coderabbitai Bot commented Aug 4, 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 XML linter now preserves source IDs, XML paths, and per-kind indexes. Diagnostics and normalized issues use stable source references. The pipeline reports duplicate non-empty IDs. Tests and checklist documentation cover the new metadata.

Changes

XML Reference-Aware Linting

Layer / File(s) Summary
Source metadata and reference extraction
skills/lark-slides/scripts/xml_text_overlap_lint.py
The linter records source paths, source IDs, and per-kind indexes for parsed elements and lines.
Reference-aware diagnostic generation
skills/lark-slides/scripts/xml_text_overlap_lint.py
Diagnostics across overlap, overflow, line, density, table, and sparse-container checks use stable references and XML paths.
Duplicate IDs and issue normalization
skills/lark-slides/scripts/xml_text_overlap_lint.py
The pipeline detects duplicate non-empty IDs and resolves issues and element counts through reference maps.
Validation coverage and output contract
skills/lark-slides/scripts/xml_text_overlap_lint_test.py, skills/lark-slides/references/validation-checklist.md
Tests cover XML paths, duplicate IDs, decoded IDs, anonymous tables, and sparse containers. The checklist documents xml_path in related_objects.

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

Sequence Diagram(s)

sequenceDiagram
  participant PresentationPipeline
  participant XMLLinter
  participant IssueNormalizer
  PresentationPipeline->>XMLLinter: slide XML and slide number
  XMLLinter->>XMLLinter: extract paths, IDs, indexes, and diagnostics
  XMLLinter->>IssueNormalizer: raw issues and reference maps
  IssueNormalizer-->>PresentationPipeline: normalized issues with XML path metadata
Loading

Possibly related PRs

Suggested reviewers: liangshuo-1, ethan-zhx

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 describes the main change: binding Slides lint issues to source XML nodes.
Description check ✅ Passed The description explains the change and provides detailed validation results, but it omits the template's Changes and Related Issues sections.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/slides-lint-xml-path

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 added the size/L Large or sensitive change across domains or core paths label Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#fix/slides-lint-xml-path -y -g

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2179      +/-   ##
==========================================
+ Coverage   75.70%   75.89%   +0.18%     
==========================================
  Files         944      962      +18     
  Lines      100288   102085    +1797     
==========================================
+ Hits        75926    77480    +1554     
- Misses      18565    18720     +155     
- Partials     5797     5885      +88     

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

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

🤖 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/references/validation-checklist.md`:
- Line 50: Update the validation checklist to add a handling row for blocking
duplicate_element_id errors, including the required remediation steps. Revise
the sparse-container location guidance so operators use
related_objects[].xml_path whenever an object ID is missing or ambiguous, rather
than relying on ID lookup alone.

In `@skills/lark-slides/scripts/xml_text_overlap_lint.py`:
- Around line 2462-2468: Update the measurement-mapping function around the
bbox_overlap handling to detect horizontal or vertical line crossings before
generic intersection-area normalization. When line_crosses_text() identifies a
crossing, emit a nonzero segment-crossing measurement and its matching rule so
consumers cannot treat intersection_area: 0 as resolved; add regression
assertions for both horizontal and vertical crossings.
- Around line 2254-2259: Update the anonymous sparse-container message
construction near element_ref(container) to use element_label(container), or
fall back to container_xml_path when source_element_id(container) is absent, so
normalized messages retain the stable XML locator instead of emitting an unknown
container label.
🪄 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: 0a1f9358-73bc-4df4-9ab3-981dfdd87854

📥 Commits

Reviewing files that changed from the base of the PR and between 3b66d47 and bef7a04.

📒 Files selected for processing (3)
  • skills/lark-slides/references/validation-checklist.md
  • skills/lark-slides/scripts/xml_text_overlap_lint.py
  • skills/lark-slides/scripts/xml_text_overlap_lint_test.py

Comment thread skills/lark-slides/references/validation-checklist.md
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py
@BD-ZERO BD-ZERO changed the title fix(slides): make lint XML paths reliable for filtered and duplicate IDs fix(slides): bind lint issues to source XML nodes Aug 4, 2026
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py Outdated
elements: list[dict[str, Any]], *, cross_slide_only: bool = False
) -> list[dict[str, Any]]:
elements_by_source_id: dict[str, list[dict[str, Any]]] = {}
for element in elements:

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.

[P2] Scan every ID-bearing source node

elements is populated from density_elements, which only materializes top-level geometry objects. Valid ID-bearing nodes outside that extractor are therefore never checked: a valid table with two <td id="dup"> cells currently produces no duplicate_element_id issue and returns release_ready: true, even though the SXSD documents td.id as a unique cell identifier. Please collect IDs from the parsed source tree (and retain nested XML paths), or explicitly narrow the rule contract instead of claiming all element IDs are unique.

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.

Thanks — td and note are covered now, but the same root cause remains for other SXSD ID-bearing nodes. At the current head, <data><shape id="dup" type="rect" topLeftX="40" topLeftY="40" width="80" height="80"/><undefined id="dup" type="video"/></data> is schema-valid, produces no duplicate_element_id, and still returns release_ready: true. The SXSD explicitly defines undefined.id as an optional unique element identifier. Please derive the ID scan from the parsed source tree, or include every ID-bearing element (including undefined), rather than hard-coding only note and td.

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

Reviewed the latest head. The previously reported duplicate-ID coverage issues are addressed, targeted lint tests pass, and CI is green.

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.

2 participants