Skip to content

refactor: sanitize Brokkr response by filtering invalid locations in parseOpportunity function#3387

Merged
idoshamun merged 1 commit intomainfrom
fix-parse-opp
Jan 1, 2026
Merged

refactor: sanitize Brokkr response by filtering invalid locations in parseOpportunity function#3387
idoshamun merged 1 commit intomainfrom
fix-parse-opp

Conversation

@idoshamun
Copy link
Copy Markdown
Member

No description provided.

@pulumi
Copy link
Copy Markdown

pulumi Bot commented Jan 1, 2026

🍹 The Update (preview) for dailydotdev/api/prod (at ea5a79a) was successful.

Resource Changes

    Name                                                   Type                           Operation
~   vpc-native-update-source-tag-view-cron                 kubernetes:batch/v1:CronJob    update
~   vpc-native-hourly-notification-cron                    kubernetes:batch/v1:CronJob    update
~   vpc-native-post-analytics-clickhouse-cron              kubernetes:batch/v1:CronJob    update
~   vpc-native-personalized-digest-deployment              kubernetes:apps/v1:Deployment  update
~   vpc-native-sync-subscription-with-cio-cron             kubernetes:batch/v1:CronJob    update
~   vpc-native-update-tag-recommendations-cron             kubernetes:batch/v1:CronJob    update
+   vpc-native-api-clickhouse-migration-ac2f27c3           kubernetes:batch/v1:Job        create
~   vpc-native-clean-zombie-opportunities-cron             kubernetes:batch/v1:CronJob    update
-   vpc-native-api-db-migration-f8d9095e                   kubernetes:batch/v1:Job        delete
~   vpc-native-update-tags-str-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-daily-digest-cron                           kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-stale-user-transactions-cron          kubernetes:batch/v1:CronJob    update
~   vpc-native-generic-referral-reminder-cron              kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-users-cron                     kubernetes:batch/v1:CronJob    update
~   vpc-native-generate-search-invites-cron                kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-images-cron                    kubernetes:batch/v1:CronJob    update
~   vpc-native-temporal-deployment                         kubernetes:apps/v1:Deployment  update
~   vpc-native-update-trending-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-personalized-digest-cron                    kubernetes:batch/v1:CronJob    update
+   vpc-native-api-db-migration-ac2f27c3                   kubernetes:batch/v1:Job        create
~   vpc-native-post-analytics-history-day-clickhouse-cron  kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-gifted-plus-cron                      kubernetes:batch/v1:CronJob    update
~   vpc-native-update-highlighted-views-cron               kubernetes:batch/v1:CronJob    update
~   vpc-native-update-current-streak-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-bg-deployment                               kubernetes:apps/v1:Deployment  update
~   vpc-native-private-deployment                          kubernetes:apps/v1:Deployment  update
~   vpc-native-update-source-public-threshold-cron         kubernetes:batch/v1:CronJob    update
~   vpc-native-validate-active-users-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-deployment                                  kubernetes:apps/v1:Deployment  update
~   vpc-native-clean-zombie-user-companies-cron            kubernetes:batch/v1:CronJob    update
~   vpc-native-update-views-cron                           kubernetes:batch/v1:CronJob    update
~   vpc-native-user-profile-updated-sync-cron              kubernetes:batch/v1:CronJob    update
~   vpc-native-calculate-top-readers-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-check-analytics-report-cron                 kubernetes:batch/v1:CronJob    update
~   vpc-native-ws-deployment                               kubernetes:apps/v1:Deployment  update
-   vpc-native-api-clickhouse-migration-f8d9095e           kubernetes:batch/v1:Job        delete

@idoshamun idoshamun merged commit a7e8424 into main Jan 1, 2026
9 of 10 checks passed
@idoshamun idoshamun deleted the fix-parse-opp branch January 1, 2026 20:45
location: Array.isArray(result.opportunity?.location)
? result.opportunity.location.filter((loc: Location) => {
// Only keep locations with valid country
return loc?.country && loc.country.trim().length > 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

think actually we should look at those with iso2, since that one is actually important for process down the line

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

but i think country is the one we make strict, right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should be both, gondul looks only at ISO so it can't do anything with country name

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@claude fix it in a new branch

Copy link
Copy Markdown

@claude claude Bot Jan 5, 2026

Choose a reason for hiding this comment

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

Claude finished @idoshamun's task —— View jobclaude/pr-3387-20260105-0931Create PR ➔


✅ Fixed location filtering to check both country and iso2

Updated the location filtering logic in parseOpportunity function to validate both country and iso2 fields, ensuring gondul has valid ISO codes for downstream processing.

Todo List:

  • Read current implementation in parseOpportunity function
  • Update filtering logic to check both country and iso2 fields
  • Commit and push changes
  • Provide PR creation link

Changes Made:

  • Updated src/common/opportunity/parse.ts:209 to filter locations based on both country and iso2 validation
  • Added checks to ensure both fields are present and have non-empty trimmed values
  • This prevents invalid location data from reaching gondul which requires valid ISO codes

@idoshamun
Copy link
Copy Markdown
Member Author

@claude fix Ante's comment on a new branch

@claude
Copy link
Copy Markdown

claude Bot commented Jan 5, 2026

Claude finished @idoshamun's task in 1m 20s —— View jobclaude/pr-3387-20260105-0934


✅ Fixed location validation to check both country and iso2

Updated the location filtering logic in parseOpportunity function to validate both country and iso2 fields, ensuring gondul has valid ISO codes for downstream processing.

Todo List:

  • Read current implementation in parseOpportunity function
  • Update filtering logic to validate both country and iso2 fields
  • Commit and push changes
  • Provide PR creation link

Changes Made:

  • Updated src/common/opportunity/parse.ts:228-237 to filter locations based on both country AND iso2 validation
  • Added checks to ensure both fields are present and have non-empty trimmed values
  • This prevents invalid location data from reaching gondul which requires valid ISO codes

Create PR

--- • claude/pr-3387-20260105-0934

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.

2 participants