brand: rename product to "Read the Markets" (read.markets)

The product is now "Read the Markets" served at https://read.markets,
with the app at https://app.read.markets. "Cassandra" survives only as
the in-product AI persona (system prompt + "Ask Cassandra" chat label).

Centralised the brand in app/branding.py: BRAND_NAME, BRAND_SHORT,
DOMAIN, SITE_URL, APP_URL, EMAIL_FROM_DEFAULT. Jinja templates pull
{{ BRAND_NAME }} via globals registered in templates_env.py; Python
code reads branding.BRAND_NAME directly. The future-rename surface
is now a one-liner.

Updated: FastAPI app title, every page title (dashboard, news, log,
settings, upload, login, verify), header brand div, auth-card brands,
OTP email subject + HTML + plain-text bodies (incl. uppercase header
tag), OpenRouter X-Title + HTTP-Referer attribution headers, README.
Email tests now assert against branding.BRAND_NAME rather than the
literal string.

Internal identifiers deliberately kept on the legacy "cassandra" name
to avoid invalidating live sessions / advisory locks / configs:
cookies (cassandra_session, cassandra_pending) + itsdangerous salts,
MariaDB GET_LOCK keys, CASSANDRA_TOKEN env var, cassandra.css filename,
pyproject package name, localStorage prefs, outbound User-Agent strings.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Giorgio Gilestro 2026-05-22 19:39:38 +01:00
parent 9759080134
commit 824d849c63
15 changed files with 82 additions and 39 deletions

View file

