Technical Debt — Tenant Migration Admin Console Gaps

By Engineering Team•October 11, 2026•3 min read
Metadata Details
System Name ui-admin-application — Tenant Data Migration feature
Document ID TD-2026-MIG-002
Author Engineering Team
Status Open

TD-30 — Client-generated batchId has no collision guard

  • Status: Open
  • Severity: Medium
  • Affected component: ui-admin-application/src/features/migration/MigrationController.ts:225.
  • Evidence: startUpload derives the batch identifier as const batchId = \batch_${Date.now()}`— a millisecond-resolution timestamp with no random component and no server-side uniqueness check before use. This value is passed directly as bothfileNameIdandtransactionIdtoMediaService.getUploadPresignedUrls, which in turn becomes the Pub/Sub envelope's transaction_idthattenant-migration's MigrationBatchCreatedReceiveruses, together with(tenant_id, service_name, transaction_name)`, as its idempotency key for batch creation (see SR-029 FR-02 and Architecture-00024 step 3).
  • Impact: Two uploads issued within the same millisecond — most plausibly two browser tabs/sessions for the same tenant, or a double-click that isn’t otherwise debounced — would generate the identical batchId. Because batch creation is explicitly idempotent on this key, the second upload’s batch-creation event would silently no-op: the second file is uploaded to storage but never gets its own migration_batches document, and the operator sees no error — only a batch that “went missing” during pollForBatch’s wait, surfacing as the generic 60-second timeout error rather than a clear “this batch ID is already in use” message.
  • Remediation direction: Replace the timestamp with a client-generated UUID (crypto.randomUUID(), already used elsewhere in this app for X-Correlation-ID generation per ui-admin-application/CLAUDE.md’s OTel section) — collision-proof at the scale this console operates at, with no server-side change needed.
  • Related requirement: SR-030 FR-02.

TD-31 — MigrationRepository.ts has no DEV_MOCK_* fallback

  • Status: Open
  • Severity: Low
  • Affected component: ui-admin-application/src/features/migration/MigrationRepository.ts.
  • Evidence: ui-admin-application/CLAUDE.md’s Rules for Code Generation, item 8, states: “All new features must include DEV mock data in the repository’s fetch function so the UI works without a running backend.” A direct search of MigrationRepository.ts for DEV_MOCK returns zero matches — every one of its nine REST calls and the SSE stream opener go straight to apiClient/openEventStream with no if (import.meta.env.DEV) return DEV_MOCK_* branch, unlike every other documented feature in this admin app.
  • Impact: The Tenant Data Migration console cannot be exercised in local frontend-only development — npm run dev with no tenant-migration backend running leaves every tab showing a load error instead of representative mock data, which every other feature in this codebase avoids by design.
  • Remediation direction: Add DEV_MOCK_BATCHES/DEV_MOCK_BATCH/DEV_MOCK_BATCH_ERRORS constants (shaped as representative MigrationBatch/BatchErrorsResult values, covering at least one of each terminal status) and the standard if (import.meta.env.DEV) return ... guard in each fetch function, following the same pattern already used elsewhere in this app (see features/category/CategoryRepository.ts for the canonical shape). openMigrationStream’s SSE path has no existing precedent for a DEV-mock equivalent in this codebase and needs its own call before assuming one — flagged here rather than assumed.
  • Related requirement: SR-030 NFR-05.

TD-32 — Entity-type names shown raw, unlike stage names

  • Status: Open
  • Severity: Low
  • Affected component: ui-admin-application/src/features/migration/MigrationService.ts.
  • Evidence: stageLabel/STAGE_LABELS humanizes each of the four fixed stage buckets (“Stage 1 — Foundational”, etc.) for display. No equivalent mapping exists for entity-type names: stageEntityRows and entitySummaryRows both pass through entityType/Object.keys/Object.values using the raw backend enum string (e.g. PRODUCT_OPENING_ENTRY_PROCESS, PRODUCT_SPECIFICATION) with no humanizing function applied anywhere in this file or in MonitorPage.tsx/AuditDrawer.tsx.
  • Impact: Minor — purely cosmetic, visible directly in the 02_live_monitor.png and 03_historical_audit_02_view.png screenshots, where every entity-type row/card label reads as a raw backend constant rather than the same plain-language labels the stage headers already get. Doesn’t block any workflow, but is inconsistent with the humanization already done one level up.
  • Remediation direction: Add an entityTypeLabel(entityType: string): string function to MigrationService.ts, following the same Record<string, string> lookup pattern as STAGE_LABELS, and apply it at the same two call sites (MonitorPage.tsx’s stage-row rendering, AuditDrawer.tsx’s entity summary cards) that currently render entityType directly.
  • Related requirement: SR-030 FR-09, FR-17.