Skip to content

feat(marketplace): shre-hub catalog source behind flag + internal read API#186

Open
Nirpat3 wants to merge 1 commit into
mainfrom
feat/capability-hub-p2-hub-catalog
Open

feat(marketplace): shre-hub catalog source behind flag + internal read API#186
Nirpat3 wants to merge 1 commit into
mainfrom
feat/capability-hub-p2-hub-catalog

Conversation

@Nirpat3

@Nirpat3 Nirpat3 commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Capability-hub mission Phase 2 — AROS leg (contract: shre-dev-kit docs/missions/capability-hub.md, founder GO 2026-07-22). Pairs with the shre-hub service PR in shreai.

What

  • SHRE_HUB_CATALOG_ENABLED (default off) routes the GET /api/apps catalog through shre-hub (:5537). Grants stay local always; any hub failure — including an empty apps read-back — falls back to the local platform_apps query. Roll-back = unset the flag; entitlement writes never leave AROS, so there is no dual-write window (the contract's transition mandate).
  • Response gains additive capabilities (fleet capability manifests from the dev-kit registry, for the Phase-4 UI) and catalog_source (shre-hub | local) — existing web clients ignore both.
  • New GET /api/internal/catalog/{apps,entitlements}: read endpoints the hub proxies as system-of-record. They serve local data unconditionally (the marketplace→hub→AROS chain terminates by construction), bearer-gated by HUB_INTERNAL_TOKEN (constant-time compare, fail-closed 503 when unset), entitlements sanitized through publicServiceConfig (no service_config secret leak — consistent with fix(marketplace): harden entitlement API + install/profile UX (review findings) #182).
  • Logic extracted to pure src/marketplace/hub-catalog.ts (functional core) with 11 tests.

Journey gate

Flag off by default ⇒ no journey is altered by this PR. The J7 marketplace journey re-walk against the hub-backed catalog happens at the operator beta-deploy step (mission Verification), before the flag is ever enabled anywhere.

Verification

  • vitest src: 310/310 (11 new)
  • tsc: 0 errors in touched files; repo baseline unchanged (66 pre-existing aros-ai/ errors, identical with the diff stashed)
  • Hub counterpart live-smoked on :5537 (health open / unauth 401 / catalog served / POST installs 501)

Operator preconditions before enabling (per contract)

vault-provision shre-hub-token + shre-hub-aros-token; set HUB_INTERNAL_TOKEN (AROS) = SHRE_HUB_AROS_TOKEN (hub); deploy shre-hub; then J7 journey-walk on beta → 0 FAIL before flipping SHRE_HUB_CATALOG_ENABLED.

🤖 Generated with Claude Code

…d API

Capability-hub mission Phase 2 (dev-kit docs/missions/capability-hub.md),
AROS leg. Flag OFF by default — no behavior or journey change until the
operator enables it; stated per the journey gate.

- SHRE_HUB_CATALOG_ENABLED routes GET /api/apps catalog through shre-hub
  (:5537); grants stay local ALWAYS; any hub failure (or empty read-back)
  falls back to the local platform_apps query — roll-back safe, no
  dual-write window. Response gains additive `capabilities` (fleet registry
  manifests) + `catalog_source`.
- GET /api/internal/catalog/{apps,entitlements}: system-of-record read
  endpoints for the hub. Serve LOCAL data unconditionally (recursion-safe),
  bearer-gated by HUB_INTERNAL_TOKEN (constant-time, fail-closed 503),
  entitlements sanitized via publicServiceConfig.
- Pure logic in src/marketplace/hub-catalog.ts; 11 new vitest cases.

Gates: vitest src 310/310; tsc errors in touched files: 0 (repo baseline
unchanged at 66 pre-existing aros-ai errors).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants