mirror of
https://github.com/larksuite/cli.git
synced 2026-09-14 18:42:53 +08:00
7cfbea68d9
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.
6.6 KiB
6.6 KiB
Slides CLI E2E Coverage
Metrics
- Denominator: 6 leaf commands
- Covered: 5
- Coverage: 83.3%
Summary
- TestSlides_CreateWorkflowAsUser: proves the user slides workflow through
create presentation with slide as userandget created presentation xml as user; creates a fresh presentation, asserts returned IDs, then reads back the XML content to prove the title and slide body persisted. - TestSlidesCreateRepeatedSlideFileDryRunE2E / TestSlidesCreateSlidesFileAndStdinDryRunE2E / TestSlidesCreateRejectsBothSlideFormsDryRunE2E: cover the
+createfile inputs through the built binary, which is the only layer that can prove the point of the feature — a multi-line, quote-heavy page reachesslide.contentbyte-for-byte with no JSON encoder in the caller's hands, and repeated--slideorder is page order. The refusal case pins the exit-2 envelope (param: "--slide") that an agent parses to repair its own command; the package test never runs the dispatcher and so cannot see it. - TestSlidesAddSlideDryRunE2E / TestSlidesDeleteSlideDryRunE2E: pin the request shapes the unit tests cover, but through the real binary, which is the only layer that proves a full
<slide>XML document survives flag parsing with its quotes and angle brackets intact. Delete additionally proves the shortcut runs without--yes, unlike the high-risk-write raw command. - TestSlides_SlideAddDeleteWorkflowAsUser: live add/delete round trip on a throwaway presentation created and torn down per run. Asserts against a readback rather than the write's own response, so it proves what the request shape cannot: the returned
slide_idaddresses a real page,--before-slide-idpositions the page between its neighbours instead of merely being forwarded, and the deleted page is gone while both neighbours survive. - TestSlidesUpdateSlideDryRunE2E / TestSlidesUpdateAliasDryRunE2E / TestSlidesUpdateSlideRefuses*DryRunE2E: dry-run coverage for
+update-slidethrough the built binary — one request carrying oneblock_replacepart whoseblock_idis the PAGE id (the whole design; an element id there would replace one element and leave the rest of the page), theslideservice alias /+updatecommand alias /--xmlspelling, and the two refusals that must not produce a request (a bare element root, and a root id naming a different page). - TestSlidesUpdateSlideLiveE2E: required live-backend assertion for
+update-slide; creates a throwaway presentation with the lane's bot credential, replaces its page using the returned page id asblock_id, reads that page back through+xml-get, verifies the new marker replaced the old marker without changingslide_id, and self-cleans. - TestSlides_HistoryWorkflow: opt-in live round-trip coverage for
+update-slide; creates a presentation, updates its page in place, asserts the returnedslide_id, the persisted marker, and that an element written back with its original id keeps that id, then reverts through slide history and self-cleans. It runs only whenLARK_SLIDES_HISTORY_E2E=1and therefore does not yet exercise the default live lane. - TestSlidesReplaceSlideNormalizationDryRunE2E / TestSlidesReplaceSlideEmptyReplacementDryRunE2E / TestSlidesReplaceSlideDryRunE2E: dry-run coverage for
+replace-slidethrough the built binary. The normalization case provesreplace/insert,target_id,content, andelementbecome a canonical request and that structured output records all conversions. The other cases preserve the strict boundary: an actually-empty canonical payload still fails, while a legitimate mixedblock_replace+block_insertbatch remains unchanged. - TestSlides_ReplaceSlideAliasWorkflowAsUser: live alias round trip on a throwaway presentation. It reads server-assigned block IDs, replaces one target through
replace/target_id/content, inserts another throughinsert/element, reads the deck back to prove both writes persisted in the requested position while a control block survived, and deletes the presentation in cleanup. - Blocked area:
slides +media-uploadis still uncovered because it needs a deterministic local image fixture plus XML follow-up proof that is separate from the base create/read workflow.
Command Table
| Status | Cmd | Type | Testcase | Key parameter shapes | Notes / uncovered reason |
|---|---|---|---|---|---|
| ✓ | slides +create | shortcut | slides_create_workflow_test.go::TestSlides_CreateWorkflowAsUser/create presentation with slide as user; slides_create_slide_inputs_dryrun_test.go::TestSlidesCreateRepeatedSlideFileDryRunE2E, TestSlidesCreateSlidesFileAndStdinDryRunE2E, TestSlidesCreateRejectsBothSlideFormsDryRunE2E | --title; --slides ["<slide ...>"] / --slides @deck.json / --slides -; repeated --slide @page.xml |
live lane reads back through raw slides API to prove persisted XML; dry-run lane pins the file inputs and the mutual-exclusion refusal |
| ✓ | slides +add-slide | shortcut | slides_slide_add_delete_dryrun_test.go::TestSlidesAddSlideDryRunE2E; slides_slide_add_delete_workflow_test.go::TestSlides_SlideAddDeleteWorkflowAsUser | --slide "<slide ...>"; --before-slide-id; --revision-id |
live append and insert both verified by reading the deck back |
| ✓ | slides +delete-slide | shortcut | slides_slide_add_delete_dryrun_test.go::TestSlidesDeleteSlideDryRunE2E, TestSlidesDeleteSlideWikiDryRunE2E; slides_slide_add_delete_workflow_test.go::TestSlides_SlideAddDeleteWorkflowAsUser | --slide-id; --revision-id; wiki URL |
live delete runs on a throwaway deck; readback proves the neighbours survive |
| ✓ | slides +update-slide | shortcut | slides_update_slide_dryrun_test.go::TestSlidesUpdateSlideDryRunE2E (+ alias / refusal cases); slides_update_slide_workflow_test.go::TestSlidesUpdateSlideLiveE2E; slides_history_workflow_test.go::TestSlides_HistoryWorkflow (opt-in history/revert) | --presentation; --slide-id; --content "<slide ...>"; --revision-id |
default live CI proves a real in-place update and readback; opt-in workflow adds history/revert and element-id preservation |
| ✓ | slides +replace-slide | shortcut | slides_replace_slide_dryrun_test.go::TestSlidesReplaceSlideNormalizationDryRunE2E, TestSlidesReplaceSlideEmptyReplacementDryRunE2E, TestSlidesReplaceSlideDryRunE2E; slides_replace_slide_workflow_test.go::TestSlides_ReplaceSlideAliasWorkflowAsUser | --presentation; --slide-id; canonical and compatibility --parts shapes |
dry-run pins canonical request construction and validation; live workflow proves alias replace/insert persistence, target ID preservation, insertion ordering, control-block survival, and cleanup |
| ✕ | slides +media-upload | shortcut | none | needs a stable local image fixture plus follow-up slide XML proof |