Skip to content

feat: delete DOProvider.Apply v1 wrapper; release v1.4.0 (Phase 3)#124

Merged
intel352 merged 1 commit into
mainfrom
feat/phase3-do-apply-deletion
May 17, 2026
Merged

feat: delete DOProvider.Apply v1 wrapper; release v1.4.0 (Phase 3)#124
intel352 merged 1 commit into
mainfrom
feat/phase3-do-apply-deletion

Conversation

@intel352

Copy link
Copy Markdown
Contributor

Summary

Phase 3 of workflow#695 cascade closeout cleanup. Resolves Copilot's PR #123 finding about FinalizeApply-vs-Apply deferred-flush loop duplication.

Why minor (v1.4.0) not patch

Observable behavior change: DOProvider.Apply now returns ErrApplyV1Removed sentinel instead of v1-dispatch result. No real-world callers exist (verified via grep post-Phase-2.5 closeout); semver convention treats behavioral change as minor.

Design

Per docs/plans/2026-05-17-phase2.5-cleanup-bundle-design.md (in workflow repo): sentinel-error stub preserves interfaces.IaCProvider contract per ADR 0024. Clean deletion not viable without breaking interface for all 4 plugins simultaneously; interface segregation (split Apply off into LegacyApplier) deferred to separate workflow-side refactor design (followup tracking issue to be filed post-cascade).

