Skip to content

Revert "Merge pull request #117 from ChanukaUOJ/fix/enable-max-date-c…#118

Merged
zaeema-n merged 1 commit into
LDFLK:mainfrom
zaeema-n:main
Jul 8, 2026
Merged

Revert "Merge pull request #117 from ChanukaUOJ/fix/enable-max-date-c…#118
zaeema-n merged 1 commit into
LDFLK:mainfrom
zaeema-n:main

Conversation

@zaeema-n

@zaeema-n zaeema-n commented Jul 8, 2026

Copy link
Copy Markdown
Member

…abinet-flow"

This reverts commit 5432299, reversing changes made to 292e59b.

…ate-cabinet-flow"

This reverts commit 5432299, reversing
changes made to 292e59b.

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request introduces a check to limit the number of requested dates in fetch_cabinet_flow to prevent excessive queries, raising a BadRequestError if exceeded. However, changing the minimum dates validation from len(dates) < 2 to len(dates) == 1 inadvertently allows empty lists to bypass validation. The feedback recommends reverting this check to len(dates) < 2 and restoring the parameterized test coverage for both empty and single-element lists.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +503 to 504
if len(dates) == 1:
raise ValueError("At least 2 dates required for the comparison")

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.

medium

Changing the validation from len(dates) < 2 to len(dates) == 1 allows an empty list of dates (len(dates) == 0) to bypass this check without raising a ValueError. Since at least 2 dates are required for comparison, an empty list should also be rejected. Using len(dates) < 2 correctly handles both empty and single-element lists.

Suggested change
if len(dates) == 1:
raise ValueError("At least 2 dates required for the comparison")
if len(dates) < 2:
raise ValueError('At least 2 dates required for the comparison')

Comment on lines 796 to 802
@pytest.mark.asyncio
@pytest.mark.parametrize("dates", [[], ["2024-09-23"]])
async def test_fetch_cabinet_flow_insufficient_dates(organisation_service, dates):
async def test_fetch_cabinet_flow_single_date_fails(organisation_service):
president_id = "pres1"
dates = ["2024-09-23"]

with pytest.raises(ValueError):
await organisation_service.fetch_cabinet_flow(president_id, dates)

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.

medium

Restore the parameterized test to cover both empty lists and single-element lists of dates, ensuring that insufficient dates are correctly validated and raise a ValueError.

Suggested change
@pytest.mark.asyncio
@pytest.mark.parametrize("dates", [[], ["2024-09-23"]])
async def test_fetch_cabinet_flow_insufficient_dates(organisation_service, dates):
async def test_fetch_cabinet_flow_single_date_fails(organisation_service):
president_id = "pres1"
dates = ["2024-09-23"]
with pytest.raises(ValueError):
await organisation_service.fetch_cabinet_flow(president_id, dates)
@pytest.mark.asyncio
@pytest.mark.parametrize('dates', [[], ['2024-09-23']])
async def test_fetch_cabinet_flow_insufficient_dates(organisation_service, dates):
president_id = 'pres1'
with pytest.raises(ValueError):
await organisation_service.fetch_cabinet_flow(president_id, dates)

@ChanukaUOJ ChanukaUOJ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@zaeema-n
zaeema-n merged commit 01f70ea into LDFLK:main Jul 8, 2026
3 checks passed
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