test: isolate unit tests from user state#1883
Conversation
📝 WalkthroughWalkthroughLive skills integration tests now require explicit opt-in, isolate user and configuration directories in temporary locations, and share preparation logic across synchronization scenarios. Test packages also gain isolated harnesses, while a dedicated Make target documents and runs the live tests. ChangesTest isolation and live skills integration
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 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: 1
🤖 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 `@cmd/update/update_test.go`:
- Around line 1696-1701: Update TestUpdateCommand_SkillsSyncColdStart to create
and defer-cancel a 90-second context, then use it for the skills CLI commands.
Before collecting global skills with “skills ls -g”, seed the isolated
environment by running the same “skills add” command for lark-calendar with
global and noninteractive flags, skipping with descriptive errors if listing or
seeding fails.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@05345c22566e1aedb7de4fce5525ef59d955e79d🧩 Skill updatenpx skills add larksuite/cli#fix/isolate-live-skills-tests -y -g |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1883 +/- ##
=======================================
Coverage 74.66% 74.67%
=======================================
Files 877 877
Lines 91731 91731
=======================================
+ Hits 68494 68496 +2
+ Misses 17926 17925 -1
+ Partials 5311 5310 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ed1060c to
05345c2
Compare
Summary
Default unit tests contained several side effects that depended on or modified developer state: two opt-in-worthy skills integration tests invoked the real npx skills CLI, ordinary update tests could fall through to npx, multiple packages wrote lark-cli cache/log/event state, registry users started background remote-metadata refreshes, and one API test saved a binary into the repository working directory.
Changes
Validation
The branch is rebased on current origin/main at 1c36744.
Summary by CodeRabbit
make live-skills-test.live-skills-testMakefile target that runs the selected live tests with the opt-in flag.