Hard rule 1 of design/FRAME.md (Account & Data Sovereignty): the business owns every account and revokes access in one click.
R1 ensures a small business never loses its ad accounts, pixels, storefront data or customer list when changing marketers. OAuth tokens live encrypted in the vault, passwords are never shared, and revoking a marketer's time-bound grant takes one click while leaving every asset intact. For example, revoking a grant immediately blocks all API reads and cancels pending proposals without touching the shop's Meta Business Portfolio.
Bu depoda nasıl kullanılır
Defined in design/FRAME.md, enforced by AGENTS.md rule 6 and implemented across vault.oauth_connections and public.marketer_grants; note R1 can also mean Release 1 in older release codes.
İlgili dosyalar:design/FRAME.mdAGENTS.md
R1, R2, R3 (release codes)
Proje kimliğiProje kodlarıDiğer adlar: R1 (Release 1), R2 (Release 2), R3 (Release 3), R2 gate
Kalıcı bağlantıShorthand labels for Release 1, Release 2 and Release 3 used across roadmaps and code, distinct from hard rules R1–R3.
Release codes divide the multi-year roadmap into three phases: R1 is the Turkish Release 1 operating ledger and safeguarded marketplace, R2 adds secondary Turkish connectors, TikTok Events API and backup PSPs, and R3 adds global expansion via a foreign entity and Stripe Connect (OD-11). Because design/FRAME.md also numbers hard rules R1 through R8, surrounding context tells whether R1 means Release 1 or account sovereignty. For example, the API code hard_denied_r1 refers specifically to Release 1 AI autonomy caps.
Bu depoda nasıl kullanılır
Used across design/FRAME.md, docs/OWNER-DECISIONS.md and AGENTS.md rule 5 to keep unbuilt Release 2 and Release 3 items off Release 1 screens.
İlgili dosyalar:design/FRAME.mddocs/OWNER-DECISIONS.mdAGENTS.md
Hard rule 2 of design/FRAME.md (90-Second Audit First): start with a free read-only audit before any card or retainer.
R2 puts proof before sales pitches: a visiting shop gets an immediate read-only check of its tracking quality, wasted spend and top SEO blockers without entering a credit card or browsing an empty marketplace. From the audit, the owner freely picks self-serve setup or a fixed 7-day sprint. For example, showing concrete tracking gaps on day one builds trust far better than a cold pitch.
Bu depoda nasıl kullanılır
Defined in design/FRAME.md and ADR-0008, with preview logic in GET /v1/audit/preview and /audit; note R2 also appears as shorthand for Release 2.
İlgili dosyalar:design/FRAME.mddocs/adr/0008-audit-to-sprint-cold-start-wedge.md
Hard rule 3 of design/FRAME.md (Dual Server-Side Parity): one event bus feeds Meta CAPI and Google Data Manager with consent.
R3 makes Meta and Google equal first-class destinations from one first-party event pipeline, with separate per-platform PII normalisation before hashing and a strict consent gate before dispatch. Nothing is ever sent without consent, and WhatsApp events receive explicit deduplication. For example, one consented purchase order creates one Meta CAPI row and one Google Data Manager row in the same transaction.
Bu depoda nasıl kullanılır
Defined in design/FRAME.md, enforced by AGENTS.md rule 9 and ADR-0002, and built across apps/collector, packages/signals and apps/api/src/dispatch-main.ts; note R3 also abbreviates Release 3.
İlgili dosyalar:design/FRAME.mdAGENTS.mddocs/adr/0002-dual-server-side-capi-and-google-data-manager.md
Hard rule 4 of design/FRAME.md (Expiring Preview Approvals): every binding mutation requires owner approval of a hash-pinned preview.
R4 closes the loop on financial safety: neither a marketer nor an AI may change a live budget, publish a campaign, alter tracking destinations or release a safeguarded payment on its own. Every change creates an expiring, SHA-256-pinned preview checked against the workspace step cap (OD-19), daily budget ceiling, kill switch and step-up MFA rules before executing. For example, an approval request exceeding a 25 percent change expires in 4 hours instead of 24.
Bu depoda nasıl kullanılır
Defined in design/FRAME.md, enforced by AGENTS.md rule 10, ADR-0005, packages/approvals and docs/schema.sql (trg_approval_requests_guardrails).
İlgili dosyalar:design/FRAME.mdAGENTS.mddocs/adr/0005-expiring-sha256-approval-ledger.md
Hard rule 5 of design/FRAME.md (Verified Proof Only): marketer badges come strictly from live APIs and the payment ledger.
R5 replaces unverified testimonials and star ratings with four dated, scoped evidence-tier badges computed only from read-only ad APIs and the marketplace payment ledger. Retention stats stay hidden below three clients (N < 3) to protect small-sample privacy, and client brand names stay anonymous unless both parties opt in. For example, a specialist with only two past clients cannot display a misleading 100 percent retention badge.
Bu depoda nasıl kullanılır
Defined in design/FRAME.md, enforced by AGENTS.md rule 11 and implemented in packages/marketplace.
İlgili dosyalar:design/FRAME.mdAGENTS.md
Hard rule 6 of design/FRAME.md (Honest Billing & Safeguarded Payments): 1-click cancel, 0 percent ad markup, licensed splits and exact tax.
R6 combines customer-friendly billing with Turkish fintech and tax compliance: self-serve one-click cancellation, zero ad-spend markup, clearly labelled pilot pricing, marketplace money routed solely through licensed iyzico Pazaryeri, and server-calculated 3/10 VAT withholding plus 1 percent e-commerce withholding in integer kuruş. For example, both sides see the exact kuruş invoice breakdown before any safeguarded milestone opens.
Bu depoda nasıl kullanılır
Defined in design/FRAME.md, enforced by AGENTS.md rule 12 and ADR-0006; live marketplace payment checkout stays locked in sandbox until counsel and YMM sign off (OD-05, issue 3).
İlgili dosyalar:design/FRAME.mdAGENTS.mddocs/adr/0006-iyzico-pazaryeri-and-turkish-tax-ledger.md
Hard rule 7 of design/FRAME.md (Closed-Loop CRM): moving a consented deal queues ad-platform conversion feedback atomically.
Service businesses and WhatsApp sellers close sales off the website, leaving ad algorithms blind to which leads actually bought. Under R7, leads from Meta forms, WhatsApp, Google Ads and shop orders enter one consent-recorded pipeline, and advancing a consented deal to Qualified or Won enqueues conversion feedback for Meta and Google inside the very same PostgreSQL transaction. For example, if the database rolls back, no stray conversion event can ever fire.
Bu depoda nasıl kullanılır
Defined in design/FRAME.md, enforced by AGENTS.md rule 13 and implemented across apps/api/src/routes/connections-crm.ts and public.conversion_feedback_queue.
İlgili dosyalar:design/FRAME.mdAGENTS.mddocs/schema.sql
Hard rule 8 of design/FRAME.md (Actionable SEO): at most five prioritised tasks per audit with URL, evidence and re-check.
Traditional SEO crawlers dump 400 overwhelming warnings that busy shop owners ignore. R8 caps every SEO audit at five concrete, revenue-prioritised tasks (MAX_SEO_ISSUES_CAP = 5), each carrying the exact affected URL, verifiable evidence, an owner or marketer assignee and a re-checkable done state, gathered by an SSRF-isolated crawler. For example, fixing a broken canonical tag on a top product page ranks ahead of minor metadata trivia.
Bu depoda nasıl kullanılır
Defined in design/FRAME.md, enforced by AGENTS.md rule 13 and capped in apps/api/src/worker-main.ts (MAX_SEO_ISSUES_CAP = 5) and apps/seo-worker.
İlgili dosyalar:design/FRAME.mdAGENTS.mdapps/api/src/worker-main.ts
race condition
TR: yarış koşuluKavramVeri ve PostgreSQLDiğer adlar: race
Kalıcı bağlantıA defect that surfaces only when two concurrent operations interleave in an unlucky order.
When two processes check a rule and then write a change without locking or a single atomic SQL statement, both can pass the check before either writes. Race conditions often pass single-user tests every time and fail only under parallel load or deliberate concurrency probes. For example, two simultaneous budget approvals that each individually fit under a workspace's daily ceiling can together exceed it unless serialized behind an advisory lock.
Bu depoda nasıl kullanılır
Database tests explicitly fire parallel requests (such as 8 concurrent sign-in completions, 8 concurrent TOTP failures, and 12 concurrent event deliveries) against real PostgreSQL to prove races fail closed.
İlgili dosyalar:packages/db/migrations/0006_auth_durable_sessions_and_mfa.sqlpackages/db/migrations/0009_tracking_event_keys_and_dispatch_lease.sql
Radix UI
TeknolojiÖn yüz ve tasarımDiğer adlar: radix-ui, Radix
Kalıcı bağlantıA library of unstyled, WAI-ARIA compliant React behavioural primitives (such as dialogs, popovers, and tabs) that our closed kit wraps with design tokens.
Building bulletproof modal focus trapping, portal stacking, pointer dismissal, and screen-reader state wiring from scratch is easy to get subtly wrong across browsers. Wrapping unstyled Radix primitives with our own closed Tailwind tokens combines tested accessibility behaviour with full control over visual design and zero third-party theme styles. For example, packages/ui/package.json includes radix-ui 1.8.1 as one of its only three runtime dependencies.
Bu depoda nasıl kullanılır
Installed as radix-ui 1.8.1 in packages/ui/package.json alongside class-variance-authority and clsx.
İlgili dosyalar:packages/ui/package.json
The standard JavaScript error thrown when a numeric argument, length, or size falls outside its valid bounds.
Throwing RangeError explicitly on negative limits, oversized buffers, wrong key lengths, or out-of-range dates makes invalid inputs fail fast instead of silently truncating or misbehaving. API error middleware then maps unexpected or domain errors cleanly into a safe application/problem+json response without echoing the raw message. For example, packages/vault/src/envelope.ts throws immediately if an IV is not exactly 12 bytes or a key is not 32 bytes.
Bu depoda nasıl kullanılır
Used across packages/vault, packages/approvals, and apps/api to enforce hard parameter boundaries.
İlgili dosyalar:packages/vault/src/envelope.ts
rate budget
KavramBağlayıcılar ve CRMDiğer adlar: connector rate budget, rate governor, hız bütçesi
Kalıcı bağlantıThe product own per-provider, per-account call allowance and priority queue that stays below external quotas.
Instead of letting different workers compete blindly for one platform quota, a rate budget allocates capacity per workspace, provider and account under a strict three-tier priority order: conversion_events (rank 100) beats order_sync (rank 50), which beats catalog_backfill (rank 10). As utilisation rises, the governor slows or defers lower-priority tasks so time-sensitive conversions never wait behind a slow history import. For example, CrossProviderRateGovernor enforces Meta 75/95 percent BUC thresholds, Shopify 25 percent catalog reserve, ikas 40-per-10-second bursts and Google Data Manager / TikTok backoff ceilings in one deterministic module. Centralised rate budgeting keeps multi-tenant syncs predictable.
Bu depoda nasıl kullanılır
Built in packages/connectors/src/rate-budget.ts (WORKLOAD_PRIORITY_RANK, CrossProviderRateGovernor) and checked by apps/api/src/routes/connectors-sync-schedule-preflight.ts.
İlgili dosyalar:packages/connectors/src/rate-budget.tsapps/api/src/routes/connectors-sync-schedule-preflight.ts
rate limiter
KavramSaldırı ve savunmalarDiğer adlar: rate limit, fixed window
Kalıcı bağlantıA per-client request counter over a bounded time window that answers HTTP 429 once traffic exceeds its quota.
Rate limiters slow down credential stuffing, brute-force guesses, and expensive endpoint abuse while keeping memory bounded against IP-flood attacks. A production-ready limiter uses a monotonic clock, bounds its key map with LRU eviction (50,000 keys), and collapses IPv6 clients to /64 subnets so rotating host bits cannot dodge limits. For example, FixedWindowRateLimiter caps auth at 60/min, audit_preview at 30/min, and marketer_apply at 10/hr, noting honestly that an in-process map is per-instance until a shared Redis store is wired for horizontal scaling.
Bu depoda nasıl kullanılır
Built in apps/api/src/platform/rate-limit.ts (FixedWindowRateLimiter, monotonic clock, 50,000-key LRU cap, IPv6 /64 collapse; currently in-memory per API process).
İlgili dosyalar:apps/api/src/platform/rate-limit.ts
ratio of sums
TR: toplamların oranıKavramÖlçümlemeDiğer adlar: ratio-of-sums, spend-weighted average, oranların oranı
Kalıcı bağlantıThe only mathematically sound way to aggregate rates: sum all numerators and sum all denominators first, then divide once.
If Day 1 had 500 lira spend and 2,500 lira revenue (ROAS 5.0) and Day 2 had 4,500 lira spend and 9,000 lira revenue (ROAS 2.0), the two-day ROAS is (2,500 + 9,000) / (500 + 4,500) = 2.30, not (5.0 + 2.0) / 2 = 3.50. Ratio of sums naturally weights each day or campaign by its real spend, impressions or orders. Every metric rollup — ROAS, MER, POAS, CPA, CPC, CPM and CTR — must follow this rule.
Bu depoda nasıl kullanılır
Enforced across packages/ai/src/layer0-analytics.ts, apps/api/src/routes/kpi-ledger.ts and apps/api/src/routes/overview-unit-economics-rollup.ts using exact BigInt sums.
İlgili dosyalar:apps/api/src/routes/kpi-ledger.tspackages/ai/src/layer0-analytics.ts
raw body
TR: ham gövdeKavramKriptografi ve gizlilerDiğer adlar: raw request body, rawBody, raw bytes
Kalıcı bağlantıThe exact unaltered bytes of an incoming HTTP request body before JSON parsing, required for verifying webhook signatures.
When a web framework parses a JSON request and serialises it back to text, key order, whitespace, or Unicode escaping can change by a single byte, breaking any HMAC signature computed by the sender. Security middleware must capture the original raw byte buffer and pass it directly to the signature verifier before parsing JSON. For example, verifying Shopify's X-Shopify-Hmac-Sha256 header against JSON.stringify(req.body) fails on pretty-printed payloads, whereas verifying the raw body succeeds every time.
Bu depoda nasıl kullanılır
Required by apps/api/src/hmac.ts (verifyRawBodyHmac) and every provider verifier in packages/connectors/src/hmac-verifiers.ts.
İlgili dosyalar:apps/api/src/hmac.tspackages/connectors/src/hmac-verifiers.ts
raw colour
TR: ham renk koduKavramÖn yüz ve tasarımDiğer adlar: raw hex, raw hex colour, hex colour, #RRGGBB
Kalıcı bağlantıA literal colour written directly as a hex code or rgb/hsl function instead of a semantic design token, banned outside packages/ui/src/tokens.css.
Scatter raw colour literals across React components and dark mode immediately breaks, contrast checks drift out of date, and brand refreshes turn into brittle multi-file hunts. Funneling every colour through CSS custom properties in one stylesheet lets an automated scanner prove that zero screens invented an unapproved shade. For example, writing text-[var(--ink)] passes light mode, dark mode, and print resets, whereas a literal hex colour fails tools/check-tokens.mjs.
Bu depoda nasıl kullanılır
Rejected across apps/web/src and packages/ui/src (except packages/ui/src/tokens.css) by tools/check-tokens.mjs and mirrored in tools/learning/lib/gates.mjs.
İlgili dosyalar:tools/check-tokens.mjspackages/ui/src/tokens.css
raw ingest envelope
TR: ham alım zarfıKavramBağlayıcılar ve CRMDiğer adlar: raw_ingest_envelopes, webhook envelope, envelope retention
Kalıcı bağlantıThe short-lived deduplicated database record of one incoming webhook delivery, stored by SHA-256 hash for 14 days.
When a storefront or payment provider posts a webhook, the server first verifies the raw-body HMAC signature and computes a SHA-256 hash of the verbatim payload, then records the delivery in raw_ingest_envelopes with its source_delivery_id, signature_verified flag and parse_status (received, parsed, duplicate, rejected, dead_letter). Retaining envelopes for 14 days by default (capped at 30 days for KVKK minimisation) lets operators detect duplicate resends immediately and safely replay failed envelopes after fixing a parser bug—without keeping raw customer payloads forever. For example, if ikas retries an order webhook twice, the second delivery matches the existing hash or delivery key and is marked duplicate with zero double-counting. Unverified envelopes are rejected fail-closed and never replayed.
Bu depoda nasıl kullanılır
Built in docs/schema.sql (raw_ingest_envelopes), packages/connectors/src/hmac-verifiers.ts (RAW_ENVELOPE_RETENTION_DAYS = 14) and apps/api/src/routes/ingest-webhooks.ts.
İlgili dosyalar:docs/schema.sqlpackages/connectors/src/hmac-verifiers.tsapps/api/src/routes/ingest-webhooks.ts
raw-body HMAC verification
KavramSaldırı ve savunmalarDiğer adlar: raw-body HMAC, HMAC-signed batch
Kalıcı bağlantıVerifying an incoming webhook or event batch's HMAC-SHA-256 signature over the exact unaltered raw request bytes plus a fresh timestamp.
Checking a webhook signature over parsed-and-restringified JSON breaks whenever key order or spacing differs, and omitting a timestamp allows attackers to replay captured requests indefinitely. Raw-body HMAC verification hashes <timestampSec>.<rawBody>, enforces a 300-second freshness window, compares digests with timingSafeEqual, and supports dual-key rotation. For example, forged or replayed connector webhooks fail immediately with HTTP 401 before touching business tables.
Bu depoda nasıl kullanılır
Built in apps/api/src/hmac.ts and packages/connectors/src/hmac-verifiers.ts across all external webhook receivers.
İlgili dosyalar:apps/api/src/hmac.tspackages/connectors/src/hmac-verifiers.ts
The component-based UI library in which packages/ui and apps/web describe screens declaratively as functions of props and state.
Instead of imperatively mutating DOM nodes by hand whenever data arrives, React components return a declarative tree for the current state and let React reconcile minimal DOM updates efficiently. React 19 adds first-class support for Server Components, streaming Suspense boundaries, and modern form transitions used by the Next.js App Router. For example, changing an approval status from pending to approved updates the pill, action bar, and status text in one predictable re-render.
Bu depoda nasıl kullanılır
Runs React 19.3.1 across apps/web/package.json and peer dependencies in packages/ui/package.json.
İlgili dosyalar:apps/web/package.jsonpackages/ui/package.json
React hook
TR: React kancasıKavramÖn yüz ve tasarımDiğer adlar: hook, useState, useEffect, useRef
Kalıcı bağlantıA use* function (useState, useEffect, useRef, useMemo) that lets a React client component hold state, reference DOM nodes, or run browser effects.
Hooks must be called at the top level of a client component function in the same order on every render so React can track each hook slot accurately. Because hooks rely on interactive client lifecycle, calling any hook inside a React Server Component fails compilation and requires placing use client at the file boundary. For example, OverviewClient.tsx uses useState for loaded records and useEffect to fetch live workspace data after mount.
Bu depoda nasıl kullanılır
Guarded by invariant 4 of tools/check-web-budgets.mjs, which verifies that any file invoking React hooks declares use client.
İlgili dosyalar:tools/check-web-budgets.mjs
React Server Component
RSCTR: React Sunucu BileşeniTeknolojiÖn yüz ve tasarımDiğer adlar: Server Component, RSC, server by default
Kalıcı bağlantıA React component that executes strictly on the server, shipping rendered output rather than its own JavaScript code to the browser—the default in Next.js App Router.
Keeping pages and layouts as Server Components by default shrinks client JavaScript bundles, speeds up initial paint, and prevents server-only utilities or secrets from ever reaching visitors browsers. Whenever a part of the page needs interactive hooks or browser listeners, only that interactive piece crosses into a use client child component. For example, every page.tsx in apps/web/src/app/ starts as an RSC that exports metadata and mounts a focused client component only where interactivity is needed.
Bu depoda nasıl kullanılır
Default component model for all 44 routes in apps/web/src/app/, including apps/web/src/app/layout.tsx and apps/web/src/app/w/[workspaceId]/layout.tsx.
İlgili dosyalar:apps/web/src/app/layout.tsxapps/web/src/app/w/[workspaceId]/layout.tsx
read-back
TR: geri okumaSüreçOnaylar ve otomasyonDiğer adlar: post-write read-back, verifyPostWriteReadBack, EXECUTION_UNVERIFIED, rendered HTML read-back
Kalıcı bağlantıFetching the remote object again immediately after a write to verify it actually holds the exact approved value before marking execution succeeded.
An ad platform can return HTTP 200 on a budget update while silently rounding the number, dropping the field or failing to commit it asynchronously. Reading the ad set back right after writing and comparing daily_budget against the approved minor-unit integer confirms real state; if the read-back disagrees, execution is flagged EXECUTION_UNVERIFIED for human inspection instead of falsely reporting success.
Bu depoda nasıl kullanılır
Executed in apps/api/src/approvals/meta-executor.ts (and checked in packages/approvals/src/action-gateway-hysteresis.ts as verifyPostWriteReadBack).
İlgili dosyalar:apps/api/src/approvals/meta-executor.tspackages/approvals/src/action-gateway-hysteresis.ts
read-before-write
SüreçOnaylar ve otomasyonDiğer adlar: read before write, PROVIDER_STATE_CHANGED, CURRENCY_MISMATCH
Kalıcı bağlantıReading the outside ad object immediately before writing to confirm its identity, currency and current budget still match the approved preview.
Before sending a single write call to Meta, the executor fetches the target ad set from Meta Graph API and checks three facts: the object exists under the connected ad account, its currency matches the proposal (CURRENCY_MISMATCH otherwise), and its current daily_budget still matches current_daily_budget_minor (PROVIDER_STATE_CHANGED otherwise). Failing before writing guarantees zero unwanted mutations and lets the request be safely handled without drift.
Bu depoda nasıl kullanılır
Implemented as step 1 of apps/api/src/approvals/meta-executor.ts before beginProviderWrite commits the write marker.
İlgili dosyalar:apps/api/src/approvals/meta-executor.ts