Skip to content

feat(connector-builder): add version constraint and wildcard support to manifest migrations #569

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

Merged
merged 3 commits into from
Jun 2, 2025

Conversation

lazebnyi
Copy link
Contributor

@lazebnyi lazebnyi commented May 28, 2025

What

Currently, the migration only accepts catalogs with versions that are not higher than the one specified in the registry.yaml file. This causes issues when some catalogs cannot be migrated due to stricter version constraints. We need to enhance the version handling to support a broader range of version definitions such as *, ==6.48.3, ~=1.2, >=1.0.0,<2.0.0, and 6.48.3.

Original slack thread - https://airbytehq-team.slack.com/archives/C08GNBT7AV7/p1747700015297039

How

Extended the _version_is_valid_for_migration method to support various version definition formats. Updated _handle_migration to adjust the version if necessary. Corresponding tests have been updated accordingly.

Summary by CodeRabbit

  • Documentation
    • Improved documentation for manifest migration registration by adding explicit examples of valid version specifiers.
  • Bug Fixes
    • Enhanced migration version matching to support wildcards and version specifiers, providing more nuanced migration application and version bumping behavior.
  • Tests
    • Updated and expanded test fixtures and test cases to reflect new versioning logic and migration metadata.
    • Introduced a dummy migration class for testing purposes.
  • Chores
    • Updated migration registry configuration to use a wildcard version, applying migrations to all versions.

@github-actions github-actions bot added the enhancement New feature or request label May 28, 2025
@lazebnyi lazebnyi changed the title feat: add version constraint and wildcard support to manifest migrations feat(connector-builder): add version constraint and wildcard support to manifest migrations May 28, 2025
@lazebnyi lazebnyi requested review from bnchrch, lmossman and maxi297 May 28, 2025 21:48
Copy link
Contributor

coderabbitai bot commented May 28, 2025

📝 Walkthrough

Walkthrough

The changes enhance the manifest migration system by improving version specifier handling, updating documentation with explicit version examples, refining migration application logic, and adjusting test fixtures and migration registry entries to use more flexible versioning. Imports and exports for migration classes are clarified, and tests now patch the migration registry for precise control.

Changes

File(s) Change Summary
airbyte_cdk/manifest_migrations/README.md Expanded documentation with explicit examples of valid version specifiers for migration registration.
airbyte_cdk/manifest_migrations/migration_handler.py Refined migration application logic: _version_is_valid_for_migration now returns two booleans for migration applicability and version bumping; logic is more nuanced and flexible for version specifiers.
airbyte_cdk/manifest_migrations/migrations/__init__.py Added imports and __all__ for three migration classes, making them explicitly exported.
airbyte_cdk/manifest_migrations/migrations/registry.yaml Changed migration version specifier from a fixed version to a wildcard "*", applying migrations to all versions.
unit_tests/manifest_migrations/conftest.py Updated test fixtures for new versioning logic, changed manifest versions and expected migration metadata, and added a DummyMigration class for testing.
unit_tests/manifest_migrations/test_manifest_migration.py Updated copyright year, reorganized imports, patched migration registry in tests, and unified resolver instantiation style.

Sequence Diagram(s)

sequenceDiagram
    participant ManifestMigrationHandler
    participant MigrationRegistry
    participant MigrationClass

    ManifestMigrationHandler->>MigrationRegistry: Get migrations for manifest version
    loop For each migration
        ManifestMigrationHandler->>ManifestMigrationHandler: _version_is_valid_for_migration(version, specifier)
        alt can_apply_migration
            ManifestMigrationHandler->>MigrationClass: Apply migration
            alt should_bump_version
                ManifestMigrationHandler->>Manifest: Bump manifest version
            end
        end
    end
Loading

Possibly related PRs

Suggested labels

manifest, migrations, airbyte-python-cdk

Suggested reviewers

  • lmossman
  • bnchrch

