Technical Debt — Tenant Catalog Bulk Migration Gaps
By Engineering Team•October 11, 2026•5 min read
| Metadata | Details |
|---|---|
| System Name | firebase-function → tenant-migration → tenant-migration-orchestrator |
| Document ID | TD-2026-MIG-001 |
| Author | Engineering Team |
| Status | Open |
TD-24 — Stale module docs claim base product records have no verify-time processor
- Status: Open
- Severity: Low
- Affected component:
tenant-migration/CLAUDE.md,06-microservices/tenant-migration.md:15,06-microservices/tenant-migration-orchestrator.md:58. - Evidence:
tenant-migration/src/migration.module.ts’sENTITY_VERIFY_PROCESSORSfactory provider registersProductVerifyProcessoralongside all other entity-type verify processors, andtenant-migration/src/service/verify/product/product-verify.processor.tsis a complete, non-stub implementation (entityType: 'PRODUCT',folder: 'products', callsprocessProductCSV, builds anEntitySummaryidentically to every other processor).VerifyService.doRunVerify’s COMPILE step treats every registered processor’s output uniformly — there is no per-entity-type special case that excludesPRODUCT. All three documents above nonetheless state or imply that base product records lack a verify-side processor. - Impact: A reader of either module’s
CLAUDE.md, or of the prior microservice docs, would reasonably conclude that bulk-importing a tenant’s base product records isn’t possible today, when it is — this is a pure documentation-debt item, not a functional gap, but it risks someone re-implementing a processor that already exists or needlessly scoping a tenant’s first migration around a limitation that isn’t real. - Remediation direction: Correct the three affected lines/sections to state that all 13 entity types — including
PRODUCT— have a registered verify-time processor, matching the dispatch-side coverage described intenant-migration-orchestrator/CLAUDE.md’s “Entity routing” section. No code change needed. - Related requirement: SR-029 FR-09.
TD-25 — No compatibility shim for batches compiled under the pipeline’s earlier JSON-array output format
- Status: Open
- Severity: Medium
- Affected component:
tenant-migration/src/service/verify/verify.service.ts’s COMPILE step (writes viawriteMigrationRecords, line-delimited only);tenant-migration/src/service/execute/execute.service.ts(reads viareadMigrationRecords, byte-offset only);tenant-migration-orchestrator/src/service/storage/migration-payload-cache.service.ts(reads viareadMigrationRecordAt, byte-offset only). - Evidence:
tenant-migration.md:61documents this format change directly: the pipeline previously compiled each entity type’s output as a single JSON array read byrecordIndex, now replaced by line-delimited (NDJSON) records read bybyteOffset/byteLength. No code path in either service parses the older array format — a batch verified before this change, if executed today, would fail validation (a message missingbyteOffset/byteLengthalongside a storage reference) rather than degrading gracefully. See ADR-00043’s Decision 1 for why the new format was chosen; the old-format incompatibility was called out there as an accepted trade-off, not resolved. - Impact: Any batch that was verified (but not yet executed) before this format change shipped cannot be executed without first being re-verified from its original upload — there is no way to bridge an old-format compiled batch forward. In practice this is bounded (the window only affects batches verified-but-not-executed at the moment of the format change, and
VERIFIEDis not a long-lived resting state in this workflow), but nothing in the code detects and reports this mismatch explicitly — it would surface as an opaque validation failure during execute rather than a clear “please re-verify this batch” message. - Remediation direction: Lowest-effort fix consistent with the pipeline’s existing patterns is a format-version marker on the
migration_batchesdocument, set at verify time, checked byExecuteServicebefore publishing a wave — a batch missing or carrying the old marker fails execute immediately with a clear, actionable error instead of an opaque per-record validation failure. Do not build a reader for the old array format — re-verifying is already cheap and the stated reason for moving off it (O(n²) whole-file reparsing) is exactly the cost a compatibility reader would reintroduce. - Related requirement: SR-029 NFR-07.
TD-26 — tenant-migration and tenant-migration-orchestrator have no active local docker-compose entry
- Status: Open
- Severity: High
- Affected component:
development/docker-compose.yml. - Evidence: Both service blocks are entirely commented out —
tenant-migration:at line 1124 (through its full definition, including the volume mount at line 1145), andtenant-migration-orchestrator:at line 1166 (through line 1187). Adepends_onreference totenant-migration-orchestratorfrom another service’s block is likewise commented at lines 213–214. A direct search for an active, uncommentedtenant-migrationservice key in this file returns no matches.development/CLAUDE.md’s own Service Command Matrix service-name list corroborates this by omitting both services entirely. - Impact: Despite a complete, verified source implementation across both services (13 verify processors, 13 registered dispatch services, full Pub/Sub tiering, dead-letter handling), neither service can be started via
docker compose -p ecommerce-shoppee upin local dev today. Anyone trying to exercise this pipeline locally — for manual testing, forapi-e2e-tests, or for onboarding a new engineer to the feature — hits a wall with no indication in the compose file itself that this is deliberate versus simply unfinished wiring. - Remediation direction: Uncomment both service blocks, reconcile the port mapping with whichever value is authoritative (see TD-27 below — the same mismatch needs settling here regardless), and verify both services boot cleanly against the existing MongoDB/Firebase Pub/Sub emulator stack before re-enabling the commented
depends_onreference. - Related requirement: SR-029 FR-01–FR-22 (the entire pipeline is unreachable locally until this is fixed).
TD-27 — tenant-migration-orchestrator has no health endpoint and a PORT mismatch
- Status: Open
- Severity: Medium
- Affected component:
tenant-migration-orchestrator/src/main.ts;tenant-migration-orchestrator/.env.example:1;development/docker-compose.yml(commented port mapping, see TD-26). - Evidence:
main.tscallsrunNestApp(AppModule, { serviceName: 'tenant-migration-orchestrator', defaultPort: 3000, ... })and registers no routes anywhere in the service — there are no controllers at all, by design (this is a pure Pub/Sub worker)..env.example:1documentsPORT=3000; the commented-out docker-compose block (TD-26) maps"3002:3002".migration-data/CLAUDE.md’s deployment checklist calls forGET /healthon this service, which does not exist. - Impact: Even once TD-26 is fixed and the service is wired into docker-compose, there is no way to probe this service’s liveness/readiness externally (no container healthcheck can target it), and the documented default port (
3000) doesn’t match the port docker-compose would actually expose (3002) — anyone following.env.examplealone would misconfigure a healthcheck or reverse-proxy rule against the wrong port. - Remediation direction: Settle on one port (recommend keeping
3002externally since that’s whatmigration-data/CLAUDE.md’s checklist and the compose mapping already assume, and updating.env.exampleto match) and add a minimalGET /healthroute — this service has no existing bare-health-route example to copy from in this monorepo, so it needs a small amount of original (not template-copied) wiring, flagged here rather than assumed. - Related requirement: SR-029 FR-15.
TD-28 — No automatic cleanup of the orchestrator’s local /tmp payload-cache directory
- Status: Open
- Severity: Low
- Affected component:
tenant-migration-orchestrator/src/service/storage/migration-payload-cache.service.ts. - Evidence:
MigrationPayloadCacheService.getRecordreads directly through the shared assets mount viareadMigrationRecordAton every call — there is no local/tmpcopy being written in the current implementation, and correspondingly no cleanup code exists anywhere in this service.tenant-migration-orchestrator/CLAUDE.md’s own “Local payload cache” section documents this as an accepted, bounded gap: unliketenant-migration, which deletes its scratch directory on verify-success or batch deletion, this service has no equivalent “batch finished” lifecycle event to key cleanup off. - Impact: Negligible today, since the current implementation doesn’t actually cache to local disk (it reads the mount straight through per call) — this entry exists to track the stated intent in the module doc in case a future change reintroduces an actual local
/tmpcache without also adding a cleanup hook. - Remediation direction: No action needed while the current straight-through-read implementation stands. If a future change adds a real local cache, it should key eviction off the batch’s terminal status (
VERIFIED/EXECUTION_FAILED/deleted) the same waytenant-migrationalready does for its own scratch directory, rather than a time-based purge. - Related requirement: SR-029 NFR-02.
TD-29 — Stale e2e test and architecture-spec doc still reference a removed /migration/start upload endpoint
- Status: Open
- Severity: Low
- Affected component:
api-e2e-tests/tests/tenant-migration/migration.spec.ts:98-100;migration-data/CLAUDE.md:133,444,466,580. - Evidence: The current implementation has no
POST /migration/startroute and no multipart-upload entry point of any kind — batch creation is upload-triggered only, viafirebase-function’sstorage_migration_upload_event.jspublishing totenant-migration’sMigrationBatchCreatedReceiver(SR-029 FR-01/FR-02).migration.spec.tsnonetheless has atest.describe('POST /migration/start', ...)block at line 98, andmigration-data/CLAUDE.mdreferences/migration/startand/or a multipart upload shape at lines 133, 444, 466, and 580. - Impact: The e2e test block is testing a route that doesn’t exist — it either fails outright or (if skipped/pending) silently provides no actual coverage of batch creation, leaving the real upload-triggered path (
storage_migration_upload_event.js→MigrationBatchCreatedReceiver) untested end-to-end. The architecture-spec doc misleads anyone reading it as the pipeline’s source of truth about how a batch actually gets created. - Remediation direction: Update
migration.spec.tsto exercise the real flow (upload to the staging bucket with themigration_bundletransaction name, then poll/assert the resultingmigration_batchesdocument), and correctmigration-data/CLAUDE.md’s four affected references to describe the upload-trigger path instead of a/migration/startcall. - Related requirement: SR-029 FR-01.
Related Documents
- BRD-028 — Tenant Catalog Bulk Data Migration
- SR-029 — Tenant Catalog Bulk Data Migration Spec
- ADR-00043 — NDJSON Streaming and Wave-Barrier Execution for Tenant Catalog Migration
- Architecture-00024 — Tenant Catalog Bulk Migration Component Topology and Data Flow
- Microservices: tenant-migration, tenant-migration-orchestrator, firebase-function