Skip to content

test: add live e2e for apps +list#1444

Open
raistlin042 wants to merge 2 commits into
mainfrom
feat/apps-live-e2e
Open

test: add live e2e for apps +list#1444
raistlin042 wants to merge 2 commits into
mainfrom
feat/apps-live-e2e

Conversation

@raistlin042

@raistlin042 raistlin042 commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

The lark-apps CLI E2E suite (tests/cli_e2e/apps/) had only dry-run coverage and no live (real-service) tests. This adds the first live E2E test, for apps +list — the only apps shortcut that is read-only AND requires no pre-existing app_id fixture, so it can be live-tested without leaking tenant state (apps has no +delete endpoint, so any create-based fixture would leave orphaned Miaoda apps).

Changes

  • Add tests/cli_e2e/apps/apps_list_workflow_test.go (TestAppsListWorkflowAsUser): five t.Run sub-scenarios — default list, page-size cap, keyword no-match, ownership filter, app-type filter. Uses clie2e.SkipWithoutUserToken so it skips without credentials; assertions are tenant-data-independent (empty list is valid) and verify the icon_url/created_at projection contract.
  • Update tests/cli_e2e/apps/coverage.md: record +list live coverage, refresh the Live-coverage metric, and reinforce the Blocked rationale for the remaining commands (no +delete endpoint → fixture creation would accumulate orphaned tenant apps).

Test Plan

  • make unit-test passed
  • validate passed (build + vet + unit + integration)
  • local-eval passed (E2E sandbox 1/1 — TestAppsListWorkflowAsUser 5/5 sub-scenarios against real service; skillave N/A — no shortcut/skill change)
  • acceptance-reviewer passed (5/5 scenarios; confirmed envelope shape, field projection, enum filters, user-only identity, error-message quality)
  • manual verification: go test ./tests/cli_e2e/apps -run TestAppsListWorkflowAsUser -count=1 -v — 5/5 PASS against the live service (skips cleanly without a user login)

Related Issues

N/A

Summary by CodeRabbit

  • Tests
    • Added a new end-to-end test for the apps +list command using user token authentication, validating the standard output shape plus scenarios for default listing, page size limits, keyword no-match handling, ownership filtering, and filtering for html.
    • Updated the CLI live coverage documentation to reflect the newly added apps +list workflow coverage and clarified why other related commands remain blocked.

@raistlin042 raistlin042 added size/S Low-risk docs, CI, test, or chore only changes feature labels Jun 12, 2026
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 987ef278-2cfb-47e9-a692-34ca19b27891

📥 Commits

Reviewing files that changed from the base of the PR and between a2c8206 and a4c313c.

📒 Files selected for processing (1)
  • tests/cli_e2e/apps/apps_list_workflow_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/cli_e2e/apps/apps_list_workflow_test.go

📝 Walkthrough

Walkthrough

Added end-to-end test TestAppsListWorkflowAsUser validating the apps +list command under a user token. The test covers default listing, pagination with --page-size, keyword filtering, --ownership filtering, and --app-type filtering. Coverage documentation updated to reflect 1/1 live coverage for apps +list and explain why other commands remain blocked.

Changes

Apps List Live Coverage

Layer / File(s) Summary
Apps list workflow test with scenario assertions
tests/cli_e2e/apps/apps_list_workflow_test.go
Implements TestAppsListWorkflowAsUser with package setup, test harness, shared assertion helper validating exit code, stdout envelope, and JSON array structure, plus five scenario subtests: default listing (validates app_id and name, ensures icon_url and created_at are absent), page size pagination (verifies --page-size 1 caps results), keyword no-match (generates high-entropy keyword and validates output shape), ownership filter --ownership mine, and app-type filter --app-type html (asserts non-full_stack values when app_type is present).
Coverage documentation and metrics update
tests/cli_e2e/apps/coverage.md
Updated live coverage metric from 0% to 1/1 for apps +list; added TestAppsListWorkflowAsUser summary; replaced "Blocked (live)" rationale explaining that every other command lacks cleanup and safe read-only behavior; updated command table to reference both dry-run and live workflow testcases.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

