Skip to content

test: add Vercel deployment sort regression tests for bad timestamps#1178

Merged
muddlebee merged 4 commits intoTracer-Cloud:mainfrom
Diwansu-pilania:feat/vercel-sort-regression-tests
May 1, 2026
Merged

test: add Vercel deployment sort regression tests for bad timestamps#1178
muddlebee merged 4 commits intoTracer-Cloud:mainfrom
Diwansu-pilania:feat/vercel-sort-regression-tests

Conversation

@Diwansu-pilania
Copy link
Copy Markdown
Contributor

Fixes #1121

Describe the changes you have made in this PR -

Added regression tests for _sort_deployment_stubs_newest_first in tests/app/remote/test_vercel_poller.py. These tests ensure that the Vercel deployment sorter handles malformed timestamps (missing, empty, or whitespace) gracefully and correctly filters out entries without a valid ID.

Demo/Screenshot for feature changes and bug fixes -

Verified the logic in a standalone environment using the correct field names (id and created_at).


Code Understanding and AI Usage

Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?

  • 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:
The implementation adds two test functions to the existing Vercel poller test suite.

  1. test_sort_deployment_stubs_handles_malformed_timestamps: Tests that the sorter doesn't crash when created_at is missing or empty, and that it treats these as the oldest possible date for sorting.
  2. test_sort_deployment_stubs_filters_invalid_ids: Confirms that the list comprehension correctly filters out stubs that don't have a valid id key.

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

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 1, 2026

Greptile Summary

This PR adds two regression tests for _sort_deployment_stubs_newest_first in tests/app/remote/test_vercel_poller.py, covering malformed/missing created_at timestamps and filtering of stubs with invalid id values. The test logic correctly reflects the implementation's behaviour (_deployment_created_sort_key falling back to "1970-01-01T00:00:00.000Z" and the id-strip filter). All three findings are P2 formatting violations — missing two-blank-line separators between the new test functions and a trailing space on a comment — which will cause make format-check / make lint to fail in CI.

Confidence Score: 5/5

Safe to merge after fixing the three ruff formatting issues (blank lines + trailing whitespace) that will otherwise block CI.

All findings are P2 style/formatting violations with no logical or correctness issues. The test assertions accurately reflect the production implementation's behaviour. Per confidence guidance, a PR with only P2 findings scores 5/5.

tests/app/remote/test_vercel_poller.py — three minor ruff violations to fix before CI will pass.

Important Files Changed

Filename Overview
tests/app/remote/test_vercel_poller.py Two new regression tests added for _sort_deployment_stubs_newest_first; test logic is correct but minor ruff/PEP-8 violations (missing blank lines, trailing whitespace) will cause make format-check / make lint to fail.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["_sort_deployment_stubs_newest_first(stubs)"] --> B{"isinstance(s, dict)\nAND str(s.get('id','')).strip() ?"}
    B -- "No (missing/whitespace id)" --> C["Filtered out"]
    B -- "Yes" --> D["_deployment_created_sort_key(stub)"]
    D --> E{"created_at\npresent & non-empty?"}
    E -- "No (missing/empty/whitespace)" --> F["Use fallback:\n'1970-01-01T00:00:00.000Z'"]
    E -- "Yes" --> G["Use raw created_at string"]
    F --> H["sorted(..., reverse=True)"]
    G --> H
    H --> I["Return newest-first list"]
    subgraph "New Tests"
        T1["test_sort_deployment_stubs_handles_malformed_timestamps"]
        T2["test_sort_deployment_stubs_filters_invalid_ids"]
    end
    T1 -.->|exercises| D
    T2 -.->|exercises| B
Loading

Reviews (1): Last reviewed commit: "test: add Vercel deployment sort regress..." | Re-trigger Greptile

Comment thread tests/app/remote/test_vercel_poller.py
Comment thread tests/app/remote/test_vercel_poller.py Outdated
Comment thread tests/app/remote/test_vercel_poller.py
@muddlebee muddlebee merged commit 3ed6236 into Tracer-Cloud:main May 1, 2026
10 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

🚀 Houston, we have a merge. @Diwansu-pilania your PR is in orbit. Thanks for launching this one!


👋 Join us on Discord - OpenSRE : hang out, contribute, or hunt for features and issues. Everyone's welcome.

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.

Add Vercel deployment sort regression tests for bad timestamps

2 participants