Skip to content

remove streams from catalog if not have permission#229

Open
mukeshbhatt18gl wants to merge 6 commits into
masterfrom
check_stream_permission
Open

remove streams from catalog if not have permission#229
mukeshbhatt18gl wants to merge 6 commits into
masterfrom
check_stream_permission

Conversation

@mukeshbhatt18gl
Copy link
Copy Markdown

Description of change

SAC-30778

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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates discovery to exclude streams from the generated catalog when the corresponding GitHub API endpoints are not accessible with the provided credentials (e.g., 403/404), aligning catalog output with actual permissions.

Changes:

  • Add discovery-time probing of top-level stream endpoints and exclude inaccessible streams (and their descendants) from the catalog.
  • Add a client helper (check_stream_accessible) to test endpoint accessibility.
  • Update unit tests to accommodate the new discovery behavior and minor formatting tweaks.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
tap_github/discover.py Adds endpoint probing and stream exclusion logic during discovery.
tap_github/client.py Introduces check_stream_accessible() helper used by discovery probing.
tests/unittests/test_main.py Updates/extends discovery tests and cleans up whitespace.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tap_github/discover.py Outdated
Comment thread tap_github/discover.py Outdated
Comment thread tap_github/discover.py Outdated
Comment thread tap_github/client.py
Comment thread tests/unittests/test_main.py Outdated
@mukeshbhatt18gl mukeshbhatt18gl changed the title code for remove stream from catalog if do not have permission remove streams from catalog if not have permission May 7, 2026
Comment thread tap_github/discover.py
Comment on lines +53 to +65
inaccessible_streams = set()
if repo_path:
for stream_name, stream_class in STREAMS.items():
stream_obj = stream_class()
if stream_obj.parent is None:
test_url = _build_access_check_url(client.base_url, stream_obj, repo_path, org)
if not client.check_stream_accessible(stream_name, test_url):
inaccessible_streams.add(stream_name)
LOGGER.warning(
"Stream '%s' will be excluded from the catalog: "
"insufficient permissions or resource not found.",
stream_name
)
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.

discovery() method is handling mulitple responsibilities, please separate those out.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed

Copy link
Copy Markdown
Contributor

@RushiT0122 RushiT0122 left a comment

Choose a reason for hiding this comment

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

Made some suggestions inline.

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