size/M

Poem

🐰 A test hops in to validate the list,
With pagination, filters—none are missed,
Coverage blooms where deletion's still todo,
Five scenarios dance, all shiny and new! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding live end-to-end tests for the apps +list command, which is the primary focus of the PR.
Description check ✅ Passed The description comprehensively covers all required template sections: Summary explaining the motivation (adding first live E2E test for apps +list), detailed Changes with file modifications, thorough Test Plan with multiple verification checkpoints, and Related Issues marked as N/A.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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/apps-live-e2e

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 and usage tips.

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

🧹 Nitpick comments (1)
tests/cli_e2e/apps/apps_list_workflow_test.go (1)

119-122: ⚡ Quick win

Strengthen --app-type html assertion to the positive contract.

Line 121 only rejects full_stack; this still passes for any other unexpected app_type value. If app_type is present, assert it equals "html" to make the filter contract explicit.

Suggested diff
 		for _, item := range items.Array() {
 			if at := item.Get("app_type"); at.Exists() {
-				assert.NotEqual(t, "full_stack", at.String(), "html filter must not return full_stack apps")
+				assert.Equal(t, "html", at.String(), "html filter should only return html apps when app_type is present")
 			}
 		}
🤖 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 `@tests/cli_e2e/apps/apps_list_workflow_test.go` around lines 119 - 122, The
test currently only rejects "full_stack" for items where item.Get("app_type")
exists; change the assertion to positively assert that the app_type equals
"html" instead: where the loop uses items.Array() and checks at :=
item.Get("app_type"); at.Exists(), replace the assert.NotEqual call with
assert.Equal(t, "html", at.String(), ...) (or equivalent) so the test explicitly
enforces the --app-type html contract and update the failure message
accordingly.
🤖 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 `@tests/cli_e2e/apps/apps_list_workflow_test.go`:
- Around line 23-25: The test TestAppsListWorkflowAsUser does not isolate CLI
config state; update the test to set the LARKSUITE_CLI_CONFIG_DIR to a temp dir
using t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir()) early in the function
(after creating ctx/cancel or at the top of TestAppsListWorkflowAsUser) so the
CLI uses an isolated config directory for this E2E test and avoids leaking
user/environment config.

---

Nitpick comments:
In `@tests/cli_e2e/apps/apps_list_workflow_test.go`:
- Around line 119-122: The test currently only rejects "full_stack" for items
where item.Get("app_type") exists; change the assertion to positively assert
that the app_type equals "html" instead: where the loop uses items.Array() and
checks at := item.Get("app_type"); at.Exists(), replace the assert.NotEqual call
with assert.Equal(t, "html", at.String(), ...) (or equivalent) so the test
explicitly enforces the --app-type html contract and update the failure message
accordingly.
🪄 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

Run ID: 2d2b1de7-f5e5-430b-b209-0a07bf6bc54e

📥 Commits

Reviewing files that changed from the base of the PR and between e1af7e3 and a2c8206.

📒 Files selected for processing (2)
  • tests/cli_e2e/apps/apps_list_workflow_test.go
  • tests/cli_e2e/apps/coverage.md

Comment thread tests/cli_e2e/apps/apps_list_workflow_test.go
@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.35%. Comparing base (8e60f01) to head (a4c313c).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1444      +/-   ##
==========================================
+ Coverage   72.89%   73.35%   +0.46%     
==========================================
  Files         733      750      +17     
  Lines       69205    69250      +45     
==========================================
+ Hits        50445    50799     +354     
+ Misses      14977    14711     -266     
+ Partials     3783     3740      -43     

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

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#feat/apps-live-e2e -y -g

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

Labels

feature size/S Low-risk docs, CI, test, or chore only changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant