Skip to content

feat: reconcile deleted yaml services#198

Merged
vigneshrajsb merged 3 commits intomainfrom
vb/stale-service-reconciliation
May 6, 2026
Merged

feat: reconcile deleted yaml services#198
vigneshrajsb merged 3 commits intomainfrom
vb/stale-service-reconciliation

Conversation

@vigneshrajsb
Copy link
Copy Markdown
Contributor

@vigneshrajsb vigneshrajsb commented May 5, 2026

Summary

  • add YAML ownership metadata on deployables so stale reconciliation only touches YAML-owned services
  • reconcile deleted/renamed YAML services behind features.reconcileDeletedServices
  • add DeployCleanupService for deploy-scoped infra cleanup and stale service row deletion
  • wire an async deploy cleanup queue for future infra-only cleanup callers
  • skip deleted-service reconciliation for selective service redeploys by passing skipDeletedServiceReconciliation through the API redeploy, resolve queue, and build queue path

Safety

  • service renames are treated as delete + create; no rename inference
  • repo-filtered reconciliation is limited to matching resolvedFromRepositoryId
  • ambiguous repositoryId = null deployables are skipped during repo-filtered reconciliation
  • full config reconciliation may delete YAML-owned repositoryId = null deployables after YAML import succeeds
  • DB-primary, merged DB/YAML, and configuration deployables are excluded from stale cleanup
  • deploy cleanup uses deploy-scoped resource names/selectors only; no namespace/build-wide cleanup helpers
  • selective service redeploys are not treated as authoritative deleted-service reconciliation scopes

Tests

  • generalized BuildService stale reconciliation tests for:
    • feature flag disabled
    • deleted YAML-owned service cleanup
    • renamed YAML service cleanup
    • repo-filtered cleanup preserving other repository scopes
    • full cleanup of YAML-owned repositoryId = null services
    • repo-filtered skip for ambiguous null repository ownership
    • non-authoritative YAML import skip
    • YAML-owned non-configuration query scope
    • cleanup failure still deleting stale DB rows
    • selective service redeploy skipping stale reconciliation
    • selective service redeploy preserving the skip flag through resolve/build queues
  • generalized DeployCleanupService tests for:
    • deploy-scoped Kubernetes, Helm, secret, and CLI cleanup
    • no service-name-only selector or build-wide cleanup usage
    • infra mode marks deploy torn_down only on full success
    • partial infra failure leaves status unchanged
    • service mode continues after partial teardown failure
    • stale service DB rows are deleted in one transaction

Validation

  • pnpm run lint passed
  • pnpm exec jest src/server/services/__tests__/build.test.ts --runInBand passed
  • pnpm run test -- src/server/services/__tests__/build.test.ts src/server/services/__tests__/deployCleanup.test.ts src/server/services/__tests__/deployable.test.ts passed
  • BUILD_MODE=yes DATABASE_URL=postgresql://lifecycle:lifecycle@localhost:5434/lifecycle APP_DB_HOST=localhost APP_DB_PORT=5434 APP_DB_USER=lifecycle APP_DB_PASSWORD=lifecycle APP_DB_NAME=lifecycle APP_DB_SSL=false pnpm run test passed
  • pnpm run ts-check was run and still fails with repo-wide existing TypeScript strictness errors unrelated to the stale reconciliation changes
  • pnpm exec jest --runInBand was run after the final redeploy-path fix and failed in this shell because many suites require DATABASE_URL / APP DB env; focused regression tests passed

@vigneshrajsb vigneshrajsb marked this pull request as ready for review May 6, 2026 01:30
@vigneshrajsb vigneshrajsb requested a review from a team as a code owner May 6, 2026 01:30
@vigneshrajsb vigneshrajsb merged commit 6fd252b into main May 6, 2026
5 checks passed
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.

1 participant