Skip to content

feat(AF-990): persist deployment change tickets and env flag - #1174

Merged
babltiga merged 2 commits into
mainfrom
feature/AF-990-deployment-tickets-persistence
Oct 21, 2026
Merged

babltiga merged 2 commits into
mainfrom
feature/AF-990-deployment-tickets-persistence

Conversation

@babltiga

Copy link
Copy Markdown
Contributor

Closes #990 (part of epic #989).

What

This is the persistence and API groundwork for deployment change tickets. No ticket is created, no webhook is handled, and gate, review, routing and notification behaviour do not change.

  • V202 add_deployment_change_tickets
    • Adds deployment_environments.change_ticket_required BOOLEAN NOT NULL DEFAULT FALSE.
    • Adds the new deployment_tickets table:
      • deployment_request_id is a foreign key with ON DELETE CASCADE.
      • organization_id and channel_id are bare UUIDs (no foreign key), following the V149 convention.
      • Unique constraints (channel_id, deployment_request_id) and (channel_id, external_id), plus an index on the request.
      • decision is APPROVED / REJECTED / null, enforced by chk_deployment_tickets_decision, with a decided_at timestamp.
  • New deploygov.api types: DeploymentTicketService, DeploymentTicketView and RecordDeploymentTicketCommand, implemented by the package-private DefaultDeploymentTicketService.
    • Decision stamping: decision is always overwritten. decided_at is stamped when the decision changes to a non-null value, kept when the same decision is sent again, and cleared when the decision becomes null.
  • changeTicketRequired on environments: threaded through the create/update commands, the view and its mapper, the web request/response records, and DefaultDeploymentPipelineAdminService.
    • On create, a missing value defaults to false.
    • On update, null leaves the current value unchanged.
  • DeploymentNotificationView: gains changeTicketRequired, commitSha, artifactRef and runUrl for notifications: create a change ticket on DEPLOYMENT_SUBMITTED #991.

Docs

Tests

  • New DefaultDeploymentTicketServiceTest (8 tests).
  • New DeploymentTicketPersistenceIntegrationTest (Testcontainers, ddl-auto=validate). It covers:
    • both unique constraints
    • the decision CHECK constraint
    • the cascade on deleting a request
    • the flag round-trip
  • Added the flag round-trip and new view-field assertions to the admin-service, validation, web-model and notification-lookup tests.
  • Widening the records required appending null/false arguments in about 20 existing test files across deploygov, schemachange, serviceaccounts and notifications. These edits are mechanical: no assertion changed.
  • Local run: ApplicationModulesTest, ApiPackageDependencyTest, and every deploygov / schemachange / deployment-notification / OnBehalfOfIntegrationTest class passed (1455 tests, 0 failures). The ticket IT was then re-run after the CHECK constraint was added: 6/6 passed.

No UI change, so no screenshots.

Review notes

None of af-reviewer, af-java-reviewer or af-content-reviewer reported a blocker.

Applied:

  • The decision CHECK constraint (af-java-reviewer, af-reviewer).
  • The decided_at wording and a "persistence only, no writer yet" qualifier in the data model (af-content-reviewer, af-reviewer).

Remaining:

  • af-content-reviewer: docs/04-api-spec.md names environment fields in camelCase (changeTicketRequired), but the wire uses global SNAKE_CASE, so the actual key is change_ticket_required. The whole section already does this (allowBreakGlass, datasourceId, …), so I followed its convention rather than mixing styles. Worth fixing section-wide in deploygov: change-ticket documentation sweep #995.
  • af-reviewer: no HTTP-level test pins the JSON key change_ticket_required. The deploygov controller tests call controller methods directly, and the key comes from the global naming strategy like every other field.
  • af-java-reviewer: DeploymentTicketRepository.findAllByDeploymentRequestId has no production caller yet. It is reserved for the gate (deploygov: gate requires an approved ticket on change_ticket_required environments #993), per the issue.
  • af-verifier was not dispatched. The gates it would run were run directly, as listed under Tests.

@github-actions

Copy link
Copy Markdown
Contributor

Backend Test Results

11 345 tests  +19   11 345 ✅ +19   12m 31s ⏱️ +29s
 1 217 suites + 2        0 💤 ± 0 
 1 217 files   + 2        0 ❌ ± 0 

Results for commit 4bdd994. ± Comparison against base commit 64b7bc0.

@github-actions

Copy link
Copy Markdown
Contributor

@babltiga
babltiga merged commit 091248c into main Oct 21, 2026
34 checks passed
@babltiga
babltiga deleted the feature/AF-990-deployment-tickets-persistence branch October 21, 2026 09:24
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.

deploygov: persistence — deployment_tickets and environment change_ticket_required

1 participant