مورد للمتعلم · PDFLearner resource · PDF
تنزيل PDFDownload PDFالحزمة التعليمية الكاملةComplete learner course pack
الأسبوع الثامن — ربط API مع PostgreSQLWeek 8 — Day 1 — Persistent contracts and safe setup
مواد تعلّم مفتوحة للدراسة المستقلة. يبقى التقدم غير الرسمي في هذا المتصفح فقط، وقد يُمحى عند مسح بيانات تخزين المتصفح. لا يُنشأ هنا حساب أو سجل حضور أو درجة أو نتيجة مساق رسمية.Open learning materials for independent study. Unofficial progress stays only in this browser and can be erased if browser storage is cleared. No account, attendance record, score, or official course result is created here.
تنزيلات المساقCourse downloads
مورد مشترك · PDFShared resource · PDF
تنزيل PDFDownload PDFمورد للمتعلم · ZIPLearner resource · ZIP
تنزيل ZIPDownload ZIPإصدار الحلSolution release
يتوفر بعد التحقق ونافذة الاستدراك والإصدار المعتمد من المدرّبAvailable after the checkpoint, recovery window, and trainer-approved release
اليوم 1Day 1
اليوم 1 — العقود الدائمة والإعداد الآمنDay 1 — Persistent contracts and safe setup
ملخص الشرائحSlide summaryالأهدافObjectives
- اربط خمس عمليات HTTP بـPostgreSQL مع الحفاظ على مخططات الأسبوع السابع وإعداد العينة الاصطناعية المخصصة.Map five HTTP operations to PostgreSQL while preserving Week 7 schemas and preparing the dedicated synthetic fixture.
المتطلبات المسبقةPrerequisites
- أكمل API الأسبوع السابع الموثقة والوصول المختبر للقاعدة من الأسبوع السادس أو مسار الدعم المتفق عليه.Complete the Week 7 documented API and Week 6 tested database access, or the agreed supported route.
- استخدم Python 3.11 أو أحدث والاعتماديات المثبتة وPostgreSQL 16 أو أحدث وقاعدة foundation_week8_test المخصصة. تؤثر الإعادة المقدمة في foundation_week8.notices فقط وتتطلب تأكيداً صريحاً.Use Python 3.11+, pinned dependencies, PostgreSQL 16+ and the dedicated foundation_week8_test database. The provided reset affects only foundation_week8.notices and requires explicit confirmation.
الشروحاتExplanations
تغيير التخزين مع الحفاظ على الحدودChange storage, preserve the boundary
يبقى عقد الإنشاء والعرض والجلب وتحديث النشر ثابتاً ويضاف الحذف بنجاح 204 فارغ. افصل نماذج الطلب وقرارات المسارات والوصول إلى البيانات. استخدم foundation_week8_test وجدول foundation_week8.notices فقط. يستبدل برنامج الإعادة المقدم صفوف هذا الجدول ويعيد تسلسله ولذلك يتطلب تأكيداً صريحاً.The create/list/get/publication-update contract is unchanged; deletion is added with empty 204 success. Separate request models, route decisions and data access. Use only foundation_week8_test and the foundation_week8.notices table. The provided reset replaces this table's rows and restarts its sequence, so it requires explicit confirmation.
أمثلةExamples
خمس عمليات عبر ثلاث طبقات: مخطط الطلب ثم المسار ثم دالة القاعدة. الإعادة إعداد محلي وليست نقطة HTTP.Five operations → three layers: request schema → route → database function. Reset is local setup, never an HTTP endpoint.الشرائحSlides
التدريب الموجّهGuided practice
- اشرح جدول نقاط النهاية بالحقول والرموز الثابتة وسلوك الحذف المضاف وفسر كل أثر للإعادة قبل تشغيلها.Annotate an endpoint table with the unchanged fields/statuses and the added delete behavior; explain every reset side effect before running it.
ورقة العملWorksheet
- قدّم عقد الصفوف الخمسة وربط المخطط والمسار وطبقة الوصول وقائمة إعداد آمن تشرح حارس اسم القاعدة والتأكيد.Submit the five-row contract, schema/route/repository mapping, and a safe setup checklist explaining the database-name and confirmation guards.مرجع الدليل: w8d1-contract-evidenceEvidence reference: w8d1-contract-evidence
خطوات المختبرLab steps
- افحص العينة القابلة للإعادة وتوقع الرمز والاستجابة والحالة المخزنة قبل تشغيل العملية.Inspect the disposable fixture and predict status, response and stored state before running an operation.
- اضبط البيئة المحلية المستبعدة وافحص المخطط والعينة المقدمين وشغّل الإعادة المؤكدة لقاعدة التدريب وأكمل endpoint-table.md. أبقِ بيانات الدخول وتفريغ القاعدة الخام خارج اللقطات.Configure the ignored local environment, inspect the supplied schema/seed, run the confirmed training reset, and complete endpoint-table.md. Keep credentials and raw database dumps out of captures.
- تتبع أول حد مختلف وأصلحه وكرر من إعداد نظيف موثق. لا تعد العينة أثناء إثبات إعادة API.Trace the first differing boundary, repair it, and repeat from documented clean setup. Do not reset during the API restart proof.
- التقط الاستجابات الخيالية المعتمدة والتعليل وملاحظة استخدام الذكاء الاصطناعي أو عدم استخدامه فقط وافحص حالة القاعدة الخام محلياً دون مشاركة تفريغها.Capture only approved fictional responses, reasoning and the AI-use or non-use note; inspect raw database state locally without sharing a dump.
البيانات الاصطناعيةSynthetic data
| الإدخال المقدمSupplied input | النوع المتوقعExpected kind |
|---|---|
Clean ids [1,2] → POST /notices {"title":"Practice","body":"Fictional workshop."} → 201 id 3 → restart API only without reset → GET 3 returns the same four fields with 200 | accepted |
POST /notices {"title":" ","body":"Fictional workshop."} → 422; stored ids remain [1,2] | rejected |
GET/PATCH/DELETE /notices/999 with valid input → 404 for each; rows unchanged | rejected |
DELETE /notices/1 after clean fixture → empty 204; remaining ids [2]; GET or repeated DELETE 1 → 404 | accepted |
Simulated unavailable database for valid input → generic 503, no driver text, SQL, connection settings or traceback | rejected |
مسرد الإنجليزية التقنيةTechnical English glossary
- بقاء البيانات بعد إعادة العملية
persistence - طبقة تعزل عمليات القاعدة
data-access layer - حالة اصطناعية معروفة
fixture
الخصوصيةPrivacy
خزّن الإعلانات الخيالية المقدمة فقط. أبقِ إعداد الاتصال وتفاصيل المشغل وتفريغ القاعدة الخام والهويات الحقيقية والرسائل الخاصة خارج اللقطات والسجلات والأدلة المشتركة واعرض حقول الاستجابة الاصطناعية المعتمدة فقط.Persist only the supplied fictional notice records. Keep connection settings, driver details, raw database dumps, real identities and private messages out of screenshots, logs and shared evidence; show only the approved synthetic response fields.
ممارسة الذكاء الاصطناعيAI practice
يمكن للذكاء الاصطناعي مراجعة اختبار فاشل بعد حجبه وإعادة إنتاجه. عليك فحص الحالة وتنفيذ الإصلاح وشرح كل اقتراح وتشغيل المجموعة كاملة ولا تطلب حل التحقق الكامل.AI may review a redacted failing test after you reproduce it. You must inspect state, implement the repair, explain each suggestion and run the complete suite; do not request the complete checkpoint solution.
الاستدراكRecovery
خلال أسبوع واحد اعزل حداً فاشلاً واحداً وكرر فحوص CRUD والإعادة والأعطال نفسها وأعد تقديم دليل عقد التخزين الدائم. إذا تعذرت PostgreSQL فرتب وصولاً مدعوماً للمختبر بدلاً من قبول دليل المحاكاة وحده.Within one week, isolate one failing boundary, repeat the same CRUD, restart and failure checks, and resubmit the persistence contract evidence. If PostgreSQL is unavailable, schedule supported lab access rather than accepting mock-only proof.
أخطاء شائعة ينبغي ملاحظتهاCommon errors to notice
- تعلن الاستجابة النجاح قبل التثبيت أو تعمل الإعادة بين لقطتي إثبات الدوام.A response says success before commit, or reset runs between the two persistence captures.
- تتضمن SQL قيماً مدمجة أو تنفذ مسارات async عمليات حاجبة أو تتشارك الطلبات معاملة طويلة العمر.SQL includes interpolated values, async routes perform blocking calls, or requests share a long-lived transaction.
- تحتوي استجابة 204 على JSON أو يتحول الصف المفقود إلى 503 أو يكشف استثناء القاعدة تفاصيل الاتصال.A 204 response contains JSON, a missing row becomes 503, or a database exception exposes connection details.
اليوم 2Day 2
اليوم 2 — العمليات ذات المعاملات والمعاملات المضبوطةDay 2 — Parameterised operations and transactions
ملخص الشرائحSlide summaryالأهدافObjectives
- نفّذ الإنشاء والعرض والجلب وتحديث النشر والحذف بمعاملات منفصلة ومعرفات تولدها PostgreSQL وحدود معاملة مضبوطة.Implement parameterised create, list, get, publication-update and delete operations with PostgreSQL-generated ids and controlled transaction boundaries.
المتطلبات المسبقةPrerequisites
- أكمل API الأسبوع السابع الموثقة والوصول المختبر للقاعدة من الأسبوع السادس أو مسار الدعم المتفق عليه.Complete the Week 7 documented API and Week 6 tested database access, or the agreed supported route.
- استخدم Python 3.11 أو أحدث والاعتماديات المثبتة وPostgreSQL 16 أو أحدث وقاعدة foundation_week8_test المخصصة. تؤثر الإعادة المقدمة في foundation_week8.notices فقط وتتطلب تأكيداً صريحاً.Use Python 3.11+, pinned dependencies, PostgreSQL 16+ and the dedicated foundation_week8_test database. The provided reset affects only foundation_week8.notices and requires explicit confirmation.
الشروحاتExplanations
لا تصبح الكتابة دائمة قبل التثبيتA write is not durable until committed
اربط القيم منفصلة عن SQL. تولد هوية PostgreSQL المعرفات ولا تعتمد max(id)+1. أعد id وtitle وbody وpublished فقط ورتب القائمة بالمعرف وتعامل مع غياب الصف كـNone أو false. استخدم سياق اتصال لتثبيت النجاح والتراجع عن الاستثناءات ثم أغلقه. قد يترك تخصيص تسلسل متراجع فجوة.Bind values separately from SQL. PostgreSQL identity generates identifiers; max(id)+1 is not the allocator. Return only id/title/body/published, order lists by id, and treat no matching row as None or false. Use a connection context to commit successful work and roll back exceptions, then close it. A rolled-back sequence allocation can leave a gap.
أمثلةExamples
عينة أولية [1,2] ثم إنشاء مثبت بالمعرف 3 ثم يقرأ اتصال منفصل 3. يجب ألا تترك المعاملة الفاشلة صفاً جزئياً.Fresh fixture ids [1,2] → committed create id 3 → a separate connection can read 3. A failed transaction must not leave a partial row.الشرائحSlides
التدريب الموجّهGuided practice
- تتبع قيمة خيالية عبر موضع معامل وقيمته وتوقع الصفوف المرئية قبل التثبيت وبعده وبعد التراجع.Trace one fictional value through a placeholder and parameter tuple; predict visible rows before commit, after commit and after rollback.
ورقة العملWorksheet
- قدّم خريطة الدوال ومعاملات SQL وتعليل الحالة قبل المعاملة وبعدها ودليلاً على أن اتصالاً جديداً يرى الكتابات المثبتة لا الفاشلة.Submit a function/SQL-parameter map, before/after transaction reasoning and evidence that a fresh connection sees committed changes but no failed write.مرجع الدليل: w8d2-repository-evidenceEvidence reference: w8d2-repository-evidence
خطوات المختبرLab steps
- افحص العينة القابلة للإعادة وتوقع الرمز والاستجابة والحالة المخزنة قبل تشغيل العملية.Inspect the disposable fixture and predict status, response and stored state before running an operation.
- أكمل دوال notice_repository.py الخمس. اختبر القراءة المرتبة والمعرفات المولدة وتحديث النشر فقط وحذف سجل واحد والنتائج المفقودة. أبقِ SQL خارج مخططات الطلب.Complete the five notice_repository.py functions. Test ordered reads, generated ids, publication-only updates, one-record deletion and missing results. Keep SQL out of request schemas.
- تتبع أول حد مختلف وأصلحه وكرر من إعداد نظيف موثق. لا تعد العينة أثناء إثبات إعادة API.Trace the first differing boundary, repair it, and repeat from documented clean setup. Do not reset during the API restart proof.
- التقط الاستجابات الخيالية المعتمدة والتعليل وملاحظة استخدام الذكاء الاصطناعي أو عدم استخدامه فقط وافحص حالة القاعدة الخام محلياً دون مشاركة تفريغها.Capture only approved fictional responses, reasoning and the AI-use or non-use note; inspect raw database state locally without sharing a dump.
البيانات الاصطناعيةSynthetic data
| الإدخال المقدمSupplied input | النوع المتوقعExpected kind |
|---|---|
Clean ids [1,2] → POST /notices {"title":"Practice","body":"Fictional workshop."} → 201 id 3 → restart API only without reset → GET 3 returns the same four fields with 200 | accepted |
POST /notices {"title":" ","body":"Fictional workshop."} → 422; stored ids remain [1,2] | rejected |
GET/PATCH/DELETE /notices/999 with valid input → 404 for each; rows unchanged | rejected |
DELETE /notices/1 after clean fixture → empty 204; remaining ids [2]; GET or repeated DELETE 1 → 404 | accepted |
Simulated unavailable database for valid input → generic 503, no driver text, SQL, connection settings or traceback | rejected |
مسرد الإنجليزية التقنيةTechnical English glossary
- استعلام تفصل فيه القيم عن SQL
parameterised query - تثبيت المعاملة
commit - التراجع عن المعاملة الفاشلة
rollback
الخصوصيةPrivacy
خزّن الإعلانات الخيالية المقدمة فقط. أبقِ إعداد الاتصال وتفاصيل المشغل وتفريغ القاعدة الخام والهويات الحقيقية والرسائل الخاصة خارج اللقطات والسجلات والأدلة المشتركة واعرض حقول الاستجابة الاصطناعية المعتمدة فقط.Persist only the supplied fictional notice records. Keep connection settings, driver details, raw database dumps, real identities and private messages out of screenshots, logs and shared evidence; show only the approved synthetic response fields.
ممارسة الذكاء الاصطناعيAI practice
يمكن للذكاء الاصطناعي مراجعة اختبار فاشل بعد حجبه وإعادة إنتاجه. عليك فحص الحالة وتنفيذ الإصلاح وشرح كل اقتراح وتشغيل المجموعة كاملة ولا تطلب حل التحقق الكامل.AI may review a redacted failing test after you reproduce it. You must inspect state, implement the repair, explain each suggestion and run the complete suite; do not request the complete checkpoint solution.
الاستدراكRecovery
خلال أسبوع واحد اعزل حداً فاشلاً واحداً وكرر فحوص CRUD والإعادة والأعطال نفسها وأعد تقديم دليل طبقة الوصول والمعاملات. إذا تعذرت PostgreSQL فرتب وصولاً مدعوماً للمختبر بدلاً من قبول دليل المحاكاة وحده.Within one week, isolate one failing boundary, repeat the same CRUD, restart and failure checks, and resubmit the repository and transaction evidence. If PostgreSQL is unavailable, schedule supported lab access rather than accepting mock-only proof.
أخطاء شائعة ينبغي ملاحظتهاCommon errors to notice
- تعلن الاستجابة النجاح قبل التثبيت أو تعمل الإعادة بين لقطتي إثبات الدوام.A response says success before commit, or reset runs between the two persistence captures.
- تتضمن SQL قيماً مدمجة أو تنفذ مسارات async عمليات حاجبة أو تتشارك الطلبات معاملة طويلة العمر.SQL includes interpolated values, async routes perform blocking calls, or requests share a long-lived transaction.
- تحتوي استجابة 204 على JSON أو يتحول الصف المفقود إلى 503 أو يكشف استثناء القاعدة تفاصيل الاتصال.A 204 response contains JSON, a missing row becomes 503, or a database exception exposes connection details.
اليوم 3Day 3
اليوم 3 — مسارات CRUD والأعطال الآمنةDay 3 — CRUD routes and safe failures
ملخص الشرائحSlide summaryالأهدافObjectives
- اربط العمليات الخمس بطبقة الوصول واحفظ نماذج التحقق والاستجابة للأسبوع السابع وميّز المدخل غير الصالح والسجل المفقود وتعذر القاعدة.Wire five operations to the repository, preserve Week 7 validation/response models, and distinguish invalid, missing and unavailable-database outcomes.
المتطلبات المسبقةPrerequisites
- أكمل API الأسبوع السابع الموثقة والوصول المختبر للقاعدة من الأسبوع السادس أو مسار الدعم المتفق عليه.Complete the Week 7 documented API and Week 6 tested database access, or the agreed supported route.
- استخدم Python 3.11 أو أحدث والاعتماديات المثبتة وPostgreSQL 16 أو أحدث وقاعدة foundation_week8_test المخصصة. تؤثر الإعادة المقدمة في foundation_week8.notices فقط وتتطلب تأكيداً صريحاً.Use Python 3.11+, pinned dependencies, PostgreSQL 16+ and the dedicated foundation_week8_test database. The provided reset affects only foundation_week8.notices and requires explicit confirmation.
الشروحاتExplanations
ترجمة الأعطال عند الحد الصحيحTranslate failures at the correct boundary
تحقق قبل الكتابة: الجسم غير الصالح أو المعرف غير الموجب أو غير الصحيح يعطي 422. المعرف الصحيح الغائب يعطي 404 للجلب والتحديث والحذف. نجاح الحذف 204 بلا جسم. ترجم أعطال الاتصال والاستعلام إلى 503 عام دون نص المشغل أو إعداد الاتصال. مع Psycopg المتزامن استخدم مسارات def عادية وسياق اتصال منفصلاً لكل طلب.Validate before writes: invalid body or non-positive/non-integer id is 422. A valid absent id is 404 for get, update and delete. Successful delete is 204 with no body. Translate connection/query failures to a generic 503 without driver text or connection settings. With synchronous Psycopg, use normal def endpoints and a separate connection context per request.
أمثلةExamples
PATCH 1 published=true يعطي 200 مع حفظ العنوان والجسم؛ DELETE 1 يعطي 204 فارغاً؛ GET 1 أو تكرار DELETE 1 يعطي 404.PATCH 1 published=true → 200 preserving title/body; DELETE 1 → empty 204; GET 1 or repeat DELETE 1 → 404.الشرائحSlides
التدريب الموجّهGuided practice
- تتبع الطلب عبر التحقق والمسار والمعاملة والاستجابة. قارن نص published غير الصالح بالمعرف 999 المفقود وبمحاكاة قاعدة غير متاحة.Trace a request through validation, route, transaction and response. Contrast invalid published text, missing id 999, and a simulated unavailable database.
ورقة العملWorksheet
- قدّم خمس عمليات موثقة ولقطات CRUD الصالحة والجلب والتحديث والحذف المفقودة واستجابة آمنة لفشل القاعدة.Submit five documented operations, valid CRUD captures, missing GET/PATCH/DELETE captures and a sanitized database-failure response.مرجع الدليل: w8d3-http-evidenceEvidence reference: w8d3-http-evidence
خطوات المختبرLab steps
- افحص العينة القابلة للإعادة وتوقع الرمز والاستجابة والحالة المخزنة قبل تشغيل العملية.Inspect the disposable fixture and predict status, response and stored state before running an operation.
- سجل المسارات الخمسة ونفذها. احفظ قيود الطول بعد إزالة الفراغات والنشر المنطقي الصارم ورفض الحقول الزائدة. وثق 201 و200 و204 و422 و404 و503 وأثبت أن الاستثناءات لا تكشف تفاصيل التخزين.Register and implement all five routes. Preserve stripped length limits, strict boolean publication and extra-field rejection. Document 201/200/204/422/404/503 and show that exceptions do not leak storage details.
- تتبع أول حد مختلف وأصلحه وكرر من إعداد نظيف موثق. لا تعد العينة أثناء إثبات إعادة API.Trace the first differing boundary, repair it, and repeat from documented clean setup. Do not reset during the API restart proof.
- التقط الاستجابات الخيالية المعتمدة والتعليل وملاحظة استخدام الذكاء الاصطناعي أو عدم استخدامه فقط وافحص حالة القاعدة الخام محلياً دون مشاركة تفريغها.Capture only approved fictional responses, reasoning and the AI-use or non-use note; inspect raw database state locally without sharing a dump.
البيانات الاصطناعيةSynthetic data
| الإدخال المقدمSupplied input | النوع المتوقعExpected kind |
|---|---|
Clean ids [1,2] → POST /notices {"title":"Practice","body":"Fictional workshop."} → 201 id 3 → restart API only without reset → GET 3 returns the same four fields with 200 | accepted |
POST /notices {"title":" ","body":"Fictional workshop."} → 422; stored ids remain [1,2] | rejected |
GET/PATCH/DELETE /notices/999 with valid input → 404 for each; rows unchanged | rejected |
DELETE /notices/1 after clean fixture → empty 204; remaining ids [2]; GET or repeated DELETE 1 → 404 | accepted |
Simulated unavailable database for valid input → generic 503, no driver text, SQL, connection settings or traceback | rejected |
مسرد الإنجليزية التقنيةTechnical English glossary
- إنشاء وقراءة وتحديث وحذف
CRUD - معرف صالح بلا سجل
missing record - تعذر خدمة التخزين مؤقتاً
service unavailable
الخصوصيةPrivacy
خزّن الإعلانات الخيالية المقدمة فقط. أبقِ إعداد الاتصال وتفاصيل المشغل وتفريغ القاعدة الخام والهويات الحقيقية والرسائل الخاصة خارج اللقطات والسجلات والأدلة المشتركة واعرض حقول الاستجابة الاصطناعية المعتمدة فقط.Persist only the supplied fictional notice records. Keep connection settings, driver details, raw database dumps, real identities and private messages out of screenshots, logs and shared evidence; show only the approved synthetic response fields.
ممارسة الذكاء الاصطناعيAI practice
يمكن للذكاء الاصطناعي مراجعة اختبار فاشل بعد حجبه وإعادة إنتاجه. عليك فحص الحالة وتنفيذ الإصلاح وشرح كل اقتراح وتشغيل المجموعة كاملة ولا تطلب حل التحقق الكامل.AI may review a redacted failing test after you reproduce it. You must inspect state, implement the repair, explain each suggestion and run the complete suite; do not request the complete checkpoint solution.
الاستدراكRecovery
خلال أسبوع واحد اعزل حداً فاشلاً واحداً وكرر فحوص CRUD والإعادة والأعطال نفسها وأعد تقديم دليل CRUD والأعطال. إذا تعذرت PostgreSQL فرتب وصولاً مدعوماً للمختبر بدلاً من قبول دليل المحاكاة وحده.Within one week, isolate one failing boundary, repeat the same CRUD, restart and failure checks, and resubmit the CRUD and failure evidence. If PostgreSQL is unavailable, schedule supported lab access rather than accepting mock-only proof.
أخطاء شائعة ينبغي ملاحظتهاCommon errors to notice
- تعلن الاستجابة النجاح قبل التثبيت أو تعمل الإعادة بين لقطتي إثبات الدوام.A response says success before commit, or reset runs between the two persistence captures.
- تتضمن SQL قيماً مدمجة أو تنفذ مسارات async عمليات حاجبة أو تتشارك الطلبات معاملة طويلة العمر.SQL includes interpolated values, async routes perform blocking calls, or requests share a long-lived transaction.
- تحتوي استجابة 204 على JSON أو يتحول الصف المفقود إلى 503 أو يكشف استثناء القاعدة تفاصيل الاتصال.A 204 response contains JSON, a missing row becomes 503, or a database exception exposes connection details.
اليوم 4Day 4
اليوم 4 — اختبارات التكامل وإثبات إعادة التشغيلDay 4 — Integration tests and restart proof
ملخص الشرائحSlide summaryالأهدافObjectives
- شغّل اختبارات قابلة للتكرار تعتمد PostgreSQL وأثبت بقاء السجل المنشأ نفسه بعد إعادة API فقط دون إعادة العينة بين اللقطات.Run repeatable PostgreSQL-backed tests and prove the same created record survives restarting only the API, without reseeding between captures.
المتطلبات المسبقةPrerequisites
- أكمل API الأسبوع السابع الموثقة والوصول المختبر للقاعدة من الأسبوع السادس أو مسار الدعم المتفق عليه.Complete the Week 7 documented API and Week 6 tested database access, or the agreed supported route.
- استخدم Python 3.11 أو أحدث والاعتماديات المثبتة وPostgreSQL 16 أو أحدث وقاعدة foundation_week8_test المخصصة. تؤثر الإعادة المقدمة في foundation_week8.notices فقط وتتطلب تأكيداً صريحاً.Use Python 3.11+, pinned dependencies, PostgreSQL 16+ and the dedicated foundation_week8_test database. The provided reset affects only foundation_week8.notices and requires explicit confirmation.
الشروحاتExplanations
الإعادة بين الاختبارات لا داخل إثبات الدوامReset between tests, not inside the persistence proof
أعد العينة المعروفة للاختبارات المستقلة ثم أنشئ سجلاً وثبته. أعد عملية API فقط مع إبقاء PostgreSQL وصفوفها دون تغيير واسترجع المعرف والحقول نفسها. لا يثبت TestClient جديد فوق العملية نفسها إعادة الخادم. استخدم عملية منفصلة أو إيقافاً وتشغيلاً فعليين. تكمل محاكاة الأعطال التكامل الحقيقي ولا تستبدله.Restore the known fixture for independent tests, then create and commit a new record. Restart only the API process while leaving PostgreSQL and its rows untouched; retrieve the same id and fields. A new TestClient over an unchanged process is not a server-restart proof. Use a separate process or an actual stop/start. Mock failures supplement, but never replace, real database integration.
أمثلةExamples
إعادة العينة ثم إنشاء 3 ثم التقاط الاستجابة ثم إيقاف وتشغيل API فقط ثم تطابق GET 3. إعادة العينة في الوسط تبطل الدليل.Reset → create id 3 → capture response → stop/start API only → GET 3 matches. Resetting the fixture in the middle invalidates that proof.الشرائحSlides
التدريب الموجّهGuided practice
- صمم اختبارات مستقلة لـCRUD والعنوان الفارغ ونوع النشر الخاطئ والصفوف المفقودة والتراجع وحدد الدليل الذي يحتاج اتصال PostgreSQL فعلياً.Design independent tests for valid CRUD, blank title, wrong published type, missing rows and rollback. Identify which evidence needs a real PostgreSQL connection.
ورقة العملWorksheet
- قدّم تشغيلين ناجحين لاختبارات التكامل وسجل إعادة التشغيل للسجل نفسه وفحوص ثبات الحالة للمدخل المرفوض وشرح الفشل والتراجع بعد الحجب.Submit two passing integration-test runs, a same-record restart transcript, unchanged-state checks for rejected input, and a redacted failure/rollback explanation.مرجع الدليل: w8d4-persistence-evidenceEvidence reference: w8d4-persistence-evidence
خطوات المختبرLab steps
- افحص العينة القابلة للإعادة وتوقع الرمز والاستجابة والحالة المخزنة قبل تشغيل العملية.Inspect the disposable fixture and predict status, response and stored state before running an operation.
- أكمل مطالب الاختبار الأربعة. قارن حالة الصفوف محلياً قبل المدخل المرفوض وبعده وأثبت الدوام بعد الإعادة وحاكِ خطأ التخزين بأمان وشغّل مرتين من إعداد نظيف دون نشر تفريغ القاعدة الخام.Complete all four test prompts. Compare row state locally before and after rejected input, prove restart persistence, simulate a storage error safely, and run twice from clean setup without publishing raw database dumps.
- تتبع أول حد مختلف وأصلحه وكرر من إعداد نظيف موثق. لا تعد العينة أثناء إثبات إعادة API.Trace the first differing boundary, repair it, and repeat from documented clean setup. Do not reset during the API restart proof.
- التقط الاستجابات الخيالية المعتمدة والتعليل وملاحظة استخدام الذكاء الاصطناعي أو عدم استخدامه فقط وافحص حالة القاعدة الخام محلياً دون مشاركة تفريغها.Capture only approved fictional responses, reasoning and the AI-use or non-use note; inspect raw database state locally without sharing a dump.
البيانات الاصطناعيةSynthetic data
| الإدخال المقدمSupplied input | النوع المتوقعExpected kind |
|---|---|
Clean ids [1,2] → POST /notices {"title":"Practice","body":"Fictional workshop."} → 201 id 3 → restart API only without reset → GET 3 returns the same four fields with 200 | accepted |
POST /notices {"title":" ","body":"Fictional workshop."} → 422; stored ids remain [1,2] | rejected |
GET/PATCH/DELETE /notices/999 with valid input → 404 for each; rows unchanged | rejected |
DELETE /notices/1 after clean fixture → empty 204; remaining ids [2]; GET or repeated DELETE 1 → 404 | accepted |
Simulated unavailable database for valid input → generic 503, no driver text, SQL, connection settings or traceback | rejected |
مسرد الإنجليزية التقنيةTechnical English glossary
- اختبار تعاون API والقاعدة
integration test - إعادة تشغيل عملية API فقط
restart - يعطي الدليل نفسه من بداية معروفة
repeatable
الخصوصيةPrivacy
خزّن الإعلانات الخيالية المقدمة فقط. أبقِ إعداد الاتصال وتفاصيل المشغل وتفريغ القاعدة الخام والهويات الحقيقية والرسائل الخاصة خارج اللقطات والسجلات والأدلة المشتركة واعرض حقول الاستجابة الاصطناعية المعتمدة فقط.Persist only the supplied fictional notice records. Keep connection settings, driver details, raw database dumps, real identities and private messages out of screenshots, logs and shared evidence; show only the approved synthetic response fields.
ممارسة الذكاء الاصطناعيAI practice
يمكن للذكاء الاصطناعي مراجعة اختبار فاشل بعد حجبه وإعادة إنتاجه. عليك فحص الحالة وتنفيذ الإصلاح وشرح كل اقتراح وتشغيل المجموعة كاملة ولا تطلب حل التحقق الكامل.AI may review a redacted failing test after you reproduce it. You must inspect state, implement the repair, explain each suggestion and run the complete suite; do not request the complete checkpoint solution.
الاستدراكRecovery
خلال أسبوع واحد اعزل حداً فاشلاً واحداً وكرر فحوص CRUD والإعادة والأعطال نفسها وأعد تقديم دليل الدوام واختبار التكامل. إذا تعذرت PostgreSQL فرتب وصولاً مدعوماً للمختبر بدلاً من قبول دليل المحاكاة وحده.Within one week, isolate one failing boundary, repeat the same CRUD, restart and failure checks, and resubmit the persistence and integration-test evidence. If PostgreSQL is unavailable, schedule supported lab access rather than accepting mock-only proof.
أخطاء شائعة ينبغي ملاحظتهاCommon errors to notice
- تعلن الاستجابة النجاح قبل التثبيت أو تعمل الإعادة بين لقطتي إثبات الدوام.A response says success before commit, or reset runs between the two persistence captures.
- تتضمن SQL قيماً مدمجة أو تنفذ مسارات async عمليات حاجبة أو تتشارك الطلبات معاملة طويلة العمر.SQL includes interpolated values, async routes perform blocking calls, or requests share a long-lived transaction.
- تحتوي استجابة 204 على JSON أو يتحول الصف المفقود إلى 503 أو يكشف استثناء القاعدة تفاصيل الاتصال.A 204 response contains JSON, a missing row becomes 503, or a database exception exposes connection details.
اليوم 5Day 5
اليوم 5 — التحقق الفردي لـAPI دائمةDay 5 — Individual persistent API checkpoint
ملخص الشرائحSlide summaryالأهدافObjectives
- اعرض فردياً CRUD المعتمدة على PostgreSQL والكتابات الدائمة وسلوك غير الصالح والمفقود والفشل والاختبارات الآلية بأدلة اصطناعية آمنة.Independently demonstrate PostgreSQL-backed CRUD, durable writes, invalid/missing/failure behavior and automated tests with safe synthetic evidence.
المتطلبات المسبقةPrerequisites
- أكمل API الأسبوع السابع الموثقة والوصول المختبر للقاعدة من الأسبوع السادس أو مسار الدعم المتفق عليه.Complete the Week 7 documented API and Week 6 tested database access, or the agreed supported route.
- استخدم Python 3.11 أو أحدث والاعتماديات المثبتة وPostgreSQL 16 أو أحدث وقاعدة foundation_week8_test المخصصة. تؤثر الإعادة المقدمة في foundation_week8.notices فقط وتتطلب تأكيداً صريحاً.Use Python 3.11+, pinned dependencies, PostgreSQL 16+ and the dedicated foundation_week8_test database. The provided reset affects only foundation_week8.notices and requires explicit confirmation.
الشروحاتExplanations
تخزين دائم عامل وحدود قابلة للشرحWorking persistence plus an explainable boundary
يجمع التحقق الكامل المخططات الثابتة والعمليات الأربع السابقة والحذف المضاف والكتابات المثبتة التي تبقى بعد إعادة API واختبارات نجاح وفشل قابلة للتكرار. اشرح المعاملات وملكية المعاملة وكل رمز. لا تثبت فحوص البيئة أو المحاكاة وحدها أو اللقطات المحفوظة السلوك الكامل.A complete checkpoint combines the stable schemas and four existing operations, the added delete operation, committed writes surviving an API restart, and repeatable success/failure tests. Explain parameters, transaction ownership and each status. Environment-only checks, mocks alone or saved screenshots cannot establish the full behavior.
أمثلةExamples
خمس عمليات وثلاثة مخططات وعينة PostgreSQL فعلية ودليل إعادة للمعرف نفسه وتشغيلان للاختبار من حالة نظيفة.Five operations, three schemas, one real PostgreSQL fixture, a same-id restart proof, and two clean-state test runs.الشرائحSlides
التدريب الموجّهGuided practice
- اقرأ المعايير المنشورة وخطط لعرض مباشر دون تلقي كود نقاط النهاية أو طبقة الوصول المكتمل.Read the published criteria and plan a live demonstration without receiving completed endpoint or repository code.
ورقة العملWorksheet
- قدّم تنفيذ CRUD الفردي والاستجابات الموثقة وسجل الدوام ونتائج آلية من حالة نظيفة وفحص الخصوصية وملاحظة استخدام الذكاء الاصطناعي أو عدم استخدامه.Submit the individual CRUD implementation, documented responses, persistence transcript, clean-state automated results, privacy check and AI-use or non-use note.مرجع الدليل: w8d5-checkpoint-evidenceEvidence reference: w8d5-checkpoint-evidence
خطوات المختبرLab steps
- افحص العينة القابلة للإعادة وتوقع الرمز والاستجابة والحالة المخزنة قبل تشغيل العملية.Inspect the disposable fixture and predict status, response and stored state before running an operation.
- انطلاقاً من البداية وعملك السابق نفذ API الدائمة واعرض كل حالة منشورة وأعد مجموعة الاختبارات كاملة واشرح تراجع الكتابات الفاشلة دون كشف تفاصيل خاصة.From the starter and your own prior work, implement the persistent API, demonstrate every published case, rerun the full test suite, and explain how failed writes roll back without exposing private details.
- تتبع أول حد مختلف وأصلحه وكرر من إعداد نظيف موثق. لا تعد العينة أثناء إثبات إعادة API.Trace the first differing boundary, repair it, and repeat from documented clean setup. Do not reset during the API restart proof.
- التقط الاستجابات الخيالية المعتمدة والتعليل وملاحظة استخدام الذكاء الاصطناعي أو عدم استخدامه فقط وافحص حالة القاعدة الخام محلياً دون مشاركة تفريغها.Capture only approved fictional responses, reasoning and the AI-use or non-use note; inspect raw database state locally without sharing a dump.
البيانات الاصطناعيةSynthetic data
| الإدخال المقدمSupplied input | النوع المتوقعExpected kind |
|---|---|
Clean ids [1,2] → POST /notices {"title":"Practice","body":"Fictional workshop."} → 201 id 3 → restart API only without reset → GET 3 returns the same four fields with 200 | accepted |
POST /notices {"title":" ","body":"Fictional workshop."} → 422; stored ids remain [1,2] | rejected |
GET/PATCH/DELETE /notices/999 with valid input → 404 for each; rows unchanged | rejected |
DELETE /notices/1 after clean fixture → empty 204; remaining ids [2]; GET or repeated DELETE 1 → 404 | accepted |
Simulated unavailable database for valid input → generic 503, no driver text, SQL, connection settings or traceback | rejected |
مسرد الإنجليزية التقنيةTechnical English glossary
- كتابة مثبتة تبقى بعد إعادة API
durable write - موضع التثبيت أو التراجع
transaction boundary - استجابة مستقرة دون تفاصيل خاصة
controlled response
الخصوصيةPrivacy
خزّن الإعلانات الخيالية المقدمة فقط. أبقِ إعداد الاتصال وتفاصيل المشغل وتفريغ القاعدة الخام والهويات الحقيقية والرسائل الخاصة خارج اللقطات والسجلات والأدلة المشتركة واعرض حقول الاستجابة الاصطناعية المعتمدة فقط.Persist only the supplied fictional notice records. Keep connection settings, driver details, raw database dumps, real identities and private messages out of screenshots, logs and shared evidence; show only the approved synthetic response fields.
ممارسة الذكاء الاصطناعيAI practice
يمكن للذكاء الاصطناعي مراجعة اختبار فاشل بعد حجبه وإعادة إنتاجه. عليك فحص الحالة وتنفيذ الإصلاح وشرح كل اقتراح وتشغيل المجموعة كاملة ولا تطلب حل التحقق الكامل.AI may review a redacted failing test after you reproduce it. You must inspect state, implement the repair, explain each suggestion and run the complete suite; do not request the complete checkpoint solution.
الاستدراكRecovery
خلال أسبوع واحد اعزل حداً فاشلاً واحداً وكرر فحوص CRUD والإعادة والأعطال نفسها وأعد تقديم دليل التحقق الفردي لـAPI الدائمة. إذا تعذرت PostgreSQL فرتب وصولاً مدعوماً للمختبر بدلاً من قبول دليل المحاكاة وحده.Within one week, isolate one failing boundary, repeat the same CRUD, restart and failure checks, and resubmit the individual persistent API checkpoint evidence. If PostgreSQL is unavailable, schedule supported lab access rather than accepting mock-only proof.
أخطاء شائعة ينبغي ملاحظتهاCommon errors to notice
- تعلن الاستجابة النجاح قبل التثبيت أو تعمل الإعادة بين لقطتي إثبات الدوام.A response says success before commit, or reset runs between the two persistence captures.
- تتضمن SQL قيماً مدمجة أو تنفذ مسارات async عمليات حاجبة أو تتشارك الطلبات معاملة طويلة العمر.SQL includes interpolated values, async routes perform blocking calls, or requests share a long-lived transaction.
- تحتوي استجابة 204 على JSON أو يتحول الصف المفقود إلى 503 أو يكشف استثناء القاعدة تفاصيل الاتصال.A 204 response contains JSON, a missing row becomes 503, or a database exception exposes connection details.