feat(townhouse): DockerOrchestrator HS profile + getHsHostname admin client (Story 45.3)#44
Open
ALLiDoizCode wants to merge 2 commits intomainfrom
Open
feat(townhouse): DockerOrchestrator HS profile + getHsHostname admin client (Story 45.3)#44ALLiDoizCode wants to merge 2 commits intomainfrom
ALLiDoizCode wants to merge 2 commits intomainfrom
Conversation
…client (Story 45.3)
- Add `profile: 'dev' | 'hs'` constructor option to DockerOrchestrator
- HS path shells out to `docker compose -f <composePath> up -d` with
deterministic `--profile` flag ordering (town → mill → dvm)
- Poll `GET /admin/hs-hostname` until hostname non-null (120s budget);
fail-fast on 503 (anon-disabled) without retrying
- Surface compose subprocess failures via existing `containerState` event
interface with stderr pattern-matching + fallback event
- HS `down()` uses `docker compose down` without `-v` (preserves anon volume)
- Inject `execFileAsync` + `adminClientFactory` via constructor options for
testable subprocess mocking without vi.mock('node:child_process')
- Add `OrchestratorError` class with `service`, `exitCode`, `stderr` fields
- Add `getHsHostname()` to ConnectorAdminClient with 503 anon-disabled handling
- Add `HsHostnameResponse` to connector types
- Update three CLI orchestrator call sites to pass `{ profile: 'dev' }` explicitly
- 14 new HS-path unit tests + 3 integration test stubs (RUN_DOCKER_INTEGRATION gate)
- All 71 existing orchestrator tests + 16 admin-client tests pass without modification
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <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.
Summary
DockerOrchestratoracceptsoptions.profile: 'dev' | 'hs'(4th constructor param, options object). Default'dev'preserves all existing behavior — AC feat: implement Epic 2 - SPSP over Nostr #2 confirmed: diff oforchestrator.test.ts,orchestrator-connector.test.ts,townhouse-cli-lifecycle.test.tsis empty.up(profiles)shells out toexecFile('docker', ['compose', '-f', composePath, ...profileFlags, 'up', '-d'])with deterministic flag order (town → mill → dvmper AC feat: implement Epic 4 - ILP-Gated Relay #4), then pollsGET /admin/hs-hostnameuntilhostname !== null(2s interval, 120s budget per AC Epic 4 #5).down()shells out todocker compose -f <composePath> down— no-vflag, preserving thetownhouse-hs-anonvolume (AC Epic 9 #9).OrchestratorErrorclass withservice,exitCode,stderrinstance fields; exported fromdocker/index.tsandsrc/index.ts(AC Epic 11: Strip auto-peering, TOON-native relay, embedded connector #11).getHsHostname()added toConnectorAdminClient; uses directfetch()call (not the privatethis.fetch()) to intercept 503 before it throws — throwsError('connector is anon-disabled (HTTP 503)')on 503 (AC feat: implement Epic 7 - SPSP Settlement Negotiation #7).HsHostnameResponseinterface inconnector/types.tsand exported through the public API.handleUp:506,handleStatus:336,handleDown:672) updated to pass{ profile: 'dev' }explicitly (AC Epic 2: Nostr Relay Reference Implementation, Protocol Stabilization & SDK Validation #14).execFileAsync+adminClientFactoryDI injected via constructor options for unit-testable subprocess mocking (AC feat: @crosstown/client v0.2.0 with multi-hop routing and payment channels #12).Test plan
pnpm --filter @toon-protocol/townhouse test orchestrator— 71 tests pass (zero test-file edits, AC feat: implement Epic 2 - SPSP over Nostr #2)pnpm --filter @toon-protocol/townhouse test admin-client— 16 tests pass (5 newgetHsHostnamecases)pnpm --filter @toon-protocol/townhouse test orchestrator-hs— 14 new HS-path unit tests pass (no Docker required)pnpm --filter @toon-protocol/townhouse test:canary— connector image contract canary green (AC docs: add Epic 5 (DVM Compute Marketplace) and Epic 6 (Advanced DVM + TEE) #17)pnpm --filter @toon-protocol/townhouse build—OrchestratorError,HsHostnameResponse,getHsHostname,profile?: ComposeProfilevisible indist/index.d.tsRUN_DOCKER_INTEGRATION=1 pnpm --filter @toon-protocol/townhouse test:integration -- orchestrator-hs— requires real Docker +dist/image-manifest.json(CI gate)Pre-existing test failures (not introduced by this PR)
src/api/routes/logs.test.ts(4 tests) fail onmainbefore this PR — confirmed by stash-and-retest.🤖 Generated with Claude Code