Skip to content

feat(events): add client-side --match/--top-level/--max-depth filters to json-layouts/json-values (FT-1969)#43

Merged
joalves merged 6 commits into
mainfrom
feat/FT-1969/events-json-filters
May 29, 2026
Merged

feat(events): add client-side --match/--top-level/--max-depth filters to json-layouts/json-values (FT-1969)#43
joalves merged 6 commits into
mainfrom
feat/FT-1969/events-json-filters

Conversation

@joalves
Copy link
Copy Markdown
Collaborator

@joalves joalves commented May 29, 2026

Summary

abs events json-layouts and events json-values return a columnar { columnNames, columnTypes, rows } result with no way to narrow it — debugging goal property paths/values meant piping the JSON into ad-hoc scripts. This adds client-side filtering:

  • events json-layouts: --match <regex> (case-insensitive, filters the path/key column), --top-level (only no-slash paths), --max-depth <n> (paths with at most N /-separated segments; --top-level is shorthand for --max-depth 1).
  • events json-values: --match <regex> (case-insensitive, filters the value column).

Filtering is pure client-side post-processing — a single helper filterColumnarRows(data, column, opts) filters rows against a named column and preserves the columnar shape, so table and -o json output are unaffected. Filters compose with AND. Invalid regex / non-positive --max-depth fail fast with a clear error. If the response shape or column is unexpectedly absent, the filter is skipped with a stderr warning (fail-open, but not silent).

Bumps CLI version to 1.8.0.

JIRA: FT-1969

Test Plan

  • Unit tests for filterColumnarRows: regex (case-insensitive, alternation), key vs value column, invalid-regex error, top-level, max-depth, topLevel precedence, bad-depth error, AND composition, no-op returns (no filters / non-columnar / absent column) + non-mutation + stderr-warning behavior
  • Command-level tests for both commands (filtered + passthrough paths) and the invalid---match CLI error
  • Full suite green (2488 passed, 0 failed); typecheck + lint + prettier clean
  • Live smoke test (latam, goal 164): --match segment_flight → only items/N/segment_flight_number; --top-level → only no-slash keys; --match LA8186 → only matching values

Summary by CodeRabbit

Release Notes

  • New Features

    • Added --match option for case-insensitive regex filtering of event data.
    • Added --top-level option to display only top-level paths in layouts.
    • Added --max-depth option to limit path nesting depth in results.
  • Documentation

    • Updated Events documentation with examples demonstrating new filtering capabilities.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dc6a8a5e-0339-4394-b02c-672b4fade823

📥 Commits

Reviewing files that changed from the base of the PR and between b211c63 and 4b9d562.

📒 Files selected for processing (6)
  • README.md
  • package.json
  • src/commands/events/events.test.ts
  • src/commands/events/index.ts
  • src/core/events/json-filter.test.ts
  • src/core/events/json-filter.ts

Walkthrough

This PR adds client-side filtering for columnar event query results across the abs events json-values and abs events json-layouts subcommands. A new core filtering utility (src/core/events/json-filter.ts) exports ColumnarFilterOptions, hasColumnarFilters(), and filterColumnarRows() to support case-insensitive regex matching (--match), top-level path filtering (--top-level), and path depth constraints (--max-depth). The events CLI now accepts these options for both subcommands, applying the filters after fetching data and before printing results. Comprehensive tests cover filtering logic, error handling, and end-to-end CLI behaviour. The package version is incremented to 1.8.0, and README examples demonstrate the new functionality.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Filterin' event rows with regex flair,
Depths and patterns floating through the air!
Columnar shapes trimmed by CLI cheer,
Tests assure all filtering crystal clear.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding client-side filtering options (--match, --top-level, --max-depth) to json-layouts and json-values commands.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 feat/FT-1969/events-json-filters

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/commands/events/events.test.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

src/commands/events/index.ts

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

src/core/events/json-filter.test.ts

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

  • 1 others

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

@joalves joalves added this pull request to the merge queue May 29, 2026
Merged via the queue into main with commit 996a4b4 May 29, 2026
5 checks passed
@joalves joalves deleted the feat/FT-1969/events-json-filters branch May 29, 2026 18:58
@joalves joalves mentioned this pull request May 29, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant