Skip to content

feat: v4 to v5 migration for zero trust list#10

Merged
tamas-jozsa merged 1 commit intomainfrom
zero_trust_list
Nov 3, 2025
Merged

feat: v4 to v5 migration for zero trust list#10
tamas-jozsa merged 1 commit intomainfrom
zero_trust_list

Conversation

@tamas-jozsa
Copy link
Collaborator

No description provided.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Problem: The state test helper wasn't correctly simulating how the actual migration framework
works, causing test failures in account_member and dns_record resources.

Root Cause: The real migration handler (internal/handlers/state_transform.go:83) passes
individual instance objects to TransformState(), not full state documents. However, the test
helper was incorrectly passing the entire state structure.

Solution: Updated internal/testhelpers/state.go to:

  1. Detect and handle instance-only test inputs (no "resources" field) by passing them directly
    to TransformState()
  2. For full state tests, iterate through instances and pass each one individually to
    TransformState() - matching real behavior
  3. Properly preserve empty arrays and edge cases like empty resources

Impact: This ensures unit tests accurately validate migration behavior, preventing bugs where
migrations work in tests but fail in production.

@tamas-jozsa tamas-jozsa force-pushed the zero_trust_list branch 2 times, most recently from 3977d17 to a1b9b3b Compare October 31, 2025 20:13
@tamas-jozsa tamas-jozsa merged commit 0111d93 into main Nov 3, 2025
7 checks passed
@tamas-jozsa tamas-jozsa deleted the zero_trust_list branch November 3, 2025 14:13
@vaishakdinesh vaishakdinesh added this to the Phase 1 milestone Nov 5, 2025
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.

4 participants