feat(slides): normalize replace-slide part aliases - #2225
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
🚧 Files skipped from review as they are similar to previous changes (8)
📝 WalkthroughWalkthroughThe ChangesReplace-slide normalization
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ReplaceSlideCLI
participant NormalizationParser
participant SlidesAPI
ReplaceSlideCLI->>NormalizationParser: provide aliased --parts JSON
NormalizationParser->>NormalizationParser: normalize aliases and validate conflicts
NormalizationParser-->>ReplaceSlideCLI: canonical parts and normalization records
ReplaceSlideCLI->>SlidesAPI: submit canonical replacement and insertion parts
SlidesAPI-->>ReplaceSlideCLI: return execution result and normalization records
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 `@shortcuts/slides/slides_replace_slide_test.go`:
- Around line 360-364: Update shortcuts/slides/slides_replace_slide_test.go
lines 360-364 and 1118-1140 so each validation error-path test uses
errs.ProblemOf to assert the validation category and invalid-argument subtype,
then errors.As to inspect *errs.ValidationError and verify Param is "--parts".
Update lines 1142-1157 similarly and additionally assert the wrapped cause is
preserved as *json.SyntaxError; retain the existing message checks where useful.
- Around line 978-1027: Update the XML-preservation assertions in
shortcuts/slides/slides_replace_slide_test.go:978-1027 within
TestReplaceSlideNormalizesCompatibleParts to verify wire replacement and
insertion values exactly match the input XML; update
shortcuts/slides/slides_replace_slide_test.go:1029-1063 to assert every alias
produces the exact canonical payload value; and update
shortcuts/slides/slides_replace_slide_test.go:1102-1116 to assert the folded
canonical Replacement equals "<shape/>".
In `@skills/lark-slides/references/lark-slides-replace-slide.md`:
- Around line 89-93: Update the successful response example and field table in
the replace-slide documentation to include the normalizations field, documenting
its path and the array item shape {part_index, kind, from, to}. Ensure the
documentation covers both normal success output and dry-run responses
consistently.
In `@tests/cli_e2e/slides/slides_replace_slide_dryrun_test.go`:
- Around line 52-56: Update the normalization assertions in
tests/cli_e2e/slides/slides_replace_slide_dryrun_test.go:52-56 to verify
part_index, kind, from, and to for each of all five entries, not just the count
and first entry. Apply the same complete success-response metadata assertions in
tests/cli_e2e/slides/slides_replace_slide_workflow_test.go:125-126 for the live
alias workflow, using the existing normalizations result and expected alias
conversion values.
🪄 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: f7a39626-e16f-402c-9765-1b096b2d123a
📒 Files selected for processing (8)
shortcuts/slides/slides_replace_slide.goshortcuts/slides/slides_replace_slide_test.goskills/lark-slides/SKILL.mdskills/lark-slides/references/lark-slides-replace-slide.mdtests/cli_e2e/slides/coverage.mdtests/cli_e2e/slides/slides_history_dryrun_test.gotests/cli_e2e/slides/slides_replace_slide_dryrun_test.gotests/cli_e2e/slides/slides_replace_slide_workflow_test.go
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@cc155bffdb7a9f36d897da0245747cb8455ade98🧩 Skill updatenpx skills add larksuite/cli#feat/slides-replace-parts-normalization -y -g |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2225 +/- ##
==========================================
+ Coverage 76.33% 76.35% +0.02%
==========================================
Files 993 993
Lines 106633 106774 +141
==========================================
+ Hits 81400 81531 +131
- Misses 19032 19038 +6
- Partials 6201 6205 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
92d0fcb to
2312cc1
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
2312cc1 to
773138f
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Accept deterministic action and field aliases while rejecting ambiguous semantics and conflicting values. Add actionable recovery guidance for malformed JSON and whole-page actions, plus dry-run and live workflow coverage.
773138f to
cc155bf
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Summary
Normalize
slides +replace-slide --partscompatibility aliases so agent-authored payloads can use deterministic action and field names while still producing the canonical Slides API request shape. The change keeps ambiguous or conflicting inputs as validation errors, and improves recovery guidance for malformed JSON and whole-page replacement attempts.Changes
replace/insertaction aliases and field aliases such astarget_id,content, andelement, then report the canonical conversions in structured dry-run output.<slide>replacements with actionable typed validation hints.+replace-slidecontract.Test Plan
go test -race -gcflags="all=-N -l" -count=1 ./shortcuts/slidesgo test -count=1 ./tests/cli_e2e/slides -run 'TestSlidesReplaceSlide.*DryRunE2E'make unit-test(fails in unrelatedshortcuts/im:TestAllIMShortcutsUseAffordanceExamples/+messages-search; the touchedshortcuts/slidespackage passed)lark-cli slides +replace-slideflow works as expectedRelated Issues
Summary by CodeRabbit
+replace-slideaccepts compatible action names and field aliases, converting them to standard formats automatically.