Skip to content

fix(base): hide redundant option ids in field-search-options#397

Open
OwenYWT wants to merge 1 commit intolarksuite:mainfrom
OwenYWT:codex/cli-base-field-option-shape
Open

fix(base): hide redundant option ids in field-search-options#397
OwenYWT wants to merge 1 commit intolarksuite:mainfrom
OwenYWT:codex/cli-base-field-option-shape

Conversation

@OwenYWT
Copy link
Copy Markdown
Contributor

@OwenYWT OwenYWT commented Apr 10, 2026

Closes #381

Summary

  • remove redundant options[].id from base +field-search-options output
  • keep the option shape aligned with +field-create and +field-get
  • add a regression test that ensures the option id is not surfaced

Test Plan

  • GOCACHE=/tmp/go-build-cache GOMODCACHE=/tmp/go-mod-cache /opt/homebrew/opt/go/bin/go test ./shortcuts/base -run 'TestBaseFieldExecuteSearchOptions'

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where internal option identifiers were being displayed in command output. Options now display user-friendly information without showing internal ID values, providing cleaner and more relevant results to end-users.

@github-actions github-actions bot added domain/base PR touches the base domain size/M Single-domain feat or fix with limited business impact labels Apr 10, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 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: b15c64ad-ca82-4866-a21c-84f1373e678c

📥 Commits

Reviewing files that changed from the base of the PR and between fa16fe1 and 20aacac.

📒 Files selected for processing (2)
  • shortcuts/base/base_execute_test.go
  • shortcuts/base/field_ops.go

📝 Walkthrough

Walkthrough

The changes remove redundant id fields from the options array returned by the base +field-search-options command through post-processing, ensuring output consistency with other field-related commands like +field-create and +field-get.

Changes

Cohort / File(s) Summary
Field Options Output Processing
shortcuts/base/field_ops.go
Added stripFieldOptionIDs helper function to clone option records while filtering out id fields; modified executeFieldSearchOptions to post-process the options array before writing to output.
Test Assertions
shortcuts/base/base_execute_test.go
Updated TestBaseFieldExecuteSearchOptions assertions to verify that option ID values are absent from command output while still validating presence of "options" and status text in stdout.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 Hop along, dear IDs, you must go away,
Your redundant presence caused agent dismay,
With stripFieldOptionIDs so clean and so bright,
Our options now match—consistency's right!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: hiding redundant option IDs in the field-search-options output.
Description check ✅ Passed The PR description includes all required sections: Summary (clearly states the changes), Changes (implicitly covered in summary), Test Plan (explicitly lists test execution), and Related Issues (closes #381).
Linked Issues check ✅ Passed The PR fully addresses issue #381 by removing redundant option IDs from field-search-options output and aligning the option shape with field-create and field-get.
Out of Scope Changes check ✅ Passed All changes are directly scoped to addressing issue #381: the test update enforces option ID removal, and the helper function strips option IDs before output.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 10, 2026

Greptile Summary

This PR removes the id field from option objects returned by +field-search-options to align the shape with +field-create and +field-get. The implementation adds a stripFieldOptionIDs helper and a regression test covering both the positive case (option name present) and the negative case (option id absent).

Confidence Score: 5/5

Safe to merge — targeted fix with a dedicated regression test, no behavioural changes outside the stripped field.

The change is minimal and well-tested. The stripFieldOptionIDs helper correctly handles nil slices, non-map elements, and maps with or without an id key. All remaining observations are P2 or below.

No files require special attention.

Important Files Changed

Filename Overview
shortcuts/base/field_ops.go Adds stripFieldOptionIDs helper and wires it into executeFieldSearchOptions; logic is correct and handles nil/non-map elements safely.
shortcuts/base/base_execute_test.go Adds TestBaseFieldExecuteSearchOptions regression test that verifies the option name is kept and the option id is stripped from the response.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[executeFieldSearchOptions] --> B[baseV3Call GET /options]
    B --> C{data has options?}
    C -- yes --> D[options = data.options]
    C -- no --> E[options = nil]
    D --> F[stripFieldOptionIDs]
    E --> F
    F --> G{len == 0?}
    G -- yes --> H[return as-is]
    G -- no --> I[copy each option map omitting 'id' key]
    I --> J[runtime.Out with stripped options]
    H --> J
Loading

Reviews (1): Last reviewed commit: "fix(base): hide redundant option ids in ..." | Re-trigger Greptile

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

Labels

domain/base PR touches the base domain size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

base +field-search-options 返回冗余 option id,建议移除以减少 agent 干扰

1 participant