Skip to content

fix(format): handle typed slices in table formatting and add regressi…#465

Open
sang-neo03 wants to merge 1 commit intomainfrom
fix/format-table-typed-slice
Open

fix(format): handle typed slices in table formatting and add regressi…#465
sang-neo03 wants to merge 1 commit intomainfrom
fix/format-table-typed-slice

Conversation

@sang-neo03
Copy link
Copy Markdown
Collaborator

@sang-neo03 sang-neo03 commented Apr 14, 2026

…on tests

Summary

Changes

  • Change 1
  • Change 2

Test Plan

  • Unit tests pass
  • Manual local verification confirms the lark xxx command works as expected

Related Issues

  • None

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of various array data types in output formatting, enabling proper item extraction from structured responses.
  • Tests

    • Added regression tests validating correct item extraction and formatting across table, CSV, and NDJSON output formats.

Copy link
Copy Markdown

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a37490a1-5c8f-4d80-b9a9-c0dde1bd661c

📥 Commits

Reviewing files that changed from the base of the PR and between 2a30124 and 67ee0de.

📒 Files selected for processing (2)
  • internal/output/format.go
  • internal/output/format_test.go

📝 Walkthrough

Walkthrough

The changes extend slice handling to support typed slices (e.g., []map[string]interface{}) alongside existing []interface{} support. New reflection-based helper functions detect slice types and convert them to generic slices, enabling proper extraction and formatting of items from various slice kinds.

Changes

Cohort / File(s) Summary
Slice Type Handling Enhancement
internal/output/format.go
Added isSliceLike and toGenericSlice helper functions using reflection to detect any slice kind and convert slices to []interface{}. Updated FindArrayField and ExtractItems strategies to recognize and process typed slices instead of only []interface{} type assertions.
Typed Slice Regression Tests
internal/output/format_test.go
Added comprehensive test coverage for []map[string]interface{} typed slice handling, validating ExtractItems item counts, FormatValue rendering with FormatTable/FormatCSV using element fields, and FormatNDJSON output with expected JSON fields in both direct and envelope-shaped data structures.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A rabbit's delight, typed slices now bright,
No more []interface{} fright—reflection takes flight!
From maps to the tables, our data flows stable,
Generic conversions make formatting able.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description follows the required template structure with all key sections, but the content is incomplete with placeholder text ('Change 1', 'Change 2') instead of actual changes. Replace placeholder text with specific changes: add details about the new isSliceLike and toGenericSlice helpers, updates to FindArrayField and ExtractItems, and the typed-slice regression tests added.
Docstring Coverage ⚠️ Warning Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main fix (handling typed slices in table formatting) and mentions regression tests, accurately reflecting the core changes.

✏️ 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 fix/format-table-typed-slice

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the size/M Single-domain feat or fix with limited business impact label Apr 14, 2026
@github-actions
Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#fix/format-table-typed-slice -y -g

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

Labels

size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant