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’s ENTITY_VERIFY_PROCESSORS factory provider registers ProductVerifyProcessor alongside all other entity-type verify processors, and tenant-migration/src/service/verify/product/product-verify.processor.ts is a complete, non-stub implementation (entityType: 'PRODUCT', folder: 'products', calls processProductCSV, builds an EntitySummary identically 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 excludes PRODUCT. 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 in tenant-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 via writeMigrationRecords, line-delimited only); tenant-migration/src/service/execute/execute.service.ts (reads via readMigrationRecords, byte-offset only); tenant-migration-orchestrator/src/service/storage/migration-payload-cache.service.ts (reads via readMigrationRecordAt, byte-offset only).
  • Evidence: tenant-migration.md:61 documents this format change directly: the pipeline previously compiled each entity type’s output as a single JSON array read by recordIndex, now replaced by line-delimited (NDJSON) records read by byteOffset/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 missing byteOffset/byteLength alongside 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 VERIFIED is 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_batches document, set at verify time, checked by ExecuteService before 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), and tenant-migration-orchestrator: at line 1166 (through line 1187). A depends_on reference to tenant-migration-orchestrator from another service’s block is likewise commented at lines 213–214. A direct search for an active, uncommented tenant-migration service 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 up in local dev today. Anyone trying to exercise this pipeline locally — for manual testing, for api-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_on reference.
  • 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.ts calls runNestApp(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:1 documents PORT=3000; the commented-out docker-compose block (TD-26) maps "3002:3002". migration-data/CLAUDE.md’s deployment checklist calls for GET /health on 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.example alone would misconfigure a healthcheck or reverse-proxy rule against the wrong port.
  • Remediation direction: Settle on one port (recommend keeping 3002 externally since that’s what migration-data/CLAUDE.md’s checklist and the compose mapping already assume, and updating .env.example to match) and add a minimal GET /health route — 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.getRecord reads directly through the shared assets mount via readMigrationRecordAt on every call — there is no local /tmp copy 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: unlike tenant-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 /tmp cache 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 way tenant-migration already 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/start route and no multipart-upload entry point of any kind — batch creation is upload-triggered only, via firebase-function’s storage_migration_upload_event.js publishing to tenant-migration’s MigrationBatchCreatedReceiver (SR-029 FR-01/FR-02). migration.spec.ts nonetheless has a test.describe('POST /migration/start', ...) block at line 98, and migration-data/CLAUDE.md references /migration/start and/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.ts to exercise the real flow (upload to the staging bucket with the migration_bundle transaction name, then poll/assert the resulting migration_batches document), and correct migration-data/CLAUDE.md’s four affected references to describe the upload-trigger path instead of a /migration/start call.
  • Related requirement: SR-029 FR-01.