Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(file-based): new AbstractFileBasedStreamPermissionsReader #402

Conversation

aldogonzalez8
Copy link
Contributor

@aldogonzalez8 aldogonzalez8 commented Mar 10, 2025

What

Introduced an AbstractFileBasedStreamPermissionsReader class to handle permission-related tasks for file-based streams.

This should fix to have to make noops like here ISP!!

I already have two PRs waiting for this change:

How

  • Created an abstract base class, AbstractFileBasedStreamPermissionsReader, to encapsulate permission-checking logic.
  • This class defines methods that subclasses must implement to verify necessary permissions for file-based streams.
  • Refactored existing code to utilize this new class, promoting cleaner and more maintainable code by separating permission logic from other functionalities.

Review guide

Here are the relevant files to review:

  1. airbyte_cdk/sources/file_based/file_based_source.py:
    • Integrates the new permission reader into the file-based source logic.
  2. airbyte_cdk/sources/file_based/file_based_stream_permissions_reader.py:
    • Defines the AbstractFileBasedStreamPermissionsReader and its core permission-handling logic.
  3. airbyte_cdk/sources/file_based/file_based_stream_reader.py:
    • Updates the stream reader to delegate permission verification to the new permission reader class.
  4. airbyte_cdk/sources/file_based/stream/identities_stream.py:
    • Modifies the identities stream to align with the new permission-handling structure.
  5. airbyte_cdk/sources/file_based/stream/permissions_file_based_stream.py:
    • Introduces or modifies the permission-based stream functionality to work with the new reader.

These files reflect the core changes introduced in this pull request, focusing on the integration of the AbstractFileBasedStreamPermissionsReader across relevant file-based stream implementations.

User Impact

Users should experience no changes in functionality. This refactoring is internal and does not alter any external interfaces or behaviors.

Can this PR be safely reverted and rolled back?

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced a dedicated mechanism for handling file permissions in file-based streams.
  • Refactor

    • Unified stream identity and permissions functionalities by integrating the new permissions management.
    • Removed legacy methods to streamline permission-related processes.
  • Tests

    • Updated test suites to validate the new permissions handling and ensure consistent stream behavior.

@github-actions github-actions bot added the enhancement New feature or request label Mar 10, 2025
@aldogonzalez8 aldogonzalez8 changed the title feat(file-based): new Permissions Reader Class feat(file-based): new AbstractFileBasedStreamPermissionsReader Mar 10, 2025
Copy link
Contributor

coderabbitai bot commented Mar 10, 2025

📝 Walkthrough

Walkthrough

This pull request introduces a new abstract class, AbstractFileBasedStreamPermissionsReader, to manage file permissions and identity schema handling. The FileBasedSource class now accepts a new parameter, stream_permissions_reader, which is utilized in its methods for creating permissions and identity streams. Additionally, methods and properties related to permissions have been removed from the legacy AbstractFileBasedStreamReader, and corresponding stream classes and unit tests have been updated accordingly.

Changes

File Path(s) Change Summary
airbyte_cdk/sources/file_based/file_based_source.py
airbyte_cdk/sources/file_based/file_based_stream_permissions_reader.py
airbyte_cdk/sources/file_based/file_based_stream_reader.py
Introduced AbstractFileBasedStreamPermissionsReader; updated FileBasedSource to accept a new stream_permissions_reader parameter and integrate it in _make_permissions_stream and _make_identities_stream; removed legacy permissions methods from AbstractFileBasedStreamReader.
airbyte_cdk/sources/file_based/stream/identities_stream.py
airbyte_cdk/sources/file_based/stream/permissions_file_based_stream.py
Updated constructors and methods to replace stream_reader with stream_permissions_reader for permissions and identity handling.
unit_tests/sources/file_based/stream/test_file_identities_stream.py
unit_tests/sources/file_based/stream/test_permissions_file_based_stream.py
Modified tests to use AbstractFileBasedStreamPermissionsReader mocks and adjust assertions for permissions-related functionality.

Sequence Diagram(s)

Loading
sequenceDiagram
  participant Client
  participant FileBasedSource
  participant PermissionsFileBasedStream
  participant FileIdentitiesStream
  participant PermissionsReader

  Client->>FileBasedSource: Initialize(stream_permissions_reader)
  FileBasedSource->>PermissionsFileBasedStream: _make_permissions_stream(stream_permissions_reader)
  FileBasedSource->>FileIdentitiesStream: _make_identities_stream(stream_permissions_reader)
  FileIdentitiesStream->>PermissionsReader: load_identity_groups()
  PermissionsFileBasedStream->>PermissionsReader: get_file_acl_permissions(file)

