feat(slides): normalize replace-slide part aliases - #2225
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe ChangesReplace-slide normalization
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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@5b874b0a85504337d909253dc8596e6f67d5b06f🧩 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.36% 76.38% +0.01%
==========================================
Files 1011 1011
Lines 111269 111352 +83
==========================================
+ Hits 84970 85051 +81
- Misses 19815 19816 +1
- Partials 6484 6485 +1 ☔ 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. |
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. |
3df22cf to
99eb42f
Compare
99eb42f to
1bf712d
Compare
1bf712d to
719420f
Compare
30b66d5 to
a673dc5
Compare
Normalize deterministic +replace-slide part aliases (replace→block_replace, target_id→block_id, and payload field folding), and reject semantically different actions up front. Point whole-page actions at +update-slide now that it is GA: - page_replace / slide_replace recovery guidance and the reference error table now direct callers to `slides +update-slide` (in-place whole-page rewrite) instead of the deprecated +replace-pages. - drop the +replace-pages reference doc, completing the #2227 deprecation (the command stays; its deprecation signal is carried by --help and the output JSON `deprecated` field). Generalize whole-page validation gating to the behavior rather than a command name (SKILL.md, workflow/validation-xml.md): "整页写回后" instead of "每次通过 +update-slide 整页写回后". Folds in PR #2255.
a673dc5 to
5b874b0
Compare
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. Ambiguous or conflicting inputs stay as typed validation errors, and — now that the Slide Engine backend is GA — all whole-page recovery guidance points atslides +update-slide(in-place whole-page rewrite) instead of the deprecated+replace-pages. Also folds in the whole-page validation-gating generalization from #2255.Changes
replace/insertaction aliases and field aliases such astarget_id,content, andelement, then report the canonical conversions in structured dry-run output.+update-slidenow that it is GA:page_replace/slide_replacerecovery guidance and the reference error table now direct callers toslides +update-slide(in-place whole-page rewrite) instead of the deprecated+replace-pages.+replace-pagesreference doc (references/cli/lark-slides-replace-pages.md). The command stays registered; its deprecation signal is carried by--helpand the output JSONdeprecatedfield.SKILL.md,workflow/validation-xml.md): "整页写回后" instead of "每次通过+update-slide整页写回后". Folds in docs(slides): generalize whole-page validation guidance #2255.slides_shared.go(+replace-pagesis deprecated but still registered, not "retired").+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'slides +replace-slidewithpage_replace/slide_replacenow exits 2 and steers toslides +update-slide(validated against the F23 comparison report).gofmt -l/go vet/go build ./...clean.make unit-test(fails in unrelatedshortcuts/im:TestAllIMShortcutsUseAffordanceExamples/+messages-search; the touchedshortcuts/slidespackage passed)lark-cli slides +replace-slideflow works as expectedRelated Issues
+replace-pagesdeprecationSummary by CodeRabbit
replaceandinsertactions, target aliases, and supported payload field aliases.