Would you like to consider adding an example migration entry in the documentation that demonstrates both the wildcard and a PEP 440 range side-by-side for extra clarity, wdyt?

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

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/manifest_migrations/migration_handler.py (1)

115-142: Robust implementation of the flexible version constraint system!

The rewritten _version_is_valid_for_migration method elegantly handles the three distinct version constraint scenarios:

  1. Wildcard ("*"): Always matches, no version bump needed - perfect for universal migrations
  2. PEP 440 operators: Uses SpecifierSet for proper spec validation, no version bump - great for range constraints
  3. Plain versions: Traditional concrete version comparison with version bumping - maintains backward compatibility

The comprehensive docstring with clear rules makes this logic very maintainable. One small suggestion: WDYT about adding some input validation to handle edge cases like empty strings or malformed version specifiers? This could prevent unexpected errors during migration processing.

 def _version_is_valid_for_migration(
     self,
     manifest_version: str,
     migration_version: str,
 ) -> Tuple[bool, bool]:
+    if not migration_version or not manifest_version:
+        return False, False
+    
     if migration_version == "*":
         return True, False

     if migration_version.startswith(("=", "!", ">", "<", "~")):
-        spec = SpecifierSet(migration_version)
-        return spec.contains(Version(manifest_version)), False
+        try:
+            spec = SpecifierSet(migration_version)
+            return spec.contains(Version(manifest_version)), False
+        except Exception:
+            return False, False

-    return Version(manifest_version) <= Version(migration_version), True
+    try:
+        return Version(manifest_version) <= Version(migration_version), True
+    except Exception:
+        return False, False
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7818b33 and cf6acd6.

📒 Files selected for processing (6)
  • airbyte_cdk/manifest_migrations/README.md (1 hunks)
  • airbyte_cdk/manifest_migrations/migration_handler.py (3 hunks)
  • airbyte_cdk/manifest_migrations/migrations/__init__.py (1 hunks)
  • airbyte_cdk/manifest_migrations/migrations/registry.yaml (1 hunks)
  • unit_tests/manifest_migrations/conftest.py (4 hunks)
  • unit_tests/manifest_migrations/test_manifest_migration.py (4 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
airbyte_cdk/manifest_migrations/migration_handler.py (2)
unit_tests/manifest_migrations/conftest.py (1)
  • _process_manifest (1222-1223)
airbyte_cdk/manifest_migrations/manifest_migration.py (1)
  • _process_manifest (94-134)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: Check: 'source-shopify' (skip=false)
  • GitHub Check: Check: 'source-amplitude' (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: Pytest (Fast)
🔇 Additional comments (17)
airbyte_cdk/manifest_migrations/migrations/registry.yaml (1)

6-6: Nice implementation of the wildcard version support!

The change from a fixed version "6.48.3" to the wildcard "*" effectively demonstrates the new flexible versioning capability. This means these migrations will apply to all manifest versions, which seems appropriate for these foundational HTTP requester migrations. The wildcard approach aligns well with the enhanced version matching logic described in the PR objectives. WDYT about this being the right approach for these particular migrations?

airbyte_cdk/manifest_migrations/README.md (1)

23-24: Excellent documentation enhancement!

These explicit examples of valid version specifiers are really helpful for users implementing migrations. The examples cover all the major PEP 440 specifier types: wildcards ("*"), exact matches ("==6.48.3"), compatible releases ("~=1.2"), version ranges (">=1.0.0,<2.0.0"), and simple version strings ("6.48.3"). This makes it much clearer how to use the new flexible versioning system. WDYT about also adding a brief explanation of when to use each type?

airbyte_cdk/manifest_migrations/migrations/__init__.py (1)

5-19: Clean package structure for migration exports!

The explicit imports and __all__ definition follow Python packaging best practices and make these migration classes properly accessible. The imported classes match the migrations referenced in the registry, which maintains good consistency across the codebase. WDYT about this approach for centralizing access to the migration classes?

airbyte_cdk/manifest_migrations/migration_handler.py (2)

9-11: Good addition of necessary imports!

The Tuple type import and SpecifierSet from packaging.specifiers are exactly what's needed for the enhanced version handling logic. These imports support the new tuple return type and PEP 440 specifier validation respectively. WDYT about the placement and necessity of these imports?


81-89: Excellent separation of migration application and version bumping logic!

The unpacking of the tuple return from _version_is_valid_for_migration into can_apply_migration and should_bump_version creates a clean separation of concerns. This allows migrations to be applied without necessarily bumping the version (like with wildcards or PEP 440 specifiers), which is exactly what the PR objectives described. The conditional version bumping on line 87-88 is a nice touch. WDYT about this approach for handling different version constraint behaviors?

unit_tests/manifest_migrations/conftest.py (6)

9-9: LGTM on the import addition.

The ManifestMigration import is correctly added to support the new DummyMigration class defined later in the file.


15-15: Version update aligns with enhanced migration versioning.

The change from "0.0.0" to "6.48.3" reflects the new migration versioning scheme that supports flexible version constraints. This creates a more realistic test scenario, wdyt?


498-509: Migration metadata correctly demonstrates version range support.

The updated metadata with from_version: "6.48.3" and to_version: ">=6.48.2,<6.50.0" effectively demonstrates the new version range capabilities mentioned in the PR objectives. This shows how the enhanced system handles compatible release versioning, wdyt?


837-837: Version reversion supports different test scenarios.

The change back to "0.0.0" in this fixture creates a different test scenario, which helps ensure the migration system works correctly across various starting versions.


1200-1212: Wildcard versioning demonstrates enhanced flexibility.

The use of "*" for to_version effectively demonstrates the wildcard support mentioned in the PR objectives. This shows how the system can now handle more flexible version matching beyond exact versions, wdyt?


1221-1232: Clean test stub implementation.

The DummyMigration class provides a minimal but complete implementation of the ManifestMigration interface. The stub methods with minimal logic are perfect for controlled testing scenarios. Nice approach to isolate test behavior, wdyt?

unit_tests/manifest_migrations/test_manifest_migration.py (6)

2-2: Standard copyright year update.

The copyright year update to 2025 is appropriate for the current changes.


4-20: Import additions support enhanced testing infrastructure.

The new imports (patch, migrations_registry, specific migration classes, and DummyMigration) are all necessary for the updated testing approach that provides precise control over migration behavior. Clean organization of the imports, wdyt?


26-36: Excellent test isolation with patch decorator.

The patch.dict approach provides precise control over which migrations are applied during testing. Using clear=True ensures clean test isolation, and the version range ">=6.48.2,<6.50.0" demonstrates the enhanced version constraint support. Great testing practice, wdyt?


46-48: Inline resolver instantiation improves test isolation.

The change from using the shared resolver instance to inline ManifestReferenceResolver() instantiation provides better test isolation by ensuring each test gets a fresh resolver instance. This prevents potential state sharing issues, wdyt?


73-73: Consistent test isolation pattern.

The patch decorator follows the same clean pattern as the first test, mapping "0.0.0" to the DummyMigration for controlled testing. This ensures the test behavior is predictable and isolated, wdyt?


82-82: Consistent resolver instantiation pattern.

The inline instantiation maintains consistency with the first test's approach, providing the same test isolation benefits throughout the test suite.

Copy link
Contributor

coderabbitai bot commented May 28, 2025

📝 Walkthrough

Walkthrough

This update refines the manifest migration framework by enhancing version matching logic, updating migration registry version specifications, improving documentation with explicit version examples, and adjusting related test fixtures and test logic to align with these changes. It also introduces a dummy migration class for testing.

Changes

File(s) Change Summary
airbyte_cdk/manifest_migrations/README.md Expanded documentation to include explicit examples of valid version specifiers for manifest migrations.
airbyte_cdk/manifest_migrations/migration_handler.py Updated _version_is_valid_for_migration to return a tuple (can_apply_migration, should_bump_version) and handle wildcard, specifier, and concrete version logic. Adjusted _handle_migration to use this tuple for migration application and version bumping.
airbyte_cdk/manifest_migrations/migrations/__init__.py Added imports and explicit __all__ for three migration classes: HttpRequesterPathToUrl, HttpRequesterRequestBodyJsonDataToRequestBody, and HttpRequesterUrlBaseToUrl.
airbyte_cdk/manifest_migrations/migrations/registry.yaml Changed migration version specifier from "6.48.3" to "*", making migrations apply to all versions.
unit_tests/manifest_migrations/conftest.py Updated test fixtures for manifest version and migration metadata changes. Introduced DummyMigration class as a minimal concrete migration for testing.
unit_tests/manifest_migrations/test_manifest_migration.py Updated copyright year, reorganized imports, added patching of migration registry, and switched to fresh resolver instances in tests. No changes to test logic or assertions.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Test
    participant Handler as ManifestMigrationHandler
    participant Migration as ManifestMigration

    Test->>Handler: _handle_migration(manifest, migration, migration_version)
    Handler->>Handler: _version_is_valid_for_migration(manifest_version, migration_version)
    Handler-->>Handler: (can_apply_migration, should_bump_version)
    alt can_apply_migration == True
        Handler->>Migration: should_migrate(manifest)
        alt should_migrate == True
            Handler->>Migration: migrate(manifest)
            alt should_bump_version == True
                Handler->>manifest: Update manifest version
            end
        end
    end
Loading

Possibly related PRs

  • airbytehq/airbyte-python-cdk#485: Introduces the initial manifest migration module and migration classes; this PR directly builds upon and modifies those core methods—wdyt?

Suggested labels

migrations, manifest

Suggested reviewers

  • darynaishchenko (Does this reviewer sound good for this PR, wdyt?)

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7818b33 and cf6acd6.

📒 Files selected for processing (6)
  • airbyte_cdk/manifest_migrations/README.md (1 hunks)
  • airbyte_cdk/manifest_migrations/migration_handler.py (3 hunks)
  • airbyte_cdk/manifest_migrations/migrations/__init__.py (1 hunks)
  • airbyte_cdk/manifest_migrations/migrations/registry.yaml (1 hunks)
  • unit_tests/manifest_migrations/conftest.py (4 hunks)
  • unit_tests/manifest_migrations/test_manifest_migration.py (4 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
airbyte_cdk/manifest_migrations/migrations/__init__.py (3)
airbyte_cdk/manifest_migrations/migrations/http_requester_path_to_url.py (1)
  • HttpRequesterPathToUrl (16-57)
airbyte_cdk/manifest_migrations/migrations/http_requester_request_body_json_data_to_request_body.py (1)
  • HttpRequesterRequestBodyJsonDataToRequestBody (13-76)
airbyte_cdk/manifest_migrations/migrations/http_requester_url_base_to_url.py (1)
  • HttpRequesterUrlBaseToUrl (13-41)
airbyte_cdk/manifest_migrations/migration_handler.py (2)
unit_tests/manifest_migrations/conftest.py (1)
  • _process_manifest (1222-1223)
airbyte_cdk/manifest_migrations/manifest_migration.py (1)
  • _process_manifest (94-134)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Check: 'source-shopify' (skip=false)
  • GitHub Check: Check: 'source-amplitude' (skip=false)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Pytest (Fast)
🔇 Additional comments (17)
airbyte_cdk/manifest_migrations/migrations/registry.yaml (1)

6-6: LGTM! Wildcard version implementation looks good.

The change from a fixed version "6.48.3" to "*" effectively implements universal migration application, which aligns perfectly with the PR objectives for enhanced version constraint support. This should allow these migrations to apply regardless of the manifest version, wdyt?

airbyte_cdk/manifest_migrations/README.md (1)

23-24: Excellent documentation enhancement!

These explicit version specifier examples significantly improve clarity for users implementing migrations. The examples cover all the key formats mentioned in the PR objectives (wildcards, exact matches, compatible releases, ranges, and simple versions). This should help prevent confusion about supported version formats, wdyt?

airbyte_cdk/manifest_migrations/migrations/__init__.py (1)

5-19: Proper package structure implementation.

The migration class imports and __all__ list follow Python packaging best practices by making these classes publicly accessible. The imported classes align with the registry entries and test usage, ensuring consistency across the codebase, wdyt?

unit_tests/manifest_migrations/test_manifest_migration.py (6)

4-4: Good addition for test isolation.

Adding the patch import enables controlled testing of the migration registry, which is essential for reliable test behavior, wdyt?


8-16: Clean import organization for test dependencies.

The imports for the migration registry, specific migration classes, and DummyMigration are well-organized and support the enhanced testing approach with explicit registry patching, wdyt?

Also applies to: 20-20


26-36: Excellent test isolation with explicit migration control.

Using @patch.dict to override MANIFEST_MIGRATIONS with a specific version range (">=6.48.2,<6.50.0") provides precise control over which migrations are applied during testing. This approach effectively demonstrates the new version constraint system while ensuring test reliability. The version range used here differs from the "*" wildcard in the registry, which I assume is intentional for testing specific range matching behavior, wdyt?


46-48: Good practice: creating fresh resolver instances.

Switching from the global resolver to creating new ManifestReferenceResolver() instances improves test isolation and prevents potential state contamination between tests, wdyt?


73-73: Appropriate use of DummyMigration for negative testing.

Using DummyMigration with version "0.0.0" effectively tests the scenario where migrations should not be applied, which validates the version constraint logic works correctly, wdyt?


82-84: Consistent resolver instance creation.

Creating a new ManifestReferenceResolver() instance maintains the improved test isolation pattern established in the previous test, wdyt?

unit_tests/manifest_migrations/conftest.py (6)

9-9: LGTM!

The import addition is necessary for the DummyMigration class implementation below.


15-15: Version update aligns with enhanced version matching.

This change from "0.0.0" to "6.48.3" supports testing the new version constraint capabilities. Good alignment with the PR objectives!


498-500: Excellent demonstration of version range support!

The change to use ">=6.48.2,<6.50.0" as the to_version showcases the new PEP 440 compliant version range capabilities. This aligns perfectly with the enhanced version constraint handling.

Also applies to: 504-506


837-837: Good setup for wildcard testing scenario.

This version change to "0.0.0" paired with the wildcard "*" to_version values below creates a proper test scenario for the new wildcard support.


1200-1200: Perfect wildcard implementation!

Using "*" as the to_version demonstrates the new wildcard support where migrations apply universally. This is a key enhancement from the PR.

Also applies to: 1206-1206, 1212-1212


1221-1232: Minimal test implementation looks good, but should we verify the is_migrated behavior?

The DummyMigration class provides a clean minimal implementation for testing. I notice that _process_manifest sets is_migrated = False - is this intentional for testing scenarios where you want to simulate migrations that don't actually apply changes? If so, this is perfect. If not, you might want to set it to True to simulate successful migrations. Wdyt?

airbyte_cdk/manifest_migrations/migration_handler.py (2)

9-9: Essential imports for enhanced version matching.

The Tuple and SpecifierSet imports are necessary for the new functionality - Tuple for the updated return type and SpecifierSet for PEP 440 version specifier support.

Also applies to: 11-11


81-89: Excellent separation of concerns with tuple unpacking!

The change to unpack (can_apply_migration, should_bump_version) is a great design improvement. This allows wildcards (*) to apply migrations without bumping versions, while version ranges can still control version updates appropriately. The conditional version bumping logic is spot-on!

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

Copy link
Contributor

@bnchrch bnchrch left a comment

Choose a reason for hiding this comment

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

One nit. But otherwise this is great.

@lmossman
Copy link
Contributor

@lazebnyi think you can address Ben's comment and then we can get this merged by EOD Monday?

@lazebnyi
Copy link
Contributor Author

lazebnyi commented Jun 2, 2025

/autofix

Auto-Fix Job Info

This job attempts to auto-fix any linting or formating issues. If any fixes are made,
those changes will be automatically committed and pushed back to the PR.

Note: This job can only be run by maintainers. On PRs from forks, this command requires
that the PR author has enabled the Allow edits from maintainers option.

PR auto-fix job started... Check job output.

🟦 Job completed successfully (no changes).

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

♻️ Duplicate comments (1)
airbyte_cdk/manifest_migrations/migration_handler.py (1)

30-30: Consider making the wildcard pattern more specific, wdyt?

I noticed there's a past review comment from bnchrch suggesting to change this to *.*.* and make it a const for future regex matches. The current pattern ".*" matches any string, but for version wildcards, shouldn't we be more specific about the wildcard character itself?

Maybe something like:

-WILDCARD_VERSION_PATTERN = ".*"
+WILDCARD_VERSION_PATTERN = r"^\*(\.\*)*$"

This would match *, *.*, *.*.*, etc., which seems more aligned with version wildcard conventions. What do you think?

🧹 Nitpick comments (1)
airbyte_cdk/manifest_migrations/migration_handler.py (1)

120-143: Excellent implementation of the three-rule version matching system!

The logic is clear and well-documented. I particularly like how you've structured it:

  1. Wildcard check first (most permissive)
  2. PEP 440 operators (structured constraints)
  3. Fallback to concrete version comparison

The return tuple (can_apply_migration, should_bump_version) makes the intent very clear. One small question though - should we add any input validation to ensure migration_version and manifest_version are valid strings before processing them, wdyt?

Consider adding basic validation:

+    if not migration_version or not manifest_version:
+        return False, False
+    
     if re.match(WILDCARD_VERSION_PATTERN, migration_version):
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cf6acd6 and 22408b2.

📒 Files selected for processing (1)
  • airbyte_cdk/manifest_migrations/migration_handler.py (4 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
airbyte_cdk/manifest_migrations/migration_handler.py (2)
unit_tests/manifest_migrations/conftest.py (1)
  • _process_manifest (1222-1223)
airbyte_cdk/manifest_migrations/manifest_migration.py (1)
  • _process_manifest (94-134)
🪛 Pylint (3.3.7)
airbyte_cdk/manifest_migrations/migration_handler.py

[warning] 86-86: Access to a protected member _process_manifest of a client class

(W0212)

⏰ Context from checks skipped due to timeout of 90000ms (7)
  • 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 (Fast)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
🔇 Additional comments (3)
airbyte_cdk/manifest_migrations/migration_handler.py (3)

8-8: LGTM! New imports look well-structured.

The added imports (re, Tuple, SpecifierSet) are properly aligned with the new functionality for version constraint handling. Good job organizing these logically!

Also applies to: 10-10, 12-12


82-89: Nice clean separation of concerns with the tuple unpacking!

The logic for separating migration application from version bumping is well-designed. This gives you fine-grained control over when to apply migrations vs when to update the version, which is exactly what the wildcard support needed.

🧰 Tools
🪛 Pylint (3.3.7)

[warning] 86-86: Access to a protected member _process_manifest of a client class

(W0212)


86-86: Static analysis hint about protected member access can be safely ignored.

The pylint warning about accessing _process_manifest is a false positive here - this is internal CDK code where the migration handler legitimately needs to call the protected method of the migration instance. This is the intended design pattern for the migration system.

🧰 Tools
🪛 Pylint (3.3.7)

[warning] 86-86: Access to a protected member _process_manifest of a client class

(W0212)

@lazebnyi lazebnyi merged commit 2841384 into main Jun 2, 2025
28 of 29 checks passed
@lazebnyi lazebnyi deleted the lazebnyi/add-version-constraint-to-manifest-handler branch June 2, 2025 11:18
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.

3 participants