fix(e2e): backfill created table fields#1386
Conversation
📝 WalkthroughWalkthroughThe PR updates the ChangesIntegration Test Cleanup
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
8140f13 to
26b5c7d
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
shortcuts/base/table_ops.go (1)
121-127: 💤 Low valueMinor asymmetry in empty-fields handling.
When
created["fields"]is present but empty ([]), line 115 assigns it toresult["fields"]. When the fallback fetches zero fields, thelen(fields) > 0guard skips assignment, soresult["fields"]remains unset. This creates asymmetry in the edge case where--fieldsis specified but the table ends up with zero fields.Consider removing the
len(fields) > 0check and always assigning the fallback result to maintain consistency:if len(fields) > 0 { - createdFields := make([]interface{}, 0, len(fields)) - for _, field := range fields { - createdFields = append(createdFields, field) - } - result["fields"] = createdFields + createdFields := make([]interface{}, 0, len(fields)) + for _, field := range fields { + createdFields = append(createdFields, field) } + result["fields"] = createdFields(Or keep the guard if the intent is to omit
fieldswhen the fallback returns an empty list.)🤖 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 `@shortcuts/base/table_ops.go` around lines 121 - 127, The code handling fallback field population is asymmetric: when created["fields"] exists but is an empty slice you set result["fields"] earlier, but the fallback branch skips assigning an empty [] because of the len(fields) > 0 guard; update the block in the function that builds result (the code that iterates fields into createdFields and assigns result["fields"]) to always assign result["fields"] = createdFields (even when createdFields is empty) so created["fields"] and the fallback behave consistently — remove the len(fields) > 0 check and always set result["fields"].
🤖 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.
Nitpick comments:
In `@shortcuts/base/table_ops.go`:
- Around line 121-127: The code handling fallback field population is
asymmetric: when created["fields"] exists but is an empty slice you set
result["fields"] earlier, but the fallback branch skips assigning an empty []
because of the len(fields) > 0 guard; update the block in the function that
builds result (the code that iterates fields into createdFields and assigns
result["fields"]) to always assign result["fields"] = createdFields (even when
createdFields is empty) so created["fields"] and the fallback behave
consistently — remove the len(fields) > 0 check and always set result["fields"].
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7ca2fe34-7aec-4347-af84-e4f1239e1a76
📒 Files selected for processing (3)
shortcuts/base/base_execute_test.goshortcuts/base/table_ops.gotests/cli_e2e/base/base_basic_workflow_test.go
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@26b5c7de245f3edb37dd395c6cebce2f704b2ee9🧩 Skill updatenpx skills add yxzhaao/cli#codex/base-table-create-fallback -y -g |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1386 +/- ##
=======================================
Coverage 71.98% 71.98%
=======================================
Files 700 700
Lines 66293 66293
=======================================
Hits 47718 47718
Misses 14870 14870
Partials 3705 3705 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
primaryFieldIDandprimaryViewIDinTestBase_BasicWorkflowWhy
Those ids are not used anywhere else in the test flow. After the table-create refactor, whether
data.fieldsis echoed in the create response can vary with backend behavior, which makes this live E2E assertion brittle without changing the workflow outcome.Verification
go test ./tests/cli_e2e/base -run '^TestBase_BasicWorkflow$' -count=1go test ./shortcuts/base -run '^TestBaseTableExecuteCreate$' -count=1Summary by CodeRabbit