Skip to content

fix(data-import): Fix/testmo import fixes#230

Merged
therealbrad merged 8 commits intomainfrom
fix/testmo-import-fixes
Apr 22, 2026
Merged

fix(data-import): Fix/testmo import fixes#230
therealbrad merged 8 commits intomainfrom
fix/testmo-import-fixes

Conversation

@therealbrad
Copy link
Copy Markdown
Contributor

Description

Fix Testmo import failures on large exports and improve import performance, progress reporting, and error recovery.

  • Fix unique constraint violations across all import entity types by including soft-deleted records in dedup checks (PostgreSQL constraints don't include isDeleted)
  • Fix transaction-poisoning bugs where try-catch blocks inside transactions swallowed errors, causing subsequent queries to fail with 25P02
  • Remove dangerous fallback lookup in automation imports that matched wrong records and caused className update collisions
  • Increase staging batch load size from 100 to 5,000 rows (testRunCases phase dropped from 1.8h to 4.6m)
  • Add per-phase timing instrumentation and per-entity rate-based ETA estimates
  • Add import retry flow — failed imports can be reconfigured and restarted without re-uploading or re-analyzing
  • Fix reset button to always be clickable when UI is stuck
  • Fix missing i18n keys in mapping configurator by reusing existing translation namespaces
  • Add dataset label translations for all Testmo dataset types
  • Add start:workers:prod script for running built workers

Related Issue

N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement

How Has This Been Tested?

  • Manual testing

Test Configuration:

  • OS: macOS Darwin 25.4.0
  • Node version: 24.14.0

Successfully imported a 12GB Testmo export (3.4M records, 98 datasets) with zero errors. Import completed in 5h 40m (down from 7h 30m — 25% improvement). Tested against both a cloned production database and a clean seeded database. Verified retry flow: failed import → reconfigure mapping → re-import without re-upload.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published
  • I have signed the CLA

Screenshots (if applicable)

N/A

Additional Notes

The two slowest import phases remain testRunStepResults (~42 items/sec) and repositoryCases (~54 items/sec). These are bottlenecked by per-row Prisma create() calls and would benefit from bulk insert optimization in the ZenStack v3 migration (Kysely).

therealbrad and others added 8 commits April 20, 2026 20:26
…rovements

- Fix unique constraint violations across all import entities by removing
  isDeleted filter from dedup checks (constraint does not include isDeleted).
  Affected: RepositoryCases, Templates, Tags, Groups, Roles, MilestoneTypes,
  Status, Integration, CaseFields, ResultFields. Soft-deleted records are
  restored on match instead of creating duplicates that violate constraints.
- Remove dangerous fallback lookup in automationImports that matched wrong
  records and caused className update collisions.
- Replace try-catch-inside-transaction patterns with upsert or
  check-before-create to avoid poisoning PostgreSQL transactions.
- Fix missing i18n keys in TestmoMappingConfigurator by reusing existing
  translation namespaces and adding truly new keys to mapping namespace.
- Add dataset label translations for all Testmo dataset types.
- Add start:workers:prod script for built worker execution.
- Fix import panel reset button to always be clickable when stuck.
- Add per-phase timing instrumentation to import worker.
- Increase staging batch load size from 100 to 5000 rows.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use observed per-phase processing rates to estimate remaining import
time instead of a single blended average. Each entity type is estimated
independently and summed for total ETA. Rates from completed phases
update dynamically; default rates from production benchmarks are used
for phases that have not started yet.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… import

Introduced a new `entityRates` property in the import context to allow for per-entity rate-based estimates of remaining import time. Default rates are defined for various entity types, enhancing the accuracy of estimated time remaining during the import process. This change improves the granularity of progress metrics by utilizing observed rates from completed phases and dynamically updating them as new phases are processed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Expanded the Spanish and French JSON translation files by adding new keys for various entities, including workflow states, templates, roles, and session-related terms. This update improves localization support and ensures consistency across the application for Spanish and French users.
- Add retry action to import job API: failed/canceled jobs can be reset
  to READY so users can reconfigure mappings and re-import without
  re-uploading or re-analyzing the file.
- Add Reconfigure and retry button in import UI when job fails during
  import phase. Analysis data is preserved on import failure.
- Update default entity rate estimates based on observed v2 import
  performance (with batch size fix). testRunCases: 30 -> 725 items/sec,
  users: 600 -> 19, and other phases adjusted to actuals.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts:
#	testplanit/dist/workers/testmoImportWorker.js.map
@therealbrad therealbrad merged commit f0cafc9 into main Apr 22, 2026
5 checks passed
@therealbrad therealbrad deleted the fix/testmo-import-fixes branch April 22, 2026 01:31
@therealbrad
Copy link
Copy Markdown
Contributor Author

🎉 This PR is included in version 0.22.5 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant