fix: local dev startup — circular dep + missing scripts (#87)#89
Merged
Conversation
1. ChannelAdapterFactory circular import crash Cycle: factory → adapters/booking-com (barrel) → inbound-controller → inbound-reservation.service → factory. The barrel re-exports BookingComInboundController, pulling runtime controller wiring into the factory's module init. Fix: factory and channel.module import adapters directly from their .adapter.ts files, bypassing the barrel. 2. Missing migrate/seed scripts README called `pnpm --filter @telivityhaip/api run migrate|seed` but those scripts live on @telivityhaip/database (or didn't exist at all). Added `"migrate": "tsx src/push-schema.ts"` to the database package and redirected db:migrate to the same (drizzle-kit migrate required pre-generated SQL files that weren't there). Updated README to call the correct filter. Verified: API starts cleanly (`Nest application successfully started`), 575/575 tests pass, build + typecheck + lint clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #87.
Summary
Three problems reported by a new developer trying to boot HAIP locally:
1. `ChannelAdapterFactory` circular import crash
`pnpm dev` crashed with `ReferenceError: Cannot access 'ChannelAdapterFactory' before initialization`. Cycle:
```
channel-adapter.factory.ts
→ ./adapters/booking-com (barrel index)
→ BookingComInboundController
→ inbound-reservation.service
→ ChannelAdapterFactory ❌ cycle
```
The barrel index re-exports the inbound controller alongside the adapter, so importing the adapter from the barrel pulls controller wiring into factory module init.
Fix: `channel-adapter.factory.ts` and `channel.module.ts` now import `BookingComAdapter` and `SiteMinderAdapter` directly from their `.adapter.ts` files, bypassing the barrel. Inline comments document why.
2. Missing `migrate` / `seed` scripts
README called `pnpm --filter @telivityhaip/api run migrate|seed` but those scripts lived on `@telivityhaip/database` (or didn't exist). Also, `db:migrate` pointed at `drizzle-kit migrate` which expects pre-generated SQL that isn't checked in.
Fix:
3. README verification
Walked the full Quick Start flow. All steps now work end-to-end.
Test plan
🤖 Generated with Claude Code