Skip to content

Conversation

@georgevanderson
Copy link
Collaborator

@georgevanderson georgevanderson commented Dec 3, 2025

Move lifecycle protection filtering to the end. Previously, clickhouse strategy could upgrade an Update to a DROP/CREATE after lifecycle filtering


Note

Lifecycle protection is enforced after table diff strategies run, blocking DROP/CREATE for protected tables and adding tests for these scenarios.

  • Core (table diffing):
    • Move lifecycle filtering to occur after strategy.diff_table_update, not before.
    • Block TableChange::Removed and corresponding orphan Added when target table is DeletionProtected or ExternallyManaged.
    • For Updated on DeletionProtected, filter out ColumnChange::Removed only.
    • Use target (after) lifecycle for decisions; only count/apply non-empty filtered changes.
  • Tests:
    • Add DropCreateStrategy mock and comprehensive tests covering: blocking strategy-generated DROP/CREATE for DeletionProtected and ExternallyManaged, allowing for FullyManaged, lifecycle transition to protected, and disabling protection via flag.

Written by Cursor Bugbot for commit c5e1f06. This will update automatically on new commits. Configure here.

@georgevanderson georgevanderson self-assigned this Dec 3, 2025
@vercel
Copy link

vercel bot commented Dec 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs-v2 Ready Ready Preview Comment Dec 3, 2025 6:23pm
framework-docs Ready Ready Preview Comment Dec 3, 2025 6:23pm

Copy link
Contributor

@jmsuzuki jmsuzuki left a comment

Choose a reason for hiding this comment

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

Looks good! thanks for the tests

// This handles both:
// 1. Strategies that convert updates to drop+create (blocks both Removed AND Added for protected tables)
// 2. Strategies that return Updated (filters out column removals for DeletionProtected tables)
let filtered_changes: Vec<OlapChange> = if respect_life_cycle {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hum this is a better place - but I think we should pull it out of the diff completely and have it applied in another phase of the infra map compiler.

@LucioFranco Woudl you have a suggestion? The issue here is we produce the plan for changes as the set of diff for the infrastructure. That Plan should be sanitized with lifecycle rules which enfore what kind of operations are allowed on a Table / Object.

Right now it is embeeded in the diff logic and it is prone for developper mistakes and doesn't get enforced no matter what. I am thinking it should wrap the internal planning methods which should become private to the inner module to make sure other modules don't call it without the filtering.

Another idea is triggered in which we could use a visitor pattern to prune the plan? or and build it maybe? But that could be another iteration on the refactor

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.

5 participants