Changes

  • internal/provider.go: delete deferredUpdater interface + v1 wrapper body; add ErrApplyV1Removed sentinel; replace Apply body with stub returning sentinel
  • internal/iacserver.go: relocate deferredUpdater named interface near FinalizeApply method (sole consumer)
  • internal/provider_apply_stub_test.go (new): TestDOProvider_Apply_ReturnsRemovedError uses errors.Is for sentinel classification
  • internal/deferred_test_helpers_test.go (new): helpers (minimalDBMock, fakeAppForDeferred, sequencedAppsForDeferred) relocated from deleted provider_deferred_test.go; consumed by iacserver_finalize_test.go (Phase 2.5 T8 regression)
  • internal/provider_deferred_test.go DELETED: regression migrated to iacserver_finalize_test.go (Phase 2.5 T8)
  • internal/provider_apply_test.go + internal/provider_test.go (team-lead-authorized scope extension): delete 11 pre-existing v1 Apply tests that exercise the now-deleted v1 wrapper. Equivalent coverage preserved at wfctlhelpers/apply*_test.go + internal/drivers/*_test.go + iacserver_finalize_test.go.
  • plugin.json: version 1.3.0 → 1.4.0

Test plan

  • go build ./... → clean
  • go vet ./... → clean
  • go test ./internal/ -run TestDOProvider_Apply_ReturnsRemovedError -v → PASS
  • go test ./... -race -count=1 → 6 packages PASS race-clean
  • Phase 2.5 regression preserved: TestDOIaCServer_FinalizeApply_FlushesDeferredUpdates + TestDOIaCServer_FinalizeApply_PreservesPerDriverErrorAttribution + TestDOIaCServer_Capabilities_DeclaresV2 — all PASS
  • No orphan imports post-deletion (wfctlhelpers removed from provider.go)

Rollback

Revert PR. Restores v1.3.0 state (Apply v1 body + deferredUpdater in provider.go + provider_deferred_test.go + 11 v1 Apply tests). Cut v1.4.1 reverting whichever change broke. Per ADR 0024 hard-cutover discipline.

If real in-process embedder surfaces: cut v1.4.1 with deprecation warning instead of sentinel error.

DOProvider.Apply was dead code post-Phase-2.5 v2 cutover (DO declares
ComputePlanVersion=v2; wfctl routes via wfctlhelpers.ApplyPlanWithHooks
+ IaCProviderFinalizer.FinalizeApply, bypassing this method).

Method body replaced with sentinel-error stub returning
ErrApplyV1Removed for diagnostic classification. interfaces.IaCProvider
contract preserved per ADR 0024 — clean deletion not viable without
breaking all 4 plugins simultaneously; interface segregation deferred
to separate refactor design (filed as followup tracking issue).

deferredUpdater interface relocated from provider.go to iacserver.go
(sole consumer is FinalizeApply); preserves Go-level type clarity.

provider_deferred_test.go deleted — regression coverage migrated to
iacserver_finalize_test.go per Phase 2.5 T8 quality-review verdict.

Eliminates FinalizeApply-vs-Apply deferred-flush loop duplication
Copilot flagged on PR #123 (workflow#695 Phase 2.5).

Scope extension (team-lead authorized): delete 11 pre-existing v1 Apply
tests across provider_apply_test.go + provider_test.go that exercise
the now-deleted v1 wrapper dispatch behavior. Equivalent coverage
preserved at wfctlhelpers.ApplyPlan tests + internal/drivers/*_test.go
per-driver tests + iacserver_finalize_test.go (Phase 2.5 T8). Helper
types relocated to internal/deferred_test_helpers_test.go for use by
remaining tests.

Closes workflow#695 followup item 'Phase 3: delete DOProvider.Apply
v1 wrapper'.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@intel352
intel352 requested review from Copilot May 17, 2026 11:39
@intel352

Copy link
Copy Markdown
Contributor Author

iac-codemod refactor-apply report

Mode: dry-run
Sites: 1
Errors: 0

Missing action-switch — hand-port required

  • internal/provider.go:241 DOProvider.Apply missing-action-switch
    • suggestion: Apply body has no switch action.Action dispatch — wfctlhelpers.ApplyPlan expects this loop+switch shape; hand-port required.

Full report (90-day retention) attached as workflow artifact.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR completes the Phase 3 cleanup by removing the legacy v1 DOProvider.Apply implementation and replacing it with a sentinel-error stub while keeping v2 deferred-update finalization on the typed IaC server path.

Changes:

  • Bumps plugin metadata and release URLs to v1.4.0.
  • Replaces DOProvider.Apply with ErrApplyV1Removed.
  • Moves deferred-update test fixtures into a shared test helper file and removes v1 Apply tests.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
plugin.json Updates plugin version and release asset URLs to v1.4.0.
internal/provider.go Removes wfctlhelpers Apply wrapper and adds the v1-removed sentinel stub.
internal/iacserver.go Relocates the deferredUpdater interface near FinalizeApply.
internal/provider_test.go Removes legacy v1 Apply coverage and now-unused helpers/imports.
internal/provider_deferred_test.go Deletes v1 deferred-flush Apply tests.
internal/provider_apply_test.go Deletes legacy v1 Apply dispatch tests.
internal/provider_apply_stub_test.go Adds sentinel-error coverage for the new Apply stub.
internal/deferred_test_helpers_test.go Adds shared deferred-update fixtures for FinalizeApply tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// invariant: DOProvider.Apply is dead code post-Phase-2.5 v2 cutover;
// reaching it indicates a misconfigured caller. Method returns sentinel
// ErrApplyV1Removed; callers can errors.Is for diagnostic classification.
// Per workflow#695 Phase 3 cleanup + docs/plans/2026-05-17-phase2.5-cleanup-bundle.md.
Comment on lines +7 to +9
// (docs/plans/2026-05-17-phase2.5-cleanup-bundle.md Task 5) — the
// fixtures themselves remain in-package so the v2-dispatch tests
// continue to exercise the canonical DatabaseDriver mock surface
@intel352

Copy link
Copy Markdown
Contributor Author

Copilot review acknowledgement

Both inline comments flag cross-repo doc-path references in test godocs (docs/plans/2026-05-17-phase2.5-cleanup-bundle.md). Path lives in workflow repo, not DO. Same advisory Minor internal code-reviewer raised at T5 quality review.

Defensible cross-repo provenance pattern: Phase 2.5 cascade (PR #123) used the same cross-repo design-doc breadcrumb in iacserver_finalize_test.go. The path is stable because design docs are LOCKED at scope-lock time (this one sha256 19b0c80e0620 per workflow repo). Removing or qualifying the path loses the audit trail for why the test exists.

Tracked + accepted by internal code-reviewer as advisory Minor (waivable). Per Phase 2.5 precedent, prefer cross-repo path with full provenance over symbol-only refs that lose the cascade context.

CI green; admin-merging.

@intel352
intel352 merged commit de2d9b3 into main May 17, 2026
12 checks passed
@intel352
intel352 deleted the feat/phase3-do-apply-deletion branch May 17, 2026 11:51
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.

2 participants