از سیستمهای توزیعشده تا پلتفرم AI خودت. پنج قابلیت بههمپیوسته؛ یک مسیر ساخت که هر تصمیمش باید قابلاثبات باشد.From distributed systems to your own AI platform. Five connected capabilities; one build track with evidence behind every decision.
این پروژه دقیقاً چیست؟What exactly is this project?
قرار است یک پلتفرم قابلاستفادهٔ مجدد بسازیم تا توسعهدهنده برنامهٔ AI خودش را روی آن اجرا و بررسی کند. Investigator اولین برنامهٔ نمونه است؛ هستهٔ پروژه، زیرساختی است که برنامههای دیگر هم بتوانند از آن استفاده کنند.Build a reusable platform on which developers can run and inspect their AI applications. Investigator is the first sample app; the core is infrastructure that other applications can also use.
زیرساخت مشترک برای برنامههای AI یک تیمShared infrastructure for a team’s AI apps
توسعهدهنده برنامهاش را با مدل، prompt، ابزارهای مجاز و دادهٔ موردنیاز تعریف میکند. پلتفرم قرار است اجرای آن را بپذیرد، وضعیتش را نگه دارد، مدل و ابزار را فراخوانی کند و نتیجه و trace قابلبررسی برگرداند.A developer defines an app with its model, prompt, permitted tools, and data. The platform is intended to accept runs, retain their state, call models and tools, and return inspectable results and traces.
کاربر اصلیPrimary user
توسعهدهندهٔ برنامهٔ AIAI-application developer
ورودیInput
تعریف app، داده و درخواستِ اجراApp definition, data, and a run request
خروجیOutput
نتیجه، وضعیت، شواهد و trace هر runResult, status, evidence, and a per-run trace
دموی پیشنهادی: چرا API کند شده؟Proposed demo: why did the API slow down?
یک alert وارد میشود. برنامهٔ Investigator از طریق پلتفرم، deployment اخیر، metric، trace و runbook مجاز را میخواند.An alert arrives. Through the platform, the Investigator app reads recent deployments, metrics, traces, and an authorized runbook.
DeploymentsMetricsTracesRunbooks
گزارشی که میخواهیم بگیریمThe report we want to receive
چه اتفاقی افتاد و به چه ترتیبی؟What happened, and in what order?
کدام فرضیه با کدام شاهد سازگار است؟Which hypothesis fits which evidence?
چه چیزی هنوز نامعلوم است؟What remains uncertain?
سناریوی آزمایشگاه مصنوعی است. نتیجهٔ مستند یا «شواهد کافی نیست» هر دو میتوانند خروجی درست باشند.The lab scenario is synthetic. An evidence-backed result or “insufficient evidence” can both be correct outcomes.
چه مشکلی را حل میکنیم؟Which problems are we solving?
Model Gateway
مسئلهProblem
هر app اتصال مدل، credential و هزینه را جدا مدیریت میکند.Every app separately manages model connections, credentials, and spend.
مسئولیت پیشنهادیProposed responsibility
یک مرز مشترک برای انتخاب مدل، مجوز، deadline، budget و ثبت مصرف.A shared boundary for routing, authorization, deadlines, budgets, and usage records.
Durable Runtime
مسئلهProblem
با crash یا timeout، اجرای چندمرحلهای نیمهکاره میماند.Crashes and timeouts interrupt multi-step runs.
مسئولیت پیشنهادیProposed responsibility
وضعیت و نتیجهٔ stepها پایدار بماند؛ retry و ادامهٔ اجرا قرارداد روشن داشته باشند.Persist step state/results and define explicit retry and resume contracts.
Live Context
مسئلهProblem
داده عوض یا حذف میشود و مجوزهای قبلی ممکن است معتبر نباشند.Data changes or is deleted, and old permissions may no longer apply.
مسئولیت پیشنهادیProposed responsibility
بازیابی دادهٔ نسخهدار و مجاز؛ تازگی و CDC بر اساس نیاز و آزمون تصمیمگیری شوند.Retrieve versioned, authorized data; justify freshness and CDC through requirements and tests.
Evaluation & Release
مسئلهProblem
با تغییر prompt یا مدل، معلوم نیست کدام رفتار بهتر یا خرابتر شده.A model or prompt change can improve some behaviors and regress others.
مسئولیت پیشنهادیProposed responsibility
نسخههای ثابت، dataset و آزمونِ کیفیت؛ تصمیمِ انتشار بر اساس شاهد.Pinned versions, datasets, and quality tests; evidence-based release decisions.
AI Investigator
مسئلهProblem
برای بررسی رخداد باید شواهد چند منبع را کنار هم گذاشت.Incident investigation requires evidence from several sources.
مسئولیت پیشنهادیProposed responsibility
یک app نمونه که از قابلیتهای مشترک استفاده میکند؛ بعداً app پاسخگویی مستند هم همان هسته را به کار میگیرد.A sample app using shared capabilities; a cited-answer app should later reuse the same core.
اولین چیزی که میسازیمThe first thing to build
پیشنهاد ADR-002: یک مسیر کوچک از ثبت app و ارسال run تا یک فراخوانی مدل، یک ابزار خواندنی و دریافت نتیجه و trace. همین مسیر باید قابلاجرا و قابلآزمون با crash باشد.ADR-002 proposes one small path: register an app, submit a run, call one model and one read-only tool, and retrieve the result and trace. Make that path runnable and test it under crashes.
context زنده و CDC، ارزیابی و انتشار نسخهها، چند برنامه روی هستهٔ مشترک و آزمایش serving روی GPU. پیشنهاد فعلی استفاده از مدل آماده است؛ آموزش یک مدل بنیادی از صفر در این scope نیست.Live context and CDC, evaluation/release, multiple apps on the shared core, and GPU-serving experiments. The current proposal uses existing models; training a foundation model from scratch is outside scope.
چه چیزی برای رزومه قابلنشاندادن میشود؟What would become portfolio evidence?
برای مسیر AI Engineer: طراحی ابزار و retrieval، ارزیابی پاسخ و تحلیل خطا. برای AI Platform Engineer: قرارداد API، دوام اجرا، کنترل دسترسی، ظرفیت، هزینه و observability. مدرکِ کار، مخزن اجرایی، demo، آزمون crash، نتیجهٔ eval و ADRهاست؛ فعلاً این صفحه دفتر طراحی آن کار است.For AI engineering: tools, retrieval, output evaluation, and error analysis. For AI platform engineering: API contracts, durable execution, access control, capacity, cost, and observability. Evidence means working code, a demo, crash tests, eval results, and ADRs. This page is currently the design workbook.
در کدام شرکتها چنین مسئلههایی مطرح شده؟Which companies have raised related problems?
خودِ این پروژه را به یک شرکت نسبت نمیدهیم. در پایین، نمونهٔ رسمیِ کار مهندسی، تمرینِ منتشرشده و تجربهٔ گزارششدهٔ مصاحبه برچسب جدا دارند. تاریخ بررسی منابع: ۱۵ اکتبر ۲۰۲۶.We do not attribute this entire project to a company. Official engineering work, a released hiring exercise, and reported interview experiences are labeled separately below. Sources checked on 15 October 2026.
سؤالها و بحثهای گزارششده در مصاحبهReported interview questions and discussions
۸ رکورد از ۷ شرکت: یک تمرین رسمیِ منتشرشده و هفت روایت داوطلب. عنوانها خلاصهسازی شدهاند، نه نقلِ کامل صورتسؤال. هر رکورد نقش، تاریخِ موجود، منبع و میزان ارتباط با پروژه را دارد.Eight records across seven companies: one officially released exercise and seven candidate accounts. Titles are paraphrases, not full prompt reproductions. Each record gives role, available date, source, and scope of relevance.
بهینهسازی برنامه روی یک شتابدهندهٔ شبیهسازیشده؛ با اندازهگیری چرخهها و تحلیل عملکرد.Optimize a program on a simulated accelerator using cycle measurements and performance analysis.
کجای پروژه به آن مربوط است؟Where does it connect to this project?
به فاز تکمیلی performance و serving مربوط است؛ این تمرینِ منتشرشده، سؤالِ طراحی کل پلتفرم ما نیست.Relevant to the later performance/serving track; this released exercise is not our entire platform design prompt.
انتشار رسمی: ۲۱ ژانویهٔ ۲۰۲۶؛ تمرینِ قدیمی منتشر شده است.Official publication: 21 Jan 2026; a former take-home was released.
وقوع و انتشار این تمرین را خود شرکت تأیید کرده؛ سؤال فعلیِ هر تیم یا شباهت کامل با پروژه را تأیید نمیکند.The company confirms this former exercise and its release, not every team’s current prompt or a full match to our project.
AnthropicSenior / Staff SWE · Inferencingطراحی API برای batch inferenceBatch-inference API designروایت داوطلبCandidate report
چه چیزی گزارش شده؟What was reported?
طراحی API برای batch inference روی خوشهٔ GPU؛ تمرکزِ گزارش روی API، صف و زمانبندی پیرامون یک مدلِ جعبهسیاه است.Design a batch-inference API over GPU clusters; the account emphasizes the API, queueing, and scheduling around a black-box model.
کجای پروژه به آن مربوط است؟Where does it connect to this project?
Gateway، صف و ظرفیت؛ زمانبند چند GPU در scope نسخهٔ اول ما نیست.Gateway, queueing, and capacity; a multi-GPU scheduler is outside our first-version scope.
مصاحبه: ۲۰۲۵ طبق عنوان منبع؛ روز دقیق مشخص نیست.Interview: 2025 according to the source title; exact day unspecified.
روایت داوطلب؛ انتساب سؤال به شرکت را مستقلاً تأیید نکردهایم. برچسب Verified متعلق به خودِ ناشر است.A candidate account; company attribution is not independently verified. Any Verified badge belongs to the publisher.
OpenAIPlatform SWEتحویل webhook با retry و بازیابی crashWebhook delivery, retries, and crash recoveryروایت داوطلبCandidate report
چه چیزی گزارش شده؟What was reported?
ساخت سرویس تحویل webhook با retry، backoff و صف خطا؛ سپس بررسیِ گیرکردن تحویل پس از crash و راهحل مبتنی بر lease.Build reliable webhook delivery with retries, backoff, and a dead-letter queue; discuss stuck deliveries after a crash and lease-based recovery.
کجای پروژه به آن مربوط است؟Where does it connect to this project?
قرارداد delivery، بازیابی worker و idempotency در Runtime؛ این سؤال دربارهٔ RAG یا کل AI platform گزارش نشده است.Delivery contracts, worker recovery, and runtime idempotency; this report does not describe RAG or a complete AI platform prompt.
تاریخ دقیق مصاحبه در متن مشخص نیست.Exact interview date is not specified in the account.
روایتِ تأییدنشده در یک انجمن با زمینهٔ تبلیغ ابزار مصاحبه؛ اعتبار پایینتر از منبع رسمی است.Unverified self-report in a community that promotes an interview tool; weaker evidence than an official source.
DatabricksSWE L4 · Compute Platformزمانبند GPU و دوام دادهGPU scheduling and durable storageروایت داوطلبCandidate report
چه چیزی گزارش شده؟What was reported?
زمانبند توزیعشدهٔ jobهای GPU؛ گزارش همچنین ساخت KV پایدار، WAL، بازیابی و مسئلهٔ برگشت worker قدیمی را شرح میدهد.A distributed GPU-job scheduler; the account also describes durable KV storage, WAL, recovery, and a returning stale worker.
کجای پروژه به آن مربوط است؟Where does it connect to this project?
Runtime، fencing و crash recovery؛ scheduling آموزش مدل یک مبحث مجاور است و در پروژهٔ اولیه پیاده نمیشود.Runtime, fencing, and crash recovery; training-job scheduling is adjacent material, not part of our initial implementation.
تاریخ دقیق مصاحبه در متن مشخص نیست.Exact interview date is not specified in the account.
همان نوع انجمن تبلیغاتی و روایت تأییدنشده؛ شاهد مستقل یا تضمینِ سؤال آینده نیست.The same promotional community context and unverified account; not independent corroboration or a future-question guarantee.
IntuitSWE-2API یک LLM، تست و پایشAn LLM API, tests, and monitoringروایت داوطلبCandidate report
چه چیزی گزارش شده؟What was reported?
افزودن API به مخزن Python/Flask با LLM کانتینری؛ سپس بحث تست، پایش و مفاهیم RAG، prompt و temperature.Add an API to a Python/Flask repository with a containerized LLM, then discuss testing, monitoring, RAG, prompts, and temperature.
کجای پروژه به آن مربوط است؟Where does it connect to this project?
اولین slice اجرایی، قرارداد API و تست سرتاسری؛ بخش RAG یک گفتوگوی مفهومی گزارش شده، نه طراحی کامل پلتفرم.The first runnable slice, API contracts, and end-to-end tests; RAG was reported as conceptual discussion, not a full platform design.
NetAppSDE-1 · 1+ YOERAG و مرور سیستمهای توزیعشدهRAG and distributed-systems discussionروایت داوطلبCandidate report
چه چیزی گزارش شده؟What was reported?
بحث دربارهٔ pipelineهای RAG، vector database، retrieval و agent؛ همراه با مرور پروژه و همزمانی و تراکنشها.Discuss RAG pipelines, vector databases, retrieval, and agents alongside a project review, concurrency, and transactions.
کجای پروژه به آن مربوط است؟Where does it connect to this project?
Live Context و retrieval، سپس پیوند با تراکنشها؛ منبع یک prompt مستقل برای ساخت AI platform ارائه نمیکند.Live Context and retrieval, connected to transactions; the source does not provide a standalone AI-platform design prompt.
AmazonSDE-1بررسی خروجی LLM در توسعهChecking LLM output during developmentروایت داوطلبCandidate report
چه چیزی گزارش شده؟What was reported?
چطور در توسعه از LLM استفاده میکنی، خروجی تولیدشده را چگونه بررسی میکنی و چه وقت به آن اعتماد نمیکنی؟How do you use LLMs in development, verify generated output, and decide when not to trust it?
کجای پروژه به آن مربوط است؟Where does it connect to this project?
شاهد و آزمون برای کیفیتِ خروجی و شیوهٔ کار؛ این بحث AI fluency است و سؤال system design محسوب نمیشود.Evidence and tests for output quality and engineering practice; this is AI-fluency discussion, not a system-design prompt.
مصاحبهٔ حضوری: ۸ مهٔ ۲۰۲۶ طبق timeline نویسنده.Onsite: 8 May 2026 according to the author’s timeline.
روایت ناشناس؛ فقط همین گفتوگوی گزارششده را پشتیبانی میکند، نه مصاحبهٔ نقش AI Engineer.An anonymous report supporting this discussion only, not a claim about an AI Engineer interview.
MicrosoftGBB Data & AI Specialistتوضیح نحوهٔ استفاده از RAGExplaining how to use RAGروایت داوطلبCandidate report
چه چیزی گزارش شده؟What was reported?
توضیح بده RAG برای LLM چگونه ساخته و استفاده میشود.Explain how to build and use RAG for an LLM.
کجای پروژه به آن مربوط است؟Where does it connect to this project?
مبانی retrieval و context؛ دربارهٔ نقش Specialist است و شاهدِ سؤال مهندسی پلتفرم در ۲۰۲۶ نیست.Retrieval/context fundamentals; this is a Specialist role and does not establish a 2026 platform-engineering prompt.
تاریخ ثبت تجربه: ۱ دسامبر ۲۰۲۳؛ نمونهٔ قدیمیتر است.Experience date: 1 Dec 2023; an older example.
بازنشر تجربهٔ یک داوطلب؛ هویت و انتساب را مستقلاً تأیید نکردهایم.A published candidate experience; identity and attribution are not independently verified.
نمونههای مستند در کارِ واقعی شرکتهاDocumented industry examples
این مقالهها وجودِ مسئلهٔ مهندسی را نشان میدهند؛ مدرکِ سؤال مصاحبه نیستند. ارتباط با پروژه، برداشت آموزشی ماست.These articles demonstrate engineering problems, not interview prompts. Their connection to this project is our educational interpretation.
Uber
یک دروازهٔ مشترک برای دسترسی تیمها به مدلها، کنترل دسترسی، پایش و حسابکردن هزینه.A shared gateway for model access, authorization, monitoring, and cost attribution.
حفظِ پیشرفت و وضعیت برای agentهایی که کارشان از یک نشست و پنجرهٔ context طولانیتر میشود.Preserving progress and state for agents working across sessions and context windows.
ارزیابی چندمرحلهای با task، trial و grader؛ برای آشکارشدن تغییر کیفیت قبل از انتشار.Multi-step evaluation with tasks, trials, and graders to expose quality changes before release.
روش جستوجو و حدودِ اعتبار این فهرستSearch method and limits of this register
در ۱۵ اکتبر ۲۰۲۶ جستوجویی گسترده با ۲۶ عبارتِ هدفمند در منابع عمومی، Reddit، LeetCode، تجربههای Aced/Exponent و Taro، و وبلاگهای مهندسی انجام شد. فهرست جامعِ کل اینترنت یا بانکِ تأییدشدهٔ سؤالهای شرکتها نیست.On 15 October 2026, a broad search used 26 targeted queries across public sources, Reddit, LeetCode, Aced/Exponent and Taro accounts, and engineering blogs. This is neither an exhaustive internet search nor a verified company question bank.
تاریخ بررسی با تاریخ مصاحبه فرق دارد؛ هرجا تاریخ دقیق نداریم، نوشتهایم. چند بازنشرِ یک روایت را شاهد مستقل حساب نکردهایم. پستهای تبلیغاتی و فهرستهای بدون منبع در نتیجهٔ رسمی ادغام نشدهاند؛ دو روایتِ دارای زمینهٔ تبلیغاتی با همان محدودیت مشخص شدهاند.The review date differs from the interview date; missing dates are explicit. Reposts are not independent corroboration. Promotional material and unsourced banks are not treated as official evidence; two reports with promotional context are identified accordingly.
برای سؤالِ «همین پلتفرم کامل را طراحی کن» شاهد عمومی کافی پیدا نشد. این پروژه ترکیبی آموزشی است؛ شباهتِ هر بخش به یک سؤال به معنای یکسانبودن scope یا کفایت برای قبولی نیست.We did not find sufficient public evidence for this exact complete-platform prompt. This is an educational synthesis; component overlap does not establish identical scope or guarantee interview success.
از نیاز توسعهدهنده شروع میکنیم؛ بعد عدد میگذاریم، گزینهها را میسنجیم و معماری را رسم میکنیم. این هفت گام مسیر طراحیاند، نه گزارشِ پیشرفتِ ساخت.Start from the developer’s needs, estimate demand, weigh alternatives, then draw the architecture. These seven stages guide the design; they do not report implementation progress.
در مرحلهٔ تعریف نیازها هستیم. مخاطب تأیید شده؛ معماری پیشنهادی است و سرویسهای پلتفرم هنوز ساخته نشدهاند.Requirements stage. Audience confirmed; architecture proposed; platform services not yet implemented.
مسئله و کاربرProblem and user
تأییدشده: کاربر اصلی توسعهدهنده است. میخواهد یک app را ثبت کند، ورودی بدهد و نتیجه و trace بگیرد. هنوز از این جمله نتیجه نمیگیریم که Kafka یا GPU لازم است.Confirmed: the primary user is a developer registering an app, submitting input, and receiving a result/trace. This does not yet imply Kafka or GPUs.
کاری که در این گام انجام میدهیمThe task for this stage
یک user story با ورودی، خروجی و معیار موفقیت بنویسیم؛ «agent همهکاره» معیار قابلآزمون نیست.Write a user story with input, output, and success criteria; an all-purpose agent is not a testable requirement.
ورودی / نیازInput / need
توسعهدهنده، app و ورودیDeveloper, app, input
تصمیم / فرضDecision / assumption
یک run قابلپیگیریOne traceable run
شاهدِ لازمEvidence needed
نتیجه و trace قابلمشاهدهAn inspectable result and trace
مرز نسخهٔ اولFirst-version boundary
پیشنهاد ADR-002: یک مسیر کوچک از ثبت app تا اجرای یک مدل و ابزار خواندنی. پنج قابلیت مقصد پروژهاند؛ هیچکدام با دیدن نمودار پیادهسازیشده محسوب نمیشود.ADR-002 proposes one small app-to-model-and-read-only-tool path. Five capabilities are the destination, not implemented services.
کاری که در این گام انجام میدهیمThe task for this stage
چه چیزی را در demo اول واقعاً میتوانیم اجرا و خراب کنیم؟ همین scope باید قبل از انتخاب ابزار روشن شود.What can the first demo actually run and deliberately break? Establish that scope before choosing tools.
ورودی / نیازInput / need
یک مدل و یک ابزار خواندنیOne model and one read-only tool
تصمیم / فرضDecision / assumption
یک مسیر کوچکِ سرتاسریOne small end-to-end slice
شاهدِ لازمEvidence needed
demo قابلاجرا و آزمونِ crashA runnable demo and a crash test
نیازهای رفتاریFunctional needs
ثبت app، هویت توسعهدهنده، پذیرش run، فراخوانی مدل/ابزار، نتیجه و مشاهدهٔ وضعیت. برای هرکدام یک acceptance example مینویسیم.Register apps, identify developers, admit runs, call models/tools, return results, expose state. Write an acceptance example for each.
کاری که در این گام انجام میدهیمThe task for this stage
نیاز: «retry پاسخ گمشده run جدید نسازد». راهحل پیشنهادیِ بعدی: idempotency key و قید یکتا. نیاز را با ابزار یکی نکنیم.Need: retrying a lost response must not create another run. Later solution candidate: idempotency key and uniqueness. Separate needs from mechanisms.
ورودی / نیازInput / need
پاسخِ پذیرش گم میشودThe admission response is lost
تصمیم / فرضDecision / assumption
retry همان run را برگرداندA retry returns the same run
شاهدِ لازمEvidence needed
شناسهٔ run قبل و بعد برابر استThe run ID stays the same
بار و تخمینWorkload and estimates
دفتر E01–E12 فرضها را ثبت میکند. میانگین روزانه، burst کوتاه و سناریوی یک میلیون سند سه workload متفاوتاند. تا اندازهگیری نکردهایم، عددها تخمیناند.E01–E12 record assumptions. Daily pilot average, short bursts, and a million-document scale scenario are different workloads. Unmeasured values remain estimates.
کاری که در این گام انجام میدهیمThe task for this stage
حجم، token، حافظه و هزینه را با فرمول حساب کنیم؛ اگر جواب با بودجه نمیخواند scope یا معماری را عوض کنیم.Calculate volume, tokens, memory, and cost; adjust scope/architecture when results exceed the budget.
۱٫۶ میلیون token در روز، فرضی1.6M daily tokens, hypothetical
شاهدِ لازمEvidence needed
مقایسهٔ حساب با بودجه و بار واقعیCompare with budget and actual load
کیفیت و خط قرمزهاQuality and invariants
اول مشخص کنیم admission، اولین token یا پایان run مهم است. سپس SLI، بار، پنجره، denominator، هدف و روش آزمون را تعریف کنیم.Choose between admission, useful first token, and final completion. Define SLI, load, window, denominator, target, and validation.
کاری که در این گام انجام میدهیمThe task for this stage
ADR-003 سه ثانیه را فرضِ TTFT میگیرد؛ این عدد نه از DDIA آمده و نه هنوز از تجربهٔ کاربر اندازهگیری شده است.ADR-003 treats three seconds as a TTFT hypothesis; it is neither a DDIA mandate nor a measured user requirement.
ورودی / نیازInput / need
برنامهٔ تعاملی؛ اولین token مفیدAn interactive app; useful first token
تصمیم / فرضDecision / assumption
۳ ثانیه، هدفِ پیشنهادیThree seconds, a proposed target
برای هر انتخابِ مهم مسئله، گزینهها، دلیل، اثر منفی، فرض، آزمون و شرط بازنگری ثبت میشود. وضعیت Proposed با Accepted فرق دارد.Record context, alternatives, rationale, downside, assumptions, validation, and revisit triggers for major choices. Proposed and Accepted differ.
کاری که در این گام انجام میدهیمThe task for this stage
فعلاً فقط انتخاب مخاطب پذیرفته شده است؛ ADRهای فنی پیشنهادیاند و با آزمایش یا گفتوگو تغییر میکنند.Only the audience choice is accepted; technical ADRs remain proposals subject to discussion and testing.
ورودی / نیازInput / need
نیاز، گزینهها و محدودیتA need, alternatives, constraints
تصمیم / فرضDecision / assumption
یک ADR با وضعیت ProposedAn ADR marked Proposed
شاهدِ لازمEvidence needed
آزمونِ انتخاب و شرطِ بازنگریA validation test and revisit trigger
رسم فلو، سپس ساختDraw the flow, then implement
بعد از این گامها، بلوکها و مرزِ داده را رسم میکنیم. انیمیشن پایین فقط یک درخواستِ فرضی را روی طرح پیشنهادی دنبال میکند.Only then draw components and data boundaries. The animation below follows a hypothetical request through a proposed design.
کاری که در این گام انجام میدهیمThe task for this stage
پس از پذیرش scope و ADRهای لازم، اولین slice را میسازیم، crash را تزریق میکنیم و نتایج واقعی را جای فرضها میگذاریم.After accepting scope and required ADRs, build the first slice, inject crashes, and replace assumptions with measured results.
ورودی / نیازInput / need
scope و تصمیمهای لازم پذیرفته شوندAccept scope and required decisions
تصمیم / فرضDecision / assumption
رسم مرزها، سپس اولین sliceDraw boundaries, then build a slice
شاهدِ لازمEvidence needed
تزریق crash و ثبت نتیجهٔ واقعیInject crashes and record real results
02هر عدد، یک فرض و یک حسابEvery number needs an assumption
دو سناریوی جدا را بررسی میکنیم: مصرفِ یک پایلوت کوچک و حجمِ یک مجموعهدادهٔ بزرگ. اعداد فرضیاند؛ شناسهٔ کنار هر ورودی، راهِ رسیدن به فرض و محدودیت آن است.Explore two separate scenarios: a small pilot’s usage and a large dataset’s size. Values are hypothetical; assumption IDs connect each input to its source and limits.
این جوابها از کجا میآیند؟Where do these answers come from?
مصرف روزانهDaily usageE01 × E02 × E03
100 × 8 × (1500 + 500) = 1,600,000 tokens/day
retry و context طولانیتر جدا هستند.Retries and longer contexts are separate.
هزینهٔ مدلModel costE01–E03 · E09
1.2M × $1/M + 0.4M × $4/M = $2.80/day
نرخها نمونهاند؛ قیمتِ یک provider نیستند.Illustrative rates, not a provider’s prices.
حافظهٔ خامِ بردارهاRaw vector memoryE04–E06
1,000,000 × 4 × 1536 × 4 B = 24.576 GB
متن، metadata، WAL و replica جدا هستند؛ GB دهدهی است.Excludes text, metadata, WAL, and replicas; decimal GB.
رسیدن به جریان زندهCatching upE04 · E07
50,000 ÷ (30 − 5) = 2,000 s ≈ 33.33 min
باید سرعت پردازش از ورود تغییرها بیشتر باشد.Processing must be faster than incoming changes.
همهٔ فرمولها و محدودیتهاAll formulas and limitations
خروجی
فرمول و عددِ سناریو
فرض و محدودیت
token روزانه
E01×E02×(input+output)=1.6M tokens/day.
retry، context طولانی و reasoning اضافه جدا اندازهگیری میشوند.
Hypothetical architecture; no GPU has been selected.
03تصمیمی که بشود از آن دفاع کردDecisions you can defend
هر رکورد یک سؤال دارد: چه نیازی، کدام گزینهها، چرا این انتخاب و با چه شاهدی؟ فقط انتخاب مخاطب پذیرفته شده؛ تصمیمهای فنی را باید با نیاز، عدد و آزمون بررسی کنیم.Each record asks: which need, which alternatives, why this choice, and what evidence? Only the audience choice is accepted. Technical decisions still need requirements, estimates, and validation.
چرا سه ثانیه؟Why three seconds?
یک فرض برای تجربهٔ تعاملی؛ هنوز نیازِ اثباتشده نیست.A hypothesis for the interactive experience, still unproven.
E11؛ بودجهٔ تخصیصی و اندازهگیرینشدهٔ مسیر؛ جمعِ p95 اجزا نیست. هدف مربوط به اولین token مفید است، نه پایانِ agent.E11: allocated, unmeasured path budget, not the sum of component p95s. The target concerns the useful first token, not agent completion.
ADR-001کاربر اصلی چه کسی است؟Who is the primary user?کاربر اصلی نسخهٔ اول توسعهدهنده است؛ Investigator فقط یک برنامهٔ نمونه روی پلتفرم است.The initial primary user is an application developer; Investigator is a sample platform application.پذیرفتهشدهAccepted
مسئلهContext
«پلتفرم AI» هم میتواند محصولِ توسعهدهنده باشد و هم پشتصحنهٔ یک دستیار on-call. این دو، نیاز و اولویت متفاوت دارند.An AI platform can serve developers or sit behind an on-call assistant; their needs and priorities differ.
گزینههای روی میزAlternatives
توسعهدهندهٔ برنامهٔ AI؛ یا مهندس on-call.AI-application developers or on-call engineers.
پیشنهاد فعلیCurrent proposal
کاربر اصلی نسخهٔ اول توسعهدهنده است؛ Investigator فقط یک برنامهٔ نمونه روی پلتفرم است.The initial primary user is an application developer; Investigator is a sample platform application.
دلیل انتخاب و هزینهاشRationale and trade-off
دامنهٔ پذیرفتهشدهٔ این کارگاه، پلتفرمِ قابلاستفادهمجدد برای توسعهدهنده است؛ پس API مشترک برای چند برنامه، معیارِ طراحی میشود.The agreed workshop scope is a reusable developer platform, so shared APIs across applications become a design criterion.
فرضهای پشت تصمیمUnderlying assumptions
هنوز تعداد توسعهدهندگان، نوع برنامه و نیاز سازمانی تأیید نشدهاند.Developer count, application types, and organizational requirements remain unconfirmed.
شاهدی که لازم داریمEvidence we need
دو برنامهٔ متفاوت با همان API ثبت و اجرا شوند، بدون تغییر هسته.Register and run two different applications through the same API without core changes.
چه وقت تغییرش بدهیم؟When to revisit
اگر مخاطب یا کاربرد اولیه عوض شد، ADR تازه ثبت شود و این تصمیم superseded شود.If the audience or initial use case changes, supersede this record with a new ADR.
ADR-002نسخهٔ اول دقیقاً چه کاری انجام میدهد؟What does the first version actually do?ثبت برنامه → ارسال run → یک call مدل و یک ابزار خواندنی → نتیجه و trace؛ سپس توسعهٔ مرحلهای.Register app → submit run → one model call and read-only tool → result/trace, then expand.پیشنهادیProposed
مسئلهContext
ساخت همزمان همهٔ قابلیتها، گرفتن بازخورد و فهم خرابیها را سخت میکند.Building all capabilities simultaneously complicates feedback and failure diagnosis.
گزینههای روی میزAlternatives
همهٔ پنج قابلیت بهصورت کامل؛ یا یک مسیر end-to-end کوچک و قابلآزمایش.Five complete capabilities at once, or one small testable end-to-end path.
پیشنهاد فعلیCurrent proposal
ثبت برنامه → ارسال run → یک call مدل و یک ابزار خواندنی → نتیجه و trace؛ سپس توسعهٔ مرحلهای.Register app → submit run → one model call and read-only tool → result/trace, then expand.
دلیل انتخاب و هزینهاشRationale and trade-off
ابتدا قرارداد مشترک پلتفرم را اثبات میکنیم؛ phase اول به GPU، Kafka و Kubernetes وابسته نیست.Prove the reusable platform contract first; the first phase does not depend on GPUs, Kafka, or Kubernetes.
فرضهای پشت تصمیمUnderlying assumptions
E01 حجم پایلوت؛ E02 سقف callها فرضاند. دادهٔ پایلوت واقعی نداریم.Pilot volume E01 and call count E02 are assumptions; real pilot data does not exist yet.
شاهدی که لازم داریمEvidence we need
developer یک app ساده و یک app ابزارمحور را از همان قرارداد اجرا کند؛ پاسخ گمشده run جدید نسازد.Run simple and tool-using apps through the same contract; lost responses do not create duplicate runs.
چه وقت تغییرش بدهیم؟When to revisit
با اثبات مسیر اول، قابلیتهای context، eval و serving با gate مستقل اضافه شوند.After the first path works, add context, evaluation, and serving behind separate gates.
ADR-003چرا SLO سه ثانیه؟ برای کدام پاسخ؟Why three seconds, and for which response?فقط برای برنامهٔ تعاملی: پیشنهاد ۹۵٪ پاسخهای موفق با اولین token مفید در ≤3000 ms در پنجرهٔ ۷روزه؛ هنوز تعهد مصوب نیست.Interactive apps only: propose successful useful-first-token responses within 3000ms for 95% of eligible requests over seven days; not an approved commitment.پیشنهادیProposed
مسئلهContext
تأییدِ پذیرش run، اولین token و پایانِ بررسی سه تجربهٔ متفاوتاند؛ یک عدد برای همهٔ آنها معنا ندارد.Admission acknowledgement, first token, and completed investigation are different experiences; one number cannot describe all three.
گزینههای روی میزAlternatives
۱ ثانیه سختگیرانه؛ ۳ ثانیه پیشنهادی؛ ۱۰ ثانیه با انتظار بیشتر؛ یا اجرای غیرتعاملی.An aggressive one second, proposed three seconds, ten seconds with more waiting, or asynchronous execution.
پیشنهاد فعلیCurrent proposal
فقط برای برنامهٔ تعاملی: پیشنهاد ۹۵٪ پاسخهای موفق با اولین token مفید در ≤3000 ms در پنجرهٔ ۷روزه؛ هنوز تعهد مصوب نیست.Interactive apps only: propose successful useful-first-token responses within 3000ms for 95% of eligible requests over seven days; not an approved commitment.
دلیل انتخاب و هزینهاشRationale and trade-off
۳ ثانیه یک فرضِ تجربهٔ کاربری است، نه استاندارد کتاب. بودجهٔ مسیر 100 + 300 + 250 + 1900 + 450 = 3000 ms است؛ باید با تست کاربر و load test رد یا تأیید شود.Three seconds is a UX hypothesis, not a book standard. The path budget is 100+300+250+1900+450=3000ms; user testing and load tests must validate it.
فرضهای پشت تصمیمUnderlying assumptions
E11 بودجههای مسیر؛ E03 توکنها؛ E10 burst. صدکهای اجزا را با هم جمع نمیکنیم؛ این تقسیمِ بودجه است، نه p95 اندازهگیریشده.E11 path budgets, E03 tokens, E10 bursts. Do not sum component percentiles: this is budget allocation, not a measured end-to-end p95.
شاهدی که لازم داریمEvidence we need
SLI از SDK/لبه تا اولین token مفید: good/eligible؛ خطای provider و deadline در مخرج باشند. schema-invalid و cancel پیش از پذیرش جدا تعریف شوند. p95 و error جدا هم گزارش شوند.Measure SDK/edge to useful first token as good/eligible, including provider errors and deadlines in the denominator. Define invalid/cancelled-before-admission exclusions explicitly; also report p95 and errors separately.
چه وقت تغییرش بدهیم؟When to revisit
اگر کاربر با ۵ ثانیه هم راضی است یا مدلِ لازم با ۳ ثانیه نمیرسد، بهجای عددسازی، UX/مدل/هدف را بازبینی کن. پاسخِ نهایی agent هدف جدا میخواهد.If users accept five seconds or the required model cannot meet three, revisit UX/model/target rather than inventing results. Final agent completion needs a separate objective.
ADR-004چرا PostgreSQL مرجع وضعیت باشد؟Why PostgreSQL for authoritative state?پیشنهاد: PostgreSQL برای metadata و state؛ artifact بزرگ بیرون DB و با pointer/hash.Propose PostgreSQL for metadata/state; store large artifacts externally with pointers/hashes.پیشنهادیProposed
مسئلهContext
run، بودجه و release به قید یکتا، تغییر شرطی و commit پایدار نیاز دارند.Runs, budgets, and releases need unique constraints, conditional updates, and durable commits.
گزینههای روی میزAlternatives
PostgreSQL؛ document store؛ event log بهعنوان تنها مرجع.PostgreSQL, document storage, or an event log as the sole authority.
پیشنهاد فعلیCurrent proposal
پیشنهاد: PostgreSQL برای metadata و state؛ artifact بزرگ بیرون DB و با pointer/hash.Propose PostgreSQL for metadata/state; store large artifacts externally with pointers/hashes.
دلیل انتخاب و هزینهاشRationale and trade-off
transaction محلی، UNIQUE و CAS ریسکِ run تکراری و overspend را محدود میکنند؛ JSON همچنان برای payload مناسب است.Local transactions, uniqueness, and CAS reduce duplicate-run/overspend risks; JSON still suits payloads.
فرضهای پشت تصمیمUnderlying assumptions
E01 پایلوت و E10 burst؛ اندازهٔ state واقعی هنوز نداریم.Pilot E01 and burst E10; actual state sizes are not measured.
شاهدی که لازم داریمEvidence we need
race روی idempotency/budget؛ EXPLAIN برای claim؛ crash پس از commit؛ تست restore.Idempotency/budget races, claim query plans, post-commit crashes, and restore tests.
چه وقت تغییرش بدهیم؟When to revisit
وقتی قفل، I/O یا حجم index در workload واقعی bottleneck شد، partition/sharding را با ADR مستقل بررسی کن.When measured locks, I/O, or index size becomes a bottleneck, evaluate partitioning/sharding in a new ADR.
ADR-005چرا Runtime ابتدا محدود باشد؟Why start with a bounded runtime?ابتدا state machine محدود برای یادگیری قرارداد؛ پیش از workflowهای بلند و پیچیده، engine آماده را benchmark کنیم.Use a bounded state machine to learn contracts; benchmark an existing engine before long complex workflows.پیشنهادیProposed
مسئلهContext
agent عمومی با انتظار، retry، cancellation و اثر بیرونی از یک حلقهٔ while پیچیدهتر است.General agents with waits, retries, cancellation, and external effects are more complex than a loop.
گزینههای روی میزAlternatives
state machine دامنهای کوچک؛ workflow engine آماده؛ موتور عمومی سفارشی.A small domain state machine, an existing workflow engine, or a custom general engine.
پیشنهاد فعلیCurrent proposal
ابتدا state machine محدود برای یادگیری قرارداد؛ پیش از workflowهای بلند و پیچیده، engine آماده را benchmark کنیم.Use a bounded state machine to learn contracts; benchmark an existing engine before long complex workflows.
دلیل انتخاب و هزینهاشRationale and trade-off
قرار نیست موتور workflow عمومی بازنویسی کنیم. نقطهٔ یادگیری، مرز commit، epoch و outcome نامعلوم است.Do not rewrite a general workflow engine. Learn commit boundaries, epochs, and unknown outcomes.
فرضهای پشت تصمیمUnderlying assumptions
E02 میانگین ۸ call فرضی است؛ سقف step و deadline باید جدا تعیین شوند.E02 assumes eight calls on average; step caps and deadlines need separate decisions.
شاهدی که لازم داریمEvidence we need
kill/resume؛ stale-owner rejection؛ pause پس از tool effect؛ ابزار write باید خود idempotency enforce کند.Kill/resume, stale-owner rejection, pause after tool effects; write tools enforce their own idempotency.
چه وقت تغییرش بدهیم؟When to revisit
با انتظار انسانی، DAG پیچیده یا تغییرات ناسازگار workflow، ادامهٔ موتور دستی دوباره توجیه شود.Rejustify custom runtime work when human waits, complex DAGs, or incompatible workflow evolution appear.
ADR-006چه زمانی CDC و Kafka لازم میشوند؟When are CDC and Kafka justified?فاز context: برای منبع تحت مالکیت، business+outbox اتمی و سپس CDC؛ Kafka وقتی replay/fan-out مستقل ارزشش را نشان دهد.Context phase: atomic business/outbox changes with CDC for owned sources; Kafka when independent replay/fan-out justifies it.پیشنهادیProposed
مسئلهContext
تازهماندن context و چند consumer مستقل در مراحل بعد لازم میشوند؛ در اولین call مدل الزامی نیستند.Fresh context and independent consumers matter later, not for the first model call.
گزینههای روی میزAlternatives
polling با cursor؛ outbox polling؛ log CDC و Kafka.Cursor polling, outbox polling, or log CDC with Kafka.
پیشنهاد فعلیCurrent proposal
فاز context: برای منبع تحت مالکیت، business+outbox اتمی و سپس CDC؛ Kafka وقتی replay/fan-out مستقل ارزشش را نشان دهد.Context phase: atomic business/outbox changes with CDC for owned sources; Kafka when independent replay/fan-out justifies it.
دلیل انتخاب و هزینهاشRationale and trade-off
dual write میتواند شکاف یا ترتیب متفاوت بسازد؛ افزودن broker بدون نیاز، هزینهٔ نگهداری دارد.Dual writes can leave gaps or divergent ordering; an unnecessary broker adds operational cost.
فرضهای پشت تصمیمUnderlying assumptions
E07 پنج event/ثانیه و دو KB/event؛ E08 هفت روز replay همگی فرضاند.E07 assumes five events/second and 2KB/event; E08 assumes seven days of replay.
شاهدی که لازم داریمEvidence we need
snapshot هممرز، overlap/delete/replay و cursor expiry؛ مقایسهٔ freshness/هزینه با polling ساده.Boundary-aligned snapshots, overlap/deletion/replay/cursor expiry; compare freshness/cost with polling.
چه وقت تغییرش بدهیم؟When to revisit
اگر polling نیازِ تازگی را با هزینهٔ کمتر جواب داد، CDC/Kafka را به مرحلهٔ بعد منتقل کن.If polling meets freshness needs more cheaply, defer CDC/Kafka.
ADR-007چرا retrieval را با baseline شروع کنیم؟Why begin retrieval with a baseline?baseline واژگانی؛ dense/hybrid تنها با بهبود Recall@k و کیفیت پاسخ روی holdout.Lexical baseline; dense/hybrid only with holdout retrieval and answer-quality improvement.پیشنهادیProposed
مسئلهContext
embedding همیشه بهتر از جستوجوی دقیقِ نام، کد و شناسه نیست.Embeddings do not always beat exact names, codes, and identifiers.
گزینههای روی میزAlternatives
lexical؛ dense؛ hybrid+reranker؛ graph retrieval.Lexical, dense, hybrid with reranking, or graph retrieval.
پیشنهاد فعلیCurrent proposal
baseline واژگانی؛ dense/hybrid تنها با بهبود Recall@k و کیفیت پاسخ روی holdout.Lexical baseline; dense/hybrid only with holdout retrieval and answer-quality improvement.
دلیل انتخاب و هزینهاشRationale and trade-off
مقایسهٔ واقعی جلوی هزینهٔ embedding بیفایده را میگیرد؛ label، نسخه و ACL همچنان در همهٔ روشها لازماند.Measurement avoids unhelpful embedding costs; labels, versions, and ACLs remain necessary for all methods.
فرضهای پشت تصمیمUnderlying assumptions
E04 یک میلیون سند؛ E05 چهار chunk؛ E06 بردار ۱۵۳۶بعدی فقط سناریوی ظرفیت است، نه مدل انتخابشده.E04 one million documents, E05 four chunks, E06 1536 dimensions are a capacity scenario, not a selected model.
شاهدی که لازم داریمEvidence we need
lexical/dense/hybrid روی یک dataset ثابت؛ latency، recall، citation support و cost ثبت شوند.Compare lexical/dense/hybrid on one pinned dataset; record latency, recall, citation support, and cost.
چه وقت تغییرش بدهیم؟When to revisit
فقط وقتی queryهای چندمرحلهایِ رابطهای شکست مستند دارند graph را اضافه کن.Add graph retrieval only after documented failures on relational multi-hop queries.
ADR-008چرا اول provider و بعد GPU؟Why provider first, GPU later?adapter قابلتعویض با budget/trace؛ سپس آزمایش GPU محدود در فاز serving.Swappable provider adapter with budgets/traces, followed by a bounded GPU experiment.پیشنهادیProposed
مسئلهContext
هدف اولیه اثبات قرارداد پلتفرم است؛ خرید ظرفیتِ بلااستفاده یادگیری را متوقف میکند.The first goal is platform contracts; idle purchased capacity can stall learning.
گزینههای روی میزAlternatives
provider API؛ model server محلی؛ هر دو از روز اول.Provider API, local serving, or both on day one.
پیشنهاد فعلیCurrent proposal
adapter قابلتعویض با budget/trace؛ سپس آزمایش GPU محدود در فاز serving.Swappable provider adapter with budgets/traces, followed by a bounded GPU experiment.
دلیل انتخاب و هزینهاشRationale and trade-off
زود به مسیر قابلآزمایش میرسیم و بعد کنترل ظرفیت را میآموزیم؛ API wrapper را مهندسی inference معرفی نمیکنیم.Reach a testable path sooner, then learn capacity control; an API wrapper is not inference engineering.
فرضهای پشت تصمیمUnderlying assumptions
E09 قیمتهای فرضی؛ E01 پایلوت کمحجم؛ هزینهٔ واقعی provider هنوز استعلام نشده است.E09 hypothetical prices, low pilot volume E01; actual provider prices have not been quoted.
شاهدی که لازم داریمEvidence we need
cost/task موفق و latency؛ در فاز GPU همان workload، model/config/hardware ثابت.Cost per successful task and latency; GPU comparisons use pinned workloads/models/configuration/hardware.
چه وقت تغییرش بدهیم؟When to revisit
نقطهٔ سربهسر هزینه، نیاز دادهٔ خصوصی یا bottleneck مستند میتواند اولویت GPU را تغییر دهد.Cost break-even, private-data requirements, or measured bottlenecks can change GPU priority.
ADR-009چرا مجوز را به مدل واگذار نکنیم؟Why is authorization outside the model?tenant از هویت؛ policy در tool gateway و guard در query/output؛ ACL فعلی حتی برای cache و citation قدیمی.Identity-derived tenant, gateway policy, query/output guards, current ACLs for caches and old citations.پیشنهادیProposed
مسئلهContext
prompt و سند میتوانند اشتباه یا آلوده باشند؛ tenant و policy باید مستقل enforce شوند.Prompts/documents may be wrong or malicious; enforce tenant/policy independently.
گزینههای روی میزAlternatives
محدودیت در prompt؛ filter روی index؛ policy gate همراه با guard مرجع.Prompt restrictions, index filters, or a policy gate backed by authoritative guards.
پیشنهاد فعلیCurrent proposal
tenant از هویت؛ policy در tool gateway و guard در query/output؛ ACL فعلی حتی برای cache و citation قدیمی.Identity-derived tenant, gateway policy, query/output guards, current ACLs for caches and old citations.
دلیل انتخاب و هزینهاشRationale and trade-off
متنِ خروجی مدل authority نیست؛ revocation در run جاری باید انتشار خروجی مبتنی بر context قدیمی را متوقف یا دوباره تولید کند.Model text is not authority; revocation during a run must stop publication based on revoked context or regenerate it.
فرضهای پشت تصمیمUnderlying assumptions
نحوهٔ auth واقعی و data classification هنوز نیازمند تعریف است؛ سناریوهای آزمون مصنوعیاند.Actual authentication and data classification remain to be specified; test scenarios are synthetic.
شاهدی که لازم داریمEvidence we need
prompt injection، cross-tenant ID، revoked context in-flight و backup replay.Injection, cross-tenant identifiers, in-flight revocation, and backup replay.
چه وقت تغییرش بدهیم؟When to revisit
هر ابزار تازه یا دادهٔ حساس تازه، threat model و همین ADR را بازبینی میکند.New tools or sensitive data require reviewing this ADR and threat model.
ADR-010چرا event ID با کلید ترتیب فرق دارد؟Why distinguish event IDs and ordering keys?پیشنهاد context: entity-key، revision و full after-image؛ event_id جدا برای dedup؛ deletion guard پایدار.For context, propose entity keys, revisions/full after-images, separate dedup IDs, and durable deletion guards.پیشنهادیProposed
مسئلهContext
replay، reorder و delete باید بدون resurrect شدن سند کار کنند.Replay, reordering, and deletion must not resurrect documents.
گزینههای روی میزAlternatives
key=event_id؛ key=entity با delta؛ key=entity با full after-image.Event-ID keys, entity-keyed deltas, or entity-keyed full after-images.
پیشنهاد فعلیCurrent proposal
پیشنهاد context: entity-key، revision و full after-image؛ event_id جدا برای dedup؛ deletion guard پایدار.For context, propose entity keys, revisions/full after-images, separate dedup IDs, and durable deletion guards.
دلیل انتخاب و هزینهاشRationale and trade-off
eventهای یک entity ترتیب مرتبط میخواهند؛ full image وابستگی به delta گمشده را کم میکند ولی بایت بیشتری دارد.Entity events need related ordering; full images reduce missing-delta dependencies at higher byte cost.
فرضهای پشت تصمیمUnderlying assumptions
E07 اندازهٔ event فرضی ۲KB است؛ سندهای بزرگ pointer/hash میخواهند و اندازه باید اندازهگیری شود.E07 assumes 2KB/event; large documents need pointers/hashes and size measurements.
شاهدی که لازم داریمEvidence we need
v3 پس از v4 و delete پس از embed؛ repeat/compaction/retention-expired consumer.v3 after v4, deletion during embedding, repeats, compaction, and expired consumers.
چه وقت تغییرش بدهیم؟When to revisit
اگر حجم full image bottleneck شد delta را با gap detection و repair اثباتشده بررسی کن.If full images bottleneck, consider deltas with proven gap detection and repair.
ADR-011چرا انتشار باید از gate ارزیابی بگذرد؟Why gate release promotion on evaluation?manifest ثابت، چند trial، state check و judge کالیبره؛ promotion با CAS و canary.Pinned manifests, repeated trials, state checks/calibrated judges, CAS promotion, and canaries.پیشنهادیProposed
مسئلهContext
prompt جدید میتواند یک خانوادهٔ task را بهتر و خانوادهٔ دیگر را بدتر کند.A new prompt can improve one task family while degrading another.
گزینههای روی میزAlternatives
دموی دستی؛ تنها LLM judge؛ مجموعهٔ ترکیبی و holdout نسخهدار.Manual demos, only an LLM judge, or mixed evaluation on versioned holdouts.
پیشنهاد فعلیCurrent proposal
manifest ثابت، چند trial، state check و judge کالیبره؛ promotion با CAS و canary.Pinned manifests, repeated trials, state checks/calibrated judges, CAS promotion, and canaries.
دلیل انتخاب و هزینهاشRationale and trade-off
نتیجهٔ قابلتکرار از متنِ قشنگ مهمتر است؛ معیار و threshold باید پیش از دیدن نتیجه تعیین شوند.Reproducible outcomes matter more than prose; set criteria/thresholds before seeing results.
فرضهای پشت تصمیمUnderlying assumptions
اندازهٔ dataset و حداقل بهبود هنوز تصمیم نشده؛ ۱۰۰٪ موفقیت روی نمونهٔ کوچک تعمیم ندارد.Dataset size and minimum improvement are undecided; 100% on a small sample does not establish generalization.
شاهدی که لازم داریمEvidence we need
regression عمدی؛ scorer drift؛ leakage؛ هزینهٔ همهٔ attemptها؛ rollback روی canary.Injected regression, scorer drift, leakage, all-attempt costs, and canary rollback.
چه وقت تغییرش بدهیم؟When to revisit
task جدید یا model revision جدید، coverage و threshold را بازبینی میکند.New tasks/model revisions require revisiting coverage and thresholds.
ADR-012Retention و خط قرمزِ حذف را چگونه انتخاب کنیم؟How do we choose retention and deletion limits?E08 هفت روز فقط فرضِ سناریو است؛ تا نیاز outage و سیاست داده معلوم نشود accepted نمیشود.E08 seven days is only a scenario assumption; acceptance needs outage requirements and data policy.پیشنهادیProposed
مسئلهContext
زمان replay طولانیتر، recovery را سادهتر ولی هزینه و ریسک داده را بیشتر میکند.Longer replay simplifies recovery but increases cost and data risk.
گزینههای روی میزAlternatives
یک روز، هفت روز، سی روز؛ backup جدا و retention متناسب با classification.One, seven, or thirty days; separate backups and classification-based retention.
پیشنهاد فعلیCurrent proposal
E08 هفت روز فقط فرضِ سناریو است؛ تا نیاز outage و سیاست داده معلوم نشود accepted نمیشود.E08 seven days is only a scenario assumption; acceptance needs outage requirements and data policy.
دلیل انتخاب و هزینهاشRationale and trade-off
horizon باید outage+recovery را با حاشیه پوشش دهد؛ پاکشدن Kafka tombstone بهتنهایی اثبات حذف و عدم احیا نیست.The horizon should cover outage/recovery with headroom; Kafka tombstone removal alone does not prove deletion/non-resurrection.
فرضهای پشت تصمیمUnderlying assumptions
E07 نرخ/اندازه؛ replica سهتایی فقط سناریوی HA؛ WAL کل دیتابیس جدا اندازهگیری میشود.E07 rate/size; three replicas are an HA scenario; measure whole-database WAL separately.
شاهدی که لازم داریمEvidence we need
replay پس از افق؛ restore backup با deletion guard؛ ثبت هزینه و فضای آزاد.Beyond-horizon replay, guarded backup restores, cost/free-space checks.
چه وقت تغییرش بدهیم؟When to revisit
قانون داده، outage واقعی، نرخ تغییر یا هزینهٔ retention هر کدام تغییر کرد، تصمیم تازه لازم است.Data policy, observed outages, change rates, or retention costs can trigger a new decision.
ADR-013زبان و framework را از کجا انتخاب کنیم؟How do we choose languages and frameworks?انتخابِ پلتفرم هنوز باز است؛ یک slice کوچک را با گزینههای قابلنگهداری مقایسه کنیم. Java در مثالهای درس سابقه دارد، نه الزامِ پلتفرم.Platform implementation choice is open: compare a small slice using maintainable options. Existing Java teaching examples do not mandate the platform language.پیشنهادیProposed
مسئلهContext
پیشنویس Java/Python را نام برده، ولی مهارت تیم، زمان و قرارداد adapter هنوز بررسی نشدهاند.The draft names Java/Python, but team skills, schedule, and adapter contracts have not been assessed.
گزینههای روی میزAlternatives
Python-only؛ Java-only؛ Java API با Python adapter.Python-only, Java-only, or Java API with Python adapters.
پیشنهاد فعلیCurrent proposal
انتخابِ پلتفرم هنوز باز است؛ یک slice کوچک را با گزینههای قابلنگهداری مقایسه کنیم. Java در مثالهای درس سابقه دارد، نه الزامِ پلتفرم.Platform implementation choice is open: compare a small slice using maintainable options. Existing Java teaching examples do not mandate the platform language.
دلیل انتخاب و هزینهاشRationale and trade-off
یک زبان راهاندازی سادهتری دارد؛ دو زبان دسترسی به ecosystem را بهتر ولی deployment و debugging قراردادها را پیچیدهتر میکند.One language simplifies setup; two improve ecosystem access but complicate deployment and contract debugging.
فرضهای پشت تصمیمUnderlying assumptions
مهارت تیم، محدودیت host و هزینهٔ نگهداری هنوز ورودی ندارند.Team skills, host constraints, and maintenance costs are unknown.
شاهدی که لازم داریمEvidence we need
یک endpoint و worker با همان contract؛ زمان توسعه، integration test، پکیج و trace مقایسه شود.Compare endpoint/worker slices under one contract for development effort, integration tests, packaging, and tracing.
چه وقت تغییرش بدهیم؟When to revisit
وقتی نیازِ library یا ظرفیت واقعی انتخاب فعلی را محدود کرد، ADR تازه ثبت شود.Revisit when required libraries or measured capacity constrain the choice.
ADR-014چرا از روز اول Kubernetes و microservice نه؟Why defer Kubernetes and microservices?پیشنهاد: اجرای محلیِ تکرارپذیر با API و worker و DB؛ orchestration پیچیده بعد از نیازِ اثباتشده.Propose repeatable local API/worker/DB deployment; add orchestration after demonstrated need.پیشنهادیProposed
مسئلهContext
مرز منطقیِ ماژول با مرز deployment یکی نیست؛ نسخهٔ اول هنوز workload و HA مصوب ندارد.Logical modules are not deployment boundaries; initial workload/HA requirements remain provisional.
گزینههای روی میزAlternatives
یک codebase با API/worker جدا؛ چند microservice؛ Kubernetes از ابتدا.One codebase with API/workers, multiple microservices, or Kubernetes immediately.
پیشنهاد فعلیCurrent proposal
پیشنهاد: اجرای محلیِ تکرارپذیر با API و worker و DB؛ orchestration پیچیده بعد از نیازِ اثباتشده.Propose repeatable local API/worker/DB deployment; add orchestration after demonstrated need.
دلیل انتخاب و هزینهاشRationale and trade-off
عملیات کمتر برای یادگیری؛ در مقابل isolation و scaling مستقل محدودتر است و در ADR مقیاس دوباره بررسی میشود.Fewer operations to learn initially, at the cost of less isolation and independent scaling; revisit under scale requirements.
فرضهای پشت تصمیمUnderlying assumptions
E01 پایلوت و E10 stress؛ تیمِ عملیات و cloud budget هنوز تعریف نشدهاند.E01 pilot/E10 stress; operations team and cloud budget are undefined.
شاهدی که لازم داریمEvidence we need
اجرای تازه از README، crash یک worker، load و drain؛ bottleneck هر پردازش جدا دیده شود.Fresh README-driven startup, worker crashes, load, draining, and per-process bottleneck visibility.
چه وقت تغییرش بدهیم؟When to revisit
HA واقعی، noisy neighbor، scaling مستقل یا نیاز استقرار تیمها میتواند deployment جدا را توجیه کند.Real HA, noisy neighbors, independent scaling, or team deployment needs can justify separation.
ADR-015Durability، RPO و failover چه تعهدی دارند؟What do durability, RPO, and failover promise?هدفهای منتخبِ طراحی پایلوت: worker با RPO=0 و RTO≤۲min؛ دیسک/DB با RPO≤۵min و RTO≤۳۰min؛ ناحیه با RPO≤۱۵min و RTO≤۴h؛ index مشتقشده با منبع سالم، RTO≤۴h. همه هدفاند، نه نتیجهٔ آزمون.Selected pilot design targets: worker RPO0/RTO≤2min; disk/database RPO≤5min/RTO≤30min; region RPO≤15min/RTO≤4h; derived-index rebuild with intact source RTO≤4h. These are objectives, not measured results.پیشنهادیProposed
مسئلهContext
از دست نرفتن run پس از crash فرایند با از دست نرفتن write در خرابی ناحیه یکی نیست.Surviving process crashes differs from preserving writes after region failure.
گزینههای روی میزAlternatives
backup روزانهٔ تنها؛ backup+WAL مستقل؛ warm standby ناهمزمان؛ replication همزمان با writer fencing. گزینهٔ pilot، backup+WAL و بازیابی سرد ناحیه است.Daily backup alone; independent backup plus WAL; asynchronous warm standby; synchronous replication with writer fencing. The pilot selects backup plus WAL and cold regional recovery.
پیشنهاد فعلیCurrent proposal
هدفهای منتخبِ طراحی پایلوت: worker با RPO=0 و RTO≤۲min؛ دیسک/DB با RPO≤۵min و RTO≤۳۰min؛ ناحیه با RPO≤۱۵min و RTO≤۴h؛ index مشتقشده با منبع سالم، RTO≤۴h. همه هدفاند، نه نتیجهٔ آزمون.Selected pilot design targets: worker RPO0/RTO≤2min; disk/database RPO≤5min/RTO≤30min; region RPO≤15min/RTO≤4h; derived-index rebuild with intact source RTO≤4h. These are objectives, not measured results.
دلیل انتخاب و هزینهاشRationale and trade-off
دادهٔ پایلوت مصنوعی و ابزارها خواندنیاند. زمانهای R01–R04 از بودجهٔ تشخیص/restore/replay/اعتبارسنجی میآیند؛ پیش از دادهٔ واقعی، تحمل loss و هزینهٔ standby بازنگری شود.Pilot data is synthetic and tools are read-only. R01–R04 allocate detection, restore, replay, and validation time; revisit loss tolerance and standby cost before real data.
فرضهای پشت تصمیمUnderlying assumptions
R01–R04 در recovery.json؛ ۱۰GB دادهٔ مرجع برای restore، ۵۰MB/s انتقال و دسترسی مستقل بازیابی. RF=3 در E08 فقط سناریوی ظرفیت log است.R01–R04 in recovery.json; 10GB restore size, 50MB/s transfer, and independent recovery access. E08’s RF3 remains a log-capacity scenario only.
شاهدی که لازم داریمEvidence we need
drillهای مستقل worker، دیسک، ناحیه و reindex با canary دارای journal اجرا شوند؛ ساعت RTO از آغاز خرابی است. policy/ACL و blobها هم باید صحیح باشند؛ تا آن زمان نتیجه planned است.Run separate journaled canary drills for worker, disk, region, and reindex failures; start the RTO clock at failure onset. Policy/ACLs and blobs must also be correct; results remain planned until then.
چه وقت تغییرش بدهیم؟When to revisit
ورود دادهٔ واقعی، ابزار دارای اثر، DB بزرگتر از ۱۰GB، archive gap خارج بودجه یا دو شکست drill؛ هدف/زیرساخت/هزینه را دوباره انتخاب کن.Revisit for real data, side-effecting tools, databases above 10GB, excessive archive gaps, or two failed drills; reassess objectives, infrastructure, and cost.
قرارداد کامل SLO و روش سنجشThe complete SLO contract and measurement method
مثال ADR-003: صورتِ کسر، درخواست موفق با اولین token مفید در حداکثر ۳ ثانیه؛ مخرج، همهٔ درخواستهای تعاملی واجد شرایط، شامل deadline و خطای provider؛ پنجره ۷ روز؛ هدف پیشنهادی ۹۵٪؛ بارِ آزمون E03 و E10. admission و پایانِ agent معیارهای جدا میخواهند. پیامِ loading، token مفید نیست.ADR-003: numerator = successful useful-first-token responses within 3 seconds; denominator = all eligible interactive requests, including deadlines/provider errors; window = 7 days; proposed target = 95%; test workload = E03 and E10. Admission and completion require separate metrics. Loading messages do not count as useful tokens.
جمعِ بودجهها، p95 سرتاسری را اثبات نمیکند. اگر احتمال عبور هر یک از پنج جزء از بودجهاش حداکثر ۱٪ باشد، union bound عبور هر جزء را حداکثر ۵٪ کران میدهد؛ این شرایط باید در همان بار اندازهگیری شوند. خطاها نیز از همان بودجهٔ ۵٪ مصرف میکنند؛ پس این کرانِ latency اثباتِ SLO نیست.Adding allocations does not prove end-to-end p95. If each of five components exceeds its allocation with probability at most 1%, a union bound limits any violation to 5%; these conditions need same-workload measurements. Errors consume that same 5% budget, so this latency bound does not prove the SLO.
هر بلوک باید پاسخی به یک نیاز باشد. این مسیرِ دوازدهگامی، طرح پیشنهادی را توضیح میدهد؛ درخواست واقعی به مدل، پایگاه داده یا ابزار نمیفرستد.Every component must answer a need. This twelve-step path explains the proposed design; it sends no real requests to a model, database, or tool.
پخش با انتخاب تو شروع میشود. نشانِ متحرک محل گام را توضیح میدهد؛ زمان حرکت، تأخیر واقعی نیست. در حالت کاهش حرکت، گامها ثابت عوض میشوند.Playback starts on request. The marker explains the current step; travel time is not actual latency. Reduced-motion mode uses static step changes.
05اگر سیستم خراب شد، چه قولی میدهیم؟What happens when the system fails?
RPO میگوید حداکثر چه مقدار از آخرین دادهها را میتوانیم از دست بدهیم. RTO میگوید حداکثر چه مدت تا بازگشتِ سرویسِ درست فرصت داریم. اینها دو قرارداد جدا هستند و برای هر نوع خرابی جدا انتخاب میشوند.RPO bounds acceptable recent data loss. RTO bounds time until correct service is restored. They are separate objectives selected for each failure scenario.
RPO · Recovery Point Objective
مثال: RPO پنج دقیقه یعنی نقطهٔ بازیابیِ پیوسته حداکثر پنج دقیقه عقب باشد؛ backup روزانه بهتنهایی کافی نیست.A five-minute RPO requires a contiguous recoverable point no more than five minutes behind; a daily backup alone is insufficient.
RTO · Recovery Time Objective
ساعت از آغاز اختلال شروع میشود، نه از وقتی تیم آن را اعلام کرد. پایان، موفقشدن canary سرتاسری با داده و مجوز درست است، نه صرفاً روشنشدن DB.Start the clock at failure onset, not incident declaration. Finish when an end-to-end canary succeeds with correct data and permissions, not merely when the database boots.
هدفهای منتخبِ طراحی پایلوت — هنوز اندازهگیری یا پیادهسازی نشدهاند. این جدول SLA میزبانی سایت نیست.Selected pilot design objectives — not implemented or measured. This is not the study site host’s SLA.
سناریو
سقف RPO
سقف RTO
مرزِ ادعا
R01 · crash یک worker
0
2 min
run و step تأییدشده؛ DB و دیسک سالماند.
R02 · ازدسترفتن DB یا دیسک
5 min
30 min
پایلوت با حداکثر ۱۰GB دادهٔ مرجع؛ restore از محل مستقل.
R03 · خرابی کامل ناحیه
15 min
4 h
پایلوت آموزشی؛ بازیابی سرد در ناحیهٔ دیگر، بدون تعهد مالی یا ابزارِ اثرگذار.
R04 · خرابی index مشتقشده
0
4 h
فقط لایهٔ retrieval؛ منبع مرجع و guard حذف/ACL سالماند؛ سناریوی یک میلیون سند E04.
Scenario
RPO limit
RTO limit
Scope
R01 · Worker process crash
0
2 min
Acknowledged run/step state; database and disk survive.
R02 · Database or disk loss
5 min
30 min
Pilot with at most 10GB of authoritative data; restore from independent storage.
R03 · Whole-region loss
15 min
4 h
Teaching pilot; cold recovery in another region, without financial commitments or side-effecting tools.
R04 · Derived-index corruption
0
4 h
Retrieval layer only; authoritative data and deletion/ACL guards survive; E04’s million-document scenario.
R01crash یک workerWorker process crash
چرا این هدف را انتخاب کردیم؟Why choose this target?
پایلوت ابزار خواندنی دارد؛ ادامهٔ اجرا نباید از ابتدا run تازه بسازد. دو دقیقه زمانِ قابلآزمون برای تشخیص و claim مجدد است.The pilot uses read-only tools; recovery must resume the same run. Two minutes is a testable detection/reclaim budget.
بودجهٔ بازیابیRecovery budget
تشخیص ۱۵ + lease حداکثر ۳۰ + claim تا ۱۵ + replay تا ۳۰ + آزمون نتیجه تا ۳۰ = ۱۲۰ ثانیه.Detect 15 + lease up to 30 + claim 15 + replay 30 + validation 30 = 120 seconds.
چه چیزی باید برقرار باشد؟Required conditions
commit پایدار با fsync و synchronous_commit روشن، دیسک سالم، epoch/CAS برای رد مالک قدیمی، ثبت نتیجهٔ step و idempotency.Durable commits with fsync/synchronous_commit enabled, intact disk, epoch/CAS fencing, recorded step results, and idempotency.
چطور آن را اثبات کنیم؟How to demonstrate it
پس از commit پاسخدادهشده worker را kill کن؛ همان run_id ادامه یابد، همهٔ commitهای تأییدشده باقی بمانند و canary سرتاسری تا ۱۲۰s موفق شود.Kill a worker after an acknowledged commit; retain the same run ID and all acknowledged state, and pass an end-to-end canary within 120s.
R02ازدسترفتن DB یا دیسکDatabase or disk loss
چرا این هدف را انتخاب کردیم؟Why choose this target?
برای دادهٔ مصنوعیِ قابلبازتولید، ازدسترفتن حداکثر پنج دقیقه را موقتاً میپذیریم؛ backup روزانه بهتنهایی این هدف را برآورده نمیکند.For reproducible synthetic pilot data, provisionally accept up to five minutes of loss; daily backups alone cannot meet this target.
بودجهٔ بازیابیRecovery budget
تشخیص ۳ + جداسازی/تأمین ۵ + دریافت backup تا ۶ + replay تا ۶ + اعتبارسنجی ۵ + بازگشایی ۵ = ۳۰ دقیقه. انتقال ۱۰GB با ۵۰MB/s تقریباً ۲۰۰s از این بودجه است.Detect 3 + isolate/provision 5 + restore download 6 + replay 6 + validate 5 + reopen 5 = 30 minutes. Transferring 10GB at 50MB/s uses about 200s of this budget.
چه چیزی باید برقرار باشد؟Required conditions
base backup روزانه + WAL پیوستهٔ قابلبازیابی در storage مستقل؛ آخرین نقطهٔ پیوستهٔ بازیابی هر دقیقه بررسی شود و gap از ۳۰۰s نگذرد. archive_timeout بهتنهایی تضمین نیست.Daily base backup plus recoverable continuous WAL in independent storage; verify the contiguous recovery point every minute and keep its gap within 300s. archive_timeout alone is not a guarantee.
چطور آن را اثبات کنیم؟How to demonstrate it
DB آزمایشی را از دیسک خالی برگردان؛ آخرین canary قابلبازیابی با journal مقایسه شود؛ policy، blob و حذفها پیش از پاسخگویی تطبیق داده شوند.Restore a disposable database onto an empty disk; compare the recovered canary with the journal and reconcile policy, blobs, and deletions before serving.
R03خرابی کامل ناحیهWhole-region loss
چرا این هدف را انتخاب کردیم؟Why choose this target?
warm standby دائمی را برای پایلوت توجیه نکردهایم. چهار ساعت outage و پانزده دقیقه دادهٔ مصنوعی، فرضِ تحمل کسبوکار است و قبل از دادهٔ واقعی باید بازنگری شود.A permanent warm standby is not yet justified. Four hours of downtime and fifteen minutes of synthetic data are explicit tolerance assumptions to revisit before real workloads.
نسخهٔ مستقلِ cross-region از backup و WAL و manifest artifact؛ gap پیوستهٔ بازیابی ≤۹۰۰s؛ کلید و IaC خارج ناحیهٔ خراب؛ IAM معتبر و fencing writer قدیمی.Independent cross-region backups/WAL and artifact manifests with a contiguous recovery gap ≤900s; keys and IaC outside the failed region, current IAM, and old-writer fencing.
چطور آن را اثبات کنیم؟How to demonstrate it
دسترسی ناحیهٔ اولیه را قطع و با دسترسی بازیابی جدا restore کن؛ اگر policy فعلی یا fence قابلاثبات نیست، fail closed بمان و RTO را ناموفق ثبت کن.Isolate the primary region and restore using separate recovery access. If current policy or fencing cannot be proven, fail closed and record the RTO miss.
R04خرابی index مشتقشدهDerived-index corruption
چرا این هدف را انتخاب کردیم؟Why choose this target?
index را از منبع بازمیسازیم؛ RPO صفر برای منبع است، نه تضمینِ تازگیِ view. سایر سرویسها ممکن است زودتر سالم باشند.Rebuild the index from its source. Zero RPO refers to source data, not view freshness; other services may recover sooner.
بودجهٔ بازیابیRecovery budget
seed≈۲٫۷۷۸h + catch-up≈۰٫۵۵۶h + اعتبارسنجی ۰٫۵h ≈۳٫۸۳۴h؛ در هدف ۴h حدود ۱۰ دقیقه حاشیه میماند.Seed≈2.778h + catch-up≈0.556h + validation 0.5h ≈3.834h; a 4h target leaves roughly 10 minutes of headroom.
چه چیزی باید برقرار باشد؟Required conditions
همان E04–E07: seed=۱۰۰ سند/s، ورود ۵ تغییر/s و replay=۳۰ تغییر/s؛ snapshot ثابت، WAL کافی و publish اتمی نسل معتبر.E04–E07: seed 100 docs/s, arrivals 5 changes/s, replay 30 changes/s; stable snapshot, sufficient WAL, and atomic publication of a validated generation.
چطور آن را اثبات کنیم؟How to demonstrate it
index را در آزمایشگاه دور بینداز؛ نسل تازه باید checksum، deletion و ACL فعلی را بگذراند. افزایش بار یا μ≤λ یعنی ازدسترفتن این هدف.Discard the test index and rebuild; require checksum, deletion, and current ACL checks. Higher load or μ≤λ invalidates this target.
ثبت نتیجهٔ drill، قبل از هر ادعای پایداریRecord the drill before claiming resilience
یک canary شمارهدار را پیش از خرابی در journal مستقل ثبت میکنیم. آخرین نقطهٔ پیوستهٔ قابلبازیابی، دادهٔ ازدسترفته و زمان بازگشتِ canary را مقایسه میکنیم. snapshot و WAL باید با artifactها، guard حذف و policy فعلی سازگار باشند.Record sequenced canaries in an independent journal before failure. Compare the last contiguous recovery point, missing data, and time to a successful recovered canary. Snapshots/WAL must agree with artifacts, deletion guards, and current policy.
در restore، ACL قدیمی مجوزِ فعلی نیست. اگر IAM معتبر، حذفها یا fencing قابلاثبات نباشند، دسترسی حساس بسته میماند و RTO ناموفق ثبت میشود. «replica داریم» یا «archive_timeout را تنظیم کردیم» بهتنهایی مدرکِ این هدفها نیست.An old restored ACL is not current authority. If IAM, deletions, or fencing cannot be validated, sensitive access stays closed and the RTO is a miss. Replicas or archive_timeout settings alone do not establish these objectives.
برای خودِ وبسایتِ فعلی: RPO نسبت به آخرین commit تأییدشده در GitHub صفر است؛ تغییرهای محلیِ pushنشده خارج این ادعا هستند. هدفِ redeploy دستی، ۳۰ دقیقه است و هنوز drill نشده؛ تضمین Vercel یا GitHub نیست.For the current website: RPO is zero relative to the last verified GitHub commit, excluding unpushed local changes. The manual-redeploy objective is 30 minutes, not yet drilled and not a Vercel/GitHub guarantee.
پیشنویس معماری و جزئیات — برای مراجعه، نه تصمیم نهاییDraft architecture and details — reference, not final decisions
این بخش طرح اولیهٔ قبلی است. عددها و ابزارها فرض یا پیشنهادند؛ ابتدا کارگاه، دفتر تخمین و ADRها را بخوانیم. انتخاب همهٔ گزینهها تأیید نشده است.This is the earlier initial proposal. Numbers and tools are assumptions/candidates; begin with the workshop, estimates, and ADRs. These choices have not all been accepted.
محصولی که قرار است ساخته شودThe platform to build
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-001
یک پلتفرم چندمستاجری برای ثبت برنامههای AI، اجرای پایدار agent، بازیابی context مجاز و تازه، ارزیابی نسخهها و مدیریت inference. اولین برنامهٔ واقعیِ روی آن، بررسی رخدادهای سیستم است؛ یک برنامهٔ پاسخگویی مستند هم باید با همان API و بدون تغییر هسته ثبت شود.A multi-tenant platform for registering AI applications, durable agent execution, fresh authorized context, release evaluation, and inference management. Incident investigation is its first application; a cited-answer application must use the same APIs without changing the core.
وضعیت فعلی: این ضمیمه یک پیشنویس معماری و مسیر احتمالی پیادهسازی است؛ تصمیمهای فنی هنوز نهایی نشدهاند. سرویسهای پلتفرم هنوز پیادهسازی نشدهاند؛ عددهای این صفحه هدف یا فرضِ آزمایشاند. نمودارها طراحی پیشنهادی را نشان میدهند.Current status: this appendix is an initial architecture proposal and possible implementation track; technical decisions remain provisional. The platform services have not been implemented; numbers below are experimental targets or assumptions. Diagrams represent the proposed architecture.
کاربر اصلی: توسعهدهندهای که برنامهٔ AI خود را ثبت و اجرا میکند (ADR-001). مهندس on-call کاربرِ برنامهٔ نمونهٔ Investigator است.Primary user: a developer registering and operating an AI application (ADR-001). On-call engineers use the sample Investigator application.
خروجی هر بررسی: timeline، فرضیههای رتبهبندیشده، شواهد موافق و مخالف، محدودهٔ عدمقطعیت و پیشنهاد اقدام. «شواهد کافی نیست» خروجی معتبر است.Each investigation returns a timeline, ranked hypotheses, supporting and contradicting evidence, uncertainty, and a proposed next action. Insufficient evidence is a valid result.
نسخهٔ اول ابزارهای خواندنی دارد. اجرای اقدامِ دارای اثر، پس از افزودن قرارداد idempotency، مجوز و تأیید منقضیشونده وارد مسیر میشود.The initial application uses read-only tools. Side-effecting actions enter the track only after idempotency, authorization, and expiring approvals exist.
دموی اصلی و پنج قابلیتThe demonstration and five capabilities
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-002
آزمایشگاه آموزشی شامل سرویس API، worker و PostgreSQL است. با تزریقِ اشباع connection pool، پاسخها کند میشوند. alert با یک کلیدِ ثابت پذیرفته میشود؛ پلتفرم deployment اخیر، metricها، traceها و runbook را میخواند، فرضیهها را بررسی میکند و گزارش قابلبازبینی میدهد. سناریوها مصنوعی و دارای ground truth هستند.The teaching lab contains an API service, a worker, and PostgreSQL. Injected connection-pool exhaustion slows responses. An alert is accepted under a stable key; the platform reads deployment history, metrics, traces, and a runbook, tests hypotheses, and produces an inspectable report. Scenarios are synthetic with known ground truth.
قابلیت
مسئولیت و مرز
مدرک اتمام
Live Context
سند و metadata نسخهدار، مجوز و index؛ telemetry خام با ابزار query خوانده میشود.
تغییر، حذف و لغو دسترسی در تست freshness و replay.
Durable Runtime
وضعیت run و step، retry، انتظار، cancellation و مالکیت worker.
kill و resume همراه با ردِ worker قدیمی.
AI Investigator
برنامهٔ کاربردی؛ فرضیهسازی و بررسی با ابزارهای محدود.
علتیابی روی سناریوهای نگهداشتهشده و گزارش مستند.
Evaluation & Release
dataset، trial، scorer و ارتقای نسخهٔ ثابتشده.
ردِ regression و canary/rollback قابلتکرار.
Gateway & Serving
بودجه، route، deadline و provider؛ سپس inference محلی.
پایش هزینه و latency؛ benchmark روی GPU در فاز serving.
Capability
Responsibility and boundary
Completion evidence
Live Context
Versioned documents, metadata, permissions, and indexes; raw telemetry is queried through tools.
Freshness and replay tests for update, delete, and access revocation.
Durable Runtime
Run/step state, retries, waits, cancellation, and worker ownership.
Kill/resume with stale-worker rejection.
AI Investigator
Application layer: hypothesis generation and bounded tool investigation.
Diagnosis on held-out incidents and evidence-backed reports.
Evaluation & Release
Datasets, trials, scoring, and pinned-release promotion.
Reproducible regression rejection and canary/rollback.
Gateway & Serving
Budgets, routing, deadlines, provider adapters, then local inference.
Cost/latency accounting; GPU benchmarks in the serving phase.
معماری پلتفرم و مرز مالکیتPlatform architecture and ownership
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-002
از Operator به Control API برو: هویت و tenant در همین ورودی تعیین میشود. Control API وضعیت را در Record Store ثبت و اجرای run را به Runtime میدهد. Runtime برای مدل از Model Gateway و برای داده از Tool Gateway عبور میکند. Tool Gateway دسترسی فعلی را پیش از query در Live Context یا telemetry کنترل میکند. Eval/Release تنها نسخهٔ پذیرفتهشده را در Control API فعال میکند. این شکل ارتباط منطقی را نشان میدهد؛ SQLهای worker و جزئیات HA در قراردادهای بعدی آمدهاند.Follow Operator → Control API: identity and tenant are established at entry. Control API persists state in Record Store and dispatches the run to Runtime. Runtime reaches inference through Model Gateway and data through Tool Gateway. Tool Gateway checks current permissions before querying context or telemetry. Eval/Release activates only accepted versions in Control API. This is a logical overview; worker SQL and HA details appear in later contracts.
خودآزماییSelf-check
اگر کلید provider در worker agent قرار بگیرد چه مرزی از بین میرود؟ جداسازی ابزار و credential از خروجی مدل؛ credential باید در gateway نگهداری شود.Which boundary fails if provider credentials live in the agent worker? The separation between model-directed execution and credentials; the gateway must retain them.
Control plane مالک tenant، تعریف برنامه، policy، manifest نسخه و pointer نسخهٔ فعال است. Data plane اجرای run، query داده و inference را انجام میدهد. اولین استقرار یک API و چند worker در یک codebase است؛ مرز منطقی بهتنهایی دلیلِ ساخت microservice مستقل نیست. نامهای فنی و کنترلهای نمودار انگلیسیاند؛ روایت هر شکل فارسی و انگلیسی است. برای خواندن جزئیات، لینک باز کردن نمودار و zoom را استفاده کن.The control plane owns tenants, application definitions, policies, release manifests, and active-version pointers. The data plane executes runs, queries data, and performs inference. The initial deployment uses one API and several workers in one codebase; logical boundaries alone do not require separate microservices. Diagram labels and viewer controls use English; walkthroughs are bilingual. Open each diagram and use zoom to inspect details.
انتخاب ابزار و ساختار پیادهسازیImplementation choices and structure
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-013
لایه
انتخاب اولیه
چرایی و شرط تغییر
هستهٔ پلتفرم
Java؛ API و worker با ماژولهای جدا؛ PostgreSQL مرجع.
هماهنگ با مسیر آموزشیِ Java؛ برای قراردادهای پایدار و تراکنشها.
AI و ارزیابی
Python برای adapterهای AI و runner ارزیابی؛ قرارداد HTTP نسخهدار.
اکوسیستم ML را یاد میگیریم؛ SQL و ownership همچنان در هسته تعریف میشوند.
Context
PostgreSQL full-text + pgvector؛ object store برای artifactهای بزرگ.
نسخهٔ کوچک با قطعات کمتر؛ search engine جدا فقط با benchmark توجیه میشود.
CDC و event log
Debezium + Kafka در فاز context زنده؛ connectorها نسخه و تنظیمات ثابت دارند.
جریان تغییرِ منابع تحت مالکیت؛ مدل delivery و retention صریح است.
Runtime
ابتدا یک state machine محدود با DB queue و lease؛ durable workflow engine در مسیر توسعه ارزیابی شود.
موتور عمومی از صفر نمیسازیم؛ retry و انتظارِ دامنه را اثبات میکنیم.
Observability
OpenTelemetry، Prometheus و Grafana؛ collectorها دادهٔ مصنوعی آزمایشگاه را میگیرند.
trace برای خود پلتفرم و دادهٔ قابلبررسی برای Investigator.
Serving
ابتدا provider adapter؛ سپس model server آماده مثل vLLM روی GPU.
gateway روی API، اثباتِ مهندسی GPU محسوب نمیشود؛ فاز GPU benchmark جدا دارد.
Layer
Initial choice
Reason and upgrade condition
Platform core
Java API and worker with separate modules; PostgreSQL as record store.
Matches the Java teaching track and supports durable contracts and transactions.
AI and evaluation
Python AI adapters and evaluation runner; versioned HTTP contracts.
Builds ML ecosystem skills; SQL and ownership remain defined in the core.
Context
PostgreSQL full-text + pgvector; object storage for large artifacts.
Fewer moving parts initially; a separate search engine needs benchmark evidence.
CDC and event log
Debezium and Kafka in the live-context phase, with pinned versions and settings.
Captures owned-source changes with explicit delivery and retention semantics.
Runtime
Start with a bounded state machine, DB queue, and leases; evaluate a durable workflow engine as scope expands.
Do not rebuild a general workflow engine; prove domain retries and waits.
Observability
OpenTelemetry, Prometheus, and Grafana collect synthetic lab telemetry.
Trace the platform itself and provide inspectable investigator evidence.
Serving
Provider adapter first; an existing model server such as vLLM on GPU later.
An API gateway does not demonstrate GPU engineering; the GPU phase has separate benchmarks.
ساختار پیشنهادی مخزنِ آینده: platform-api/، runtime-worker/، context-pipeline/، ai-adapters/، evals/، incident-lab/، infra/ و docs/adr/. این نامها طرح سازماندهیاند؛ این صفحه مخزنِ اجرایی پلتفرم را ایجاد نمیکند.Proposed future repository: platform-api/, runtime-worker/, context-pipeline/, ai-adapters/, evals/, incident-lab/, infra/, and docs/adr/. These are organizational plans, not an implemented platform repository.
نیازمندیها، SLO و ناورداییهاRequirements, SLOs, and invariants
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-003
معیار
هدف اولیهٔ آموزشی
تعریف اندازهگیری
پذیرش run
بودجهٔ پیشنهادی admission: ۳۰۰ms از E11؛ بار بر اساس سناریوی E01/E10 تعیین شود.
از ورود HTTP تا commit run؛ پاسخ LLM داخل این latency نیست.
تازگی context
نیازمند تصمیم: مثال قبلیِ ۵ ثانیه هنوز نیاز کاربر نیست؛ polling و CDC طبق ADR-006 مقایسه شوند.
از commit منبع تا query-visible شدن نسلِ فعال؛ backlog هم جدا ثبت شود.
پایداری run
هیچ run تأییدشدهای پس از crash فرایند گم نشود.
restart با همان DB پایدار؛ خرابی دیسک/ناحیه نیازمند سیاست replication و backup است.
کیفیت
ابتدا baseline؛ سپس بهبود روی holdout با گزارش تعداد نمونه و نوسان.
تستِ منفی برای query، citation، cache، trace و blob؛ این تست ادعای امنیت مطلق نیست.
Metric
Initial experimental target
Measurement
Run admission
Proposed admission budget: 300ms from E11; define load using E01/E10.
HTTP arrival to run commit, excluding LLM completion.
Context freshness
Undecided: the earlier five-second example is not a confirmed user need; compare polling and CDC under ADR-006.
Source commit to query visibility in the active generation; record backlog separately.
Run durability
No acknowledged run lost after process crash.
Restart against durable DB storage; disk/region loss needs separate replication and backup policies.
Quality
Establish baseline, then improve on a holdout with sample count and variation reported.
Diagnosis, evidence, abstention, and cost; model confidence is not a calibrated probability.
Access control
Zero cross-tenant disclosures in the test suite.
Negative tests for queries, citations, caches, traces, and blobs; not a proof of absolute security.
I1: هر کلیدِ idempotency در محدودهٔ tenant و برنامه فقط یک run منطقی میسازد؛ payload متفاوت با همان کلید conflict میدهد.I1: An idempotency key scoped to tenant and application creates one logical run; a different payload under that key conflicts.
I2: هر commit وضعیت، epoch مالک فعلی و revision مورد انتظار را بهشکل اتمی بررسی میکند.I2: Every state commit atomically checks current owner epoch and expected revision.
I3: نسخهٔ قدیمیِ سند نمیتواند نسخهٔ جدید یا نشان حذف را overwrite کند.I3: An old document revision cannot overwrite a newer revision or deletion marker.
I4: گزارش تنها به شواهد مجازِ همان tenant اشاره میکند؛ سیاست در زمان query و پیش از انتشار دوباره بررسی میشود.I4: Reports cite authorized evidence from their tenant; policy is checked at query time and again before publication.
I5: ارتقای release فقط از manifest ثابت و ارزیابیِ قبولشده انجام میشود.I5: Release promotion requires a pinned manifest and passing evaluation.
I6: deadline، تعداد step و بودجهٔ token سقف دارند؛ worker و مدل حق افزایشِ خودسرانهٔ آنها را ندارند.I6: Deadlines, step counts, and token budgets are bounded; workers and models cannot raise them.
مدل داده و UML رابطههاData model and UML relationships
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-004
UML / ER: tenant، برنامه، run و شواهدUML / ER: tenants, applications, runs, and evidenceباز کردن نمودارOpen diagram
روایت مدرسTeacher walkthrough
از Tenant شروع کن: کلیدِ tenant در رابطههای برنامه، سند و اجرا حمل میشود. Application تعریف قابلاستفادهمجدد است؛ هر Run یک manifest ثابت دارد. Run چند Step و Step چند ToolCall میتواند داشته باشد. DocumentRevision منبعِ نسخهدار Evidence است. همان کلیدهای ترکیبی که در شکل دیده میشوند باید در foreign keyها هم enforce شوند، تا FK صحیح با tenant اشتباه ساخته نشود.Start with Tenant: its key flows through applications, documents, and runs. Application is reusable; each Run pins a release manifest. A Run owns multiple Steps and each Step can own multiple ToolCalls. DocumentRevision is a versioned source for Evidence. Composite keys shown in the diagram must also be enforced in foreign keys to prevent cross-tenant references.
خودآزماییSelf-check
آیا داشتن tenant_id در JSON کافی است؟ خیر؛ کلید ترکیبی، شرط query، policy و تستِ منفی هم لازم است.Is tenant_id in JSON sufficient? No: composite keys, query predicates, policy checks, and negative tests are also required.
Envelope رویداد: event_id, tenant_id, source_id, source_epoch, entity_key, revision, operation, schema_version, occurred_at, source_cursor, trace_id, payload. کلید entity نسخه را مرتب میکند؛ event_id تکرار را میشناسد؛ source_cursor با Kafka offset و ساعت دیوار یکی نیست.Event envelope: event_id, tenant_id, source_id, source_epoch, entity_key, revision, operation, schema_version, occurred_at, source_cursor, trace_id, payload. Entity keys support ordering, event IDs identify duplicates, and source cursors differ from Kafka offsets and wall clocks.
UML اجزا: برنامه روی قراردادهای پلتفرمComponent UML: applications depend on platform contractsباز کردن نمودارOpen diagram
روایت مدرسTeacher walkthrough
Investigator یک AIApplication است و از RuntimePort استفاده میکند. Runtime، ModelPort و ToolPort را صدا میزند؛ ContextPort پشت ToolPort قرار دارد. EvalRunner از همان قرارداد برنامه برای trial استفاده میکند. پیکانهای dependency میگویند مصرفکننده به قرارداد وابسته است؛ provider adapter و model server را بدون تغییر برنامه میتوان عوض کرد.Investigator implements an AIApplication and uses RuntimePort. Runtime calls ModelPort and ToolPort; ContextPort sits behind ToolPort. EvalRunner uses the same application contract for trials. Dependency arrows point to contracts; provider adapters and model servers can change without rewriting the application.
خودآزماییSelf-check
برنامهٔ دوم چه چیزی را reuse میکند؟ Runtime، context مجاز، gateway و eval؛ فقط تعریف ابزار، منطق برنامه و dataset عوض میشود.What does a second application reuse? Runtime, authorized context, gateway, and evaluation; application logic, tool definitions, and datasets change.
CDC، ترتیب و اثرِ تکرارCDC, ordering, and duplicate effects
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-010
Source و Outbox در یک تراکنش هستند. CDC تغییر commitشده را به Event Topic میبرد؛ هر entity_key به یک پارتیشن پایدار میرود. Projector هم revision را مقایسه میکند و هم ownership خودش را. Index فقط نسلِ فعال را سرو میکند. دادهٔ telemetry از مسیر OTLP وارد ابزارهای query میشود؛ تبدیل همهٔ logها به embedding شرط این طراحی نیست.Source and Outbox commit together. CDC publishes committed changes to Event Topic; an entity key maps to a stable partition. Projector checks both revision and its own ownership. Index serves the active generation. Telemetry reaches query tools through OTLP; embedding every raw log is not required.
خودآزماییSelf-check
اگر key=event_id باشد، v2 و v3 یک سند چه میشوند؟ ممکن است به دو پارتیشن بروند؛ برای ترتیب، key باید entity_key باشد و event_id در envelope بماند.If key=event_id, what happens to document revisions v2 and v3? They may land in different partitions; use entity_key for ordering and retain event_id in the envelope.
API تغییرِ سند و outbox را با هم commit میکند. CDC رویداد را میخواند و بعد از ack پایدارِ broker میتواند checkpoint را جلو ببرد. اگر بعد از publish و قبل از checkpoint قطع شود، رویداد تکرار میشود. Projector اول اثرِ نسخهدار را پایدار میکند و بعد offset را ثبت میکند. crash بین این دو مجاز است چون replay همان اثر را بازتولید میکند.The API commits the document change with its outbox row. CDC reads the event and advances progress only after a durable broker acknowledgement. A crash after publishing but before checkpointing can duplicate it. Projector durably applies the versioned effect before committing the offset. A crash between them is tolerated because replay reproduces the same effect.
خودآزماییSelf-check
آیا ack بروکر یعنی index بهروز است؟ خیر؛ freshness را تا query-visible شدن sink اندازه میگیریم.Does broker acknowledgement mean the index is current? No; measure freshness through query-visible sink state.
تاپیک رویداد append-only و دارای retention محدود است؛ key=tenant+source+entity و event_id برای dedup است. تاپیک state فشردهشونده همان key را دارد ولی value آخرین state است. دفترچهٔ outbox پاکشده seed کامل نیست.The append-only event topic has bounded retention, key=tenant+source+entity, and event IDs for deduplication. A compacted state topic uses the same key with latest-state values. A purged outbox is not a complete seed.
full after-image برای context انتخاب میشود تا replay مستقل باشد. اگر delta استفاده شود، gap در revision باید متوقف یا با snapshot مرجع ترمیم شود؛ پرش به نسخهٔ بعدی مجاز فرض نمیشود.Choose full after-images for context so replay can stand alone. With deltas, a revision gap requires stopping or repair from the record; skipping missing revisions is not assumed safe.
SQL sink: inbox و effect با هم commit شوند. sink بیرونی: conditional version و نشان حذف لازم است؛ offset بعد از اثرِ پایدار ثبت میشود. Kafka transaction بهتنهایی DB و search بیرونی را اتمی نمیکند.For SQL sinks, commit inbox and effect together. External sinks require conditional versions and deletion guards; commit offsets after durable effects. Kafka transactions alone do not make external DB/search writes atomic.
poison event را همراه شواهد در quarantine میگذاریم؛ entity یا پارتیشن مربوط را degraded علامت میزنیم. عبور دادنِ بیصدای revision خراب و ادعای همگرایی ممنوع است.Quarantine poison events with evidence and mark the affected entity/partition degraded. Silently skipping a broken revision cannot support a convergence claim.
برای منبعی که مالک آن نیستیم، از webhook/cursor و rescan استفاده میشود. snapshot و مرز منطقی همان منبع باید اثبات شوند؛ نام CDC جای تضمینِ connector را نمیگیرد.For unowned sources, use webhooks/cursors and rescans. Prove that source’s snapshot/cursor boundary; calling it CDC does not establish connector guarantees.
Snapshot، بازسازی و cutoverSnapshots, rebuilds, and cutover
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-006
Bind Snapshot مرز B را به snapshot همان منبع وصل میکند. Seed Shadow ردیفهای آن تصویر را با mapper نسخهدار بار میکند و Replay Delta تغییرهای بعد از B را میرساند. Compare State در یک cut مشترک بررسی میکند؛ صرفاً صفر شدن lag کافی نیست. Switch Pointer با CAS و بررسی ACL فعلی نسل را عوض میکند. Retire Old پس از خروج خوانندههای قبلی اتفاق میافتد.Bind Snapshot links B to the same source snapshot. Seed Shadow loads it through a versioned mapper; Replay Delta applies changes after B. Compare State checks an identical declared cut; zero lag alone is insufficient. Switch Pointer uses CAS and current ACL checks. Retire Old waits for existing readers to drain.
خودآزماییSelf-check
چرا snapshot یک replica و LSN جداگانهٔ primary کافی نیست؟ چون مرزهایشان الزاماً یکی نیست و تغییرها میتوانند در شکاف جا بمانند.Why is a replica snapshot plus an independently sampled primary LSN insufficient? Their boundaries may differ, leaving changes in a gap.
baseline تحت مالکیت: logical slot با exported MVCC snapshot و cursor متناظر، یا snapshotter مستندِ connector. همین پروتکل به mapperِ پایدار سند وصل میشود؛ هماهنگکنندهٔ bootstrap کارِ پیادهسازی است، نه قابلیت خودکارِ Outbox SMT.For owned sources, use a logical slot with its exported MVCC snapshot/cursor, or a documented connector snapshotter. Connect that protocol to the stable document mapper; bootstrap coordination is implementation work, not an automatic Outbox SMT feature.
snapshot با همان transaction/image، keyset pagination و بودجهٔ I/O خوانده شود. نگهداری transaction طولانی vacuum را عقب میاندازد؛ روش incremental فقط با پروتکل overlap/dedup اثباتشده جایگزین شود.Read the same transaction/image with keyset pagination and an I/O budget. Long snapshots delay vacuum; incremental alternatives require a proven overlap/dedup protocol.
B در منبع شاردشده یک vector از cursorهاست؛ ادعای snapshot اتمیِ کل shardها نمیکنیم. برای مقایسه، snapshot manifest و high-watermark هر partition را pin و ingestion مقایسه را در آن cut متوقف میکنیم.For sharded sources, B is a vector of cursors, not an atomic global snapshot. Pin the snapshot manifest and each partition’s high-watermark, and stop comparison ingestion at that cut.
در بافر، تغییرهای بعد از B ثبت میشوند؛ seed پایانیافته سپس replay میشود. checksum بر projection canonical در همان cut، تعداد ردیف، نسخهٔ mapper، حذفها و missing keyها را پوشش دهد.Buffer changes after B; complete the seed, then replay. Compare canonical projections at the same cut with counts, mapper versions, deletion state, and missing keys.
قبل از هر chunk، بودجهٔ CPU، I/O، replication lag، فضای WAL و backlog بررسی شود. از دسترفتن snapshot یا خارجشدن cursor از retention باعث abort و نسل تازه میشود؛ نسل ناقص publish نمیشود.Before each chunk, check CPU/I/O budget, replication lag, WAL space, and backlog. Lost snapshots or expired cursors abort the generation and require a fresh one; partial generations are never published.
Kafka tombstone برای compaction است؛ حفاظت از resurrect شدن با deleted revision پایدار در guard registry و بررسیِ منبع انجام میشود. مصرفکنندهای که از افق retention عقب افتاده، resnapshot میگیرد.Kafka tombstones support compaction; persistent deleted revisions in a guard registry and source validation prevent resurrection. Consumers beyond the retention horizon must resnapshot.
نمونهٔ حسابِ ظرفیت: یک میلیون سند با نرخ seed صد سند/ثانیه حدود ۱۰٬۰۰۰ ثانیه یا ۲٫۷۸ ساعت میگیرد. با پنج تغییر/ثانیه، ۵۰٬۰۰۰ delta جمع میشود. مصرفِ سی تغییر/ثانیه، با ورودیِ پنج، حدود ۲٬۰۰۰ ثانیه catch-up لازم دارد. این نرخها فرضِ آموزشیاند؛ نرخ embedding و بزرگترین tenant باید اندازهگیری شوند.Capacity example: one million documents at 100 seed documents/second take about 10,000 seconds or 2.78 hours. At five changes/second, 50,000 deltas accumulate. Processing 30/second while five arrive requires about 2,000 seconds of catch-up. These rates are teaching assumptions; embedding throughput and the largest tenant need measurement.
اجرای پایدار، مالکیت و بازیابیDurable execution, ownership, and recovery
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-005
Queued به Running میرود؛ complete وارد Finalize میشود و تنها با epoch و policy معتبر به Succeeded میرسد. خطای گذرا Retry Wait دارد و به Running برمیگردد؛ exhaustion به Failed ختم میشود. Approval Wait انتظار پایدار و deadline دارد؛ رد یا انقضا به Cancelled میرود. مسیرِ نمایششدهٔ approval برای تأیید انتشار خروجی است؛ اقدامِ بیرونی باید دوباره وارد execution و reauthorization شود.Queued enters Running; completion reaches Finalize and succeeds only with valid epoch and policy. Transient failures use Retry Wait and resume Running; exhaustion ends Failed. Approval Wait is durable and has a deadline; denial/expiry ends Cancelled. The depicted approval path approves publication; external actions must return to execution and reauthorization.
خودآزماییSelf-check
آیا waiting باید یک worker را اشغال کند؟ خیر؛ وضعیت و زمانِ بیداری پایدارند و scheduler بعداً کار را claim میکند.Must a wait occupy a worker? No; durable state and wake time let the scheduler claim it later.
Worker A با epoch هفت یک ابزار را صدا میزند و pause میشود. Worker B پس از انقضای lease، با CAS مالکیت و epoch هشت میگیرد. B آخرین step پایدار را میخواند. اگر عملیات تکرار شود، همان K استفاده میشود. A که بیدار شد حق commit با epoch هفت ندارد. این رد، اثر بیرونی را خودبهخود خنثی نمیکند؛ آن ابزار باید K یا fencing را enforce کند.Worker A calls a tool under epoch seven and pauses. After lease expiry, Worker B atomically claims epoch eight and reads the last durable step. Retries retain operation key K. When A resumes, its epoch-seven commit is rejected. Rejection does not undo external effects; that sink must enforce K or fencing.
خودآزماییSelf-check
آیا fencing در DB اثر بیرونی را هم امن میکند؟ فقط اگر خود ابزار، token یا کلید عملیات را enforce کند.Does DB fencing also protect external effects? Only if that tool enforces the token or operation key.
claim با transaction/conditional update: owner_epoch را افزایش بده، lease_until را با ساعت DB بگذار و expected status را بررسی کن. heartbeat فقط از مالک همان epoch پذیرفته شود.Claim with a transaction/conditional update: increment owner_epoch, set lease_until from the DB clock, and check expected status. Accept heartbeats only from that epoch.
input، خروجی مدل، tool intent و result بهشکل step record ثبت میشوند. replay از خروجیِ ثبتشده استفاده میکند؛ دوباره صدا زدن مدل خروجی مشابه را تضمین نمیکند.Persist inputs, model outputs, tool intents, and results as step records. Replay uses persisted output; reinvoking a model does not guarantee the same result.
retry محدود با backoff و jitter؛ خطای policy/schema/authorization retry نمیشود. deadline کلی و token budget مستقل از timeout هر call هستند.Use bounded backoff and jitter. Policy/schema/authorization failures are not retried. Overall deadlines and token budgets differ from per-call timeouts.
timeout یعنی outcome نامعلوم؛ operation key و query وضعیت ابزار باید reconciliation بدهند. ابزار بدون این قرارداد، برای write خودکار فعال نمیشود.Timeout means unknown outcome. Operation keys and tool-status queries enable reconciliation. Tools without this contract are not enabled for automatic writes.
cancel وضعیت پایدار است، epoch/قصد اجرا را بیاعتبار میکند و پیش از call بعدی بررسی میشود؛ کارِ بیرونیِ قبلاً commitشده با cancel بازنمیگردد.Cancellation persists state, invalidates execution authority, and is checked before the next call; it cannot reverse an already committed external action.
برنامهٔ اول: بررسی رخداد با شواهدFirst application: evidence-driven investigation
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-001
Operator یک alert میدهد؛ Control API آن را به run پایدار تبدیل میکند. Runtime context مجاز میگیرد و مدل فقط ابزار پیشنهادی را میسازد. Tool Gateway schema، scope و هزینهٔ query را کنترل میکند؛ نتیجهٔ محدود با ID شواهد به runtime برمیگردد. پس از ثبت stepها، گزارش به شواهد واقعی اشاره میکند و پیش از ارائه مجوزش دوباره بررسی میشود.Operator submits an alert and Control API creates a durable run. Runtime obtains authorized context; the model only proposes tools. Tool Gateway validates schema, scope, and query cost, returning bounded evidence with IDs. Runtime persists steps; the report cites actual evidence and is reauthorized before delivery.
خودآزماییSelf-check
اگر log بگوید «دستور قبلی را فراموش کن» چه باید شود؟ log دادهٔ نامطمئن است؛ هیچ مجوز یا tool intent از آن بهصورت خودکار استخراج و اجرا نمیشود.What if a log says “ignore previous instructions”? Logs are untrusted data; they cannot directly grant authority or execute tools.
ابزار
ورودی محدود
خروجی و دفاع
query_metrics
service allowlist، بازهٔ زمانی، query template.
series+timestamp+source؛ سقف مدت و تعداد series.
search_logs
service، trace_id، filter و limit.
نمونهٔ redacted با cursor؛ text log دستور سیستم نیست.
get_trace
trace_id متعلق به tenant.
span tree با latency و خطا؛ artifact hash.
get_deployments
service و time window.
commit/config diff مجاز؛ تازگی و source revision.
retrieve_runbook
query، service و context generation.
chunkهای مجاز با سند، نسخه و citation؛ recheck در render.
Tool
Bounded input
Output and control
query_metrics
Allowed service, time interval, query template.
Series, timestamps, source; interval and series limits.
search_logs
Service, trace ID, filter, limit.
Redacted samples and cursor; log text is not a system instruction.
get_trace
Trace ID owned by the tenant.
Span tree with latency/errors and artifact hash.
get_deployments
Service and time window.
Authorized commit/config diffs with freshness and source revision.
retrieve_runbook
Query, service, context generation.
Authorized chunks with document/revision/citation; recheck on render.
سه خانوادهٔ baseline: اشباع DB pool، retry storm و deployment با تنظیمِ timeout اشتباه. هر خانواده چند شدت و یک موردِ شواهد ناکافی دارد. نمونههای آموزش و holdout به خانواده/seed مستقل تقسیم میشوند. خروجی علتِ احتمالی است؛ correlation با deployment بهتنهایی causation را ثابت نمیکند.Initial failure families: DB-pool exhaustion, retry storms, and a deployment with incorrect timeout configuration. Each has several severities and an insufficient-evidence case. Development/holdout splits use independent families or seeds. Reports propose probable causes; deployment correlation alone does not establish causation.
Retrieval، embedding و حافظهٔ contextRetrieval, embeddings, and context memory
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-007
ابتدا baseline واژگانی؛ سپس dense و hybrid با fusion رتبهها. وزندهیِ امتیاز BM25 و cosine بدون نرمالسازی توجیه ندارد؛ reranker با eval انتخاب شود.Start with a lexical baseline, then dense/hybrid retrieval with rank fusion. Raw BM25 and cosine scores cannot be mixed without justification; select rerankers by evaluation.
هر chunk شامل tenant، source، entity، revision، acl_revision، chunker_version، embedding_model و content_hash است. با تغییر مدل، generation تازه میسازیم؛ vector با dimension متفاوت در یک index مخلوط نمیشود.Each chunk carries tenant, source, entity, revision, ACL revision, chunker version, embedding model, and content hash. Model changes create a new generation; incompatible vector dimensions are not mixed.
سند v3 embedding میشود؛ در این فاصله v4 میآید یا سند حذف میشود. worker فقط اگر revision و ACL هنوز معتبرند pointer را publish میکند؛ chunkهای قدیمی زیر guard نامرئی میمانند و بعد پاک میشوند.While v3 is embedded, v4 may arrive or the document may be deleted. Publish only if revision/ACL still match; stale chunks remain invisible behind the guard and are then removed.
cache key شامل tenant، policy epoch، context generation، release، query و tool input hash است. لغو مجوز باید cache قدیمی را بیاعتبار کند؛ cache مشترکِ پاسخ خصوصی ممنوع است.Cache keys include tenant, policy epoch, context generation, release, query, and tool-input hash. Revocation invalidates old entries; private answers never share a public cache.
خلاصهٔ session یک نمای مشتقشده است؛ event log و artifactهای اصلی امکان بازبینی میدهند. replayِ ثبتشده با تولیدِ تازهٔ مدل فرق دارد و هزینهٔ دو حالت جداست.Session summaries are derived views; original events and artifacts support inspection. Recorded replay differs from fresh model generation, with separate cost accounting.
پیش از ارسال context به provider و پیش از نمایش citation، مجوزِ فعلی بررسی شود. embedding و trace ممکن است اطلاعات حساس داشته باشند؛ text پاکشده فقط از index متن حذف نمیشود.Recheck current authorization before sending context to providers and displaying citations. Embeddings and traces can contain sensitive data; deletion must cover more than the text index.
زمانِ رویداد، window و joinEvent time, windows, and joins
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-006
رخدادِ latency، log و deployment از ساعتها و شبکههای متفاوت میآیند. event_time، observed_at و ingested_at را جدا نگه میداریم و uncertainty ساعت را ثبت میکنیم. ترتیبِ entity از revision/cursor میآید؛ زمانِ دیوار ترتیب قطعی ایجاد نمیکند.Latency metrics, logs, and deployments arrive from different clocks and networks. Retain event_time, observed_at, and ingested_at separately, with clock uncertainty. Entity ordering comes from revisions/cursors, not wall-clock timestamps.
الگو
کاربرد
قرارداد
Stream–table
enrichment alert با service metadata و owner.
revision metadata در run pin شود؛ گزارش «اکنون» با تحلیلِ as-of فرق دارد.
Stream–stream
correlation alert و deployment در پنجرهٔ دهدقیقهای فرضی.
دو ترتیب ورود، state محدود، watermark هر منبع و correction دیررس تست شوند.
Table–table
نمای service، runbook و permission.
حذف و ACL از هر ورودی باید نمای join را اصلاح کند.
Batch
بازسازی index و تحلیل هزینهٔ روزانه.
manifest ورودی immutable و خروجیِ publishشده all-or-nothing.
Pattern
Use
Contract
Stream–table
Enrich alerts with service metadata and ownership.
Pin metadata revisions; current-state reports differ from as-of analysis.
Stream–stream
Correlate alerts/deployments in an illustrative ten-minute window.
Test both arrival orders, bounded state, source watermarks, and late corrections.
Table–table
Service/runbook/permission materialized view.
Deletes and ACL changes from either input update the join.
Batch
Index rebuilds and daily cost analysis.
Immutable input manifest and all-or-nothing output publication.
سیاست آموزشیِ دیررس: window با watermark میبندد، رویداد دیررس گزارش را revision جدید میکند و خروجی قبلی superseded میشود. منبع idle با policy صریح از watermark کنار میرود؛ با بازگشت آن، دادهٔ قدیمی late محسوب میشود. برای billing، اصلاحیه از دفتر usage قطعی میآید، نه از حدس watermark.Teaching late-data policy: close windows by watermark, issue a new report revision for late evidence, and supersede the old report. Explicit idle-source policy advances watermarks; returning old data is late. Billing corrections derive from durable usage records, not watermark guesses.
ارزیابی، آزمایش و انتشار نسخهEvaluation, experiments, and release
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-011
Freeze Version یک manifest ثابت میسازد؛ Pin Dataset ورودی و snapshot جهان آزمایش را قفل میکند. Run Trials چند بار همان task را اجرا میکند. Score Results شواهد، نتیجه و هزینه را بررسی میکند. Check Gate اگر threshold رد شود همان نسخهٔ فعال را نگه میدارد. Promote تغییر کوچک canary و rollback دارد؛ این فلو کنترل انتشار برنامه است، نه آموزش یک مدل پایه.Freeze Version creates a pinned manifest; Pin Dataset locks inputs and the evaluation-world snapshot. Run Trials repeats tasks. Score Results checks evidence, outcome, and cost. Check Gate retains the active version on failure. Promote uses a small canary and rollback; this is application release control, not foundation-model training.
خودآزماییSelf-check
چرا یک LLM judge کافی نیست؟ چون داور هم خطا و سوگیری دارد؛ state check، ground truth و کالیبراسیون انسانی لازماند.Why is one LLM judge insufficient? Judges also have errors and bias; state checks, ground truth, and human calibration remain necessary.
سنجش
روش
خطرِ نتیجهٔ نادرست
Retrieval
Recall@k و MRR روی شواهد برچسبخورده؛ latency جدا.
پاسخ خوب retrieval ضعیف را پنهان نکند.
Diagnosis
علت درست، فرضیهٔ ردشده و abstention؛ چند trial.
seedهای holdout در prompt و development دیده نشوند.
Evidence
citation وجود دارد، متعلق به tenant و واقعاً ادعا را پشتیبانی میکند.
Recall@k/MRR on labelled evidence; separate latency measurements.
Good prose must not hide weak retrieval.
Diagnosis
Correct cause, rejected hypotheses, and abstention across trials.
Holdout seeds must not leak into prompts/development.
Evidence
Citations exist, belong to the tenant, and support the claim.
A valid citation ID alone is not semantic support.
Tool correctness
Check schemas, scopes, final state, and duplicate operations.
Text claiming completion does not prove outcome.
Cost / latency
Cost per successful task, p50/p95, errors, and tokens for all retries.
Do not count only successful tasks or final-response tokens.
manifest شامل code commit، prompt version، model identifier، پارامترهای generation، tool schema، dataset version، scorer version و context generation است. مدلِ سرویس بیرونی ممکن است عوض شود؛ قابلیت بازتولید آن محدودیتِ ثبتشده دارد. با sample count، بازهٔ عدمقطعیت و نتایج per-family گزارش بده؛ رتبهبندیِ یک اجرا معیار انتشار نیست.The manifest pins code commit, prompt version, model ID, generation parameters, tool schemas, dataset/scorer versions, and context generation. Hosted models may change; record that reproducibility limit. Report sample counts, uncertainty intervals, and per-family results; one run’s ranking is not a release criterion.
Model Gateway، بودجه و inferenceModel gateway, budgets, and inference
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-008
AI Application به Gateway میرسد. پیش از dispatch، سهمیه در Budget Ledger اتمی رزرو میشود. route بیرونی به Provider API میرود؛ route محلی وارد صف محدود و Model Server میشود و GPU مصرف میکند. بعد از تکمیل، usage واقعی رزرو را تسویه میکند؛ crash یا پاسخ نامعلوم، رزرو را برای reconciliation نگه میدارد.AI Application reaches the gateway. Before dispatch, quota is atomically reserved in Budget Ledger. Remote requests reach Provider API; local requests enter a bounded queue and model server backed by GPUs. Actual usage settles reservations; crashes and unknown outcomes keep them pending for reconciliation.
خودآزماییSelf-check
اگر stream بعد از اولین token قطع شود، fallback چه باید کند؟ همان پاسخ را با مدل دوم بیصدا ادامه نمیدهیم؛ خطای partial و attempt جدید مشخص میشود.What if a stream fails after its first token? Do not silently continue with a second model; expose partial output and identify a new attempt.
بودجهٔ tenant با reservation و قید تراکنشی کنترل شود؛ check-then-act جدا میتواند در concurrency overspend ایجاد کند. هزینهٔ retry و request ناموفقِ billشده هم ثبت شود.Control tenant budgets with transactional reservations; separate check-then-act can overspend under concurrency. Record retries and failed-but-billed requests.
routing اولیه rule-based است؛ مدل ارزان/سریع فقط اگر روی eval همان task پذیرفته شده باشد. fallback همراه remaining deadline و budget تصمیم میگیرد، نه صرفاً error code.Initial routing is rule-based; cheaper/faster models qualify through task evaluation. Fallback considers remaining deadlines and budget, not just error codes.
provider adapter schema ورودی/خروجی، tool calls، streaming، usage و error mapping را نسخهدار میکند. credentials بیرون از runtime و دادهٔ prompt نگه داشته میشوند.Provider adapters version input/output schemas, tool calls, streaming, usage, and error mapping. Keep credentials outside runtime and prompt data.
فاز GPU: model card و مجوز، VRAM، precision/quantization، طول context، batch و concurrency مستند شوند. TTFT، inter-token latency، tokens/second، queue delay، utilization و OOM را بسنج.GPU phase: document model card/license, VRAM, precision/quantization, context length, batch size, and concurrency. Measure TTFT, inter-token latency, tokens/second, queue delay, utilization, and OOM.
baseline یک replica؛ سپس continuous batching و prefix caching با benchmark. چند GPU، tensor parallelism یا prefill/decode جدا فقط با منابع و bottleneck واقعی آزمایش میشوند.Start with one replica, then benchmark continuous batching and prefix caching. Multi-GPU, tensor parallelism, and separated prefill/decode require resources and measured bottlenecks.
autoscaling با token backlog و latency هدف؛ cold start و warmup در گزارش باشند. admission control قبل از صفِ نامحدود، فشار را با ۴۲۹ و Retry-After قابلفهم کنترل میکند.Autoscale from token backlog and latency targets; report cold starts/warmup. Admission control rejects excess load with understandable 429/Retry-After responses before queues grow unbounded.
ظرفیت، شاردینگ و تکثیرCapacity, sharding, and replication
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-012
سناریوی stress پیشنهادی، نه نیاز تأییدشده: ۱۰ tenant فرضی، burst بیست run در دقیقه برای پنج دقیقه (E10)، میانگین ۸ call مدل در هر run و ۲٬۰۰۰ token ورودی و خروجیِ مجموع در هر call. نتیجه حدود ۵٬۳۳۳ token/second در میانگین است؛ این عدد ظرفیت GPU را ثابت نمیکند چون prefill، decode و توزیع طولها متفاوتاند. با burst سهبرابر جدا load test میگیریم.Proposed stress scenario, not a confirmed requirement: 10 hypothetical tenants, bursts of 20 runs/minute for five minutes (E10), eight model calls/run, and 2,000 combined input/output tokens/call. This averages about 5,333 tokens/second; it does not establish GPU capacity because prefill, decode, and length distributions differ. Test a threefold burst separately.
کلید event بر entity و کلید state run بر tenant+run است. tenant بزرگ با virtual bucket تقسیم میشود؛ سهمیه و fair scheduling از noisy neighbor جلوگیری میکند.Partition events by entity and run state by tenant+run. Split large tenants across virtual buckets; quotas and fair scheduling limit noisy neighbors.
افزایش partition count ممکن است mapping یک key را تغییر دهد؛ migration با topic version، barrier، drain و pointer جدید انجام شود. salt تصادفی برای entity مرتبشونده استفاده نشود.More partitions can remap a key; migrate with versioned topics, barriers, draining, and a new pointer. Do not randomly salt an entity that requires ordering.
PostgreSQL primary مرجع claim، budget و promotion است. replica ناهمزمان برای آنها خوانده نمیشود؛ read-after-write با primary یا token پیشرفت انجام میشود.The PostgreSQL primary owns claims, budgets, and promotion. Do not use async replicas for these checks; use primary reads or progress tokens for read-after-write.
هدف طراحیِ پایلوت در خرابی ناحیه: RPO≤۱۵min و RTO≤۴h طبق ADR-015 و R03؛ هنوز آزمون نشده است. اگر RPO=0 برای write تأییدشده لازم شد، synchronous replication و failover policy مناسب میخواهد؛ majority و health check بهتنهایی هر primary قدیمی را fence نمیکنند. در partition بدون مرجع معتبر، dispatch حساس متوقف میشود.Pilot regional design targets: RPO≤15min and RTO≤4h under ADR-015/R03; not yet tested. If zero-RPO acknowledged writes are required, synchronous replication and a suitable failover policy are needed. Majority/health checks alone do not fence every old primary. Stop sensitive dispatch when no authoritative writer exists.
Kafka در استقرار HA به replica و ISR مناسب، ack پایدار و سیاست outage نیاز دارد. تنظیم acks=all بهتنهایی جای انتخاب replication factor، min ISR و disaster recovery را نمیگیرد.HA Kafka needs replicas/ISR, durable acknowledgements, and an outage policy. acks=all alone does not replace replication factor, minimum ISR, and disaster recovery decisions.
CDC failover نیازمند slot/WAL قابلادامه و source identity معتبر است؛ اگر پیوستگی اثبات نشود نسلِ تازه از snapshot ساخته میشود. epochِ source و revisionِ entity با consumer epoch متفاوتاند.CDC failover needs resumable slots/WAL and valid source identity. If continuity is unproven, bootstrap a fresh generation. Source epochs/entity revisions differ from consumer-owner epochs.
B-tree برای point lookup و شرط تراکنشی؛ index متنی/برداری برای retrieval؛ columnar artifact برای eval و تحلیل هزینه. LSM و Bloom را بهعنوان گزینهٔ storage بررسی میکنیم؛ ساخت موتور storage شرط پروژه نیست.Use B-trees for point lookup/transactional conditions, text/vector indexes for retrieval, and columnar artifacts for evaluation/cost analysis. Review LSM/Bloom as storage alternatives; building a storage engine is not required.
جدول خرابی و رانبوک بازیابیFailure matrix and recovery runbook
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-005
خرابی
رفتار و recovery
مدرک آزمون
API پس از commit و پیش از پاسخ
retry همان idempotency key؛ run قبلی خوانده میشود.
یک run؛ request hash متفاوت conflict.
worker pause یا crash
lease با epoch تازه؛ commit مالک قدیمی رد شود.
آخرین step پایدار حفظ و guard SQL اجرا شده است.
provider timeout
attempt ثبت، سقف retry و رزرو pending؛ نتیجه/هزینهٔ نامعلوم reconcile.
از سقف token/deadline عبور نشود؛ double-charge بیصدا نباشد.
Kafka / CDC outage
backlog و WAL monitor؛ pause seed؛ از دسترفتن cursor یعنی resnapshot.
هیچ gap پنهانی؛ گزارشِ degraded و cut معتبر.
poison event / schema ناسازگار
quarantine با metadata کمینه؛ entity degraded تا repair.
offset/نسخهٔ خطادار و recovery قابلمشاهده.
مرگِ projector وسط embedding
artifact موقت؛ publish فقط با revision+epoch معتبر؛ retry همان generation.
v قدیمی و chunk orphan در retrieval ظاهر نشوند.
خرابی DB یا از دسترفتن quorum
dispatch حساس توقف؛ خواندنِ stale با نشان روشن؛ failover فقط با writer fenced.
split brain، RPO و بازیابی backup جدا آزمایش شوند.
لغو دسترسی در run جاری
policy epoch تازه؛ context و output پیش از ارسال/نمایش دوباره مجازسنجی شوند.
citation، cache، blob و گزارش قدیمی تحت مجوز فعلی.
خرابی canary
pointer فعال با CAS به release قبلی برگردد؛ runهای موجود pin میمانند.
نسخههای in-flight مخلوط نشوند؛ rollback هم audit دارد.
Failure
Behavior and recovery
Test evidence
API dies after commit, before response
Retry the same idempotency key and retrieve the existing run.
One run; conflicting request hashes rejected.
Worker pause/crash
New lease epoch; reject stale-owner commits.
Last durable step preserved and SQL guard exercised.
Provider timeout
Record attempts, cap retries, retain pending reservation, reconcile uncertain outcome/cost.
No token/deadline overrun; no silent duplicate billing.
Kafka/CDC outage
Monitor backlog/WAL, pause seeds, resnapshot on lost cursors.
No hidden gap; explicit degraded state and valid cut.
Poison event/incompatible schema
Quarantine minimal metadata; affected entities stay degraded until repair.
Visible failed offset/revision and recovery path.
Projector dies mid-embedding
Temporary artifact; publish only with valid revision/epoch; retry the same generation.
Stale revisions and orphan chunks never appear in retrieval.
DB outage/quorum loss
Stop sensitive dispatch, label stale reads, fail over only with writer fencing.
Test split brain, RPO, and backup recovery separately.
Access revoked during a run
New policy epoch; reauthorize context/output before dispatch/display.
Citations, caches, blobs, and old reports respect current access.
Canary regression
CAS the active pointer back; existing runs remain pinned.
In-flight versions stay coherent; rollback is audited.
امنیت، حریم خصوصی و حذفSecurity, privacy, and deletion
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-009
tenant از هویت معتبر استخراج میشود؛ context/tool/citation/blob هرکدام مجوز دارند. RBAC نقش کلی میدهد و policy scope، service و data classification را محدود میکند.Derive tenant from authenticated identity; context/tools/citations/blobs each need authorization. RBAC defines roles while policy limits service, scope, and classification.
runbook و telemetry ورودی نامطمئناند؛ prompt injection با prompt تنها حل نمیشود. ابزار allowlist، schema validator، سقف query و جداسازی credential در gateway لازم است.Runbooks/telemetry are untrusted; prompts alone do not solve injection. Enforce tool allowlists, schema validation, query limits, and credential isolation at gateways.
audit شامل intent، policy revision، tool request hash، نتیجه، actor و زمان است؛ secret، chain-of-thought داخلی و PII خام ضرورت ندارند. توضیحِ تصمیم و trace ساختاری ثبت میشود.Audit intent, policy revision, tool-input hash, result, actor, and time. Secrets, internal chain-of-thought, and raw PII need not be stored; record decision summaries and structured traces.
حذف: دسترسی را فوراً با guard ببند، deletion revision ثبت کن، متن و chunk و embedding و cache و artifact را sweep کن، در هر sink تأیید بگیر و restore/replay را از همان guard عبور بده.Deletion: deny access immediately through guards, record a deletion revision, sweep text/chunks/embeddings/caches/artifacts, obtain sink receipts, and gate restore/replay with the same guard.
نگهداری backup و outbox با replay horizon و سیاست داده هماهنگ شود. tombstone یا hashِ قابلپیوند هم ممکن است حساس باشد؛ حداقل metadata و مدت نگهداری روشن باشند.Align backup/outbox retention with replay horizons and data policy. Linkable tombstones/hashes may still be sensitive; minimize metadata and specify retention.
برای دادهٔ واقعی، رضایت، هدف پردازش، region و شرایط provider پیش از ingest روشن شوند. آزمایشگاه از دادهٔ مصنوعی استفاده میکند؛ دربارهٔ تعهد حقوقیِ فرضی ادعا نمیکند.For real data, establish purpose, consent, region, and provider terms before ingestion. The lab uses synthetic data and makes no claims about hypothetical legal compliance.
خطای agent بهصورت خودکار به سنجش عملکردِ کارکنان تبدیل نشود. report راه اعتراض و اصلاح دارد؛ uncertainty و کیفیت شواهد در UI دیده میشوند.Agent mistakes must not automatically become employee-performance scores. Reports support challenge/correction, with visible uncertainty and evidence quality.
هر ۱۴ فصل در این پروژهAll 14 chapters in this project
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-002
این فهرست مفاهیم اصلی صفحات همین درس را به تصمیمِ پیشنهادی و مدرکِ موردنیاز وصل میکند. همهٔ الگوها همزمان پیاده نمیشوند: گزینهای مثل multi-leader یا 2PC با تحلیل trade-off رد میشود، و این رد بخشی از پوشش درس است. وضعیتِ «هدف» با آزمونِ اجراشده اشتباه گرفته نمیشود.This index maps the core concepts of the existing lessons to proposed decisions and required evidence. Not every pattern is implemented simultaneously: alternatives such as multi-leader writes or 2PC can be rejected through trade-off analysis. Rejection is part of coverage; a target is not an executed test.
فصل 1: معماری و trade-offهاChapter 1: Architecture and trade-offs
مفاهیم
تصمیم یا کاربرد در پروژه
مرجع/مشتق، OLTP/OLAP، ETL/reverse ETL
run و policy مرجع؛ retrieval و dashboard مشتق؛ تحلیل offline از manifest پایدار.
build/buy، کلاود، توزیع، microservice/serverless
adapter و engine موجود؛ worker جدا برای کار طولانی؛ استقرار اولیه محدود و تصمیمِ توزیع مستند.
Concepts
Decision or application
Record/derived, OLTP/OLAP, ETL/reverse ETL
Runs/policies are records; retrieval/dashboards are derived; offline analytics use stable manifests.
مدرک: tenant پرمصرف و تغییر partition mapping را بدون شکست ترتیب اجرا کن.Evidence: Exercise a noisy tenant and partition remapping without broken ordering.
Local model server, load generator, benchmark/HA report.
Declared GPU and reproducible results, measured capacity/cost, tested failover/draining.
هر مرحله یک demo مستقل دارد و به gate قبلی وابسته است. مدت و هزینه پس از شناخت منابع و baseline تعیین میشوند؛ فاز GPU میتواند روی سختافزار اجارهای و بهصورت آزمایش محدود انجام شود. Docker Compose مسیر اولیه است؛ Kubernetes وقتی scaling/HA اندازهگیریشده توجیهش کند وارد میشود.Each stage has its own demo and depends on earlier gates. Schedule/cost follow resource discovery and baselines; GPU work can use bounded experiments on rented hardware. Start with Docker Compose; adopt Kubernetes when measured scaling/HA needs justify it.
آزمونهای پذیرش و مدارک پروژهAcceptance tests and project evidence
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-011
این جدول برنامهٔ آزمون است. هر ردیف باید در پیادهسازی یک fixture، فرمان اجرا، oracle و artifact نتیجه داشته باشد. در این مرحله هیچ ردیف بهعنوان تستِ پاسشدهٔ پلتفرم معرفی نمیشود.This is a test plan. Each row needs a fixture, runnable command, oracle, and result artifact in the implementation. No row is presented as an already-passing platform test.
شناسه
تزریق/ورودی
نتیجهٔ مورد انتظار
P01
دو درخواست یکسان با کلید یکسان؛ یکی پس از پاسخ گمشده.
Proven continuity or resnapshot; no erased/revoked data restoration.
P16
Serving bursts and varying prompt lengths.
Report TTFT/ITL/queues/errors/costs; distinguish simulated from measured results.
خروجی رزومه و روایت فنیPortfolio artifacts and engineering story
پیشنهادِ قابلبحث؛ چرایی و شرط بازنگری: Proposal for discussion; rationale and revisit condition: ADR-001
demo سه تا پنج دقیقهای: inject failure، اجرای agent، شواهد، kill/resume و مقایسهٔ دو release. محیط و دادهٔ مصنوعی برچسب دارند.A three-to-five-minute demo: injected failure, investigation, evidence, kill/resume, two-release comparison. Label environment and synthetic data.
README اجرای محلی، معماری و ADRها، threat model، manifestهای eval، benchmark خام، نمودارهای latency/هزینه و یک postmortem.Local-run README, architecture/ADRs, threat model, evaluation manifests, raw benchmarks, latency/cost plots, and a postmortem.
معیارها با sample count، سختافزار، نسخهها و دستور بازتولید؛ نتیجهٔ منفی و محدودیت هم ثبت شوند. ادعای production-grade فقط از روی ظاهر صفحه ساخته نمیشود.Metrics include sample counts, hardware, versions, and reproduction commands; retain negative results and limitations. Appearance alone cannot support a production-grade claim.
قالب رزومه پس از پیادهسازی: «یک پلتفرم چندمستاجری برای اجرای پایدار agent و بررسی رخداد ساختم؛ بازیابی پس از crash، retrieval با رعایت مجوز، ارزیابی regression و بودجهٔ inference را با آزمایشهای قابلتکرار سنجیدم.» عددهای واقعی بعد از اجرای benchmark اضافه میشوند.Resume template after implementation: “Built a multi-tenant platform for durable agents and incident investigation; tested crash recovery, permission-aware retrieval, regression evaluation, and inference budgets through reproducible experiments.” Add measured numbers only after benchmarks run.
مسیر AI Engineer: retrieval، ابزار، context engineering، ارزیابی و بهبود رفتار. مسیر AI Platform Engineer: runtime، tenancy، schema، release، quota، observability و HA. مسیر تخصصی inference به فاز serving، PyTorch/GPU و profiling بیشتری نیاز دارد.AI Engineer track: retrieval, tools, context engineering, evaluation, behavior improvement. AI Platform Engineer track: runtime, tenancy, schemas, releases, quotas, observability, HA. Specialized inference roles additionally require the serving phase and deeper PyTorch/GPU profiling.
منابع و مرز اعتبارSources and scope of evidence
طراحی این صفحه پیشنهاد آموزشی است و از معماری داخلی شرکتها کپی نشده است. منابعِ رسمی جهتگیری فنی را پشتیبانی میکنند؛ موفقیت یا عددِ محصولِ آنها نتیجهٔ این پروژه نیست. منابع در ۱۵ اکتبر ۲۰۲۶ بررسی شدند؛ در پیادهسازی، نسخهٔ dependency و تنظیمات با manifest ثابت شوند.This is a proposed teaching design, not a copy of any company’s internal architecture. Primary sources support the technical direction; their product results are not this project’s results. Sources were reviewed on October 15, 2026; implementation must pin dependency versions and configuration in manifests.
سایت آموزشی دوزبانه با ۱۴ فصل و یک کارگاه طراحی پلتفرم.A bilingual 14-chapter study site and platform-design workshop.
۱۵ ADR، تخمینهای قابلتغییر، قراردادهای بازیابی و نمودارهای معماری/UML.15 ADRs, editable estimates, recovery contracts, and architecture/UML diagrams.
فلو و walkthrough نمایشی؛ محاسبات و کنترلهای آن واقعاً در مرورگر کار میکنند.Illustrative flow and walkthrough; their calculations and controls work locally in the browser.
پلتفرمی که این طرح توصیف میکندThe platform described by the design
توسعهدهنده app را تعریف میکند، run میفرستد و نتیجه و trace میگیرد؛ هستهٔ مشترک، context مجاز، اجرای پایدار، gateway و ارزیابی نسخه را فراهم میکند. API، worker، DB، CDC و serving این پلتفرم هنوز پیادهسازی نشدهاند.A developer defines an app, submits runs, and retrieves results/traces. Shared infrastructure provides authorized context, durable execution, a gateway, and release evaluation. Its APIs, workers, database, CDC, and model serving are not implemented yet.
از دید توسعهدهنده، یک بار مسیر را ببینیمSee the journey from the developer’s point of view
این POV یک پیشنمایش تعاملی از محصولِ پیشنهادی است؛ هیچ مدل، ابزار، DB یا سرویس خارجی را فراخوانی نمیکند. زمان پخش هم RTO اندازهگیریشده نیست.This POV is an interactive preview of the proposed product. It calls no model, tool, database, or external service. Playback time is not a measured RTO.
Own the Stack / Developer workspaceنمایش آموزشی با دادهٔ مصنوعیEducational simulation · synthetic data
تعریف برنامهDefine the app
Configured
برنامه و ابزارهای مجازش را تعریف میکنم.I define the app and its permitted tools.
App
Incident Investigator
Tenant
demo-sandbox
Model
Provider adapter · proposed
Tools
read_metrics · read_traces · read_runbook
درخواست اجراSubmit a run
Accepted
یک alert میفرستم؛ همان کلیدِ درخواست باید همیشه همان run را برگرداند.I submit an alert; the same request key must return the same run.
Run ID
run_demo_001
Idempotency
alert_demo_001
State
Committed before acknowledgement
جمعآوری شاهدGather evidence
Running
فقط منابعِ مجازِ همین tenant خوانده میشوند. این سه مقدار، دادهٔ مصنوعیِ سناریو هستند.Only this tenant’s permitted sources are read. These three values are synthetic scenario data.
Metrics
Connection pool: 98% used
Traces
Database connection wait increased
Deployment
v42 · before the alert
قطع workerWorker interrupted
Interrupted
worker از دسترس میرود؛ اطلاعاتِ commitشدهٔ run هنوز در مخزن پایدار است.The worker disappears; committed run state remains in durable storage.
در نمایش، اجرای worker شمارهٔ ۷ قطع میشود. سرویس واقعی را kill نمیکنیم.In the illustration, worker 7 is interrupted. No real service is killed.
Committed step
2 · retained
Run ID
run_demo_001 · unchanged
ادامهٔ همان runResume the same run
Resuming
مالک تازه با epoch جدید ادامه میدهد؛ commit مالک قدیمی باید رد شود. هدف R01: دادهٔ تأییدشده گم نشود و بازیابی تا دو دقیقه.A new epoch takes ownership; stale commits must be rejected. R01 targets no acknowledged-state loss and recovery within two minutes.
Owner epoch
7 → 8
Resume
After committed step 2
R01 objective
RPO = 0 · RTO ≤ 120 s · not measured
خواندن گزارشInspect the report
Report ready
گزارش را همراهِ شاهد و عدمقطعیت میخوانم؛ ابزارِ دارای اثر در این نسخه اجرا نمیشود.I inspect evidence and uncertainty. This version executes no side-effecting tool.
شاهد: استفادهٔ ۹۸٪ از pool و افزایش انتظار DB در trace.Evidence: 98% pool usage and longer DB waits in traces.
ابهام: همزمانی با deployment علت را ثابت نمیکند.Uncertainty: deployment timing alone does not establish causation.
گام بعدِ پیشنهادی: بررسی leak و تنظیم pool توسط مهندس.Suggested next step: an engineer checks for leaks and pool configuration.
آزمونِ نسخهEvaluate the release
Review required
پیش از ارتقای نسخه، آزمونِ کیفیت و خرابی لازم است. این نمایش فقط مسیر کار را توضیح میدهد؛ eval واقعی اجرا نشده است.Quality and failure tests precede promotion. This walkthrough illustrates the path; it runs no real evaluation.
مدرکی که برای انتشار میخواهیمEvidence required before release
نتیجهٔ holdout و مقایسه با baselineHoldout results and a baseline comparison
drillهای RPO/RTO با زمان و دادهٔ مشاهدهشدهRPO/RTO drills with observed times and data
کنترل ACL، حذف و worker قدیمیACL, deletion, and stale-worker checks
مجوز برای کار اصیل پروژه است؛ حقوق کتاب، فونتها و اجزای ثالث طبق NOTICE و مجوز خودشان محفوظ است. وبسایت و مخزن GitHub عمومی است.The license covers original project work; book, font, and third-party rights remain governed by NOTICE and their own licenses. The website and the GitHub repository are public.