Skip to content

test(vercel): add unit tests for extract helpers - #4672

Open
ThePhaniVemuri wants to merge 2 commits into
Tracer-Cloud:mainfrom
ThePhaniVemuri:issue/4653-unit-tests-for-vercel-text-extractors
Open

test(vercel): add unit tests for extract helpers#4672
ThePhaniVemuri wants to merge 2 commits into
Tracer-Cloud:mainfrom
ThePhaniVemuri:issue/4653-unit-tests-for-vercel-text-extractors

Conversation

@ThePhaniVemuri

Copy link
Copy Markdown

Fixes #4653

Describe the changes you have made in this PR

Added unit tests for the following helper functions in integrations/vercel/client.py:

  • _extract_event_text
  • _extract_runtime_log_message

The tests cover:

  • Top-level text extraction
  • Nested payload.text extraction
  • Missing and empty payloads
  • Top-level message extraction
  • Fallback to payload.text, payload.message, and payload.body
  • Non-dictionary payload handling
  • Payload field precedence

No production code was modified.

Demo/Screenshot for feature changes and bug fixes

Not applicable. This PR only adds unit tests.


Code Understanding and AI Usage

  • No, I wrote all the code myself
  • Yes, I used AI assistance (continue below)

If you used AI assistance

  • I have reviewed every single line of the AI-generated code.
  • I can explain the purpose and logic of each function/component I added.
  • I have tested edge cases and understand how the code handles them.
  • I have modified the AI output to follow this project's coding standards and conventions.

Explain your implementation approach

I first reviewed the implementations of _extract_event_text and _extract_runtime_log_message to understand their behavior and fallback logic.

Based on the implementation and the issue requirements, I identified the expected behaviors and wrote unit tests covering normal inputs, fallback paths, and missing/empty payload cases. I verified the tests locally using pytest and ensured the test file passes formatting and linting checks with Ruff.


Checklist before requesting a review

  • I have added proper PR title and linked to the issue.
  • I have performed a self-review of my code.
  • I can explain the purpose of every function, class, and logic block I added.
  • I understand why my changes work and have tested them thoroughly.
  • I have considered potential edge cases and how my code handles them.
  • If it is a core feature, I have added thorough tests.
  • My code follows the project's style guidelines and conventions.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Greptile code review

This repo uses Greptile for automated review. Before merge, aim for Confidence Score: 5/5 with zero unresolved review threads — see CONTRIBUTING.md.

Run a review — add a PR comment with:

@greptile review

Give it ~5-10 minutes (sometimes longer) for results, then fix feedback and re-trigger until you reach Confidence Score: 5/5.

Optional: automate with the greploop skill.

@ThePhaniVemuri

Copy link
Copy Markdown
Author

@greptile review

@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds focused unit tests for Vercel event-text and runtime-log extraction helpers, covering field precedence, fallback behavior, empty values, missing fields, and non-dictionary payloads.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
tests/integrations/vercel/test_extract_helpers.py Adds discoverable unit tests whose assertions align with the current helper implementations and established test patterns.

Reviews (2): Last reviewed commit: "test(vercel): add explicit empty value t..." | Re-trigger Greptile

@cerencamkiran cerencamkiran left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could you also add explicit tests for empty values? The issue asks for both missing and empty cases.

@ThePhaniVemuri

Copy link
Copy Markdown
Author

Could you also add explicit tests for empty values? The issue asks for both missing and empty cases.

Thanks for the review, I'll add explicit tests for empty values and update the PR shortly.

@ThePhaniVemuri

Copy link
Copy Markdown
Author

@greptile review

@ThePhaniVemuri

Copy link
Copy Markdown
Author

Could you also add explicit tests for empty values? The issue asks for both missing and empty cases.

Done! I've added explicit empty-value test cases and pushed the update.

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.

C-43: Unit tests for Vercel text extractors

2 participants