Architecture-00025 — Tenant Migration Admin Console Component Topology and Data Flow
By Engineering Team•October 11, 2026•6 min read
Metadata
| Field | Value |
|---|---|
| System Name | ui-admin-application — Tenant Data Migration feature |
| Document ID | ARCH-2026-MIG-002 |
| Author | Engineering Team |
| Status | Implemented (gaps noted inline) |
Realizes SR-030 under ADR-00046. Drives the backend pipeline documented in Architecture-00024.
Components
| Component | Role |
|---|---|
MigrationPage.tsx |
Composition root — renders the three-tab Tabs/Tab shell, switches between IngestPage/MonitorPage/HistoryPage by ctrl.tab, and always mounts AuditDrawer (open/closed driven by ctrl.selectedBatchId). |
MigrationController.ts (useMigrationController) |
The feature’s only stateful layer — owns all State (tab, upload/verify/execute progress, current batch, history list, drawer/errors-panel state, pending destructive action), the two bounded poll loops, the SSE stream lifecycle (streamCloserRef), and every handler the three sub-pages call. |
MigrationRepository.ts |
The only file importing apiClient/openEventStream. Nine REST calls (fetchBatches, fetchBatch, verifyBatch, executeBatch, deleteBatch, cancelBatch, retryBatch, fetchBatchErrors) plus openMigrationStream, which wraps core/http/sseClient’s openEventStream and returns a close() the controller must call on unmount/tab change. |
MigrationService.ts |
Pure functions: gating predicates (isVerifyReady, isExecuteReady, canRetryBatch, canDeleteBatch), status-to-color mapping (statusColor), and view-shaping (stageEntityRows, entitySummaryRows, verificationProgress). No React, no API calls. |
MigrationTypes.ts |
MigrationBatch, MigrationBatchStages/MigrationBatchStage (the four fixed stage buckets mirroring SR-029’s wave-barrier plan), VerificationStep, EntitySummary, MigrationError/BatchErrorsResult — shared by every layer above. |
pages/ingest/IngestPage.tsx |
Upload dropzone, upload-progress bar, the 3-step Verification panel, and the Verify/Execute Migration action buttons, gated by isVerifyReady/isExecuteReady. |
pages/monitor/MonitorPage.tsx |
Renders ctrl.currentBatch’s overall status chip plus the four-stage entity breakdown (via stageEntityRows), or an empty state when no batch is currently selected for monitoring. |
pages/history/HistoryPage.tsx |
The batch list (ctrl.batches), each row’s available actions (watchBatch/runExecute/requestHistoryAction) gated by the same MigrationService predicates used on Ingest. |
pages/history/AuditDrawer.tsx |
Per-batch detail drawer — verification steps, entity summary cards (entitySummaryRows), and the collapsible MigrationErrorsPanel. |
shared/StatusChip.tsx |
Renders a MigrationBatch['status'] as a colored MUI Chip using MigrationService.statusColor — the one place status-to-color mapping is consumed. |
shared/MigrationErrorsPanel.tsx |
Paginated verification + execution error list for one batch, shown when getTotalFailed(batch) > 0 || batch.status === 'VERIFICATION_FAILED'. |
features/media/MediaService.ts (getUploadPresignedUrls, uploadFileToStorage) |
Shared presigned-upload flow reused as-is from the Media feature — Migration does not have, and must not grow, its own upload mechanism. |
core/http/sseClient.ts (openEventStream) |
Shared SSE client — attaches auth/App-Check headers and parses event frames; the reason openMigrationStream can’t just use the browser’s bare EventSource. |
core/telemetry/tracing.ts |
traceparent/X-Correlation-ID injection on every Axios call via apiClient’s interceptor — no Migration-specific tracing code. |
Backend: tenant-migration |
Receives the uploaded bundle via firebase-function’s Storage trigger, and serves every REST endpoint MigrationRepository.ts calls (verify/execute/cancel/retry/delete/list/get/errors/stream) — see Architecture-00024. |
Diagram

