Skip to content

fix(ers): Add postgres_object_array output transformation for JSON/JSONB array results - #3811

Open
ryanulit wants to merge 1 commit into
mainfrom
fix/add-postgres-object-array-om-transform
Open

fix(ers): Add postgres_object_array output transformation for JSON/JSONB array results#3811
ryanulit wants to merge 1 commit into
mainfrom
fix/add-postgres-object-array-om-transform

Conversation

@ryanulit

@ryanulit ryanulit commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Proposed Changes

closes #3813

Checklist

  • I have added or updated unit tests
  • I have added or updated integration tests (if appropriate)
  • I have added or updated documentation

Testing Instructions

Summary by CodeRabbit

  • Enhancements
    • Added support for converting PostgreSQL object arrays into structured object lists.
    • Improved handling of empty, null, JSON, and mixed-value array formats.
    • Added clearer validation errors for invalid array elements and unsupported input types.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The output mapper adds the postgres_object_array transformation. It converts PostgreSQL JSON/JSONB object arrays from supported input shapes into []map[string]any and reports contextual errors. Table-driven tests cover successful conversions, empty inputs, malformed data, and unsupported types.

Changes

Postgres object array support

Layer / File(s) Summary
Array transformation and validation
service/entityresolution/multi-strategy/output_mapper.go, service/entityresolution/multi-strategy/output_mapper_test.go
The dispatcher registers postgres_object_array. The mapper handles nil, parsed slices, []any, JSON bytes, and strings. Tests validate conversions and indexed or type-specific errors.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • #3803 — The change updates transformation handling in output_mapper.go and may align with registry refactoring for PostgreSQL object transformations.

Suggested reviewers: strantalis

Poem

I’m a rabbit with arrays to map,
JSON objects in a tidy stack.
Bytes and strings now find their way,
Nil becomes an empty tray.
Errors point to where they hide—
Hop, hop, structured data inside!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation and tests cover the linked issue requirements for postgres_object_array inputs, outputs, coercion, and errors [#3813].
Out of Scope Changes check ✅ Passed The changes are limited to the requested transformation and its focused tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the addition of the postgres_object_array output transformation for JSON/JSONB array results.
✨ 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/add-postgres-object-array-om-transform

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions

Copy link
Copy Markdown
Contributor
Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 224.278046ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 118.871201ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 421.777228ms
Throughput 237.09 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 50.789440668s
Average Latency 506.717685ms
Throughput 98.45 requests/second

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Govulncheck found vulnerabilities ⚠️

The following modules have known vulnerabilities:

  • examples
  • otdfctl
  • sdk
  • service
  • lib/fixtures
  • tests-bdd

See the workflow run for details.

@ryanulit
ryanulit marked this pull request as ready for review July 31, 2026 20:35
@ryanulit
ryanulit requested a review from a team as a code owner July 31, 2026 20:35

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 `@service/entityresolution/multi-strategy/output_mapper_test.go`:
- Around line 215-243: Update the table-driven cases in the output mapper tests
to include expected error-message fragments for each failure type, then assert
those fragments in the shared error-checking logic. Require “index 0” for
unsupported []any elements, “[]byte” or “string” for the respective JSON
decoding failures, and “got int” for unsupported top-level input, using the
existing test symbols and preserving the current hasError assertions.
🪄 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: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9495b266-6466-4acf-ab69-6586d1e9269c

📥 Commits

Reviewing files that changed from the base of the PR and between 9d79df1 and 8c0a104.

📒 Files selected for processing (2)
  • service/entityresolution/multi-strategy/output_mapper.go
  • service/entityresolution/multi-strategy/output_mapper_test.go

Comment thread service/entityresolution/multi-strategy/output_mapper_test.go
@ryanulit ryanulit changed the title fix(ers): add postgres object array transform to ers fix(ers): Add postgres_object_array output transformation for JSON/JSONB array results Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ers): add postgres_object_array output transformation for multi-strategy ERS

1 participant