Possibly related PRs

  • feat(file-based): sync file acl permissions and identities #260 – The changes in this PR enhance the handling of stream permissions by integrating a dedicated permissions reader into the FileBasedSource class, which relates to modifications in the retrieved PR that also focus on syncing file ACL permissions and identities.

Suggested reviewers

  • aaronsteers – Interested in the design and integration of the new permissions reader, wdyt?
  • maxi297 – Familiar with the file-based stream changes; could provide valuable insights, wdyt?
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sorry, something went wrong.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (10)
airbyte_cdk/sources/file_based/stream/identities_stream.py (3)

29-29: Add docstring for new parameter?
Would you like to expand the docstring to clarify this parameter's role (e.g., describing what the caller should pass in)? wdyt?


35-35: Consider renaming the attribute.
Would you consider prefixing it with an underscore (e.g., _stream_permissions_reader) if it's intended to be private? wdyt?


45-45: Loading large identity groups?
If you expect a lot of identities, might you want partial fetching or pagination to avoid large in-memory sets? wdyt?

airbyte_cdk/sources/file_based/file_based_stream_permissions_reader.py (7)

5-8: Imports are minimal and clear.
No issues here, though if you need advanced ABC features, you might consider typing_extensions. wdyt?


9-9: Use of RemoteFile
Is there a possibility you might also read from local files in future? If so, do you foresee expanding or renaming this class? wdyt?


12-15: Class docstring looks helpful.
Would you consider adding clarifications on how logger should be provided and used in each method? wdyt?


17-34: Consider typed return for ACL permissions.
Would you consider returning a dataclass or typed model instead of a generic Dict for future type-checking? wdyt?


36-58: Potential pagination approach
If there could be many identities, might you want to handle partial fetching to avoid memory spikes? wdyt?


60-84: Schema location
Would you store this schema in a separate JSON resource for easier updates and versioning, rather than in code? wdyt?


86-109: Collaboration with file_permissions_schema
Might you share definitions across both permission and identity schemas (e.g., common fields) to reduce duplication? wdyt?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 969dec1 and 4bf8d8e.

📒 Files selected for processing (7)
  • airbyte_cdk/sources/file_based/file_based_source.py (5 hunks)
  • airbyte_cdk/sources/file_based/file_based_stream_permissions_reader.py (1 hunks)
  • airbyte_cdk/sources/file_based/file_based_stream_reader.py (0 hunks)
  • airbyte_cdk/sources/file_based/stream/identities_stream.py (3 hunks)
  • airbyte_cdk/sources/file_based/stream/permissions_file_based_stream.py (4 hunks)
  • unit_tests/sources/file_based/stream/test_file_identities_stream.py (3 hunks)
  • unit_tests/sources/file_based/stream/test_permissions_file_based_stream.py (5 hunks)
💤 Files with no reviewable changes (1)
  • airbyte_cdk/sources/file_based/file_based_stream_reader.py
🧰 Additional context used
🪛 GitHub Actions: Linters
airbyte_cdk/sources/file_based/file_based_source.py

[error] 106-106: Incompatible default for argument 'stream_permissions_reader' (default has type 'None', argument has type 'AbstractFileBasedStreamPermissionsReader'). PEP 484 prohibits implicit Optional.

⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Check: 'source-pokeapi' (skip=false)
  • GitHub Check: Check: 'source-amplitude' (skip=false)
  • GitHub Check: Check: 'source-shopify' (skip=false)
  • GitHub Check: Check: 'source-hardcoded-records' (skip=false)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (Fast)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: SDM Docker Image Build
  • GitHub Check: Analyze (python)
🔇 Additional comments (24)
unit_tests/sources/file_based/stream/test_permissions_file_based_stream.py (5)

17-19: Import looks good, aligned with the PR objective.

The import of AbstractFileBasedStreamPermissionsReader properly sets up the test to work with the new permissions reader class.


59-59: Good addition of the permissions reader mock.

This adds the necessary mock for the new permissions reader, keeping the test aligned with the implementation changes.


67-67: Setting schema on permissions reader is correct.

Moving the schema setting from stream_reader to stream_permissions_reader aligns with the new responsibility separation.


79-79: Proper constructor update.

