test: add Vercel deployment sort regression tests for bad timestamps#1178
Conversation
Greptile SummaryThis PR adds two regression tests for Confidence Score: 5/5Safe 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
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
Reviews (1): Last reviewed commit: "test: add Vercel deployment sort regress..." | Re-trigger Greptile |
|
🚀 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. |

Fixes #1121
Describe the changes you have made in this PR -
Added regression tests for
_sort_deployment_stubs_newest_firstintests/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 (
idandcreated_at).Code Understanding and AI Usage
Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?
If you used AI assistance:
Explain your implementation approach:
The implementation adds two test functions to the existing Vercel poller test suite.
test_sort_deployment_stubs_handles_malformed_timestamps: Tests that the sorter doesn't crash whencreated_atis missing or empty, and that it treats these as the oldest possible date for sorting.test_sort_deployment_stubs_filters_invalid_ids: Confirms that the list comprehension correctly filters out stubs that don't have a valididkey.Checklist before requesting a review