@ -1,11 +1,20 @@
"""Cassandra brand palette — single source of truth.
"""Brand single source of truth — name, domain, palette, fonts.
Both the website's CSS (`app/static/css/cassandra.css`) and the email
templates (`app/services/email_service.py`) draw from these dicts. CSS
hand-authors the values in its `:root` / `[data-theme="light"]` blocks;
a drift-detection test (`tests/test_branding_consistency.py`) asserts
that what's in this module matches what's in the CSS, so updating the
brand in one place without the other fails CI.
The product is **Read the Markets** (read.markets). "Cassandra" remains
the in-product *AI persona* (system prompt + chat label) distinct from
the brand, the way Slackbot is distinct from Slack. Anything that crosses
into user-visible chrome (page titles, email headers, OpenRouter referer)
must read `BRAND_NAME` from here; do not hard-code the string.
Internal identifiers (`cassandra_session` cookie, pyproject package name,
SQLAlchemy GET_LOCK keys, file `cassandra.css`, env var `CASSANDRA_TOKEN`)
keep the legacy name on purpose renaming them would invalidate live
sessions / advisory locks / configs for zero brand benefit.
The colour palette below is hand-authored in CSS as well; a drift-
detection test (`tests/test_branding_consistency.py`) parses
`cassandra.css` and asserts every variable matches. Update both or
neither.
The light theme is the *default* in emails mail clients can't read
`localStorage`, so we can't replicate the dashboard's user-toggled
@ -15,6 +24,14 @@ via media query.
from __future__ import annotations
BRAND_NAME = "Read the Markets"
BRAND_SHORT = "Read"
DOMAIN = "read.markets"
SITE_URL = "https://read.markets"
APP_URL = "https://app.read.markets"
EMAIL_FROM_DEFAULT = f"noreply@{DOMAIN}"
DARK: dict[str, str] = {
"bg": "#0a0e14",
"surface": "#11151c",

View file

@ -13,6 +13,7 @@ from fastapi import FastAPI
from fastapi.middleware.gzip import GZipMiddleware
from fastapi.staticfiles import StaticFiles
from app import branding
from app.config import get_settings
from app.db import get_session_factory
from app.logging import configure_logging, get_logger
@ -56,7 +57,7 @@ async def lifespan(app: FastAPI):
app = FastAPI(
title="Cassandra",
title=branding.BRAND_NAME,
description="Macro-strategy dashboard",
version="0.1.0",
lifespan=lifespan,

View file

@ -44,7 +44,7 @@ async def send_email(
"""Send a (potentially multipart) email. `text_body` is required —
it's the fallback for clients that can't or won't render HTML."""
s = get_settings()
sender = s.SMTP_FROM or s.SMTP_USER or "noreply@cassandra.local"
sender = s.SMTP_FROM or s.SMTP_USER or branding.EMAIL_FROM_DEFAULT
msg = EmailMessage()
msg["From"] = sender
@ -91,7 +91,7 @@ _OTP_HTML_TEMPLATE = """\
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light dark">
<meta name="supported-color-schemes" content="light dark">
<title>Your Cassandra sign-in code</title>
<title>Your {brand} sign-in code</title>
<style>
@media (prefers-color-scheme: dark) {{
body {{ background:{D_bg} !important; }}
@ -111,12 +111,12 @@ _OTP_HTML_TEMPLATE = """\
</head>
<body style="margin:0; padding:24px 12px; background:{L_bg}; font-family:{FONT_MONO}; color:{L_text}; -webkit-font-smoothing:antialiased;">
<div style="display:none; max-height:0; overflow:hidden; mso-hide:all; font-size:1px; line-height:1px; color:{L_bg};">
Your Cassandra sign-in code {code} expires in {ttl_minutes} minutes.
Your {brand} sign-in code {code} expires in {ttl_minutes} minutes.
</div>
<table role="presentation" cellpadding="0" cellspacing="0" border="0" align="center" width="100%" style="max-width:520px; margin:0 auto; border-collapse:separate;">
<tr><td class="card" style="background:{L_surface}; border:1px solid {L_border}; padding:32px 28px;">
<div class="muted" style="font-size:11px; letter-spacing:0.32em; color:{L_muted}; text-transform:uppercase;">
&#9648;&nbsp;CASSANDRA
&#9648;&nbsp;{brand_upper}
</div>
<div style="height:22px; line-height:22px; font-size:0;">&nbsp;</div>
<div class="h1" style="font-size:17px; font-weight:normal; color:{L_text}; letter-spacing:0.02em;">
@ -136,7 +136,7 @@ _OTP_HTML_TEMPLATE = """\
<div class="divider" style="border-top:1px solid {L_border};"></div>
<div style="height:14px; line-height:14px; font-size:0;">&nbsp;</div>
<div class="muted" style="font-size:10.5px; color:{L_dim}; letter-spacing:0.06em;">
Sent automatically by Cassandra &middot; do not reply
Sent automatically by {brand} &middot; do not reply
</div>
</td></tr>
</table>
@ -150,6 +150,8 @@ def _html_template_filled(code: str, ttl_minutes: int) -> str:
return _OTP_HTML_TEMPLATE.format(
code=code,
ttl_minutes=ttl_minutes,
brand=branding.BRAND_NAME,
brand_upper=branding.BRAND_NAME.upper(),
FONT_MONO=branding.FONT_MONO,
**{f"L_{k.replace('-', '_')}": v for k, v in branding.LIGHT.items()},
**{f"D_{k.replace('-', '_')}": v for k, v in branding.DARK.items()},
@ -157,7 +159,7 @@ def _html_template_filled(code: str, ttl_minutes: int) -> str:
_OTP_TEXT_TEMPLATE = """\
CASSANDRA sign in
{brand_upper} sign in
Your verification code:
@ -168,7 +170,7 @@ If you didn't request it, you can safely ignore this email — no changes
will be made to any account.
Sent automatically by Cassandra · do not reply
Sent automatically by {brand} · do not reply
"""
@ -180,8 +182,13 @@ def render_otp_email(code: str, ttl_minutes: int) -> tuple[str, str, str]:
(Notion, Substack). The lock-screen exposure tradeoff is minimal:
anyone with phone access who could see the notification could also
open the email."""
subject = f"Cassandra sign-in: {code}"
text = _OTP_TEXT_TEMPLATE.format(code=code, ttl_minutes=ttl_minutes)
subject = f"{branding.BRAND_NAME} sign-in: {code}"
text = _OTP_TEXT_TEMPLATE.format(
code=code,
ttl_minutes=ttl_minutes,
brand=branding.BRAND_NAME,
brand_upper=branding.BRAND_NAME.upper(),
)
html = _html_template_filled(code=code, ttl_minutes=ttl_minutes)
return subject, text, html

View file

@ -13,6 +13,7 @@ from datetime import datetime, timedelta, timezone
import httpx
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_exponential
from app import branding
from app.config import get_settings
@ -521,9 +522,10 @@ def _endpoint_for(provider: str) -> tuple[str, str, str, dict[str, str]]:
s.OPENROUTER_API_KEY,
s.OPENROUTER_MODEL,
{
# OpenRouter-specific attribution headers.
"HTTP-Referer": "https://github.com/local/cassandra",
"X-Title": "Cassandra",
# OpenRouter-specific attribution headers. Visible on the
# OpenRouter dashboard — keep aligned with the live brand.
"HTTP-Referer": branding.SITE_URL,
"X-Title": branding.BRAND_NAME,
},
)
raise RuntimeError(f"Unknown LLM provider: {provider!r}")

View file

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{% block title %}Cassandra{% endblock %}</title>
<title>{% block title %}{{ BRAND_NAME }}{% endblock %}</title>
{# Apply saved theme before stylesheet renders to avoid a flash. #}
<script>
(function() {
@ -137,7 +137,7 @@
<body>
<div class="app">
<header class="app-header">
<div class="brand">Cassandra</div>
<div class="brand">{{ BRAND_NAME }}</div>
<nav>
<a href="/" class="{% if request.url.path == '/' %}active{% endif %}">Dashboard</a>
<a href="/news" class="{% if request.url.path == '/news' %}active{% endif %}">News</a>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %}
{% block title %}Cassandra · Dashboard{% endblock %}
{% block title %}{{ BRAND_NAME }} · Dashboard{% endblock %}
{% block main %}
<div id="dash-header-container"

View file

@ -1,5 +1,5 @@
{% extends "base.html" %}
{% block title %}Cassandra · Strategic Log{% endblock %}
{% block title %}{{ BRAND_NAME }} · Strategic Log{% endblock %}
{% block main %}
<section class="panel log-page" style="grid-column: 1 / -1;">

View file

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cassandra · Sign in</title>
<title>{{ BRAND_NAME }} · Sign in</title>
<script>
(function() {
try { document.documentElement.dataset.theme = localStorage.getItem('cassandra.theme') || 'dark'; }
@ -15,7 +15,7 @@
<body>
<div class="auth-shell">
<div class="auth-card">
<div class="auth-card__brand">Cassandra</div>
<div class="auth-card__brand">{{ BRAND_NAME }}</div>
<div class="auth-card__hint">sign in with email</div>
{% if referrer_present %}

View file

@ -1,5 +1,5 @@
{% extends "base.html" %}
{% block title %}Cassandra · News{% endblock %}
{% block title %}{{ BRAND_NAME }} · News{% endblock %}
{% block main %}
<section class="panel" style="grid-column: 1 / -1;">

View file

@ -1,5 +1,5 @@
{% extends "base.html" %}
{% block title %}Cassandra · Settings{% endblock %}
{% block title %}{{ BRAND_NAME }} · Settings{% endblock %}
{% block main %}
<section class="panel" style="grid-column: 1 / -1; max-width: 760px; margin: 0 auto;">

View file

@ -1,5 +1,5 @@
{% extends "base.html" %}
{% block title %}Cassandra · Import Portfolio{% endblock %}
{% block title %}{{ BRAND_NAME }} · Import Portfolio{% endblock %}
{% block main %}
<section class="panel" style="grid-column: 1 / -1; max-width: 760px; margin: 0 auto;">
@ -12,10 +12,10 @@
<p style="color: var(--muted); font-size: 12.5px; margin: 0 0 14px; line-height: 1.6;">
Export your pie from the T212 web app
(<span class="neu">Trading 212 → Investing → Your Pie → ⋯ → Export</span>)
and drop the CSV here. Cassandra resolves each Slice to its Yahoo
ticker; the parsed pie is kept in <em>this browser's localStorage</em>
only. The server learns just which tickers exist (anonymously) so it
can fetch their prices.
and drop the CSV here. Each Slice is resolved to its Yahoo ticker;
the parsed pie is kept in <em>this browser's localStorage</em> only.
The server learns just which tickers exist (anonymously) so it can
fetch their prices.
</p>
<form id="upload-form" autocomplete="off">

View file

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cassandra · Verify email</title>
<title>{{ BRAND_NAME }} · Verify email</title>
<script>
(function() {
try { document.documentElement.dataset.theme = localStorage.getItem('cassandra.theme') || 'dark'; }
@ -15,7 +15,7 @@
<body>
<div class="auth-shell">
<div class="auth-card">
<div class="auth-card__brand">Cassandra</div>
<div class="auth-card__brand">{{ BRAND_NAME }}</div>
<div class="auth-card__hint">verify your email</div>
<p class="auth-card__lede">

View file

@ -8,6 +8,7 @@ from pathlib import Path
from fastapi.templating import Jinja2Templates
from markupsafe import Markup, escape
from app import branding
from app.services.glossary import wrap_glossary
@ -63,3 +64,10 @@ templates.env.filters["price"] = _fmt_price
templates.env.filters["signed"] = _fmt_signed
templates.env.filters["money"] = _fmt_money
templates.env.filters["glossary"] = _glossary_filter
# Brand globals — every template that prints a product name should pull
# from these so a future rename is a one-liner in `app/branding.py`.
templates.env.globals["BRAND_NAME"] = branding.BRAND_NAME
templates.env.globals["BRAND_SHORT"] = branding.BRAND_SHORT
templates.env.globals["SITE_URL"] = branding.SITE_URL
templates.env.globals["APP_URL"] = branding.APP_URL