compliance: flag-gate AI portfolio + cloud sync + Stripe; de-risk prompts; harden reviewer

Implements docs/read-markets-compliance-changes.md as flag-gated changes
(no deletions) so paused features stay in the tree for future re-enable.
All four flags default False so a fresh deploy is compliance-safe.

- New env flags: PORTFOLIO_AI_ENABLED, PORTFOLIO_SYNC_ENABLED,
  TICKER_UNIVERSE_AGGREGATE_ENABLED, SUBSCRIPTIONS_ENABLED.
- Gates: /api/analyze, /api/portfolio/sync*, /api/stripe/*, /pricing,
  ticker_universe writes, portfolio_analysis.analyse(). is_paid_active()
  returns True for any auth'd user when subscriptions are paused.
- Prompts (PROMPT_VERSION 10): universal _COMPLIANCE_RIDER prepended to
  every system prompt; watch list removed; price-target / close-above-below
  / trigger / forward-state-as-description rules added; SPECULATIVE
  pivoted to regime-only scenarios; daily + weekly digests tightened.
- Reviewer: deterministic regex/lexicon pre-check fail-closed under the
  Haiku call; portfolio rider gated by PORTFOLIO_AI_ENABLED; base prompt
  sharpened for forward-state and MAR forward-opinion patterns;
  ReviewerVerdict audit table; generate_with_review retry helper.
- Migration 0026: purge portfolio_sync + ticker_universe; create
  reviewer_verdicts.
- Copy: MAR cite fixed to Art 3(1)(35) + Art 20 + Del Reg 2016/958;
  portfolio reframed as browser-only viewer in disclaimer / privacy /
  terms / about / pricing / landing (en + it). TODO(legal) marker for
  lawyer sign-off on disclaimer.
- Tests: 13 lexicon + 6 reviewer compliance regressions; conftest enables
  all flags so existing 402 tests still cover their code paths.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Giorgio Gilestro 2026-05-29 19:57:12 +02:00
parent ee8384f1ba
commit 47dce1a1a4
38 changed files with 1188 additions and 279 deletions

View file

@ -25,12 +25,21 @@
<h2 class="public-section__head">2. The Service</h2>
<p>
{{ BRAND_NAME }} provides a macro-strategy dashboard with curated
market data, news, and AI-generated commentary. Paid features include
portfolio import, AI portfolio analysis, and optional end-to-end
encrypted cloud sync of your portfolio. Feature lists, tiers, and
pricing are described on the <a href="/pricing">Pricing page</a> and
may change over time.
market data, news, and AI-generated commentary on public market
data (strategic log, indicator summaries, and a follow-up chat
grounded on those reads). It also includes a browser-only portfolio
composition viewer: CSVs you upload are parsed in your browser and
used to compute neutral statistics (weights, sector / currency /
concentration breakdown). Your holdings stay in your browser; they
are not sent to or stored on the server, and the Service does not
produce AI commentary on them.
</p>
{% if SUBSCRIPTIONS_ENABLED %}
<p>
Feature tiers and pricing are described on the
<a href="/pricing">Pricing page</a> and may change over time.
</p>
{% endif %}
<p>
Nothing produced by the Service is investment advice. See the
<a href="/disclaimer">Disclaimer</a> for the full position.
@ -76,6 +85,7 @@
<section class="public-section">
<h2 class="public-section__head">5. Paid plans</h2>
{% if SUBSCRIPTIONS_ENABLED %}
<p>
Paid plans are available at &pound;7/month or &pound;70/year (terms
and current prices on the <a href="/pricing">pricing page</a>). New
@ -88,6 +98,15 @@
stated. Detailed refund and cancellation rights are set out in
section 6 below.
</p>
{% else %}
<p>
Paid plans are not currently available; the Service is offered to
signed-in users at no cost while the subscription system is paused.
Sections 5 and 6 (paid plans and refunds) are retained for reference
and will apply again if subscriptions resume; their terms are not in
force at the moment.
</p>
{% endif %}
</section>
<section class="public-section">
@ -181,9 +200,11 @@
permission.
</p>
<p>
Any portfolio you upload remains your data. The Service does not
persist your holdings as plaintext (see the
<a href="/privacy">Privacy notice</a>).
Any portfolio CSV you upload remains your data. The portfolio
feature is browser-only: CSVs are parsed in your browser, the
resulting pie is kept in your browser&rsquo;s local storage, and
nothing about your holdings is sent to or stored on the server
(see the <a href="/privacy">Privacy notice</a>).
</p>
</section>