-
Notifications
You must be signed in to change notification settings - Fork 0
K1bs/4902/add search route #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary by CodeRabbitRelease Notes
WalkthroughAdds a new Programs#search_members API to perform bounded member searches with validated parameter combinations, updates README with usage and pagination notes, adds VCR cassettes for recorded search responses, and adds integration tests covering valid/invalid search parameter scenarios. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Caller
participant Lib as ProgramsResource
participant API as DataNexusAPI
rect rgba(200,230,255,0.5)
Client->>Lib: search_members(params)
Lib->>Lib: validate_search_params!(params)
end
rect rgba(200,255,200,0.5)
Lib->>API: POST /api/programs/:id/members/search (body: params)
API-->>Lib: 200 OK (data, more_results)
Lib-->>Client: return parsed response (hash with :data and :more_results)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@spec/integration/program_members_spec.rb`:
- Around line 79-113: The tests are failing because API responses are parsed
with string keys while callers expect symbol keys; update the connection layer
to return symbolized keys by modifying the response parsing in the
Connection#post (and any other request methods) to convert parsed JSON to symbol
keys (e.g., use JSON.parse with symbolize_names: true or call
deep_symbolize_keys on the parsed hash) so that callers can use result[:data]
and result[:more_results]; alternatively, if you prefer tests change, update the
spec expectations to use string keys ("data"/"more_results") everywhere instead
of symbols.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@spec/cassettes/program_members/search_employee_id.yml`:
- Around line 40-48: The cassette contains JSON string values that are split
across lines (e.g., the fields first_name, street_address_1, and
health_plan_coverage_tier), which can inject newlines/whitespace into parsed
values; fix by re-recording or normalizing the cassette so all JSON string
values are single-line (join the broken lines or escape newline characters) for
the affected entries (look for the member objects containing first_name,
street_address_1, health_plan_coverage_tier and employee_id placeholders) to
ensure compact, valid JSON strings.
- Around line 40-51: The cassette contains real PII in JSON fields (email,
phone_number, first_name, last_name, street_address_1, city, postal_code) —
replace those values with generic placeholders (e.g. "<EMAIL>", "<PHONE>",
"<FIRST_NAME>", "<LAST_NAME>", "<ADDRESS>", "<CITY>", "<POSTAL>") throughout the
cassette string and add corresponding filter_sensitive_data rules to your test
VCR/config so those keys (email, phone_number, first_name, last_name,
street_address_1, city, postal_code) are scrubbed automatically on record;
search for the JSON keys "email", "phone_number", "first_name", "last_name",
"street_address_1", "city", and "postal_code" in the cassette and update values
and VCR filters accordingly.
🧹 Nitpick comments (1)
spec/support/vcr.rb (1)
21-24: Scopeallow_playback_repeatsto targeted cassettes to keep tests strict.Making repeats global can hide accidental extra requests; with
match_requests_on: %i[method path], different POST bodies may also replay the same response. Consider enabling repeats only for specific cassettes or adding body matching where necessary.
|
[sc-4902] |
fastjames
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍰
Adds support for the
POST /api/programs/:program_id/members/searchendpoint.Invalid param combinations raise
ArgumentError.more_resultsflag (no pagination)