feat(branding): derive colour and logo from the signup domain (#155, part 2) #157

Closed
sharang wants to merge 5 commits from feat/branding-derive into main
pull from: feat/branding-derive
5 Commits
Author SHA1 Message Date
Sharang Parnerkar 78e0cb5f82 Merge remote-tracking branch 'origin/main' into feat/branding-derive
ci / shared (pull_request) Failing after 4s
ci / test (pull_request) Successful in 8m17s
ci / image (pull_request) Skipped
# Conflicts:
#	internal/config/config.go
#	internal/server/openapi_test.go
#	internal/server/server.go
#	openapi.yaml
2026-12-01 14:13:51 +01:00
Sharang ParnerkarandClaude Opus 5.5 3191617502 fix(branding): stop background retries once the budget ran out
ci / shared (pull_request) Successful in 12s
ci / test (pull_request) Successful in 7m41s
ci / image (pull_request) Skipped
When the 25 s budget was what failed, the attempt count was read with
the expired context; Postgres refused, and a retry was scheduled every
6 h without end. The failure is now recorded with a context that has
not ended. README: BRANDING_DERIVE, BRANDING_BACKFILL and the branding
route groups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 13:29:48 +01:00
Sharang ParnerkarandClaude Opus 5.5 fb86a78324 feat(branding): derive colour and logo from the signup domain
ci / shared (pull_request) Successful in 30s
ci / test (pull_request) Successful in 8m49s
ci / image (pull_request) Skipped
Customer branding (#155), steps 1–6: the registry reads the home page
of the workspace's company domain and stores its CI colour and logo.

- Domain: the admin's address, else the most frequent member domain
  (tie: alphabetical); free mail never counts; no domain, no branding.
- Fetch (internal/branding): own transport (no proxy, no trace
  headers, no cookies), https on 443 only, public IPs only, checked on
  every dial after DNS, ≤ 5 redirects within the registrable domain,
  10 s per request, HTML ≤ 2 MB, images ≤ 1 MB, User-Agent
  BreakpilotBranding/1.0.
- Colour: theme-color without media, the manifest's theme_color, else
  the logo's dominant colour; white, black and grey are skipped.
- Logo: manifest PNG ≥ 128 px, apple-touch-icon, PNG/ICO/JPEG icon,
  /favicon.ico; stored as a 256×256 PNG, never SVG.
- POST /v1/tenants/{id}/branding/derive ("Neu ermitteln"): synchronous,
  replaces a manual choice and counts as acknowledged.
- Background: tenant creation and trial requests queue the workspace;
  RunBranding derives queued ones every minute, retries network
  failures twice, 6 h apart. Audit branding.derived / branding.failed.
- Switches: BRANDING_DERIVE=on (off by default), BRANDING_BACKFILL=on
  queues every customer workspace without branding once at start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 13:15:31 +01:00
Sharang ParnerkarandClaude Opus 5.5 d64fc342d1 test(migrations): expect the Monitor SKU after 0034
ci / shared (pull_request) Successful in 28s
ci / test (pull_request) Successful in 8m33s
ci / image (pull_request) Skipped
TestMigrate_productsSeedMatchesDefaults still expected the SKU list
before 0034 (#152). CI does not run the migrations package, so it went
unnoticed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 13:15:28 +01:00
Sharang ParnerkarandClaude Opus 5.5 c7dda6da5a feat(branding): tenant branding store, endpoints and check field
Customer branding (#155), the contract part: products and the portal
can read and set a workspace's CI colour and logo. The derivation from
the signup domain follows in a separate change.

- Migration 0035: tenant_branding (colour, 256×256 PNG logo with its
  sha256 ETag, manual flag, provenance, derivation queue, notice ack).
  ON DELETE CASCADE, so a purge removes it.
- Entitlements check: "branding" {color, logo_etag, notice, domain,
  name}, only when allowed and there is a colour or logo. A read error
  leaves the field out instead of failing the check.
- GET/PUT /v1/tenants/{id}/branding (tenants.read/write): the portal's
  Erscheinungsbild page; a PUT makes the branding manual. Logos are
  decoded (PNG, JPEG, GIF, ICO) and re-encoded; SVG is refused.
- GET /v1/tenants/{id}/branding/logo (branding.read): PNG, ETag, 304.
- POST /v1/tenants/{id}/branding/ack (branding.ack): "Passt" by an IT
  admin or owner, checked in Keycloak; 403 not_admin otherwise.
- BRANDING_DERIVE config switch (off by default), reported to the
  portal as derive_enabled.
- CI runs the new internal/branding tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 13:08:54 +01:00