Added access check in discovery, updated unittests and integration base test#19
Open
rsaha-qlik wants to merge 7 commits into
Open
Added access check in discovery, updated unittests and integration base test#19rsaha-qlik wants to merge 7 commits into
rsaha-qlik wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds discovery-time permission probing so streams that the configured Mailshake API key cannot access are excluded from the discovered catalog (instead of failing later during sync).
Changes:
- Added
check_stream_access()and updateddiscover()to probe top-level stream endpoints and exclude inaccessible streams, while only including child streams when their parent is accessible. - Updated CLI discovery wiring (
do_discover) to pass a constructed client intodiscover(client). - Reworked unit tests and the mock integration harness to accommodate the new
discover(client)signature and access-check behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
tap_mailshake/discover.py |
Introduces access probing and filters catalog streams based on permissions. |
tap_mailshake/__init__.py |
Passes the client through to discovery from the CLI entrypoint. |
tests/unittests/test_discover.py |
Adds/updates unit tests for access-check and stream exclusion behavior. |
tests/unittests/test_sync.py |
Updates schema-writing tests to call discover(client) with access-check patched. |
tests/_mock_tap_tester.py |
Updates mock “check mode” to call discover(client) under patched access-checks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
RushiT0122
requested changes
Jun 11, 2026
RushiT0122
left a comment
Contributor
There was a problem hiding this comment.
We are skipping ERROR Error status_code = 401 while check_access() at the beginning of tap execution. Ideally we should throw exception immediately if we don't valid permissions.
RushiT0122
requested changes
Jun 11, 2026
RushiT0122
left a comment
Contributor
There was a problem hiding this comment.
Standard metadata changes missing which is already handled in the PR#15.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of change
Summary
Added discovery-time access checks to
tap-mailshakeso that streams the API key cannot access are excluded from the catalog rather than causing a runtime error.Changes
tap_mailshake/discover.pycheck_stream_access(client, stream_name, stream_config) -> boolthat probes each top-level stream endpoint withperPage: 1and returnsFalseonMailshakeInvalidApiKeyError/MailshakeNotAuthorizedErrordiscover()to accept aclientargumentrecipients) are included only if their parent (campaigns) is accessible — child streams are never probed directlytap_mailshake/__init__.pydo_discover()to accept and passclienttodiscover(client)tests/unittests/test_discover.pycheck_stream_accessand pass aMagicMockclienttest_inaccessible_stream_excludedtest_child_stream_excluded_when_parent_inaccessibletest_child_stream_included_when_parent_accessibletest_child_stream_not_probed_directlytest_warning_logged_for_excluded_streamtest_all_inaccessible_raises_exceptiontests/unittests/test_sync.pyTestWriteSchematests to patchcheck_stream_accessand pass aMagicMockclient todiscover()tests/_mock_tap_tester.py_run_check_mode()to build a lightweightMailshakeClient(bypassing__init__) and calldiscover(client)withcheck_stream_accesspatched toTrue, matching the pattern used inrun_syncTesting
Manual QA steps
Risks
Rollback steps
AI generated code
https://internal.qlik.dev/general/ways-of-working/code-reviews/#guidelines-for-ai-generated-code