Adding the stream_permissions_reader to the constructor ensures the test creates the stream with the correct dependencies.


83-83: Correctly updated test methods to use permissions reader.

The test methods now properly call methods on the new permissions reader mock rather than the stream reader, maintaining test functionality while adapting to the new implementation.

Also applies to: 110-112, 125-125

airbyte_cdk/sources/file_based/stream/permissions_file_based_stream.py (5)

10-12: Import of new permissions reader class looks good.

The import is properly structured and aligns with the PR objective of introducing a dedicated class for permissions handling.


32-37: Clean implementation of the updated constructor.

The constructor now properly accepts and stores the permissions reader, maintaining backward compatibility with the **kwargs pattern while adding the new required parameter.


41-41: Good refactoring of schema retrieval.

Switched from using stream_reader to stream_permissions_reader for schema retrieval, properly aligning with the new responsibility distribution.


52-54: Properly updated permissions retrieval.

Now using the specialized permissions reader to get file ACL permissions, which aligns with the separation of concerns.


94-94: Consistent schema retrieval update.

The _get_raw_json_schema method now also retrieves the schema from the permissions reader, maintaining consistency across all schema-related methods.

unit_tests/sources/file_based/stream/test_file_identities_stream.py (6)

15-17: Import for permissions reader looks good.

The import is properly structured and matches the implementation changes.


64-64: Good replacement of stream reader with permissions reader.

This change correctly updates the test to use the new permissions reader mock instead of the generic stream reader.


67-67: Correctly set schema on permissions reader.

The test now sets the identity schema on the permissions reader, aligning with implementation changes.


71-71: Updated constructor parameter correctly.

FileIdentitiesStream constructor is now called with stream_permissions_reader instead of stream_reader, matching the implementation changes.


77-80: Test correctly updated to use permissions reader.

The test now calls load_identity_groups on the permissions reader mock instead of the stream reader.


92-94: Exception handling properly updated.

The test now raises exceptions from the permissions reader mock, maintaining test coverage for error cases.

airbyte_cdk/sources/file_based/file_based_source.py (5)

51-53: Import for permissions reader looks good.

The import is properly structured and aligns with the PR objective.


109-109: Good storage of permissions reader in instance variable.

Properly stores the permissions reader for later use in stream creation methods.


348-350: Nice addition of docstring.

Adding a clear docstring to _make_permissions_stream helps explain its purpose and improves code documentation.


361-361: Properly updated stream creation.

Now passing the permissions reader to the PermissionsFileBasedStream constructor, aligning with the implementation changes.


384-384: Correctly updated identities stream creation.

Now using stream_permissions_reader for FileIdentitiesStream, maintaining consistency across the codebase.

airbyte_cdk/sources/file_based/stream/identities_stream.py (2)

11-13: Imports look good!
No issues here; everything seems in order. wdyt?


49-49: Validate identities schema?
Would you like to confirm that this schema is aligned with what the rest of the connector expects by adding a quick integration check? wdyt?

airbyte_cdk/sources/file_based/file_based_stream_permissions_reader.py (1)

1-4: License header looks proper.
Everything seems correct with the 2025 attribution. wdyt?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
airbyte_cdk/sources/file_based/file_based_source.py (1)

386-389: Consider reducing code duplication

This validation check is almost identical to the one in _make_permissions_stream. Would it make sense to extract this common validation to a helper method to avoid duplication, perhaps called _ensure_permissions_reader_available()? wdyt?

-        if not self.stream_permissions_reader:
-            raise ValueError(
-                "Stream permissions reader is required for streams that use permissions transfer mode."
-            )
+        self._ensure_permissions_reader_available()

+    def _ensure_permissions_reader_available(self):
+        """
+        Validates that a stream permissions reader is available.
+        Raises a ValueError if the reader is not provided.
+        """
+        if not self.stream_permissions_reader:
+            raise ValueError(
+                "Stream permissions reader is required for streams that use permissions transfer mode."
+            )
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4bf8d8e and 03dc23e.