End-to-end flow
- Operator opens the Tenant Data Migration feature;
MigrationPage.tsxmounts on theingesttab by default, anduseMigrationController’s initial effect callsloadHistory()so the Historical Audits list is already populated if the operator switches tabs (SR-030 FR-10). - On Ingest,
selectFilestores the chosen ZIP in controller state;startUploadgenerates a client-sidebatchId(batch_${Date.now()}), callsMediaService.getUploadPresignedUrlswithtransactionName: 'migration_bundle'andtransactionId: batchId, thenuploadFileToStoragePUTs the file directly to the tenant’s staging bucket, reporting progress back intouploadProgress(SR-030 FR-01). - Once the PUT resolves,
startUploadbeginspollForBatch— a bounded 1.5s-interval poll (BATCH_POLL_INTERVAL_MS×BATCH_POLL_MAX_ATTEMPTS) againstGET /migration/batches/:batchId, waiting forfirebase-function’s Storage trigger andtenant-migration’sMigrationBatchCreatedReceiverto materialize themigration_batchesdocument server-side (SR-030 FR-02, FR-03; see ADR-00046’s Decision 2 for why this wait is a bounded poll rather than SSE). - Once the batch appears,
IngestPageshows the Verification panel with all three stepsPENDINGand an enabled Verify button, gated byisVerifyReady(status === 'UPLOADED') (SR-030 FR-04). startVerifycallsPOST /migration/verify/:batchId, then beginspollForVerification— the second bounded poll, ending the moment the batch reachesVERIFIEDorVERIFICATION_FAILED(SR-030 FR-05).- On
VERIFIED,isExecuteReadygates the Execute Migration button open; onVERIFICATION_FAILED, the same panel instead surfaces the failed step inline, andMigrationErrorsPanelbecomes visible (SR-030 FR-06, FR-16). startExecutecallsPOST /migration/execute/:batchId, switchestabtomonitor, and opens the SSE stream viaopenMonitorStream/openMigrationStreamscoped to thisbatchId(SR-030 FR-07, FR-08).MonitorPagerenders every SSE-pushedMigrationBatchframe — the overall status chip plus, viastageEntityRows, each of the four fixed stage buckets’ entity types with their queued/processed/failed counts andblockedByannotations, mirroring the backend’s wave-barrier plan (Architecture-00024 step 10) (SR-030 FR-09).- The stream is closed explicitly — on tab switch away from
monitor(setTab’scloseStream()call) and on controller unmount — via thestreamCloserRefsingle-connection guard, which also prevents a second stream opening while one is already active for the same batch (SR-030 FR-08). - On Historical Audits,
HistoryPagelists every batch fromloadHistory’sfetchBatchescall, each row showing per-batch actions gated by the sameMigrationServicepredicates:watchBatch(re-open Monitor’s SSE stream for an in-flight batch),runExecute(resume aVERIFIEDbatch straight to Execute — the only path back to Execute oncecurrentBatchIdis lost to a page refresh, per therunExecutecode comment) (SR-030 FR-07), andrequestHistoryActionfor retry/delete/cancel (SR-030 FR-12, FR-13, FR-14). - A destructive history action (
retry/delete/cancel) goes throughrequestHistoryAction→ a confirmation step →confirmPendingHistoryAction, which dispatches torunRetry/runDelete/runCancelonly after the operator confirms (SR-030 FR-15). openAuditDraweropensAuditDrawerfor a selected batch, rendering its verification steps,entitySummaryRows’ per-entity-type detail (totals, file list, validation checks), and — whengetTotalFailed(batch) > 0, or the batch isVERIFICATION_FAILED— the paginatedMigrationErrorsPanel, backed byfetchBatchErrors’spage/pageSizeparameters (SR-030 FR-17).
What this does not yet guarantee
- The client-generated
batchId(batch_${Date.now()}) has millisecond resolution and no collision check before being used as the idempotency key’stransactionId— two uploads issued by different browser tabs within the same millisecond would silently collide at the backend’s idempotent batch-creation step. See TD-00024. MigrationRepository.tshas noDEV_MOCK_*fallback, unlike every other feature in this admin app — the console cannot be exercised without a runningtenant-migrationbackend. See TD-00024.entitySummaryRows/stageEntityRowssurface each entity type’s raw enum string (e.g.PRODUCT_OPENING_ENTRY_PROCESS) directly —MigrationService.tshumanizes stage names (STAGE_LABELS) but has no equivalent mapping for entity-type names. See TD-00024.
Related Documents
- SR-030 — Admin UI: Tenant Catalog Migration Console Spec
- BRD-029 — Admin UI: Tenant Catalog Migration Console
- ADR-00046 — Tabs and Dual-Channel Status Strategy for the Tenant Migration Console
- Architecture-00024 — Tenant Catalog Bulk Migration Component Topology and Data Flow
- TD-00024 — Admin UI: Tenant Catalog Migration Console Gaps
- Tenant Data Migration Admin UI — Walkthrough Overview
- tenant-migration
- tenant-migration-orchestrator