From 5d1ad576a1ff09e61d537d4375992f53c3db5728 Mon Sep 17 00:00:00 2001
From: Diego Rodrigues de Sa e Souza
<8016841+diegosouzapw@users.noreply.github.com>
Date: Sun, 19 Jul 2026 19:07:44 -0300
Subject: [PATCH] feat(quality): gate the free-tier headline so it can never
silently drift again (#7798)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* docs(free-tiers): correct the headline to the 1.37B the catalog actually computes
The 2026-06-17 honesty correction landed 1.54B, but v3.8.42 reclassified longcat
from a 150M/mo recurring grant to a one-time 10M signup credit and the doc was
never resynced. Verified against computeFreeModelTotals() at every release tag
from 3.8.13 to HEAD: no free provider was lost by mistake.
* feat(quality): gate the free-tier headline against the live catalog
The README headlined ~1.6B free tokens/mo for seven releases after the catalog had
already been corrected down to 1.37B. No gate watched that number, so the drift was
invisible — check:docs-counts only covered providers, locales, executors, strategies,
oauth, a2a skills and cloud agents.
Adds a STRICT check that runs computeFreeModelTotals() (the same function behind
/api/free-tier/summary) and fails the build when README.md or FREE_TIERS.md publish a
headline that no longer rounds to it. Degrades to a skip if tsx is unavailable rather
than going falsely red.
The extractor is a whitelist: the theoretical ceiling (~10B), the historical ~1.94B and
per-model rows (~1.00B) are legitimate figures that must never trip the gate.
Also adds the biweekly-audit note under the README headline, so readers know the number
moves both ways and is what the catalog computes rather than a rounded-up best case.
* feat(quality): extend the counts gate to engines, MCP tools/scopes and CLI tools
The v3.8.49 audit found four more numbers that had silently drifted, all invisible to
CI because check:docs-counts only watched providers/locales/executors/strategies/oauth/
a2a/cloud-agents: 10->11 compression engines, 94->104 MCP tools, 30->31 scopes,
26->33 CLI tools.
Adds a generic makeNumberClaimValidator that reads every fact in ONE tsx subprocess via
the same functions the app serves (ENGINE_IDS, countUniqueMcpTools, the live scope union,
CLI_TOOLS) — never a hardcoded copy — with DATA_DIR redirected to a throwaway dir so
importing the MCP tool modules can't touch the operator's SQLite. Each check declares a
skip pattern so legitimate non-aggregate figures never trip it: per-module tool counts
('Memory tool definitions (3 tools)') and the CLI catalog total sitting next to the MCP
total. Degrades to a skip when tsx is unavailable rather than a false red.
7 new unit tests (all pass) covering the exact stale values this audit found and proving
per-module counts are ignored.
* docs(diagrams): sync the animated cards and mermaid sources to the audited v3.8.49 numbers
The README text was fixed in #7795 but the SVG cards and mermaid sources kept the
old numbers baked in — exactly the drift the readers see first.
- compression-pipeline.svg: 10 -> 11 engine cells (Omniglyph added as #8, matching
the README alt text), re-spaced 51px cells, highlight cascade re-timed, the
Caveman kill-dot repositioned inside its cell, default-stack bracket recentered
- free-tier-budget.svg: bar and grid rebuilt from computeFreeModelTotals() — 21 -> 19
countable pools (LongCat-2.0 moved to one-time credit, Inclusion provider removed),
huggingchat entry is now ERNIE 4.5 VL, kiro shows Claude Sonnet 4.5, signup credits
~616M -> ~626M (+longcat 10M pill), aria said 'about 1.6 billion' -> 1.4/2.0,
lower sections shifted up 30px (viewBox 872 -> 842)
- promise-pillars.svg: 26 -> 33 coding agents
- mcp-tools-94.mmd -> mcp-tools-104.mmd: real per-collection unique contributions
(42 base + memory 3 + skill 4 + githubSkill 3 + pool 6 + gamification 8 + plugin 8
+ notion 6 + obsidian 22 + compression 2), exported SVG regenerated, zh-CN ref synced
- request-pipeline.mmd: 17 -> 18 strategies, exported SVG regenerated
- README free-tier alt + docs/diagrams/README.md synced to the same numbers
Both edited cards pass validate-svg.sh and were render-verified at 4 timestamps
(animation runs; first frame is the finished composition).
* docs(env): register the 4 env vars missing from the .env.example contract (base-red unblock)
FREE_PROXY_AUTO_SYNC_ENABLED / FREE_PROXY_AUTO_SYNC_INTERVAL_MS (scheduler.ts) and
MITM_ROOT_CA_ENABLED / MITM_CERT_MODE (mitm manager/server, #6684) landed on
release/v3.8.49 without their .env.example + ENVIRONMENT.md entries, turning the
docs-gates job red for every PR on the branch. Documented with their real defaults
and the set-by-manager caveat for MITM_CERT_MODE.
* fix(dashboard): narrow the Codex session ParseResult with an equality check (base-red unblock)
#7725 landed 'if (!result.ok)' in OAuthModal — under this repo's strict:false,
tsc 6 only narrows a discriminated union on the equality form, so the negation
raised TS2339 (Property 'error' does not exist on ParseResult) and turned the
dashboard-typecheck gate red for every PR on release/v3.8.49. Runtime semantics
are identical (ok is a strict boolean).
Also ratchets the frozen baseline down 260 -> 259: the real fix here plus 3
baselined errors that other merges already fixed (CostOverviewTab TS2304,
SidebarTab TS2322, FreePoolTab TS2304). Baseline diff is deletions-only.
* fix(dashboard): keep OAuthModal within the frozen file-size cap
The narrowing comment pushed the file to 1032 > 1030 frozen; the rationale lives
in the previous commit message and the dashboard-typecheck gate itself guards the
'=== false' form from being refactored back to '!result.ok'.
* test(providers): align the grok-web credential assertion with the #7567 hint (base-red unblock)
#7713 added hintKey/hintFallback (proactive cf_clearance/User-Agent guidance) to the
grok-web web-session metadata without touching this test's deepEqual, turning unit
shard 2/4 red for every PR on release/v3.8.49. Rewritten in the same contract-only
style the file already uses for lmarena: structural fields stay strictly asserted,
the hint asserts key + intent (cf_clearance / User-Agent) without freezing operator
copy. Net stronger than before — the old assertion never checked the hint at all.
* test(golden): regenerate translate-path snapshot for the notion-web endpoint move (base-red unblock)
#7768 switched notion-web to app.notion.com without regenerating the golden,
turning unit shard 3/4 red for every PR on release/v3.8.49. Two-line regen,
reflects the deliberate production change.
---
.env.example | 17 ++
README.md | 4 +-
.../quality/dashboard-typecheck-baseline.json | 9 -
docs/diagrams/README.md | 4 +-
docs/diagrams/compression-pipeline.svg | 133 ++++++------
docs/diagrams/exported/mcp-tools-104.svg | 1 +
docs/diagrams/exported/mcp-tools-94.svg | 1 -
docs/diagrams/exported/request-pipeline.svg | 2 +-
docs/diagrams/free-tier-budget.svg | 180 ++++++++--------
.../{mcp-tools-94.mmd => mcp-tools-104.mmd} | 18 +-
docs/diagrams/promise-pillars.svg | 4 +-
docs/diagrams/request-pipeline.mmd | 2 +-
docs/i18n/zh-CN/docs/frameworks/MCP-SERVER.md | 4 +-
docs/reference/ENVIRONMENT.md | 4 +
docs/reference/FREE_TIERS.md | 8 +-
scripts/check/check-docs-counts-sync.mjs | 201 ++++++++++++++++++
src/shared/components/OAuthModal.tsx | 2 +-
tests/snapshots/provider/translate-path.json | 4 +-
tests/unit/check-docs-counts-sync.test.ts | 98 +++++++++
tests/unit/web-session-credentials.test.ts | 21 +-
20 files changed, 525 insertions(+), 192 deletions(-)
create mode 100644 docs/diagrams/exported/mcp-tools-104.svg
delete mode 100644 docs/diagrams/exported/mcp-tools-94.svg
rename docs/diagrams/{mcp-tools-94.mmd => mcp-tools-104.mmd} (52%)
diff --git a/.env.example b/.env.example
index 032dabfd57..9f2869678c 100644
--- a/.env.example
+++ b/.env.example
@@ -1806,6 +1806,15 @@ APP_LOG_TO_FILE=true
# Skip writing to the hosts file when adding/removing DNS entries (e.g. sandboxed
# or read-only test environments). Used by: src/mitm/dns/dnsConfig.ts.
# OMNIROUTE_SKIP_DNS_WRITE=1
+# Opt in to the root-CA + per-host-leaf cert model for the MITM proxy (#6684).
+# Fresh installs and installs with this set to "true" get a persisted root CA that
+# signs per-host leaves; installs with a pre-existing trusted legacy leaf keep the
+# legacy fixed-SAN cert unless opted in. Used by: src/mitm/manager.ts.
+# MITM_ROOT_CA_ENABLED=true
+# Set BY the MITM manager for the spawned proxy process ("root-ca" | "legacy") —
+# reflects the migration decision above; not meant to be set manually.
+# Read by: src/mitm/server.cjs.
+# MITM_CERT_MODE=legacy
# ── Test/CI-only guards (never needed in production) ──
# Set automatically by tests/_setup/isolateDataDir.ts and the CI workflows: the
@@ -1825,6 +1834,14 @@ APP_LOG_TO_FILE=true
# ONEPROXY_MAX_PROXIES=500
# ONEPROXY_MIN_QUALITY_THRESHOLD=50
+# ── Free Proxy Pool (auto-sync scheduler) ──
+# Background refresh of the free-proxy pool. Opt-in, OFF by default (parallels
+# Hard Rule #20's default-off posture for data-mutating background features).
+# Used by: src/lib/freeProxyProviders/scheduler.ts
+# FREE_PROXY_AUTO_SYNC_ENABLED=true
+# Sync interval in ms (default: 1800000 = 30 min).
+# FREE_PROXY_AUTO_SYNC_INTERVAL_MS=1800000
+
# ── Free Proxy Pool (1proxy source) ──
# Used by: src/lib/freeProxyProviders/oneproxy.ts
# Set FREE_PROXY_1PROXY_ENABLED=false to disable this source.
diff --git a/README.md b/README.md
index 3ebc463ab4..e53aadc503 100644
--- a/README.md
+++ b/README.md
@@ -18,9 +18,11 @@
> Stacking free tiers by hand is painful — dozens of SDKs, dozens of rate limits, and no idea how much you actually have. OmniRoute aggregates the **documented** free tiers of **39 provider pools / 460+ models** into one honest number and shows it live on the dashboard (`/dashboard/free-tiers`).
-
+
> Animated summary of the live `/dashboard/free-tiers` page. Full methodology (pool dedupe, credit tiers, provider terms): **[docs/reference/FREE_TIERS.md](docs/reference/FREE_TIERS.md)**.
+>
+> These figures are re-audited every two weeks against the live catalog and **move both ways** — a provider ends a free tier and the number drops; a new one lands and it climbs. We publish what the catalog actually computes, never a rounded-up best case. A CI gate (`check:docs-counts`) fails the build if this headline drifts from the code.
diff --git a/config/quality/dashboard-typecheck-baseline.json b/config/quality/dashboard-typecheck-baseline.json
index 4f7857d6ce..20617731af 100644
--- a/config/quality/dashboard-typecheck-baseline.json
+++ b/config/quality/dashboard-typecheck-baseline.json
@@ -63,9 +63,6 @@
"src/app/(dashboard)/dashboard/compression/studio/EncoderComparisonTable.tsx": {
"TS2322": 1
},
- "src/app/(dashboard)/dashboard/costs/CostOverviewTab.tsx": {
- "TS2304": 1
- },
"src/app/(dashboard)/dashboard/costs/quota-share/QuotaSharePageClient.tsx": {
"TS2551": 7,
"TS2322": 2,
@@ -184,12 +181,6 @@
"src/app/(dashboard)/dashboard/settings/components/RedisLauncherPanel.tsx": {
"TS2345": 11
},
- "src/app/(dashboard)/dashboard/settings/components/SidebarTab.tsx": {
- "TS2322": 1
- },
- "src/app/(dashboard)/dashboard/settings/components/proxy/FreePoolTab.tsx": {
- "TS2304": 1
- },
"src/app/(dashboard)/dashboard/tools/traffic-inspector/components/CustomHostsManager.tsx": {
"TS2339": 1
},
diff --git a/docs/diagrams/README.md b/docs/diagrams/README.md
index dee34594f5..0fa9f35bca 100644
--- a/docs/diagrams/README.md
+++ b/docs/diagrams/README.md
@@ -16,7 +16,7 @@ Mermaid sources (`.mmd`) and exported SVGs for OmniRoute v3.8.0 architecture flo
| [auto-combo-12factor.mmd](./auto-combo-12factor.mmd) | [SVG](./exported/auto-combo-12factor.svg) | docs/routing/AUTO-COMBO.md |
| [resilience-3layers.mmd](./resilience-3layers.mmd) | [SVG](./exported/resilience-3layers.svg) | docs/architecture/RESILIENCE_GUIDE.md, CLAUDE.md |
| [i18n-flow.mmd](./i18n-flow.mmd) | [SVG](./exported/i18n-flow.svg) | docs/guides/I18N.md |
-| [mcp-tools-94.mmd](./mcp-tools-94.mmd) | [SVG](./exported/mcp-tools-94.svg) | docs/frameworks/MCP-SERVER.md |
+| [mcp-tools-104.mmd](./mcp-tools-104.mmd) | [SVG](./exported/mcp-tools-104.svg) | docs/frameworks/MCP-SERVER.md |
| [cloud-agent-flow.mmd](./cloud-agent-flow.mmd) | [SVG](./exported/cloud-agent-flow.svg) | docs/frameworks/CLOUD_AGENT.md |
| [authz-pipeline.mmd](./authz-pipeline.mmd) | [SVG](./exported/authz-pipeline.svg) | docs/architecture/AUTHZ_GUIDE.md |
| [db-schema-overview.mmd](./db-schema-overview.mmd) | [SVG](./exported/db-schema-overview.svg) | docs/architecture/CODEBASE_DOCUMENTATION.md |
@@ -34,7 +34,7 @@ inside GitHub's `` sandbox:
| [combo-always-on.svg](./combo-always-on.svg) | style reference | Animated priority-combo fallback (4 layers, 16s loop). Edit the SVG directly — there is no `.mmd` source. |
| [cli-terminal.svg](./cli-terminal.svg) | README.md (root) | Compact half-height animated terminal (1200×350): 3 real CLI commands cycling with typewriter + scrolling subcommand ticker; first frame = completed providers screen. Edit the SVG directly — there is no `.mmd` source. |
| [compression-pipeline.svg](./compression-pipeline.svg) | README.md (root) | Animated 10-engine compression funnel (8s loop). Edit the SVG directly — there is no `.mmd` source. |
-| [free-tier-budget.svg](./free-tier-budget.svg) | README.md (root) | Animated free-tier budget card (~1.6B/mo headline, 21-pool budget bar, per-model grid, signup credits, 10s loop). Edit the SVG directly — there is no `.mmd` source. |
+| [free-tier-budget.svg](./free-tier-budget.svg) | README.md (root) | Animated free-tier budget card (~1.4B/mo headline, 19-pool budget bar, per-model grid, signup credits, 10s loop). Edit the SVG directly — there is no `.mmd` source. |
| [readme-hero.svg](./readme-hero.svg) | README.md (root) | Animated hero card (tagline, 268-provider/90+ free headline, full-width compression bar demo, 6 stat chips). Edit the SVG directly — there is no `.mmd` source. |
| [promise-pillars.svg](./promise-pillars.svg) | README.md (root) | Animated "The Promise" 6-pillar card (12s border-highlight sweep). Edit the SVG directly — there is no `.mmd` source. |
| [why-pain-fix.svg](./why-pain-fix.svg) | README.md (root) | Animated "Why OmniRoute" 10-row pain-vs-fix ledger (15s green row sweep). Edit the SVG directly — there is no `.mmd` source. |
diff --git a/docs/diagrams/compression-pipeline.svg b/docs/diagrams/compression-pipeline.svg
index e03d5293a5..72a12994e4 100644
--- a/docs/diagrams/compression-pipeline.svg
+++ b/docs/diagrams/compression-pipeline.svg
@@ -1,4 +1,4 @@
-