Review: Fix ImportState to extract parent relationship IDs across all resources
Verdict: READY
Note: Both
READY and APPROVED are accepted as passing verdicts by the check-board-advance hook.Template Completeness
Bug template (
template-issue-bug) — all sections present:- [x] Type — Bug
- [x] Lineage — "Blocks appstoreconnect-tofu #5 (state import)"
- [x] Repo — ldraney/appstoreconnect-tofu
- [x] What Broke — detailed description of ImportState passthrough issue with 11 affected resources
- [x] Repro Steps — 4 clear steps with concrete import block and plan output
- [x] Expected Behavior — clear
- [x] Environment — provider version, commit SHA, target app, OpenTofu version, known API edge case (age_rating_declaration HTTP 403)
- [x] Acceptance Criteria — 4 criteria
- [x] Related — references #5 (blocked) and #15 (completed)
Traceability
- [x] story:ios-iac label — IaC coverage for App Store Connect
- [x] story note verified — found in project-platform-playbook user-stories section (key: ios-iac, role: Platform operator, metric: 16 ASC resources declared)
- [x] arch:ios label — turbo-ios / iOS infrastructure
- [x] arch note verified — arch-ios note exists in pal-e-docs
- [x] Forgejo issue — ldraney/appstoreconnect-tofu#18, open
File Targets
Bug template does not require explicit file targets, but the "What Broke" section identifies 11 resources. All verified against the codebase at
~/appstoreconnect-tofu:- [x]
resource_beta_group.go— verified: uses ImportStatePassthroughID, schema has app_id, Read populates via parseToOneRelationship - [x]
resource_beta_tester.go— verified: uses ImportStatePassthroughID, schema has beta_groups - [x]
resource_beta_app_review_detail.go— verified: uses ImportStatePassthroughID, schema has app_id - [x]
resource_beta_app_localization.go— verified: uses ImportStatePassthroughID, schema has app_id - [x]
resource_app_info.go— verified: uses ImportStatePassthroughID, schema has app_id - [x]
resource_app_info_localization.go— verified: uses ImportStatePassthroughID, schema has app_info_id - [x]
resource_age_rating_declaration.go— verified: uses ImportStatePassthroughID, schema has app_info_id - [x]
resource_app_store_version.go— verified: uses ImportStatePassthroughID, schema has app_id - [x]
resource_app_store_version_localization.go— verified: uses ImportStatePassthroughID, schema has app_store_version_id - [x]
resource_app_store_review_detail.go— verified: uses ImportStatePassthroughID, schema has app_store_version_id - [x]
resource_bundle_id_capability.go— verified: NO ImportState implementation at all (confirmed absent from grep)
Helper functions
parseToOneRelationship and parseToManyRelationship already exist in pkg/appstoreconnect/client.go (lines 289, 309). The client layer already extracts relationships in its fromResource converters (e.g., betaGroupFromResource calls parseToOneRelationship). The fix needs to ensure ImportState triggers a Read that populates these fields, or ImportState itself fetches the resource.Repo Placement
Correct. Issue filed on appstoreconnect-tofu, fix is entirely within appstoreconnect-tofu. No cross-repo work needed.
Dependencies
- depends:appstoreconnect-tofu#15 — SATISFIED. Issue #15 is closed. Board item (id 1982) is in done column.
- Blocks appstoreconnect-tofu#5 (state import) — board item 1975, backlog. Cannot proceed with full state import until parent IDs import correctly.
- Transitive: #5 blocks landscaping-assistant-ios#8 — board item 1976, backlog.
- Dependencies are documented in the issue Lineage and Related sections.
Acceptance Criteria
4 criteria, all testable:
- [x] AC1: "All 11 resources have working ImportState that extracts parent relationship IDs" — agent can implement and unit-test
- [x] AC2: "bundle_id_capability implements ImportState" — agent can implement and unit-test
- [x] AC3: "go build and go test ./... pass" — agent can run directly
- [x] AC4: "Import verified: tofu plan with import blocks shows no forced replacements" — requires live Apple API or httptest mocks. The agent should add import-specific tests with httptest mocks to verify this without live API. Manual verification against live ASC can follow.
Blast Radius
resource_profile.goalso usesImportStatePassthroughIDand has parent relationship attributes (bundle_id_id,certificate_ids). Its Read function populates these from relationships via the client layer. If profile exhibits the same forced-replacement behavior, it should be filed as a separate ticket. The issue correctly scopes to the 10 resources from #15 plus bundle_id_capability.- No other repos are affected. The pattern is internal to appstoreconnect-tofu.
- Downstream consumers (#5, landscaping-assistant-ios#8) are blocked, not broken — they depend on this fix completing, not on its current state.
Decomposition Assessment
- 11 file targets in 1 repo (triggers >3 file threshold but single-repo)
- 4 acceptance criteria (under 5 threshold)
- Mechanical pattern change — all 11 resources need the same fix: replace
ImportStatePassthroughIDwith a custom ImportState that fetches the resource and extracts relationship IDs - Relationship parsing helpers already exist in the codebase
- Estimated agent time: 10-15 minutes (repetitive pattern, not creative work)
- No decomposition needed
Recommendation
No action needed. Scope is solid, traceability is complete, all file targets verified, dependencies satisfied.