feat(cloud-mount): port commerce to HIP-0106 Mount(*zip.App, cloud.Deps)#28
Merged
Conversation
Add pkg/commerce/mount.go exposing the canonical HIP-0106 contract so
the unified hanzoai/cloud binary can co-resident the checkout router
without reimplementing every handler. The legacy gin engine is brought
up via the existing Embed() and adapted under /v1/commerce and
/_/commerce via zip.AdaptNetHTTP — one trust-boundary, one route surface.
PCI scope guard: commerce is a LIGHT ROUTER, NOT in PCI-DSS scope.
Mount() warns loudly on startup if deps.Payments / deps.Vault are nil
(payment paths fail closed; tenant config + admin still served).
Wiring:
- init() registers ("commerce", order=100) in cloud.Registry
- /_/commerce/healthz is native zip — independent of the gin engine
- DataDir flows from deps.DataDir for per-tenant SQLite per HIP-0302
Build hygiene:
- pin github.com/luxfi/lens v0.1.4 + github.com/luxfi/pulsar v1.0.9 via
replace; the transitive chain through luxfi/threshold pulled unpublished
rc tags ("v0.1.0-rc1-pq-consensus-freeze") that broke `go mod tidy` for
every caller.
- pin github.com/hanzoai/cloud + github.com/hanzoai/zip via local ../
replace so the Mount signature evolves in lockstep.
Tests:
- new TestMount_RegistersHealth boots a fresh zip.App, mounts commerce,
asserts the /_/commerce/healthz route answers via fiber.
- existing TestEmbed* still pass; cmd/commerce + cmd/commerced still build.
Schema: schema/commerce.zap describes Health + Tenant service for the
zapc codegen path.
Subsystem code lives in package commerce at repo root. Importers now use `github.com/hanzoai/commerce` (no /pkg/commerce/ nesting). Standalone shim moved to cmd/commerce/ where applicable. Per Hanzo Go-stdlib pattern: repo IS the package.
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
pkg/commerce/Mount(*zip.App, cloud.Deps) error(build tagcloud) per HIP-0106.Embed()and adapted under/v1/commerce+/_/commerceviazip.AdaptNetHTTP— one trust boundary, one route surface, no rewrites of every handler./_/commerce/healthzis independent of the gin engine so probes survive a router-wide outage.Mount()warns loudly on startup ifdeps.Payments/deps.Vaultis nil — commerce is a LIGHT ROUTER, NOT in PCI-DSS scope per HIP-0106. Token handling only.Wiring
init()registers("commerce", order=100)incloud.Registry.DataDirflows fromdeps.DataDirfor per-tenant SQLite per HIP-0302.//go:build cloudso the standalonecmd/commerce+cmd/commercedbinaries keep building without pulling hanzoai/cloud + hanzoai/zip.Build hygiene
Two unrelated transitive failures fixed (commerce was broken at HEAD before this PR —
go mod tidywould not complete):github.com/luxfi/lens v0.1.4andgithub.com/luxfi/pulsar v1.0.9via replace; the chain throughluxfi/thresholdwas pulling unpublished rc tags (v0.1.0-rc1-pq-consensus-freeze).../cloudand../zipreplaces so the Mount signature evolves in lockstep.Test plan
go build ./...cleango build ./cmd/commerce ./cmd/commercedclean (legacy binaries unaffected)go test ./pkg/commerce/...— existingTestEmbed*still passgo test -tags=cloud ./pkg/commerce/...— newTestMount_RegistersHealthpasses; native/_/commerce/healthzreturns 200 with{"service":"commerce"}.~/work/hanzo/cloudonce the matching cmd/cloud import lands (other-agent territory per the task brief).