📒 Files selected for processing (1)
  • airbyte_cdk/sources/file_based/file_based_source.py (5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (python)
🔇 Additional comments (6)
airbyte_cdk/sources/file_based/file_based_source.py (6)

51-53: Clean import addition

The import of AbstractFileBasedStreamPermissionsReader is well placed with related imports. This aligns with the PR objective of introducing a new permissions reader class.


106-106: Type annotation looks good

The parameter is correctly typed as Optional[AbstractFileBasedStreamPermissionsReader] with a default value of None. This resolves the previous linting issue that was flagged in a past review.


109-109: Instance variable assignment is appropriate

The assignment to self.stream_permissions_reader follows the existing pattern in the class and is placed logically with other similar assignments.


348-354: Good error handling with clear message

The validation check and error message provide clear guidance when the permissions reader is missing. The docstring also clearly explains the method's purpose.


365-365: Parameter update matches new architecture

Passing stream_permissions_reader to the PermissionsFileBasedStream constructor aligns with the refactoring goal of centralizing permission-checking logic.


392-392: Parameter name updated correctly

The parameter was changed from stream_reader to stream_permissions_reader which matches the new design that uses a dedicated permissions reader class.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
airbyte_cdk/sources/file_based/file_based_stream_permissions_reader.py (4)

34-35: Docstring references incorrect class name

I noticed the docstring refers to AbstractFileBasedStreamReader but this class is named AbstractFileBasedStreamPermissionsReader. Should we update this to reference the correct class name? wdyt?

-        Therefore, concrete implementations of AbstractFileBasedStreamReader's config setter should assert that `value` is of the correct
+        Therefore, concrete implementations of AbstractFileBasedStreamPermissionsReader's config setter should assert that `value` is of the correct

64-64: Return type mismatch in example docstring

The example method signature returns Dict[str, Any] but the actual method signature returns Iterable[Dict[str, Any]]. Should we make these consistent? wdyt?

-        def load_identity_groups(self, logger: logging.Logger) -> Dict[str, Any]:
+        def load_identity_groups(self, logger: logging.Logger) -> Iterable[Dict[str, Any]]:

90-90: Small typo in docstrings

I noticed "patter" in the docstring which should probably be "pattern". Would you like to fix this? wdyt?

-            # you can also follow the patter we have for python connectors and have a json file and read from there e.g. schemas/identities.json
+            # you can also follow the pattern we have for python connectors and have a json file and read from there e.g. schemas/identities.json

Also applies to: 116-116


125-126: Trailing comma in schema definition

There's a trailing comma inside the schema definition (line 125) which might cause issues in some JSON parsers. Would you like to remove it? wdyt?

                "name": { "type": ["null", "string"] },
                "email_address": { "type": ["null", "string"] },
                "member_email_addresses": { "type": ["null", "array"] },
-                "type": { "type": "string" },
+                "type": { "type": "string" }
              }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0a2b4d6 and 8b6212a.

📒 Files selected for processing (2)
  • airbyte_cdk/sources/file_based/file_based_source.py (6 hunks)
  • airbyte_cdk/sources/file_based/file_based_stream_permissions_reader.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • airbyte_cdk/sources/file_based/file_based_source.py
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Check: 'source-pokeapi' (skip=false)
  • GitHub Check: Check: 'source-amplitude' (skip=false)
  • GitHub Check: Check: 'source-shopify' (skip=false)
  • GitHub Check: Check: 'source-hardcoded-records' (skip=false)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (Fast)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: SDM Docker Image Build
  • GitHub Check: Analyze (python)
🔇 Additional comments (1)
airbyte_cdk/sources/file_based/file_based_stream_permissions_reader.py (1)

1-132: Great job on implementing this new abstract class!

The AbstractFileBasedStreamPermissionsReader class looks well-structured with clear abstract methods and detailed docstrings. The examples will be particularly helpful for developers implementing concrete subclasses.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (5)
airbyte_cdk/sources/file_based/file_based_stream_permissions_reader.py (5)

1-4: Check the copyright year

I noticed the copyright year is set to 2025. Would it make more sense to use the current year 2024 instead? Just checking if this was intentional or if we should adjust it, wdyt?


13-17: The class docstring could be more descriptive

The current docstring is quite brief. Perhaps we could enhance it to provide more context about how this class fits into the architecture and its relationship with other components in the system? Something like:

"This abstract class defines the interface for reading file permissions and identity information from a source. It's used by FileBasedSource to handle permission-related operations separately from stream reading functionality, allowing for better separation of concerns."

What do you think about expanding it this way?


34-36: Fix typo in docstring

There's a small typo in the docstring - "AbstractFileBasedStreamPermissionsReader's's" has an extra "'s".

- Therefore, concrete implementations of AbstractFileBasedStreamPermissionsReader's's config setter should assert that `value` is of the correct
+ Therefore, concrete implementations of AbstractFileBasedStreamPermissionsReader's config setter should assert that `value` is of the correct

