Skip to content

feat(fanclub): consolidate FanClub AI as opt-in Cloud-native subsystem (#57) - #69

Merged
zeekay merged 1 commit into
hanzoai:mainfrom
zeekay:feat/fanclub-cloud-native
Nov 25, 2026
Merged

zeekay merged 1 commit into
hanzoai:mainfrom
zeekay:feat/fanclub-cloud-native

Conversation

@zeekay

@zeekay zeekay commented Nov 25, 2026

Copy link
Copy Markdown
Member

Summary

Consolidates FanClub AI as an opt-in staged subsystem (CLOUD_ENABLE_STAGED=fanclub) natively in hanzoai/cloud, replacing the legacy standalone Node/SQLite prototype in hanzoai/stack.

Canonical Hanzo Services Only

  • Hanzo IAM: JWT verification through Cloud's SanitizeIdentity + TokenValidator; OIDC PKCE exchange (POST /v1/fanclub/oauth/exchange) with strict exact redirect URI allowlist; GET /v1/fanclub/me returns IAM-validated org & admin roles. Zero client tenant selector.
  • Hanzo Cloud Base: Exclusive persistence in encrypted Cloud Base collections fc_members, fc_proposals, fc_audit via existing base.db (visible through /v1/base/collections/* and /mcp). Zero independent SQLite DB.
  • Hanzo Cloud Tasks & Audit: Role-authorized (IsOrgAdmin || IsSuperAdmin) proposal approvals with consent check, atomic idempotency (409 on replay), durable simulation task enqueueing (fanclub_action_simulation, external_side_effects: false), and dual audit receipts (fc_audit + Cloud tamper-evident AuditTrail).
  • Hanzo AI / Engine (/v1/): Added clients.AIHTTPAt (CLOUD_AI_BASE_URL) with loopback/Hanzo-host egress guard and IAM bearer relay; POST /v1/fanclub/chat sends aggregate org counts only and fails closed with HTTP 503 on unconfigured or upstream model outages (zero synthetic/external fallback).
  • Hanzo MCP (/mcp) & OpenAPI: All routes are typed zip ops with zipdoc_gen.go, projected automatically to /v1/openapi.json and /mcp JSON-RPC 2.0 under the same IAM boundary.
  • Embedded UI: Offline static assets embedded in console/fanclub/, served at /fanclub/index.html and /fanclub/. Clearly labels opt-in synthetic fixtures, deterministic rules baseline, simulation-only approvals, and unqualified train-to-serve.

Verification Receipts

  • GOENV=off GOWORK=off GOPROXY=https://proxy.golang.org GOSUMDB=sum.golang.org GOFLAGS=-mod=readonly CGO_ENABLED=0 go build ./... && go vet ./... — PASS
  • CGO_ENABLED=0 go test ./apps/fanclub/... ./clients/... ./apps . — PASS (including TestAppsImportNothingOfTheirHost, TestFanClubCloudNativeE2E, TestTmpConsole)
  • CGO_ENABLED=1 go test -tags 'sqlite_fts5 sqlite_math_functions' ./apps/... ./clients/... . — PASS
  • Live encrypted CGO_ENABLED=0 binary E2E against real Hanzo IAM (https://hanzo.ai), encrypted SQLCipher Base/Tasks, live Hanzo AI (https://api.hanzo.ai model zen), live 503 model-outage fail-closed check, forged-header 401 rejection, unauthenticated & authenticated /mcp tools/call fanclub_summary — ALL 10 CHECKS PASSED.

Closes #57.

hanzoai#57)

Replace the standalone Stack Node/SQLite prototype with an opt-in staged
subsystem (CLOUD_ENABLE_STAGED=fanclub) inside hanzoai/cloud:

- Identity: Hanzo IAM JWT validation via Cloud SanitizeIdentity plus PKCE
  code exchange (POST /v1/fanclub/oauth/exchange) with exact redirect URI
  allowlist and TokenValidator verification. No browser tenant switcher.
- Persistence: Cloud Base (/v1/base) collections fc_members, fc_proposals,
  and fc_audit exclusively. Zero independent SQLite database.
- Approvals & Tasks: Org-admin / SuperAdmin role gate, consent enforcement,
  atomic idempotency (409 on re-decide), durable simulation task enqueueing
  in Cloud Tasks (fanclub_action_simulation, external_side_effects=false),
  and dual audit receipts (fc_audit + Cloud tamper-evident AuditTrail).
- Inference: HTTP /v1/chat/completions AIClient (CLOUD_AI_BASE_URL) with
  loopback/Hanzo-host egress guard, IAM bearer relay, aggregates-only
  prompting, and strict fail-closed 503 on unconfigured or model outages.
- MCP & OpenAPI: All 14 endpoints are typed zip ops projected automatically
  into /v1/openapi.json and /mcp JSON-RPC 2.0 under the same IAM boundary.
- UI: Embedded offline static FanClub console at /fanclub/index.html.

Closes hanzoai#57.

Co-authored-by: Hanzo Dev <[email protected]>
@zeekay
zeekay merged commit 6acb10f into hanzoai:main Nov 25, 2026
1 of 2 checks passed
zeekay added a commit to hanzoai/stack that referenced this pull request Nov 25, 2026
zeekay added a commit to hanzoai/stack that referenced this pull request Nov 25, 2026
…#2)

* chore(stack): retire duplicate FanClub app after canonical Cloud migration

Co-authored-by: Hanzo Dev <[email protected]>

* chore(stack): retire duplicate FanClub app after canonical Cloud migration

Co-authored-by: Hanzo Dev <[email protected]>

* chore(stack): retire duplicate FanClub app after canonical Cloud migration

Co-authored-by: Hanzo Dev <[email protected]>

* chore(stack): retire duplicate FanClub app after canonical Cloud migration

Co-authored-by: Hanzo Dev <[email protected]>

* chore(stack): retire duplicate FanClub app after canonical Cloud migration

Co-authored-by: Hanzo Dev <[email protected]>

* chore(stack): retire duplicate FanClub app after canonical Cloud migration

Co-authored-by: Hanzo Dev <[email protected]>

* chore(stack): retire duplicate FanClub app after canonical Cloud migration

Co-authored-by: Hanzo Dev <[email protected]>

* chore(stack): retire duplicate FanClub app after canonical Cloud migration

Co-authored-by: Hanzo Dev <[email protected]>

* chore(stack): retire duplicate FanClub app after canonical Cloud migration

Co-authored-by: Hanzo Dev <[email protected]>

* chore(stack): retire duplicate FanClub app after canonical Cloud migration

Co-authored-by: Hanzo Dev <[email protected]>

* chore(stack): retire duplicate FanClub app after canonical Cloud migration

Co-authored-by: Hanzo Dev <[email protected]>

* docs(stack): point to Cloud as the sole FanClub application owner

Co-authored-by: Hanzo Dev <[email protected]>

* docs(stack): point to Cloud as the sole FanClub application owner

Co-authored-by: Hanzo Dev <[email protected]>

* docs(stack): reference landed Cloud-native FanClub app (hanzoai/cloud#69)

Co-authored-by: Hanzo Dev <[email protected]>

---------

Co-authored-by: Hanzo Dev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consolidate FanClub AI into native Cloud; retire stack Node demo after qualification

1 participant