Skip to content

fix(registry): normalize legacy table search payloads#2197

Merged
topher-lo merged 2 commits intomainfrom
codex/investigate-and-fix-search_rows-execution-error
Feb 26, 2026
Merged

fix(registry): normalize legacy table search payloads#2197
topher-lo merged 2 commits intomainfrom
codex/investigate-and-fix-search_rows-execution-error

Conversation

@topher-lo
Copy link
Contributor

@topher-lo topher-lo commented Feb 26, 2026

Motivation

  • The SDK TablesClient.search_rows() accepted either a raw list or a paginated dict containing items, and raised ValueError("Unexpected search response") for other dict shapes; some deployments still return paginated payloads keyed as rows, causing executor failures when calling tracecat_registry.core.table.search_rows.

Description

  • Updated packages/tracecat-registry/tracecat_registry/sdk/tables.py::TablesClient.search_rows to accept the canonical items paginated payload and to normalize legacy rows-based paginated payloads into a types.TableSearchResponse shape while preserving existing validation.
  • Normalization maps rows -> items and forwards next_cursor, prev_cursor, has_more, has_previous, and optional total_estimate into the returned response.
  • Added unit tests in tests/registry/test_tables_sdk.py that verify normalization of the legacy rows payload and that unexpected dict shapes still raise ValueError("Unexpected search response").

Testing

  • Ran uv run ruff check packages/tracecat-registry/tracecat_registry/sdk/tables.py tests/registry/test_tables_sdk.py which passed.
  • Attempted uv run pytest tests/registry/test_tables_sdk.py tests/registry/test_core_table.py -q, but the run failed in this environment due to missing PostgreSQL on localhost:5432 required by test fixtures, preventing a full test run here.
  • The change is covered by the new SDK-focused tests and will be verified in CI where the full test environment (including the database) is available.

Codex Task


Summary by cubic

Normalize legacy table search responses in TablesClient.search_rows to support old "rows" pagination alongside "items". This prevents executor errors on deployments that still return "rows".

  • Bug Fixes
    • Map rows -> items and forward next_cursor, prev_cursor, has_more, has_previous, and optional total_estimate into TableSearchResponse.
    • Keep strict validation; unexpected dict shapes still raise ValueError("Unexpected search response").
    • Add unit tests with typing-safe assertions to cover normalization and the rejection path.

Written for commit 95d899c. Summary will update on new commits.

@topher-lo topher-lo added fix Bug fix core-actions Improvements to core Tracecat actions labels Feb 26, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

@topher-lo topher-lo merged commit 45586ed into main Feb 26, 2026
15 checks passed
@topher-lo topher-lo deleted the codex/investigate-and-fix-search_rows-execution-error branch February 26, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex core-actions Improvements to core Tracecat actions fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant