Skip to content

[O2B-1515] Migrate to DONE status for all environments and remove deprecated DESTROYED - #2259

Merged
graduta merged 4 commits into
mainfrom
improv/O2B-1515/migrate-to-DONE-status-for-all-BKP
Oct 20, 2026
Merged

graduta merged 4 commits into
mainfrom
improv/O2B-1515/migrate-to-DONE-status-for-all-BKP

Conversation

@graduta

@graduta graduta commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

I have a JIRA ticket

  • branch and/or PR name(s) include(s) JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected

Notable changes for users:

  • Environments previously in DESTROYED status are now shown as DONE; DESTROYED is no longer available in the environments status filter

Notable changes for developers:

  • DESTROYED removed from status enums (server and public), history item DTO validation, status colours and raw SQL queries
  • GetAllEnvironmentsUseCase: status history filter simplified, a trailing X now only anchors the match to the end of the history (single DONE status)
  • transitionToErrorLostEnvironments now also excludes environments already DONE
  • Seeders and tests updated to use DONE
  • Note: AliEcsSynchronizer forwards the AliECS state as is, so an incoming DESTROYED state would now be rejected by validation

Changes made to the database:

  • New migration 20261019110000-environment-destroyed-status-to-done: UPDATE environments_history_items SET status = 'DONE' WHERE status = 'DESTROYED' (down is a no-op as the conversion cannot be reverted)

graduta and others added 3 commits October 20, 2026 12:45
…o DONE

Add a migration converting DESTROYED history items to DONE and update the seeders accordingly.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
DONE is now the only terminal status: drop DESTROYED from the status enums, DTO validation, colours and SQL queries, and simplify the status history filter of GetAllEnvironmentsUseCase now that 'X' maps to a single status.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…status

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@graduta
graduta requested a review from isaachilly as a code owner October 20, 2026 10:47
@graduta graduta added frontend backend DB test Label to be used when PR is only about tests labels Oct 20, 2026
@graduta graduta self-assigned this Oct 20, 2026
@graduta graduta removed the test Label to be used when PR is only about tests label Oct 20, 2026
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 46.44%. Comparing base (21fe6fd) to head (63db0b5).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...1019110000-environment-destroyed-status-to-done.js 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2259      +/-   ##
==========================================
- Coverage   46.46%   46.44%   -0.03%     
==========================================
  Files        1052     1053       +1     
  Lines       17358    17353       -5     
  Branches     3164     3161       -3     
==========================================
- Hits         8066     8060       -6     
- Misses       9292     9293       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@graduta
graduta requested a balanced review from Copilot October 20, 2026 10:56
@graduta
graduta merged commit b475464 into main Oct 20, 2026
25 of 26 checks passed
@graduta
graduta deleted the improv/O2B-1515/migrate-to-DONE-status-for-all-BKP branch October 20, 2026 10:59

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.

🟡 Changes recommended

The migration must preserve historical update timestamps to avoid changing status ordering and filter results.

1 open issue
What changed in this PR

Standardizes completed environments on DONE, replacing deprecated DESTROYED across stored history, filtering, and display.

Changes:

  • Adds a one-way migration converting historical statuses to DONE.
  • Updates validation, status mappings, queries, and lost-environment handling.
  • Aligns seed data and tests with the unified status.
File Description
test/​public/​Filters/​urlToFilter.test.js Expects DONE from URL filters.
test/​public/​Filters/​filtersToUrl.test.js Expects DONE in serialized filters.
test/​public/​eosReport/​ecs-creation.test.js Uses DONE report fixtures.
test/​public/​envs/​overview.test.js Updates status display and filtering tests.
test/​public/​envs/​detailsPage.test.js Expects DONE in environment details.
test/​lib/​usecases/​environment/​UpdateEnvironmentUseCase.test.js Tests updates to DONE.
test/​lib/​server/​services/​statistics/​StatisticsService.test.js Updates history statistics expectations.
test/​lib/​server/​services/​eosReport/​EosReportService.test.js Uses DONE report fixtures.
test/​lib/​server/​services/​environmentHistoryItem/​createEnvironmentHistoryItem.test.js Tests creation with DONE.
test/​lib/​server/​services/​environment/​getEnvironmentsInPeriod.test.js Updates terminal-status assertions.
test/​lib/​server/​services/​environment/​EnvironmentService.test.js Updates validation error expectations.
lib/​usecases/​environment/​GetAllEnvironmentsUseCase.js Simplifies history filtering and trailing X handling.
lib/​server/​services/​housekeeping/​handleLostRunsAndEnvironments.js Updates comment terminology.
lib/​server/​services/​environment/​transitionToErrorLostEnvironments.js Excludes DONE environments from error transitions.
lib/​server/​services/​environment/​getEnvironmentsInPeriod.js Removes deprecated status condition.
lib/​public/​views/​Environments/​ColoredEnvironmentStatusComponent.js Removes deprecated color mapping.
lib/​public/​domain/​enums/​statusAcronym.mjs Removes public DESTROYED acronym entry.
lib/​domain/​enums/​StatusAcronyms.js Removes server DESTROYED acronym entry.
lib/​domain/​dtos/​CreateEnvironmentHistoryItemDto.js Rejects deprecated status values.
lib/​database/​seeders/​20230124105627-environment-history.js Converts seeded history to DONE.
lib/​database/​seeders/​20220412122043-environments.js Updates fixture comments only.
lib/​database/​repositories/​EnvironmentHistoryItemRepository.js Uses DONE in history distribution queries.
lib/​database/​migrations/​v1/​20261019110000-environment-destroyed-status-to-done.js Converts historical statuses with no-op rollback.

Review effort: Balanced

module.exports = {
up: async (queryInterface) => queryInterface.sequelize.query(`
UPDATE environments_history_items
SET status = 'DONE'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants