GetClaps
Ücretsiz DenetimFiyatlandırmaSözlükAkademi
  1. Ana sayfa
  2. /Akademi
  3. /L08 · Approvals and safe automation: propose, approve, execute, recover

Ana sayfa / Akademi / L08 · Approvals and safe automation: propose, approve, execute, recover

L08Bölüm C · Ürün motorlarıOrtaKod doğrulama tarihi: 2026-12-04

Approvals and safe automation: propose, approve, execute, recover

How every ad budget, campaign and tracking change passes through hash-pinned previews, layered ceilings, guarded executors and crash recovery without blind retries.

20 dk·3969 kelime·6 soru·36 terim·docs/lessons/08-approvals-and-safe-automation.md
Ön koşul:L03 · Data: PostgreSQL, tenants, exact money, and doing things exactly onceL04 · Identity and access: sign-in, sessions, passkeys, step-up, OAuth, roles
Tüm derslere dön
●

Ders içerikleri İngilizce yayınlanır (OD-23)

Sayfa çerçevesi Türkçe ve İngilizce olarak sunulur. Teknik ders metinleri, kod örnekleri ve kendini sına soruları doğrudan ortak kaynak dosyalarından İngilizce okunur; hukuk ve ürün terimlerinde Türkçe karşılıklar yer alır.

0%
▲Yanıtlanan sorular
0 / 6
—
○Doğruluk oranı
Henüz yanıt yok

Bu dersteki bölümler

  1. 1.Why this matters
  2. 2.The ideas
  3. 3.How this repository does it
  4. 4.What went wrong once
  5. 5.Try it yourself
  6. 6.Check yourself
  7. 7.Words to know
  8. 8.Go deeper

Why this matters

An advertising error costs real money within minutes: one misplaced zero on a daily budget or one unreviewed campaign launch can drain a small business's monthly marketing cash before breakfast. Letting an AI agent or an invited marketer mutate Meta or Google accounts directly turns a prompt bug, a stale report or a typo into an irreversible bill. This repository therefore puts a hard human-in-the-loop gate in front of every spend, campaign, tracking and safeguarded-payment action. This lesson explains how proposals are bound cryptographically to their previews, checked against layered ceilings, executed with read-before-write and read-back verification, and recovered safely after crashes without blind retries.

The ideas

Why nobody — human marketer or AI — executes directly

Small-business owners routinely work with external freelancers, agencies and AI recommendations, yet only the owner bears the credit-card bill when ad spend jumps unexpectedly. Product rules R4 and N2 establish one simple invariant: no external or financial mutation ever executes directly without an explicit human approval. Every automation mode honours this boundary — in disabled and observe, AI diagnostics cannot even draft proposals, and in copilot (the default), AI can only submit a pending proposal for the owner to read and decide.

Everyday actions are grouped into three risk tiers so the owner stays protected without suffering approval fatigue:

  • Reversible acts (archiving a note or moving an unsent CRM lead stage) apply immediately with an undo message.
  • Binding acts (changing a Meta or Google daily budget, publishing or pausing a campaign, changing a workspace tracking destination, or releasing a safeguarded payment milestone) always pass through Propose → Approve → Atomic Verify & Execute.
  • Irreversible acts (revoking a marketer, cancelling a subscription, deleting a workspace or erasing customer data) require a plain-language consequence confirmation.

Propose, approve, verify and execute

Separating drafting from decision and from execution creates three clear checkpoints:

text
1. PROPOSE (workspace member, marketer or AI diagnostic)
      |  complete 4-field intent + closed payload allow-list + preview binding
      |  guardrail check + canonical SHA-256 preview hash + expiry (24h / 4h)
      v
   [pending]  (database trigger locks all intent columns permanently)
      |
      |  owner reviews exact diff in Approval Drawer (+ step-up MFA if needed)
      v
2. APPROVE (owner decides before expires_at)
      |  pins approved_payload_sha256 + decided_by_user_id + decided_at
      v
   [approved]  (owner may still withdraw to [cancelled] before claim)
      |
      |  auto-execute on approval for META_UPDATE_BUDGET & TRACKING_UPDATE_DESTINATION
      v
3. ATOMIC VERIFY & EXECUTE
      |  re-check preview hash, expiry, kill switch, guardrails, step-up & aggregate ceiling
      |  single-use DB claim: approved -> [executing] (starts 120s write budget)
      |  read-before-write -> commit write marker -> external write -> read-back
      v
   [executed] (verified receipt)  OR  [failed] / released to [approved] if no write started
●

In plain words

Proposing writes a sealed cheque that cannot spend a single kuruş; approving signs the exact sealed cheque; verifying and executing checks the seal, the expiry date and the account balance one last time right before handing it to the bank.

Exact-diff previews, intent binding and SHA-256 pinning

A vague approval card saying "Raise budget" is almost as dangerous as no approval at all. Every approval request carries both a human-readable change preview and a machine-readable action payload for one allowed action type, locked together by five strict rules:

  1. Complete budget intent: Any budget proposal must state all four integer figures — current daily budget, proposed daily budget, lira delta and basis-point step — and the server verifies that proposed - current === delta and that the step matches exact arithmetic. Leaving out even one field fails with BUDGET_INTENT_INCOMPLETE.
  2. Intent binding: Intent binding proves that the human preview summary, the top-level intent columns and the executable payload agree on every single number and target. Any discrepancy fails immediately with PAYLOAD_PREVIEW_MISMATCH.
  3. Closed payload allow-list: Each action type permits only a fixed recursive payload allow-list of keys. Any unrecognised key — such as smuggling status: "ACTIVE" inside a budget payload — is rejected with PAYLOAD_KEY_NOT_ALLOWED.
  4. Canonical SHA-256 preview hash: The server serialises the payload deterministically (sorted keys, exact integers) and computes its 64-character preview hash. Approval pins that hash, and execution recomputes it from scratch and aborts (HASH_MISMATCH) if even a single byte differs.
  5. Approval expiry: Every proposal carries a hard expiry: 24 hours by default, tightened to 4 hours whenever a budget move exceeds 25 percent. Expired rows can neither be approved nor executed (APPROVAL_EXPIRED).

Layered ceilings, guardrails and step-up verification

Every proposal — and every execution — passes through an ordered guardrail pipeline where the most protective failure always wins deterministically with HTTP 422:

GuardrailDefault limit or ruleWhat it stops
Kill switchWorkspace emergency stop (kill_switch_active)Blocks all budget changes, campaign launches and tracking updates — even already-approved ones — while still allowing META_PAUSE_ENTITY
Protected entityOwner-maintained list of locked target_ref valuesPrevents anyone from altering flagship campaigns until explicitly unprotected
Paused by defaultNew campaigns must carry initial_status: "PAUSED"Stops newly published campaigns from spending money before the owner switches them on
Step cap2000 basis points (20 percent of current budget)Prevents sudden runaway spend and avoids resetting platform learning phases; binds every proposer, including workspace owners (OD-19)
Daily budget ceiling500_000 kuruş (5,000 lira per day)Stops typos such as turning 500 lira into 50,000 lira
Aggregate ceilingWorkspace-wide total across all active committed budgets, checked under a database lockStops ten separate 5,000-lira campaigns from stacking to 50,000 lira per day
Step-up thresholdBudget delta above 100_000 kuruş (1,000 lira), plus every tracking destination update and safeguarded payment milestone releaseEnsures a stolen session cookie or unattended browser cannot authorise high-impact spend or reroute conversion data

Pay special attention to signed ceiling rounding inside the step cap. Standard half-up or floor rounding turns a +20.004% increase into 2000 basis points, sneaking an out-of-bounds spend jump under a 2000 wall. Using pure BigInt ceiling rounding away from zero maps +20.001% to +2001 (and -20.001% to -2001), keeping the boundary mathematically watertight.

Notice also how execute on approval interacts with bulk decision. When an owner individually approves a META_UPDATE_BUDGET or TRACKING_UPDATE_DESTINATION proposal from the approval drawer, the approve endpoint runs the executor immediately so the response already confirms whether the change took effect. By contrast, bulk decisions are capped at 20 rows and deliberately skip every request that requires step-up verification, trips a guardrail or auto-executes, ensuring one bulk click can never silently fire live ad-account mutations.

Guarded executors: test accounts, read-before-write and read-back

Even after an owner approves a valid, unexpired, hash-pinned proposal, the executor still treats the outside platform as untrusted and mutable:

  1. Test-account boundary: Until the project owners explicitly configure the live execution acknowledgement environment value (EXECUTION_LIVE_ACKNOWLEDGED=owners-signed-off-OD-05), the Meta executor refuses any ad account unless the owner has explicitly set its test account flag (execution_test_account = true).
  2. Read-before-write: Immediately before modifying anything, the executor fetches the live ad set from Meta Graph API and checks that it belongs to the connected account, uses the exact expected currency (CURRENCY_MISMATCH otherwise) and still holds the exact current_daily_budget_minor shown in the preview (PROVIDER_STATE_CHANGED otherwise). If somebody already edited the budget directly inside Meta Ads Manager, the executor stops without writing.
  3. Write and read-back: After recording the write marker and posting the budget update to Meta, the executor fetches the ad set a second time to verify that Meta actually stored the exact approved integer budget. If the live value shows provider drift (rounding, partial write or stale value), execution is marked EXECUTION_UNVERIFIED instead of falsely claiming success.
  4. Execution receipt: Every attempt stores a structured JSON receipt (execution_receipt_jsonb) with its outcome code, observed before-and-after values and whether any remote write occurred. If an executed change later proves undesirable, the rollback helper drafts a brand-new compensating proposal back to the previous value — rollbacks are never autonomous.

The eight-state machine and crash recovery with two clocks

Every approval request moves through eight strict approval statuses enforced both in TypeScript and in PostgreSQL triggers:

  • Active states: pending, approved, executing.
  • Terminal states (never transition again): executed, failed, rejected, cancelled, expired.

Database triggers enforce immutable intent columns once a row exists, and restrict withdrawing an approval from approved to cancelled strictly to workspace owners so an outside marketer cannot cancel an owner's decision.

The hardest engineering problem in safe automation is a process crash mid-execution. Suppose an API worker wins the single-use execution claim (approved -> executing) and then dies suddenly from an out-of-memory kill. Did it crash while reading Meta's current budget (zero external effect — safe to retry), or did it crash two milliseconds after sending the HTTP POST that raised the budget (unknown external effect — blind retry could double-apply or conflict)?

This repository solves crash recovery with one durable database marker and two separated clocks:

text
t = 0s          Worker wins execution claim (approved -> executing)
   |            Read-before-write runs against Meta (still zero remote write)
   |
t <= 120s       WRITE BUDGET (EXECUTION_WRITE_BUDGET_SECONDS = 120s)
   |            Worker calls beginProviderWrite() -> commits execution_write_started_at
   |            (If worker arrives after 120s, DB refuses with EXECUTION_CLAIM_LOST;
   |             worker aborts cleanly with ZERO external write.)
   |            Only AFTER commit succeeds does worker send Meta HTTP write.
   |
   |            <--- 780-second safety gap: live worker and recovery NEVER overlap --->
   |
t >= 900s       STUCK THRESHOLD (EXECUTION_STUCK_AFTER_SECONDS = 900s, DB floor 300s)
                60-second recovery sweep inspects rows still in [executing]:
                  - execution_write_started_at IS NULL     -> release to [approved] (EXECUTION_INTERRUPTED)
                  - execution_write_started_at IS NOT NULL -> terminal [failed] (EXECUTION_STATE_UNKNOWN)

That design gives a rock-solid guarantee:

  • Before the write marker (execution_write_started_at) is committed, zero external write has happened, so stuck-execution recovery can safely release the claim back to approved (EXECUTION_INTERRUPTED).
  • Once the write marker is committed, a PostgreSQL trigger forbids moving executing back to approved ever again; if the process dies, recovery ends the row permanently as failed (EXECUTION_STATE_UNKNOWN) so a human verifies Meta Ads Manager first.
  • Because the write budget (120 seconds) is far shorter than the stuck threshold (900 seconds, hard database floor 300 seconds), a stalled executor that wakes up late fails beginProviderWrite with EXECUTION_CLAIM_LOST long before the recovery sweep can ever touch the row.

Finally, approval creation accepts a caller-supplied idempotency key so retrying a timed-out HTTP proposal request does not create duplicate pending rows. Following owner decision OD-22, idempotency keys belong to each workspace independently so Workspace A's key can never collide with or reveal Workspace B's key.

How this repository does it

Pure domain package versus database and API executors

Keeping approval rules in a zero-I/O package lets unit and fuzz tests prove every boundary before touching PostgreSQL or network mocks:

  • Guardrails and intent checks: guardrails.ts implements evaluateApprovalGuardrails, complete 4-field budget intent checks, preview-payload intent binding, signed ceiling rounding (computeBudgetStepBpsExact), kill switch, protected entities, paused-by-default, step cap, daily ceiling, tracking-health gate and step-up MFA thresholds.
  • Closed payload allow-list: payload-allowlist.ts validates every nested key per action type (APPROVAL_PAYLOAD_KEY_ALLOWLIST).
  • Canonical hash and state machine: canonical-hash.ts computes deterministic SHA-256 digests, state-machine.ts enforces the 8-state transitions and verify-and-execute checks, aggregate-ceiling.ts sums workspace committed budgets, execution-errors.ts separates retryable pre-write errors from terminal unknown-state errors, and rollback.ts drafts compensating proposals with autonomousRollbackAllowed: false.
  • Hysteresis and simulation: action-gateway-hysteresis.ts holds editable-field allow-lists, diff re-signing, remote version locks and delayed-conversion hysteresis (1.50 / 2.20 ROAS dead band, 24h dwell, 12h cooldown, 3-in-7d flap breaker), while policy-simulator.ts replays candidate actions dry-run.

Migrations, routes and executors

Three additive database migrations harden the approval ledger below the API:

  • 0003_approval_intent_integrity.sql: Locks immutable intent columns (BEFORE UPDATE trigger) and prevents tampering with approved proposals.
  • 0013_real_approval_execution.sql: Adds execution_test_account on ad-account connections, restricts approved -> cancelled withdrawals to owners, adds the per-workspace idempotency index and extends execution receipt support.
  • 0014_execution_progress_and_recovery.sql: Adds execution_write_started_at, enforces the 300-second SQL floor on stuck recovery, blocks executing -> approved once a write started, and defines recover_stuck_approval_executions.

In the API layer, approvals.ts handles propose, approve (auto-executing META_UPDATE_BUDGET and TRACKING_UPDATE_DESTINATION), reject, cancel/withdraw and execute; approvals-bulk.ts enforces the 20-item anti-rubber-stamp bulk route; approvals-execution-account.ts toggles the owner test-account flag; meta-executor.ts runs test-account checking, read-before-write, beginProviderWrite, Meta Graph API update and read-back verification; tracking-executor.ts applies approved tracking destination updates inside PostgreSQL; and execution-recovery.ts runs the 60-second stuck-execution sweep.

◆

Not built yet

Nothing is deployed to production and zero real Meta or Google budget calls have been sent to live ad accounts. On this branch, packages/db/migrations/ ends at 0014: migration 0013 added the per-workspace idempotency index, while dropping the older global idempotency constraint decided in OD-22 awaits future migration 0015. Live Google Ads budget execution (GOOGLE_UPDATE_BUDGET) is not built yet; the Approval Drawer and Queue UI screens exist, but owner UI forms for proposing test budgets and toggling execution_test_account are not built yet (operators use the API runbook today); outbound approval e-mail and web-push notifications compose previews only and do not send live yet; and apps/api/src/routes/approval-freshness.ts currently runs as a separate check route rather than inside the approve route.

What went wrong once

Adversarial reviews and integration audits across Waves 45 through 48 uncovered real edge cases in the approval engine, each closed with dedicated tests and migrations.

  • Missing budget intent fields silently skipped the step cap. Earlier proposal validation checked budget_step_bps only if the caller supplied it, allowing a partial budget payload to bypass the 20 percent wall. Closing this gap mandated all four intent fields and exact cross-checking (BUDGET_INTENT_INCOMPLETE).
  • A benign preview could wrap a mismatched executable payload. Without explicit cross-checks between preview_summary_jsonb and action_payload_jsonb, a crafted request could show +100 lira on screen while executing a larger value. Adding strict intent binding (PAYLOAD_PREVIEW_MISMATCH) and closed per-action key allow-lists (PAYLOAD_KEY_NOT_ALLOWED) closed both preview-spoofing and extra-parameter smuggling.
  • Database triggers were missing below the TypeScript state machine. Before migration 0003, immutability of approved payloads lived only in application code, meaning a buggy UPDATE query could alter an approved row. Adding the PostgreSQL BEFORE UPDATE trigger made intent immutability impossible to bypass from SQL.
  • Standard rounding let 20.004% sneak under a 2000 bps cap, and single-campaign ceilings could be split across parallel proposals. Switching step math to BigInt signed ceiling rounding fixed the boundary (20.001% -> 2001), and adding aggregate-ceiling.ts under a workspace lock stopped concurrent multi-campaign proposals from breaching the workspace daily limit (AGGREGATE_DAILY_CEILING_EXCEEDED).
  • Tracking destination changes initially bypassed the approval ledger. Changing meta_dataset_id or Google destination routing directly from a settings endpoint meant a single compromised session could silently redirect conversion signals. Moving tracking destination edits onto TRACKING_UPDATE_DESTINATION with mandatory step-up MFA put tracking changes under the exact same audit trail as spend changes.
  • Non-owners could cancel an already-approved request, and mid-write crashes risked double execution. Migration 0013 restricted approved -> cancelled strictly to workspace owners so marketers cannot undo an owner's approval, and migration 0014 introduced the 120s write budget, 900s stuck threshold and execution_write_started_at trigger so crashes after a write starts can never be retried blindly.

Try it yourself

Every step below runs locally against pure in-memory approval suites — no running API server, no PostgreSQL port and zero external Meta or Google calls.

Step 1: Run the core approvals state-machine, hash-pinning and guardrail tests

This verifies preview hashing, expiry, kill-switch precedence, paused-by-default launches, protected entities and step-up thresholds.

bash
node --test packages/approvals/test/approvals.test.mjs

Confirm all tests pass and check that tampering with a single payload field triggers HASH_MISMATCH.

Step 2: Run the intent-binding and closed payload allow-list suite

This proves that incomplete 4-field budget intents, preview-versus-payload mismatches and smuggled extra JSON keys are rejected deterministically.

bash
node --test packages/approvals/test/intent-binding.test.ts

Observe how BUDGET_INTENT_INCOMPLETE, PAYLOAD_PREVIEW_MISMATCH and PAYLOAD_KEY_NOT_ALLOWED fire before any proposal can enter the queue.

Step 3: Run the Wave 48 approval gap tests (signed ceiling rounding, aggregate ceiling and step-cap parity)

This exercises OD-19 (step cap binding workspace owners too), 20.001% -> 2001 signed ceiling rounding and workspace-wide aggregate ceilings.

bash
node --test packages/approvals/test/wave48-approval-gaps.test.ts

Confirm that an owner proposal above the step cap and split proposals exceeding the aggregate daily ceiling are both blocked.

Step 4: Run the Action Gateway hysteresis and diff re-signing suite

This tests the 1.50 / 2.20 ROAS dead band, 24-hour dwell time, 12-hour cooldown, 3-in-7-day flap breaker and retired-hash rejection after edits.

bash
node --test packages/approvals/test/action-gateway-hysteresis.test.ts

Notice that even when every hysteresis gate passes, the output only recommends a proposal and never executes autonomously.

Check yourself

0 / 6

Q1.An API worker claims an approved Meta budget change (approved -> executing), commits execution_write_started_at via beginProviderWrite, sends the HTTP write to Meta, and crashes before reading the reply. What happens 15 minutes later when the recovery job runs?

Q2.Why must the 120-second write budget stay strictly shorter than the 900-second stuck threshold (and its 300-second database floor)?

Q3.A workspace has a 5,000-lira daily budget ceiling and a 20 percent (2000 bps) step cap. A workspace owner tries to propose raising Campaign A's daily budget from 1,000 lira to 1,201 lira (a 20.1% increase). What happens?

Q4.An owner activates the workspace kill switch after discovering a broken checkout page. One budget increase was already in approved status and one pause proposal (META_PAUSE_ENTITY) is submitted. What does the system allow?

Q5.An owner selects 5 pending requests in the Approvals queue and clicks Bulk Approve. Two of them are META_UPDATE_BUDGET requests, one is a TRACKING_UPDATE_DESTINATION request (which requires step-up MFA), and two are low-risk non-auto-executing proposals. What does POST .../approvals/bulk-decision do?

Q6.Before updating a Meta ad set's daily budget from 1,000 lira to 1,200 lira, the Meta executor reads the live ad set from Meta Graph API and discovers its current daily budget is already 1,400 lira because someone edited it directly in Meta Ads Manager. What does the executor do?

Words to know

36
action payload

The structured JSON description of the exact external change an executor will perform once an approval is granted.

Onaylar ve otomasyonSözlükte incele
action type

The closed category naming what kind of change an approval request performs, such as updating a Meta budget or changing a tracking destination.

Onaylar ve otomasyonSözlükte incele
aggregate ceiling

The workspace-wide daily ad-budget cap checked across all committed campaigns under a lock so split proposals cannot bypass the ceiling.

Onaylar ve otomasyonSözlükte incele
expiry (of a proposal)TR: önizleme geçerliliği

The deadline after which an approval request can no longer be approved or executed: 24 hours by default, or 4 hours for budget moves over 25 percent.

Onaylar ve otomasyonSözlükte incele
approval requestTR: onay talebi

The immutable database ledger row recording one proposed change, its preview hash, expiry, decision and execution receipt.

Onaylar ve otomasyonSözlükte incele
approval status

One of the eight lifecycle states of an approval request: three active (pending, approved, executing) and five terminal (executed, failed, rejected, cancelled, expired).

Onaylar ve otomasyonSözlükte incele
automation modeTR: otomasyon modu

The workspace policy setting (disabled, observe or copilot) controlling whether AI may draft proposals for human review.

Onaylar ve otomasyonSözlükte incele
bulk decisionTR: toplu onay

Approving or rejecting up to 20 pending proposals in one call, automatically skipping any row that needs step-up MFA, breaks a guardrail or auto-executes.

Onaylar ve otomasyonSözlükte incele
change previewTR: değişiklik önizlemesi

The exact human-readable before-and-after diff shown to the owner before they decide, bound cryptographically to the executable payload.

Onaylar ve otomasyonSözlükte incele
daily budget ceilingTR: günlük bütçe üst sınırı

The maximum daily ad budget permitted by a workspace — 5,000 lira (500_000 kuruş) by default — above which proposals are refused.

Onaylar ve otomasyonSözlükte incele
execute on approval

The rule that approving a META_UPDATE_BUDGET or TRACKING_UPDATE_DESTINATION request runs its executor inside the same decision flow.

Onaylar ve otomasyonSözlükte incele
execution claim

The atomic single-use database transition from approved to executing ensuring at most one worker ever executes an approval.

Onaylar ve otomasyonSözlükte incele
execution receipt

The permanent JSON record stored on an approval after execution, capturing the outcome code, values read back and whether an outside call occurred.

Onaylar ve otomasyonSözlükte incele
executor

The action-specific backend module that carries out one approved action type against an outside platform or internal configuration table.

Onaylar ve otomasyonSözlükte incele
guardrailTR: güvenlik sınırı

A server-enforced safety rule checked automatically on every proposal and execution regardless of who asks.

Onaylar ve otomasyonSözlükte incele
immutable intent columns

The database columns defining what an approval request will do, locked by a PostgreSQL trigger so they can never be altered after creation.

Onaylar ve otomasyonSözlükte incele
intent binding

The check proving that the human-readable preview summary and the machine-executable action payload describe the exact same change.

Onaylar ve otomasyonSözlükte incele
kill switchTR: acil durdurma

The per-workspace emergency stop that immediately blocks all budget changes, campaign launches and tracking updates — even already-approved ones — while still allowing pauses.

Onaylar ve otomasyonSözlükte incele
live acknowledgement

The exact environment acknowledgement string owners-signed-off-OD-05 required before real non-test ad accounts or live Meta signals can be mutated.

Onaylar ve otomasyonSözlükte incele
paused by defaultTR: duraklatılmış başlar

The guardrail requiring every newly published campaign to launch with initial_status: "PAUSED" so spending never starts without an owner turning it on.

Onaylar ve otomasyonSözlükte incele
payload allow-list

The closed per-action-type list of permitted JSON keys that rejects any unknown or nested extra key in an action payload.

Onaylar ve otomasyonSözlükte incele
preview hashTR: önizleme özeti

The canonical SHA-256 digest of the exact payload shown in the change preview, recomputed and matched right before execution.

Onaylar ve otomasyonSözlükte incele
Propose → Approve → Atomic Verify & Execute

The three-stage safety workflow — Propose, Approve, Atomic Verify & Execute — that gates every ad budget, campaign, tracking and safeguarded-payment change.

Onaylar ve otomasyonSözlükte incele
protected entityTR: korunan kampanya

A flagship campaign or ad object locked by the workspace owner so no proposal from anyone can modify it.

Onaylar ve otomasyonSözlükte incele
drift (outside value)

A mismatch between the value an approval expected and the actual value found on the external platform due to outside edits or rounding.

Onaylar ve otomasyonSözlükte incele
read-backTR: geri okuma

Fetching the remote object again immediately after a write to verify it actually holds the exact approved value before marking execution succeeded.

Onaylar ve otomasyonSözlükte incele
read-before-write

Reading the outside ad object immediately before writing to confirm its identity, currency and current budget still match the approved preview.

Onaylar ve otomasyonSözlükte incele
signed ceiling rounding

Rounding a budget step's basis-point magnitude upward while preserving its sign so 20.001 percent counts as 2001 and cannot sneak past a 2000 cap.

Onaylar ve otomasyonSözlükte incele
step capTR: tek adım sınırı

The maximum single-change percentage allowed on a daily budget — 20 percent (2000 basis points) by default — binding every proposer.

Onaylar ve otomasyonSözlükte incele
step-up thresholdTR: adım doğrulama eşiği

The budget-delta size — 1,000 lira (100_000 kuruş) by default — above which approval requires a fresh step-up MFA check, always required for tracking and safeguarded-payment changes.

Onaylar ve otomasyonSözlükte incele
stuck-execution recovery

The periodic API sweep (every 60 seconds) that resolves approvals stranded in executing after a process crash using the write marker.

Onaylar ve otomasyonSözlükte incele
stuck threshold

The elapsed duration — 900 seconds by default, with a hard database floor of 300 seconds — an approval must stay in executing before crash recovery acts on it.

Onaylar ve otomasyonSözlükte incele
test account flag

The owner-controlled boolean flag on a connected ad account marking it as a safe test account, the only accounts Meta execution can touch before live sign-off.

Onaylar ve otomasyonSözlükte incele
withdraw an approvalTR: onayı geri çek

Cancelling a pending request or withdrawing an already-approved request before execution claims it, permanently moving it to cancelled.

Onaylar ve otomasyonSözlükte incele
write budget

The 120-second deadline after claiming an execution within which the executor must stamp beginProviderWrite before making any external write.

Onaylar ve otomasyonSözlükte incele
write marker

The database timestamp (execution_write_started_at) committed right before an executor sends its first outside write call, splitting safe retries from unknown outcomes.

Onaylar ve otomasyonSözlükte incele

Go deeper

In this repository

  • Operator runbook and owner decisions: Approve Meta Test Budget Change Runbook, Owner Decisions (OD-05, OD-19, OD-22), Wave 48 B Report and Wave 48 E Report.
  • Database migrations enforcing intent immutability and crash recovery: 0003_approval_intent_integrity.sql, 0013_real_approval_execution.sql and 0014_execution_progress_and_recovery.sql.
  • Companion lessons: Lesson 3 (Data, PostgreSQL triggers and locks), Lesson 5 (Cryptography and preview hashes) and Lesson 7 (Measurement and tracking endpoints).
  • Archived lessons absorbed by this chapter: Archived lesson 05 (AI governance and action boundaries), Archived lesson 15 (Distributed state machines and idempotency), Archived lesson 22 (Spend guardrails and cross-route fuzzing), Archived lesson 23 (Bounded autonomy and assurance) and Archived lesson 29 (Rollout readiness and operational SLAs).

External references

  • Meta Marketing API — Ad Set reference (daily_budget).
  • RFC 9110 — HTTP 422 Unprocessable Content.
  • NIST FIPS 180-4 — Secure Hash Standard (SHA-256).
◆

NOT LEGAL OR TAX ADVICE · Açık karar kapıları dürüstlüğü

Bu müfredat öğrenme amaçlıdır; hukuk veya vergi danışmanlığı değildir. #3 hukuk ve mali müşavir onayı, #21 keşif görüşmeleri, OD-01 marka tescil kontrolü ve canlı dağıtım henüz tamamlanmamıştır. ISO-27001 / SOC 2: UNOBTAINED. Sıfır canlı müşteri veya canlı reklam harcaması iddia edilmez.

Önceki ders: L07Sonraki ders: L09

L08 · Part C · intermediate · Verified 2026-12-04 · 20 min

Approvals and safe automation: propose, approve, execute, recover

How every ad budget, campaign and tracking change passes through hash-pinned previews, layered ceilings, guarded executors and crash recovery without blind retries.

Bu müfredat öğrenme amaçlıdır; hukuk veya vergi danışmanlığı değildir. #3 hukuk ve mali müşavir onayı, #21 keşif görüşmeleri, OD-01 marka tescil kontrolü ve canlı dağıtım henüz tamamlanmamıştır. ISO-27001 / SOC 2: UNOBTAINED. Sıfır canlı müşteri veya canlı reklam harcaması iddia edilmez.

Why this matters

An advertising error costs real money within minutes: one misplaced zero on a daily budget or one unreviewed campaign launch can drain a small business's monthly marketing cash before breakfast. Letting an AI agent or an invited marketer mutate Meta or Google accounts directly turns a prompt bug, a stale report or a typo into an irreversible bill. This repository therefore puts a hard human-in-the-loop gate in front of every spend, campaign, tracking and safeguarded-payment action. This lesson explains how proposals are bound cryptographically to their previews, checked against layered ceilings, executed with read-before-write and read-back verification, and recovered safely after crashes without blind retries.

The ideas

Why nobody — human marketer or AI — executes directly

Small-business owners routinely work with external freelancers, agencies and AI recommendations, yet only the owner bears the credit-card bill when ad spend jumps unexpectedly. Product rules R4 and N2 establish one simple invariant: no external or financial mutation ever executes directly without an explicit human approval. Every automation mode honours this boundary — in disabled and observe, AI diagnostics cannot even draft proposals, and in copilot (the default), AI can only submit a pending proposal for the owner to read and decide.

Everyday actions are grouped into three risk tiers so the owner stays protected without suffering approval fatigue:

  • Reversible acts (archiving a note or moving an unsent CRM lead stage) apply immediately with an undo message.
  • Binding acts (changing a Meta or Google daily budget, publishing or pausing a campaign, changing a workspace tracking destination, or releasing a safeguarded payment milestone) always pass through Propose → Approve → Atomic Verify & Execute.
  • Irreversible acts (revoking a marketer, cancelling a subscription, deleting a workspace or erasing customer data) require a plain-language consequence confirmation.

Propose, approve, verify and execute

Separating drafting from decision and from execution creates three clear checkpoints:

1. PROPOSE (workspace member, marketer or AI diagnostic)
      |  complete 4-field intent + closed payload allow-list + preview binding
      |  guardrail check + canonical SHA-256 preview hash + expiry (24h / 4h)
      v
   [pending]  (database trigger locks all intent columns permanently)
      |
      |  owner reviews exact diff in Approval Drawer (+ step-up MFA if needed)
      v
2. APPROVE (owner decides before expires_at)
      |  pins approved_payload_sha256 + decided_by_user_id + decided_at
      v
   [approved]  (owner may still withdraw to [cancelled] before claim)
      |
      |  auto-execute on approval for META_UPDATE_BUDGET & TRACKING_UPDATE_DESTINATION
      v
3. ATOMIC VERIFY & EXECUTE
      |  re-check preview hash, expiry, kill switch, guardrails, step-up & aggregate ceiling
      |  single-use DB claim: approved -> [executing] (starts 120s write budget)
      |  read-before-write -> commit write marker -> external write -> read-back
      v
   [executed] (verified receipt)  OR  [failed] / released to [approved] if no write started
●

In plain words

Proposing writes a sealed cheque that cannot spend a single kuruş; approving signs the exact sealed cheque; verifying and executing checks the seal, the expiry date and the account balance one last time right before handing it to the bank.

Exact-diff previews, intent binding and SHA-256 pinning

A vague approval card saying "Raise budget" is almost as dangerous as no approval at all. Every approval request carries both a human-readable change preview and a machine-readable action payload for one allowed action type, locked together by five strict rules:

  1. Complete budget intent: Any budget proposal must state all four integer figures — current daily budget, proposed daily budget, lira delta and basis-point step — and the server verifies that proposed - current === delta and that the step matches exact arithmetic. Leaving out even one field fails with BUDGET_INTENT_INCOMPLETE.
  2. Intent binding: Intent binding proves that the human preview summary, the top-level intent columns and the executable payload agree on every single number and target. Any discrepancy fails immediately with PAYLOAD_PREVIEW_MISMATCH.
  3. Closed payload allow-list: Each action type permits only a fixed recursive payload allow-list of keys. Any unrecognised key — such as smuggling status: "ACTIVE" inside a budget payload — is rejected with PAYLOAD_KEY_NOT_ALLOWED.
  4. Canonical SHA-256 preview hash: The server serialises the payload deterministically (sorted keys, exact integers) and computes its 64-character preview hash. Approval pins that hash, and execution recomputes it from scratch and aborts (HASH_MISMATCH) if even a single byte differs.
  5. Approval expiry: Every proposal carries a hard expiry: 24 hours by default, tightened to 4 hours whenever a budget move exceeds 25 percent. Expired rows can neither be approved nor executed (APPROVAL_EXPIRED).

Layered ceilings, guardrails and step-up verification

Every proposal — and every execution — passes through an ordered guardrail pipeline where the most protective failure always wins deterministically with HTTP 422:

GuardrailDefault limit or ruleWhat it stops
Kill switchWorkspace emergency stop (kill_switch_active)Blocks all budget changes, campaign launches and tracking updates — even already-approved ones — while still allowing META_PAUSE_ENTITY
Protected entityOwner-maintained list of locked target_ref valuesPrevents anyone from altering flagship campaigns until explicitly unprotected
Paused by defaultNew campaigns must carry initial_status: "PAUSED"Stops newly published campaigns from spending money before the owner switches them on
Step cap2000 basis points (20 percent of current budget)Prevents sudden runaway spend and avoids resetting platform learning phases; binds every proposer, including workspace owners (OD-19)
Daily budget ceiling500_000 kuruş (5,000 lira per day)Stops typos such as turning 500 lira into 50,000 lira
Aggregate ceilingWorkspace-wide total across all active committed budgets, checked under a database lockStops ten separate 5,000-lira campaigns from stacking to 50,000 lira per day
Step-up thresholdBudget delta above 100_000 kuruş (1,000 lira), plus every tracking destination update and safeguarded payment milestone releaseEnsures a stolen session cookie or unattended browser cannot authorise high-impact spend or reroute conversion data

Pay special attention to signed ceiling rounding inside the step cap. Standard half-up or floor rounding turns a +20.004% increase into 2000 basis points, sneaking an out-of-bounds spend jump under a 2000 wall. Using pure BigInt ceiling rounding away from zero maps +20.001% to +2001 (and -20.001% to -2001), keeping the boundary mathematically watertight.

Notice also how execute on approval interacts with bulk decision. When an owner individually approves a META_UPDATE_BUDGET or TRACKING_UPDATE_DESTINATION proposal from the approval drawer, the approve endpoint runs the executor immediately so the response already confirms whether the change took effect. By contrast, bulk decisions are capped at 20 rows and deliberately skip every request that requires step-up verification, trips a guardrail or auto-executes, ensuring one bulk click can never silently fire live ad-account mutations.

Guarded executors: test accounts, read-before-write and read-back

Even after an owner approves a valid, unexpired, hash-pinned proposal, the executor still treats the outside platform as untrusted and mutable:

  1. Test-account boundary: Until the project owners explicitly configure the live execution acknowledgement environment value (EXECUTION_LIVE_ACKNOWLEDGED=owners-signed-off-OD-05), the Meta executor refuses any ad account unless the owner has explicitly set its test account flag (execution_test_account = true).
  2. Read-before-write: Immediately before modifying anything, the executor fetches the live ad set from Meta Graph API and checks that it belongs to the connected account, uses the exact expected currency (CURRENCY_MISMATCH otherwise) and still holds the exact current_daily_budget_minor shown in the preview (PROVIDER_STATE_CHANGED otherwise). If somebody already edited the budget directly inside Meta Ads Manager, the executor stops without writing.
  3. Write and read-back: After recording the write marker and posting the budget update to Meta, the executor fetches the ad set a second time to verify that Meta actually stored the exact approved integer budget. If the live value shows provider drift (rounding, partial write or stale value), execution is marked EXECUTION_UNVERIFIED instead of falsely claiming success.
  4. Execution receipt: Every attempt stores a structured JSON receipt (execution_receipt_jsonb) with its outcome code, observed before-and-after values and whether any remote write occurred. If an executed change later proves undesirable, the rollback helper drafts a brand-new compensating proposal back to the previous value — rollbacks are never autonomous.

The eight-state machine and crash recovery with two clocks

Every approval request moves through eight strict approval statuses enforced both in TypeScript and in PostgreSQL triggers:

  • Active states: pending, approved, executing.
  • Terminal states (never transition again): executed, failed, rejected, cancelled, expired.

Database triggers enforce immutable intent columns once a row exists, and restrict withdrawing an approval from approved to cancelled strictly to workspace owners so an outside marketer cannot cancel an owner's decision.

The hardest engineering problem in safe automation is a process crash mid-execution. Suppose an API worker wins the single-use execution claim (approved -> executing) and then dies suddenly from an out-of-memory kill. Did it crash while reading Meta's current budget (zero external effect — safe to retry), or did it crash two milliseconds after sending the HTTP POST that raised the budget (unknown external effect — blind retry could double-apply or conflict)?

This repository solves crash recovery with one durable database marker and two separated clocks:

t = 0s          Worker wins execution claim (approved -> executing)
   |            Read-before-write runs against Meta (still zero remote write)
   |
t <= 120s       WRITE BUDGET (EXECUTION_WRITE_BUDGET_SECONDS = 120s)
   |            Worker calls beginProviderWrite() -> commits execution_write_started_at
   |            (If worker arrives after 120s, DB refuses with EXECUTION_CLAIM_LOST;
   |             worker aborts cleanly with ZERO external write.)
   |            Only AFTER commit succeeds does worker send Meta HTTP write.
   |
   |            <--- 780-second safety gap: live worker and recovery NEVER overlap --->
   |
t >= 900s       STUCK THRESHOLD (EXECUTION_STUCK_AFTER_SECONDS = 900s, DB floor 300s)
                60-second recovery sweep inspects rows still in [executing]:
                  - execution_write_started_at IS NULL     -> release to [approved] (EXECUTION_INTERRUPTED)
                  - execution_write_started_at IS NOT NULL -> terminal [failed] (EXECUTION_STATE_UNKNOWN)

That design gives a rock-solid guarantee:

  • Before the write marker (execution_write_started_at) is committed, zero external write has happened, so stuck-execution recovery can safely release the claim back to approved (EXECUTION_INTERRUPTED).
  • Once the write marker is committed, a PostgreSQL trigger forbids moving executing back to approved ever again; if the process dies, recovery ends the row permanently as failed (EXECUTION_STATE_UNKNOWN) so a human verifies Meta Ads Manager first.
  • Because the write budget (120 seconds) is far shorter than the stuck threshold (900 seconds, hard database floor 300 seconds), a stalled executor that wakes up late fails beginProviderWrite with EXECUTION_CLAIM_LOST long before the recovery sweep can ever touch the row.

Finally, approval creation accepts a caller-supplied idempotency key so retrying a timed-out HTTP proposal request does not create duplicate pending rows. Following owner decision OD-22, idempotency keys belong to each workspace independently so Workspace A's key can never collide with or reveal Workspace B's key.

How this repository does it

Pure domain package versus database and API executors

Keeping approval rules in a zero-I/O package lets unit and fuzz tests prove every boundary before touching PostgreSQL or network mocks:

  • Guardrails and intent checks: guardrails.ts implements evaluateApprovalGuardrails, complete 4-field budget intent checks, preview-payload intent binding, signed ceiling rounding (computeBudgetStepBpsExact), kill switch, protected entities, paused-by-default, step cap, daily ceiling, tracking-health gate and step-up MFA thresholds.
  • Closed payload allow-list: payload-allowlist.ts validates every nested key per action type (APPROVAL_PAYLOAD_KEY_ALLOWLIST).
  • Canonical hash and state machine: canonical-hash.ts computes deterministic SHA-256 digests, state-machine.ts enforces the 8-state transitions and verify-and-execute checks, aggregate-ceiling.ts sums workspace committed budgets, execution-errors.ts separates retryable pre-write errors from terminal unknown-state errors, and rollback.ts drafts compensating proposals with autonomousRollbackAllowed: false.
  • Hysteresis and simulation: action-gateway-hysteresis.ts holds editable-field allow-lists, diff re-signing, remote version locks and delayed-conversion hysteresis (1.50 / 2.20 ROAS dead band, 24h dwell, 12h cooldown, 3-in-7d flap breaker), while policy-simulator.ts replays candidate actions dry-run.

Migrations, routes and executors

Three additive database migrations harden the approval ledger below the API:

  • 0003_approval_intent_integrity.sql: Locks immutable intent columns (BEFORE UPDATE trigger) and prevents tampering with approved proposals.
  • 0013_real_approval_execution.sql: Adds execution_test_account on ad-account connections, restricts approved -> cancelled withdrawals to owners, adds the per-workspace idempotency index and extends execution receipt support.
  • 0014_execution_progress_and_recovery.sql: Adds execution_write_started_at, enforces the 300-second SQL floor on stuck recovery, blocks executing -> approved once a write started, and defines recover_stuck_approval_executions.

In the API layer, approvals.ts handles propose, approve (auto-executing META_UPDATE_BUDGET and TRACKING_UPDATE_DESTINATION), reject, cancel/withdraw and execute; approvals-bulk.ts enforces the 20-item anti-rubber-stamp bulk route; approvals-execution-account.ts toggles the owner test-account flag; meta-executor.ts runs test-account checking, read-before-write, beginProviderWrite, Meta Graph API update and read-back verification; tracking-executor.ts applies approved tracking destination updates inside PostgreSQL; and execution-recovery.ts runs the 60-second stuck-execution sweep.

◆

Not built yet

Nothing is deployed to production and zero real Meta or Google budget calls have been sent to live ad accounts. On this branch, packages/db/migrations/ ends at 0014: migration 0013 added the per-workspace idempotency index, while dropping the older global idempotency constraint decided in OD-22 awaits future migration 0015. Live Google Ads budget execution (GOOGLE_UPDATE_BUDGET) is not built yet; the Approval Drawer and Queue UI screens exist, but owner UI forms for proposing test budgets and toggling execution_test_account are not built yet (operators use the API runbook today); outbound approval e-mail and web-push notifications compose previews only and do not send live yet; and apps/api/src/routes/approval-freshness.ts currently runs as a separate check route rather than inside the approve route.

What went wrong once

Adversarial reviews and integration audits across Waves 45 through 48 uncovered real edge cases in the approval engine, each closed with dedicated tests and migrations.

  • Missing budget intent fields silently skipped the step cap. Earlier proposal validation checked budget_step_bps only if the caller supplied it, allowing a partial budget payload to bypass the 20 percent wall. Closing this gap mandated all four intent fields and exact cross-checking (BUDGET_INTENT_INCOMPLETE).
  • A benign preview could wrap a mismatched executable payload. Without explicit cross-checks between preview_summary_jsonb and action_payload_jsonb, a crafted request could show +100 lira on screen while executing a larger value. Adding strict intent binding (PAYLOAD_PREVIEW_MISMATCH) and closed per-action key allow-lists (PAYLOAD_KEY_NOT_ALLOWED) closed both preview-spoofing and extra-parameter smuggling.
  • Database triggers were missing below the TypeScript state machine. Before migration 0003, immutability of approved payloads lived only in application code, meaning a buggy UPDATE query could alter an approved row. Adding the PostgreSQL BEFORE UPDATE trigger made intent immutability impossible to bypass from SQL.
  • Standard rounding let 20.004% sneak under a 2000 bps cap, and single-campaign ceilings could be split across parallel proposals. Switching step math to BigInt signed ceiling rounding fixed the boundary (20.001% -> 2001), and adding aggregate-ceiling.ts under a workspace lock stopped concurrent multi-campaign proposals from breaching the workspace daily limit (AGGREGATE_DAILY_CEILING_EXCEEDED).
  • Tracking destination changes initially bypassed the approval ledger. Changing meta_dataset_id or Google destination routing directly from a settings endpoint meant a single compromised session could silently redirect conversion signals. Moving tracking destination edits onto TRACKING_UPDATE_DESTINATION with mandatory step-up MFA put tracking changes under the exact same audit trail as spend changes.
  • Non-owners could cancel an already-approved request, and mid-write crashes risked double execution. Migration 0013 restricted approved -> cancelled strictly to workspace owners so marketers cannot undo an owner's approval, and migration 0014 introduced the 120s write budget, 900s stuck threshold and execution_write_started_at trigger so crashes after a write starts can never be retried blindly.

Try it yourself

Every step below runs locally against pure in-memory approval suites — no running API server, no PostgreSQL port and zero external Meta or Google calls.

Step 1: Run the core approvals state-machine, hash-pinning and guardrail tests

This verifies preview hashing, expiry, kill-switch precedence, paused-by-default launches, protected entities and step-up thresholds.

node --test packages/approvals/test/approvals.test.mjs

Confirm all tests pass and check that tampering with a single payload field triggers HASH_MISMATCH.

Step 2: Run the intent-binding and closed payload allow-list suite

This proves that incomplete 4-field budget intents, preview-versus-payload mismatches and smuggled extra JSON keys are rejected deterministically.

node --test packages/approvals/test/intent-binding.test.ts

Observe how BUDGET_INTENT_INCOMPLETE, PAYLOAD_PREVIEW_MISMATCH and PAYLOAD_KEY_NOT_ALLOWED fire before any proposal can enter the queue.

Step 3: Run the Wave 48 approval gap tests (signed ceiling rounding, aggregate ceiling and step-cap parity)

This exercises OD-19 (step cap binding workspace owners too), 20.001% -> 2001 signed ceiling rounding and workspace-wide aggregate ceilings.

node --test packages/approvals/test/wave48-approval-gaps.test.ts

Confirm that an owner proposal above the step cap and split proposals exceeding the aggregate daily ceiling are both blocked.

Step 4: Run the Action Gateway hysteresis and diff re-signing suite

This tests the 1.50 / 2.20 ROAS dead band, 24-hour dwell time, 12-hour cooldown, 3-in-7-day flap breaker and retired-hash rejection after edits.

node --test packages/approvals/test/action-gateway-hysteresis.test.ts

Notice that even when every hysteresis gate passes, the output only recommends a proposal and never executes autonomously.

Words to know

  • action payload
  • action type
  • aggregate ceiling
  • expiry (of a proposal)
  • approval request
  • approval status
  • automation mode
  • bulk decision
  • change preview
  • daily budget ceiling
  • execute on approval
  • execution claim
  • execution receipt
  • executor
  • guardrail
  • immutable intent columns
  • intent binding
  • kill switch
  • live acknowledgement
  • paused by default
  • payload allow-list
  • preview hash
  • Propose → Approve → Atomic Verify & Execute
  • protected entity
  • drift (outside value)
  • read-back
  • read-before-write
  • signed ceiling rounding
  • step cap
  • step-up threshold
  • stuck-execution recovery
  • stuck threshold
  • test account flag
  • withdraw an approval
  • write budget
  • write marker

Go deeper

In this repository

  • Operator runbook and owner decisions: Approve Meta Test Budget Change Runbook, Owner Decisions (OD-05, OD-19, OD-22), Wave 48 B Report and Wave 48 E Report.
  • Database migrations enforcing intent immutability and crash recovery: 0003_approval_intent_integrity.sql, 0013_real_approval_execution.sql and 0014_execution_progress_and_recovery.sql.
  • Companion lessons: Lesson 3 (Data, PostgreSQL triggers and locks), Lesson 5 (Cryptography and preview hashes) and Lesson 7 (Measurement and tracking endpoints).
  • Archived lessons absorbed by this chapter: Archived lesson 05 (AI governance and action boundaries), Archived lesson 15 (Distributed state machines and idempotency), Archived lesson 22 (Spend guardrails and cross-route fuzzing), Archived lesson 23 (Bounded autonomy and assurance) and Archived lesson 29 (Rollout readiness and operational SLAs).

External references

  • Meta Marketing API — Ad Set reference (daily_budget).
  • RFC 9110 — HTTP 422 Unprocessable Content.
  • NIST FIPS 180-4 — Secure Hash Standard (SHA-256).

Kendini sına soru özeti ve yanıt anahtarı

Q1. An API worker claims an approved Meta budget change (approved -> executing), commits execution_write_started_at via beginProviderWrite, sends the HTTP write to Meta, and crashes before reading the reply. What happens 15 minutes later when the recovery job runs?

Answer: C

Once execution_write_started_at is committed, the system cannot know locally whether Meta applied the write. A PostgreSQL trigger blocks executing -> approved, and recovery ends the row as terminal failed (EXECUTION_STATE_UNKNOWN) so a human checks Meta Ads Manager before making another change.

Q2. Why must the 120-second write budget stay strictly shorter than the 900-second stuck threshold (and its 300-second database floor)?

Answer: A

Separating the write budget (120s) from the stuck threshold (900s, floor 300s) leaves a wide safety gap where a sluggish worker cannot start a late remote write while the recovery job is releasing the claim to another worker.

Q3. A workspace has a 5,000-lira daily budget ceiling and a 20 percent (2000 bps) step cap. A workspace owner tries to propose raising Campaign A's daily budget from 1,000 lira to 1,201 lira (a 20.1% increase). What happens?

Answer: C

Under OD-19, numeric guardrails such as the step cap apply equally to owners, marketers and AI diagnostics — owners who want a wider step update the workspace policy explicitly rather than bypassing the check. Signed ceiling rounding ensures any fraction above 20% exceeds 2000 bps.

Q4. An owner activates the workspace kill switch after discovering a broken checkout page. One budget increase was already in approved status and one pause proposal (META_PAUSE_ENTITY) is submitted. What does the system allow?

Answer: C

Atomic Verify & Execute re-checks the kill switch right before claiming execution, blocking even previously approved spend, launch or tracking changes, while deliberately keeping META_PAUSE_ENTITY open so owners can halt spending in an emergency.

Q5. An owner selects 5 pending requests in the Approvals queue and clicks Bulk Approve. Two of them are META_UPDATE_BUDGET requests, one is a TRACKING_UPDATE_DESTINATION request (which requires step-up MFA), and two are low-risk non-auto-executing proposals. What does POST .../approvals/bulk-decision do?

Answer: C

Anti-rubber-stamp bulk decisions cap batches at 20 items and skip any row that requires step-up MFA, violates a guardrail or auto-executes on approval, ensuring high-impact external mutations always receive individual review in the Approval Drawer.

Q6. Before updating a Meta ad set's daily budget from 1,000 lira to 1,200 lira, the Meta executor reads the live ad set from Meta Graph API and discovers its current daily budget is already 1,400 lira because someone edited it directly in Meta Ads Manager. What does the executor do?

Answer: B

Read-before-write checks that the live remote object still matches the approved baseline (1,000 lira) and currency before any write occurs. Detecting external drift stops execution cleanly with PROVIDER_STATE_CHANGED and zero unwanted writes.

GetClaps Kurucu Akademisi · Tarayıcı açılışında ağ çağrısı yapılmaz; ilerleme yalnızca cihazındaki yerel depolamada tutulur.