feat: --show-only flag and audience JSON pretty-print#40
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
WalkthroughThis PR introduces a new Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
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 docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/api-client/entity-summary.test.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. src/api-client/entity-summary.tsESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox. src/api-client/experiment-summary.test.tsESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.
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 `@src/commands/users/index.ts`:
- Around line 141-143: The avatar rendering breaks because
summarizeUserRow/applyShowExclude may drop the id when showOnly is used; change
the avatar lookup to use the original source user identity rather than the
filtered row: when mapping users (the users array passed into summarizeUserRow
and applyShowExclude) either attach the original id (e.g., a hidden __origId) to
each produced row or, better, keep and use the original users array for avatar
lookup (use users[dataIdx].id) when rendering avatars instead of
rows[dataIdx].id; update any code that currently references rows[dataIdx].id
(avatar rendering code) to read the id from the preserved source (users) or the
added __origId so avatars remain stable even when showOnly omits id.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: babf4324-86fe-45d5-a23f-e6b4e223a85f
📒 Files selected for processing (26)
.gitignoresrc/api-client/entity-summary.test.tssrc/api-client/entity-summary.tssrc/api-client/experiment-summary.test.tssrc/api-client/experiment-summary.tssrc/api-client/format-helpers.test.tssrc/api-client/format-helpers.tssrc/commands/customfields/index.tssrc/commands/experiments/custom-fields.tssrc/commands/experiments/get.test.tssrc/commands/experiments/get.tssrc/commands/experiments/list.tssrc/commands/goals/index.tssrc/commands/metrics/index.tssrc/commands/segments/index.tssrc/commands/teams/index.tssrc/commands/users/index.tssrc/core/customfields/get.tssrc/core/experiments/custom-fields.tssrc/core/experiments/get.test.tssrc/core/experiments/get.tssrc/core/experiments/list.test.tssrc/core/experiments/list.tssrc/core/segments/segments.tssrc/core/teams/get.tssrc/lib/utils/list-command.ts
| const rows = (users as Array<Record<string, unknown>>).map((u) => | ||
| applyShowExclude(summarizeUserRow(u), u, show, exclude) | ||
| applyShowExclude(summarizeUserRow(u), u, show, exclude, showOnly) | ||
| ); |
There was a problem hiding this comment.
Avatar lookup breaks when --show-only omits id.
On Line 172, avatar rendering keys off rows[dataIdx].id, but Line 142 now allows rows without id via showOnly, so avatars silently disappear for valid combinations like users list --show-avatars --show-only name. Use the source user array (stable identity) for avatar lookup instead of filtered row data.
💡 Proposed fix
- if (/^│/.test(stripped) && dataIdx >= 0 && dataIdx < rows.length) {
- const img = avatarMap.get(rows[dataIdx]!.id as number);
+ if (/^│/.test(stripped) && dataIdx >= 0 && dataIdx < rows.length) {
+ const sourceUserId = (users as User[])[dataIdx]!.id;
+ const img = avatarMap.get(sourceUserId);🤖 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 `@src/commands/users/index.ts` around lines 141 - 143, The avatar rendering
breaks because summarizeUserRow/applyShowExclude may drop the id when showOnly
is used; change the avatar lookup to use the original source user identity
rather than the filtered row: when mapping users (the users array passed into
summarizeUserRow and applyShowExclude) either attach the original id (e.g., a
hidden __origId) to each produced row or, better, keep and use the original
users array for avatar lookup (use users[dataIdx].id) when rendering avatars
instead of rows[dataIdx].id; update any code that currently references
rows[dataIdx].id (avatar rendering code) to read the id from the preserved
source (users) or the added __origId so avatars remain stable even when showOnly
omits id.
Summary
audienceis now parsed to a real JSON object informatExtraField, soabs exp get <id> --show audience -o json(and -o yaml) emit a nested object instead of an escaped string blob.--show-only <fields...>everywhere--showexists today —exp get,exp list,exp custom-fields, plus goals / metrics / users / teams / segments / customfields get & list. Replaces default columns entirely; mutually exclusive with--showand--exclude(throws at the command layer).-o renderedonexp getnow honors--show/--exclude/--show-only. The filtered summary drives every section (header table, audience block, variants, metric sections, custom-field sections). Default rendered output is preserved: when--show-onlyis absent,audience+ all custom-field titles are injected as implicit extras so today's output is unchanged. With--exclude audiencethe audience section disappears; with--show-only id nameonly the title, a two-row table, and footer render.Test plan
bun run test -- --run— 2416 passed (+29 new), 4 skippedbun run lint— cleanbun run typecheck— cleanabs --profile latam exp get 2812 -o json --show audienceshows audience as nested objectabs --profile latam exp get 2812 -o renderedmatches pre-change output byte-for-byteabs --profile latam exp get 2812 -o rendered --show-only id name audiencerenders only the requested minimumabs --profile latam exp get 2812 --show-only id name --show audienceexits non-zero with the mutual-exclusion errorSummary by CodeRabbit
New Features
Improvements
Refactor
Tests