What do you think?


64-77: Inconsistency in example variables

I noticed a few inconsistencies in the example:

  1. Line 72 uses groups.name but it should likely be group.name to match the variable name
  2. Line 72 references user.email but should likely be group.email
  3. Line 68 refers to self.google_directory_service which seems like an implementation-specific reference rather than a generic example

Would it make sense to standardize these variable names for clarity, wdyt?

- members_api = self.google_directory_service.members()
+ members_api = api_conn.members()
- group_obj = my_identity_model(id=group.id, name=groups.name, email_address=user.email, type="group").dict()
+ group_obj = my_identity_model(id=group.id, name=group.name, email_address=group.email, type="group").dict()

115-128: Remove trailing comma in JSON schema

There's a trailing comma after the "type" property in the schema definition. While this is valid in Python literals, it's not valid in strict JSON.

                "email_address": { "type": ["null", "string"] },
                "member_email_addresses": { "type": ["null", "array"] },
-               "type": { "type": "string" },
+               "type": { "type": "string" }

Would you like to remove it for consistency with standard JSON format?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8b6212a and 87e407e.

📒 Files selected for processing (1)
  • airbyte_cdk/sources/file_based/file_based_stream_permissions_reader.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Check: 'source-pokeapi' (skip=false)
  • GitHub Check: Check: 'source-amplitude' (skip=false)
  • GitHub Check: Check: 'source-shopify' (skip=false)
  • GitHub Check: Check: 'source-hardcoded-records' (skip=false)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: SDM Docker Image Build
  • GitHub Check: Pytest (Fast)
  • GitHub Check: Analyze (python)
🔇 Additional comments (3)
airbyte_cdk/sources/file_based/file_based_stream_permissions_reader.py (3)

45-53: Good example implementation

The example implementation is clear and helpful for understanding how to implement this method. I like the use of concrete examples to guide implementers.


89-103: Good schema example

The schema example is well-structured and provides a clear template for implementers to follow. The comments about alternative approaches (reading from a JSON file) are also helpful.


1-132: Overall good abstract class design

The abstract class is well-designed with clear method signatures, detailed docstrings, and helpful examples. The use of abstract methods and properties with informative error messages ensures that implementers will understand what they need to provide.

The separation of concerns between file permissions and stream reading is a good architectural decision that should improve maintainability. Nice work on this implementation!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
airbyte_cdk/sources/file_based/file_based_stream_permissions_reader.py (4)

34-34: Typographical edit needed.
There's a minor double 's's in the docstring that may confuse readers. Would you like to remove one of the 's to clarify?

-Therefore, concrete implementations of AbstractFileBasedStreamPermissionsReader's's config setter
+Therefore, concrete implementations of AbstractFileBasedStreamPermissionsReader's config setter

39-55: Clarify example references.
The sample snippet mentions some_api and SOME_CREDENTIALS as placeholders. Would you like to explicitly mark these as pseudo code to avoid confusion, or remove them if they are purely illustrative? wdyt?


78-101: Consider referencing an external JSON schema.
You mention that reading from a JSON file (like schemas/file_permissions.json) is a pattern followed in Python connectors. Would you like to adopt that approach here for maintainability? wdyt?


102-124: Consistent approach for schemas.
Similarly, for the identities schema, do you plan to keep it inline or move it to a dedicated JSON file for consistency? wdyt?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 87e407e and c084c2c.

📒 Files selected for processing (1)
  • airbyte_cdk/sources/file_based/file_based_stream_permissions_reader.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Check: 'source-pokeapi' (skip=false)
  • GitHub Check: Check: 'source-amplitude' (skip=false)
  • GitHub Check: Check: 'source-shopify' (skip=false)
  • GitHub Check: Check: 'source-hardcoded-records' (skip=false)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (Fast)
  • GitHub Check: SDM Docker Image Build
  • GitHub Check: Analyze (python)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
🔇 Additional comments (1)
airbyte_cdk/sources/file_based/file_based_stream_permissions_reader.py (1)

13-16: Nicely introduced abstract class.
This abstract class effectively sets the stage for file permission logic. Great approach!

@aldogonzalez8 aldogonzalez8 merged commit f0a57f1 into main Mar 12, 2025
25 checks passed
@aldogonzalez8 aldogonzalez8 deleted the aldogonzalez8/file-based/decouple-permissions-with-new-class branch March 12, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants