Skip to content

fix: preserve slides schema issues#1948

Open
ethan-zhx wants to merge 1 commit into
mainfrom
feat/slides_table_lint
Open

fix: preserve slides schema issues#1948
ethan-zhx wants to merge 1 commit into
mainfrom
feat/slides_table_lint

Conversation

@ethan-zhx

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

Copy link
Copy Markdown
Collaborator

Summary

Expose non-fatal Slides XML schema issues through the shortcut output, so callers can see server-side validation warnings.

Changes

  • Preserve presentation and per-slide issues in slides +create.
  • Preserve per-page slide-create issues in slides +replace-pages.
  • Add unit coverage for both output paths.

Test Plan

  • Unit tests pass (not run; not requested in this turn).
  • Manual local verification (not run; not requested in this turn).

Related Issues

  • None

Summary by CodeRabbit

  • Bug Fixes

    • Slide creation now reports presentation-level and per-slide API issues in command output.
    • Slide replacement now includes any issues returned while creating replacement slides.
    • Results continue to include slide IDs, counts, and replacement status alongside issue details.
  • Tests

    • Added coverage to verify issue details are preserved for slide creation and page replacement workflows.

@github-actions github-actions Bot added the size/M Single-domain feat or fix with limited business impact label Jul 18, 2026
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Slides creation and page replacement commands now preserve schema issue details returned by Slides API responses. Creation exposes top-level and per-slide issues, while page replacement includes issues in affected page results with corresponding test coverage.

Changes

Slides issue propagation

Layer / File(s) Summary
Presentation and slide creation issues
shortcuts/slides/slides_create.go, shortcuts/slides/slides_create_test.go
Creation output preserves presentation issues and records per-slide indexes, IDs, and issue details in slide_issues.
Page replacement issue output
shortcuts/slides/slides_replace_pages.go, shortcuts/slides/slides_replace_pages_test.go
Page replacement stores slide creation issues and conditionally includes them in replacement results; tests verify the propagated value.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • larksuite/cli#1585: Introduced the replace-pages implementation that this issue propagation change extends.

Suggested labels: feature

Suggested reviewers: liangshuo-1, fangshuyu-768

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: preserving Slides schema issues.
Description check ✅ Passed The description follows the required template and includes summary, changes, test plan, and related issues.
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/slides_table_lint

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.

Caution

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

⚠️ Outside diff range comments (1)
shortcuts/slides/slides_create.go (1)

188-218: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Avoid introducing new loose-map structures.

The slideIssues slice is constructed using inline map[string]interface{} literals. As per coding guidelines, do not introduce new loose-map code for structured data. Instead, define and use a local struct with json tags.

♻️ Proposed refactor to use a typed struct
-				var slideIssues []map[string]interface{}
+				type slideIssue struct {
+					SlideIndex int         `json:"slide_index"`
+					SlideID    string      `json:"slide_id"`
+					Issues     interface{} `json:"issues"`
+				}
+				var slideIssues []slideIssue
				for i, slideXML := range slides {
					slideData, err := runtime.CallAPITyped(
						"POST",
						slideURL,
						map[string]interface{}{"revision_id": -1},
						map[string]interface{}{
							"slide": map[string]interface{}{"content": slideXML},
						},
					)
					if err != nil {
						return appendSlidesProgressHint(err, fmt.Sprintf("adding slide %d/%d failed; presentation %s was created, %d slide(s) added before failure", i+1, len(slides), presentationID, i))
					}
					sid := common.GetString(slideData, "slide_id")
					if sid != "" {
						slideIDs = append(slideIDs, sid)
					}
					if issues, ok := slideData["issues"]; ok {
-						slideIssues = append(slideIssues, map[string]interface{}{
-							"slide_index": i + 1,
-							"slide_id":    sid,
-							"issues":      issues,
-						})
+						slideIssues = append(slideIssues, slideIssue{
+							SlideIndex: i + 1,
+							SlideID:    sid,
+							Issues:     issues,
+						})
					}
				}

				result["slide_ids"] = slideIDs
				result["slides_added"] = len(slideIDs)
				if len(slideIssues) > 0 {
					result["slide_issues"] = slideIssues
				}
🤖 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 `@shortcuts/slides/slides_create.go` around lines 188 - 218, Replace the
loose-map slideIssues collection in the slide creation loop with a local typed
struct containing slide_index, slide_id, and issues fields, each using the
appropriate json tags. Use a slice of that struct and append typed values while
preserving the existing result["slide_issues"] output and behavior.

Source: Coding guidelines

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

Outside diff comments:
In `@shortcuts/slides/slides_create.go`:
- Around line 188-218: Replace the loose-map slideIssues collection in the slide
creation loop with a local typed struct containing slide_index, slide_id, and
issues fields, each using the appropriate json tags. Use a slice of that struct
and append typed values while preserving the existing result["slide_issues"]
output and behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ed6aaa41-57dd-417f-bf06-2c9244cd8ad8

📥 Commits

Reviewing files that changed from the base of the PR and between 4a56748 and f826a72.

📒 Files selected for processing (4)
  • shortcuts/slides/slides_create.go
  • shortcuts/slides/slides_create_test.go
  • shortcuts/slides/slides_replace_pages.go
  • shortcuts/slides/slides_replace_pages_test.go

@github-actions

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

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

@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.03%. Comparing base (1efe2df) to head (f826a72).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1948   +/-   ##
=======================================
  Coverage   75.02%   75.03%           
=======================================
  Files         894      894           
  Lines       94294    94310   +16     
=======================================
+ Hits        70746    70762   +16     
  Misses      18137    18137           
  Partials     5411     5411           

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants