Skip to content

Upgrade api version to v2 for audit trial#131

Open
prijendev wants to merge 8 commits intomasterfrom
SAC-27501-upgrade-api-version-to-v2
Open

Upgrade api version to v2 for audit trial#131
prijendev wants to merge 8 commits intomasterfrom
SAC-27501-upgrade-api-version-to-v2

Conversation

@prijendev
Copy link
Copy Markdown
Contributor

Description of change

  • We are upgrading API version for mambu to v2.
    • In v1, we were using settings/organization to fetch the timezone info. In v2, setup/organization is the replacement of this endpoint but it requires admin permission and there’s no other way to fetch timezone info via API without that access. So, we have added configurable property timezone which we would use in case if customer has not provided admin creds.
    • Made necessary changes for audit_trial. But we have not tested that change because it requires Audit Trail API Key which we don't have.

Manual QA steps

Risks

Rollback steps

  • revert this branch

AI generated code

https://internal.qlik.dev/general/ways-of-working/code-reviews/#guidelines-for-ai-generated-code

  • this PR has been written with the help of GitHub Copilot or another generative AI tool

@vishalp-dev vishalp-dev self-requested a review September 24, 2025 05:43
@prijendev prijendev changed the title Upgrade api version to v2 Upgrade api version to v2 for audit trial Sep 24, 2025
Comment on lines +38 to +40
else:
raise RuntimeError("Unable to retrieve timezone information from the Mambu endpoint. Please provide administrator credentials or configure valid timezone in the UI(e.g., US/Pacific)." \
" Refer this for more details: https://support.mambu.com/docs/organization-contact-currency-and-timezone")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's too wide, let's follow PEP 8's 79-character line limit

Suggested change
else:
raise RuntimeError("Unable to retrieve timezone information from the Mambu endpoint. Please provide administrator credentials or configure valid timezone in the UI(e.g., US/Pacific)." \
" Refer this for more details: https://support.mambu.com/docs/organization-contact-currency-and-timezone")
raise RuntimeError(
"Unable to retrieve timezone information from the Mambu endpoint. "
"Please provide administrator credentials or configure valid timezone "
"in the UI(e.g., US/Pacific). Refer this for more details: "
"https://support.mambu.com/docs/organization-contact-currency-and-timezone"
)

Comment on lines +68 to 69
if self.has_more or self.start_datetime < self.end_datetime:
raise StopIteration()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This condition looks to me inverted. Shouldn't it raise when there's NO more data?

Comment on lines +47 to +51
def _all_fetch_batch_steps(self):
# Large buffer size can impact memory utilization of connector
# so empty the buffer once it reaches default max limit
if len(self.buffer) > self.max_buffer_size:
return
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This makes me still think of potential memory issues - buffer management logic may still accumulate large amounts of data because the check happens after fetching, not before. (just thinking out loud)

Copy link
Copy Markdown

@agzam agzam left a comment

Choose a reason for hiding this comment

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

I like good error messages - clear runtime errors. Backward compatibility looks good. Good debug logging. Overall - great work!

The 5-minute overlap strategy is confusing, consider adding some explanation in comments.

I don't like that the PR explicitly adds untested code path due to missing API keys, but that's what we have to roll with sometimes (not my call to make)

I really don't want to block this work - thus only comments for now. Will gladly give it another gander sometime later.

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.

3 participants