Building on the domains and data model you designed in Week 1, implement front-end integration, back-end business logic and idempotency,
member/auth security audits, payment transactions and global launch monitoring yourself, and complete your ai_review.md decision evidence.
10 assignments
2 per day / 10 problems total
50 pts / 100 pts
50 pts per problem (100 pts per day)
90–120 min
Suggested time per day
ZIP submission
Submit StudentID_Name_DayNN.zip
📌 Day 5–10 homework submission and grading rules
File structure: inside the StudentID_Name_DayNN.zip file, create HW-DNN-01 and HW-DNN-02 folders and submit the required source code, design docs and ai_review.md
AI review record (ai_review.md required): must include the check questions you wrote, AI's key feedback and your reasons for accepting, rejecting or changing (simply copy-pasting AI answers gets 0 points)
In-depth assignment rule: the example prompts are only for reference. You must write your own code that solves business exceptions and edge cases yourself.
Grading: 2 problems per day (50 pts each, 100 total); your Week 2 final grade is the average of the 5 days' scores.
DAY 06 ASSIGNMENTS
Day 6. Front-End Development and API Integration
HW-D06-01
Day 6 • HW-D06-0150 pts
HW-D06-01. Live Video Player & State Binding UI
Build a UI state machine and event binding for the VidAce player that renders video metadata, an ad countdown (skip after 5 sec) and live viewing stats at the same time during HLS streaming.
HW-D06-02. Fallback UX for AdBlock and Network Drops
Design a resilient UX where the player doesn't freeze and falls back to a replacement banner or safe mode when the ad API is blocked by the browser's ad blocker (AdBlock) or network delays.
Day 7. Connecting Features and Completing User Scenarios
HW-D07-01
Day 7 • HW-D07-0150 pts
HW-D07-01. Async Pipeline for Large Video Upload and Encoding
Complete idempotency logic so that network retries don't cause duplicate encoding during chunked upload of a 2GB video and state changes in the async encoding queue.
HW-D07-02. Abuse Detection (FDS) and Correcting Transactions
Block abnormal playback and fake ad clicks by macro bots in real time, and build business rules that issue negative correction entries for already wrongly billed records without damaging the ledger.
Day 8. Member Services and the Onboarding Experience
HW-D08-01
Day 8 • HW-D08-0150 pts
HW-D08-01. Multi-Tenant Permission (RBAC/ABAC) Matrix and Guards
Define a permission matrix per role — viewer, creator (owner/editor), advertiser, admin — and design authorization middleware that completely blocks deleting others' videos or channel takeover (IDOR).
HW-D08-02. Preventing OAuth2 Token Theft and a Session Security Audit
To defend against token theft through XSS/CSRF in social login and SPA setups, set up HttpOnly cookie-based Refresh Token Rotation (RTR) and immediate session expiry.
When advertisers top up large budgets, check for tampered amounts between the payment window and back-end approval, and build an idempotent checkout pipeline that blocks double payments from double clicks or network delays.
HW-D09-02. Payment Timeout Compensating Transactions (Saga) and Settlement Reconciliation
Build a system that automatically and fully recovers 'ghost payment' mismatches — the card was approved after a PG approval timeout but the system balance wasn't credited — with batch Reconciliation and Saga compensating cancellation.
HW-D10-01. Company-Wide Core E2E Integration QA and Launch Readiness Review
Automate tests for E2E scenarios of the whole business loop linking viewers, creators and advertisers, and finish a Go/No-Go checklist to decide production deployment on launch day.
HW-D10-02. Circuit Breaker & Zero-Downtime Rollback for Large Traffic Failures
Build circuit breaker middleware that prevents Cascading Failure when traffic surges 20x right after launch, and a rollback runbook that recovers without loss within 1 minute when a deployment defect is found.
You're building the core video player UI component that streams 4K/FHD video on the VidAce web platform. Beyond simple play/pause, the player must handle these complex async states on one screen:
Ad display states: pre-roll ad ('Skip ad' enabled after a 5-second countdown); pause the player and switch to an ad-only progress bar when a mid-roll ad is inserted
Viewing stats and communication: sending the timeupdate event that fires every second straight to the server risks overload from thousands of concurrent users per second → 5-second Throttling and async batch sending are required
💡 Self-Reflection Questions
When managing with simple React useState or global variables, ad and video playback states get tangled and cause a black screen. How will you prevent this with a Finite State Machine?
When buffering lasts 3+ seconds because of network delay, how will you bind UI feedback (skeleton, spinner, notice of auto-switch to lower quality) to prevent users leaving?
How should you use navigator.sendBeacon to send the last watched position without loss when the browser tab goes to the background or the user closes the window (beforeunload)?
🤖 Example AI question (reference prompt)
⚠️ This is a reference example: copying the prompt below as-is for your answer loses points. Ask questions reflecting the business situation above and your own design, and leave a critical evaluation of AI's answers and your final reasons in ai_review.md.
I'm writing a video streaming web player component.
Design a finite state machine (FSM) structure in JavaScript that safely manages playback states (IDLE, LOADING, PLAYING, BUFFERING, ERROR) and ad states (AD_PREROLL, AD_MIDROLL).
Throttle the timeupdate event that fires every second to every 5 seconds to send viewing records to the server,
and include logic that enables the 'Skip' button after 5 seconds of an ad.
🎯 Real Mission Tasks
1
Write the player state machine diagram (player_state_machine.md)
Write transition rules between main video states and ad states (State Transition Table & Mermaid diagram), and state the blocking conditions for invalid transitions (e.g. clicking skip ad while buffering).
2
Build the core video player controller (VideoPlayer.js)
Build working code that controls the HTML5 Video element, with event listeners for play/pause/buffering detection, a 5-second skip countdown and batch sending of viewing data every 5 seconds.
3
Sync viewing history when the screen closes abnormally
Include visibilitychange and navigator.sendBeacon exception handling that keeps the current playback position when the user closes the browser window.
4
AI review and self-critique report (ai_review.md)
Check the state management code AI wrote for concurrency flaws or possible memory leaks (Event Listeners not removed), and record what you fixed yourself.
📊 Grading (50 pts):FSM state transition integrity 15 ptsThrottling and Beacon sync code 15 pts5-second ad skip UI binding 10 ptsEvidence of AI judgment and review 10 pts
DAY 6 • Assignment 2 (HW-D06-02)
HW-D06-02. Fallback UX for AdBlock and Network Drops
🚨 Real business situation (Production Context)
In the VidAce launch beta test, about 35% of users turned out to use browser extensions like uBlock Origin and AdGuard. Because of this, every API call to the ad server (ad.vidace.com) was forcibly stopped at browser level with net::ERR_BLOCKED_BY_CLIENT.
// A critical failure!
AdService.fetchAd() → Error: net::ERR_BLOCKED_BY_CLIENT
Result: Promise.all() rejects, stopping even the main video stream loader!
User screen: frozen forever on a black screen!
Business team requirement: we can't lose paying viewers just because ads are blocked, so if an ad fails to load, within 3 seconds either replace it with our own house ad (public service ad or a VidAce original teaser) or go smoothly straight to the main video.
💡 Self-Reflection Questions
Without an ad-blocker detection library, how will you separate a plain fetch error (Failed to fetch) from other network errors?
When an ad fails, will you show a banner asking users to turn off their blocker, or quietly show your own replacement ad and keep playing? (Business vs UX trade-off)
How should you design a UX where, if the connection drops briefly during chunked streaming, the player doesn't crash and tries to reconnect automatically with Exponential Backoff?
🤖 Example AI question (reference prompt)
⚠️ This is a reference example: don't just copy the prompt below; talk with AI including the Fallback scenarios and error classification rules you thought of.
When an ad server fetch request in a web video player is blocked by AdBlock (ERR_BLOCKED_BY_CLIENT),
write a safe async error handler and retry logic so the main video doesn't stop,
and instead falls back to a local replacement ad or starts the main video right away.
🎯 Real Mission Tasks
1
Write a Fallback flowchart (fallback_flow.md)
Write a decision tree and UI state diagram for 4 states: normal ad → AdBlock blocked → network down → CDN failure.
2
Ad failure isolation and replacement ad renderer (ad_fallback_handler.js)
Isolate the catch block so ad API errors don't stop the whole player Promise, and write resilient code that guarantees a local replacement banner or immediate ad-free playback.
3
Build offline detection and a notice UI
Build a recovery UI linked to the window.navigator.onLine event that pauses playback and shows a 'Retrying network connection...' toast.
4
Revenue vs user experience trade-off analysis (ai_review.md)
Discuss with AI the drop-off from blocking AdBlock users (Anti-Adblock) versus the business pros and cons of switching to house ads, and record your final decision.
📊 Grading (50 pts):Async error isolation and no-freeze playback 15 ptsComplete Fallback branch flow 15 ptsNetwork retry backoff logic 10 ptsEvidence of business judgment and AI review 10 pts
DAY 7 • Assignment 1 (HW-D07-01)
HW-D07-01. Async Pipeline for Large Video Upload and Encoding
🚨 Real business situation (Production Context)
You must build a system in VidAce's creator studio to upload large 4K video files of 2–5GB. A single HTTP POST must restart from the beginning on browser timeout (30 sec) or network drop, so you chose 5MB Chunk multipart upload.
// Upload and encoding concurrency failures!
1. A creator clicked upload 3 times in a row, creating the same video 3 times
2. Mobile Wi-Fi dropped, Chunk #12 was sent twice and the file broke
3. The encoding-complete Webhook arrived twice because of network delay, so encoding was billed twice!
Task: introduce an Idempotency-Key to prevent duplicate requests, and build back-end business logic that checks a SHA-256 checksum after all chunks arrive and safely hands off to a background encoding worker.
💡 Self-Reflection Questions
How will you atomically check the client-generated upload_session_id and chunk number (chunk_index) in a database or in-memory store?
If the user closes the tab or the computer turns off during chunk upload, how will you automatically clean up (Garbage Collection) unfinished temporary chunk files after 24 hours?
How will you defend against race conditions that move backward to an earlier state in the encoding state transitions (UPLOAD_INIT → UPLOADING → COMPLETE → ENCODING → READY / FAILED)?
🤖 Example AI question (reference prompt)
⚠️ This is a reference example: don't copy the prompt below as-is; ask specifically, reflecting your language stack and idempotency store (Redis, PostgreSQL, etc.).
Design a back-end service class for a large video Chunk upload pipeline.
Check the Idempotency-Key and chunk_index sent by the client to prevent duplicate receipt,
and write logic that assembles the final file when all chunks arrive and queues the async encoding job only once.
🎯 Real Mission Tasks
1
Upload pipeline state transition spec (upload_state_spec.md)
Describe HTTP API specs, state transition conditions and idempotency header rules for each step: session creation, chunk sending, assembly and encoding done.
2
Build the upload domain service (UploadService.js or .py)
Write service code that stores chunks, identifies duplicate chunks, atomically increments the chunk count and guarantees a single encoding queue publish when the last chunk arrives.
3
Write file integrity checksum (SHA-256) logic
Write a function that, after merging all chunks, compares the hash given when the upload session started with the final file's hash.
4
Concurrency and idempotency report (ai_review.md)
Analyze with AI the Race Condition defects that can happen when the same chunk is sent many times at once, and record your reasons for the fix.
HW-D07-02. Abuse Detection (FDS) and Correcting Transactions
🚨 Real business situation (Production Context)
A VidAce settlement audit found suspicious signs: certain malicious creators ran headless browser (Puppeteer) botnets to repeatedly visit their own videos and watch ads, fraudulently collecting ₦15 million a month in payouts.
Check itemNormal user patternMacro bot abuse pattern
Minimum watch timeAd shown after 15+ seconds of real playbackAd impression event sent 1.2 seconds after entering the page
Repeat views from the same IPRe-watching the same video within 10 minutes isn't counted60 refreshes in a row in 1 minute from one IP
Mouse/touch interactionInteractions like volume changes and mouse moves recorded0 interaction events, requests at an unnaturally fixed interval
Platform accounting rule: if data already billed to advertisers or recorded in the creator payout ledger is removed with DELETE, it can't pass an audit. You must issue a negative entry through a Compensating Transaction.
💡 Self-Reflection Questions
How will you separate lag from regular users on slow networks from abnormal requests by malicious bots without False Positives?
How will you apply an in-memory Sliding Window algorithm so the FDS filter doesn't become a bottleneck on a real-time event stream (thousands per second)?
When fraud is confirmed, how should the accounting data model deduct (Clawback) already-paid payouts from next month's settlement?
🤖 Example AI question (reference prompt)
⚠️ This is a reference example: don't use the prompt below as-is; write in-depth questions including the bot detection parameters and accounting correction logic you thought of.
Write fraud detection (FDS) and accounting correction transaction code for a video ad platform.
1) Filtering that voids ad billing events for a 10-minute cooldown per IP and views under 15 seconds
2) For already-approved fraudulent payouts, build domain service and transaction logic
that issues negative correction entries without deleting ledger data.
🎯 Real Mission Tasks
1
Write FDS business rules and a detection matrix (fds_business_rules.md)
Specify normal viewing criteria (minimum watch time, interaction checks, cooldown) and a formula for a suspicion Risk Score (0–100).
2
Build a view validation engine (ViewValidator.js or .py)
Build validation middleware that receives playback request metadata, judges risk, and immediately blocks billing for abnormal requests.
3
Write a Compensating Transaction issuer
Build transaction code that creates an ADJUSTMENT_NEGATIVE entry for fraudulent payouts found in a later audit, while keeping the original ledger records.
4
Accounting integrity and AI audit report (ai_review.md)
Argue against the legal and accounting risks of the simple Hard Delete model AI suggested, and record the reasoning for finally choosing a double-entry correction model.
📊 Grading (50 pts):Precise FDS detection rules 15 ptsIntegrity of ledger correction transactions 15 ptsPreventing false positives and handling exceptions 10 ptsCritical AI audit and decisions 10 pts
DAY 8 • Assignment 1 (HW-D08-01)
HW-D08-01. Multi-Tenant Permission (RBAC/ABAC) Matrix and Guards
🚨 Real business situation (Production Context)
VidAce grew from a single-user service into a multi-tenant platform serving business MCN channels and agency advertisers. Now one user can belong to several channels, and permissions are split further within a channel:
Channel permission personas (Creator Team)
• OWNER (channel owner): delete the channel, change the payout account, invite members, full CRUD on all videos
• EDITOR (video editor): can edit/delete only videos they uploaded or are assigned (can't delete other editors' videos)
• ANALYST (data analyst): can only view viewing stats and ad revenue (no editing/deleting videos at all)
Security warning: if you only do a simple Role check (user.role === 'EDITOR'), you're wide open to BOLA (Broken Object Level Authorization / IDOR) attacks, where an attacker changes the video_id in the request body to another channel's video ID and deletes it without permission.
💡 Self-Reflection Questions
How will you combine simple role-based access control (RBAC) with attribute-based access control (ABAC), which also checks resource ownership and channel membership, into a single guard middleware?
If every API request queries the DB to check permissions, how will you ease the DB bottleneck with caching (Redis, JWT Claims) while still reflecting revoked permissions immediately?
How should security responsibility be split between hiding unauthorized buttons in the client UI (Frontend Guard) and returning 403 Forbidden from the back end?
🤖 Example AI question (reference prompt)
⚠️ This is a reference example: make your question specific with a middleware format for your back-end framework (Express, NestJS, FastAPI, etc.) and BOLA defense scenarios.
Design back-end Authorization guard middleware for a multi-tenant video platform.
Write complete code that defends against BOLA (IDOR) attacks by checking not only the user's global Role
but also their role within a specific channel (OWNER, EDITOR, ANALYST)
and the video resource's ownership (resource.channel_id === request.channel_id).
🎯 Real Mission Tasks
1
Role-Permission Matrix doc (role_permission_matrix.md)
Write an allow/deny matrix for 15 core API endpoints for the 4 roles (VIEWER, CREATOR, ADVERTISER, ADMIN) and the 3 channel member sub-roles.
2
Build RBAC + ABAC authorization middleware (auth_guard.js or .py)
Build a guard function that parses the user ID from the JWT, checks the channel ID and ownership of the target resource (video, payout account, etc.) in the DB/cache, and controls permissions.
3
Write 5 BOLA (IDOR) penetration test cases
Write 5 unauthorized attack scenarios — like an editor trying to delete another channel's video, or an analyst trying to change the payout account — and code that checks for a 403 response.
4
AI security review and privilege theft defense report (ai_review.md)
Point out parameter tampering blind spots easy to miss in AI's draft, and record the check rules you added.
HW-D08-02. Preventing OAuth2 Token Theft and a Session Security Audit
🚨 Real business situation (Production Context)
After VidAce introduced Google and Facebook social login, an outside security audit reported these critical session weaknesses:
[CRITICAL 1] JWT Refresh Token stored in LocalStorage: one line of XSS attack script can leak a user's long-lived token to a hacker's C2 server.
[CRITICAL 2] No Refresh Token reuse detection: even if a hacker uses a leaked token to get a new Access Token, the real user never learns the session was hijacked.
[HIGH 3] Weak OAuth2 CSRF defense: missing state parameter checks when exchanging the Auth Code allow account linking to be hijacked.
Fix required: use HttpOnly, Secure, SameSite=Strict cookies, discard the old token each time a Refresh Token is renewed, and if an already-used token is submitted again, treat it as a breach and force-expire all sessions for that account (Family Invalidation) — an RTR (Refresh Token Rotation) architecture.
💡 Self-Reflection Questions
When the SPA and back-end API server are on different domains (api.vidace.com vs www.vidace.com), how must SameSite cookies and CORS be set so cookies aren't lost?
How do you handle a grace period (10 seconds) so a normal client that accidentally sends the previous token twice due to mobile network delay during rotation doesn't get its session cut by a false positive?
When storing a session revocation list in Redis, what technique matches the token's remaining expiry (TTL) to reduce wasted memory?
🤖 Example AI question (reference prompt)
⚠️ This is a reference example: don't copy and submit the prompt below. Build your own prompt that covers token family management and anomaly detection in detail.
Build security-hardened JWT Refresh Token Rotation (RTR) service code.
1) Issue tokens with HttpOnly/Secure cookies
2) On renewal, invalidate the old Refresh Token and issue a new token family (Family ID)
3) Include logic that detects a breach when an already-used, discarded token is resent, and immediately invalidates all of that user's active sessions.
🎯 Real Mission Tasks
1
Security audit and threat modeling report (security_audit_report.md)
Write a comparison table of security weaknesses by token storage location (LocalStorage vs Memory vs HttpOnly Cookie) and attack vector scenarios.
2
Build the Refresh Token Rotation service (token_service.js or .py)
Write back-end code that manages Token Families, rotates tokens, and revokes all of an account's sessions (Session Revocation) when reuse is detected.
3
Build OAuth2 State / PKCE authorization checks
Write state and PKCE hash check routines that block CSRF attacks and auth code theft when handling social login callbacks.
4
AI security review and final architecture decision (ai_review.md)
Evaluate the performance/operations limits (like Redis memory load) of AI's suggested token security methods for real production, and describe the reasons for your adjustments.
📊 Grading (50 pts):Depth of threat modeling report 15 ptsRTR and token family expiry code 15 ptsCSRF/PKCE defense logic 10 ptsChecking AI security advice and judgment 10 pts
You must build a checkout system for VidAce where business advertisers top up a ₦10 million video ad campaign budget by credit card. Payments tie directly to company revenue, so not a single error is allowed.
// Possible payment incidents!
1. [Amount tampering]: in the client's developer tools, change the payment amount from ₦10,000,000 to ₦1,000, then open the PG payment pop-up
2. [Double payment]: clicking approve repeatedly causes 2 card approvals for the same order
3. [Missing payment]: PG approval succeeded, but the network dropped right before saving to the server DB, leaving the advertiser balance at ₦0 and stopping the ads
System requirements: complete a pipeline that 1) records the expected payment amount on the back end when the order is created, 2) checks payment amount integrity server-to-server when requesting PG approval, and 3) completely blocks double payments with an Idempotency-Key.
💡 Self-Reflection Questions
Why must you never trust the payment amount sent by the client, and how should you compare it with the order amount in the server DB right before calling the PG approval API?
When the same advertiser sends duplicate requests for the same order within 1 second, how will you combine a DB-level Unique constraint and a Redis lock?
If payment approval finished but publishing the advertiser balance top-up event failed, will you roll back the transaction or hand it to a retry queue?
🤖 Example AI question (reference prompt)
⚠️ This is a reference example: don't just ask for PG payment code; include detailed conditions that force amount tampering checks and idempotency.
Write a checkout back-end service that prevents amount tampering and guarantees idempotency when integrating PG payments.
1) Create the order and amount on the server before client payment (Order Create)
2) Before calling PG approval (Confirm), check that the server order ledger amount matches the PG request amount
3) Include preventing duplicate approval with an Idempotency-Key and topping up the balance inside a transaction.
🎯 Real Mission Tasks
1
Write a checkout sequence diagram (payment_pipeline.md)
Fully visualize the payment request, amount check, approval and balance update flow between the browser, VidAce back end and PG server as a Mermaid sequence diagram.
2
Build the core checkout service class (CheckoutService.js or .py)
Write code that handles payment Prepare, amount check and approval (Confirm), and ad budget ledger recording (Credit Deposit) as an atomic transaction.
3
Write test cases against amount tampering and double payment
Build test code that immediately rejects requests with the amount changed by even ₦1, and duplicate approval attempts with the same idempotency key.
4
AI review of financial transaction reliability (ai_review.md)
Check the transaction Isolation Level and deadlock risk of AI's suggested payment code, and describe how you improved it.
📊 Grading (50 pts):Sequence diagram and design completeness 15 ptsAmount tampering prevention and idempotency code 15 ptsTransaction atomicity and exception tests 10 ptsEvidence of AI payment review and decisions 10 pts
DAY 9 • Assignment 2 (HW-D09-02)
HW-D09-02. Payment Timeout Compensating Transactions (Saga) and Settlement Reconciliation
🚨 Real business situation (Production Context)
On a big promotion day, a sudden traffic surge hit the PG network, and after VidAce's server called the PG approval API it got HTTP 504 Gateway Timeout. Not knowing whether it was approved, VidAce marked the order 'failed', but in reality ₦5 million was successfully charged to the advertiser's card — a Ghost Transaction.
StateVidAce databasePG's real ledger
Timed-out transactionOrder status: PAYMENT_PENDING or FAILEDPayment status: SUCCESS (card approved)
What the advertiser sees"Payment failed" screen shownSMS on their phone: "₦5,000,000 payment complete"
Recovery requirement: since two-phase commit (2PC) isn't possible in a distributed setup, build Saga compensating transactions and a Reconciliation Worker running every 5 minutes that automatically detects mismatches and either cancels the payment or safely credits the balance.
💡 Self-Reflection Questions
When a timeout happens, should you request card approval cancellation right away, or first call the PG status lookup API to check the state?
What 'confirming approval' state will you show on screen to stop the advertiser complaining to support or paying again before the reconciliation batch runs?
When the network to the PG is completely down and even the cancel API fails, how will you design a fallback that puts it in a Dead Letter Queue (DLQ) and sends an operator alert (Slack/SMS)?
🤖 Example AI question (reference prompt)
⚠️ This is a reference example: ask AI including the distributed transaction recovery algorithm and Reconciliation interval conditions you came up with.
Design Saga compensating transactions and a reconciliation worker that recover ghost payment mismatches when payment approval times out.
1) Periodically check PENDING payments with the PG transaction lookup API
2) Auto-top-up the ad budget for approved payments; confirm unapproved ones as failed
3) Write logic that runs a PG automatic cancellation (Compensating Cancel) for cases that can't be processed due to system errors.
🎯 Real Mission Tasks
1
Write a payment recovery state machine (payment_recovery_state.md)
Describe a state transition diagram for PENDING, CONFIRMING, TIMEOUT, AUTO_RECONCILED and COMPENSATING_CANCELLED, and a timeout threshold policy.
2
Build the reconciliation worker (PaymentReconciliationWorker.js or .py)
Write batch code that looks up payments PENDING for 5+ minutes, compares them with the PG status lookup API, and auto-tops-up or compensates-cancels depending on whether they match.
3
Write a DLQ (Dead Letter Queue) and failure alert handler
Build an exception handler that sends the error payload to the admin dashboard for manual action after 3 failed retries.
4
AI audit report on distributed transaction consistency (ai_review.md)
Point out the blind spots of the simple Retry approach AI suggested, and argue by comparison why adopting Saga compensating transactions is justified.
📊 Grading (50 pts):Consistent recovery state machine design 15 ptsReconciliation worker and compensating cancel code 15 ptsDLQ and exception alert system 10 ptsCritical AI review of distributed transactions 10 pts
DAY 10 • Assignment 1 (HW-D10-01)
HW-D10-01. Company-Wide Core E2E Integration QA and Launch Readiness Review
🚨 Real business situation (Production Context)
VidAce global launch, D-3. Every team's individual features (FE screens, upload encoding, member permissions, PG payment) are done, but the company-wide End-to-End business loop where they all connect hasn't been checked yet.
Core business loop (Core Loop):
[Advertiser] sign up → top up a ₦10 million budget → create a video ad campaign →
[Creator] upload a 4K video and finish encoding → turn on ad monetization →
[Viewer] play the video → skip after 5 seconds of ad → publish a view-complete event →
[Platform] deduct one impression fee (₦200) from the advertiser budget → credit the share (₦140) to the creator payout ledger
Launch decision responsibility: to pass the Go / No-Go Decision Gate that gives final approval for production deployment on launch day, set criteria for zero Blocker / Critical defects and automated E2E test scripts.
💡 Self-Reflection Questions
Even with 100% of Unit Tests passing, why might things fail in a real browser because of payment pop-up blocking or third-party cookie policies?
Where is the line between 'P0 (Blocker)' scenarios that must pass on launch day and 'P2 (Minor)' defects that can be hotfixed after launch?
How will you switch between Sandbox mode and Mock payments so running E2E tests doesn't charge the real PG?
🤖 Example AI question (reference prompt)
⚠️ This is a reference example: design your question specifically, reflecting your E2E automation tool (Playwright, Cypress, etc.) and launch criteria.
Write company-wide core E2E integration test scenarios and a Launch Readiness checklist for launching a video and ad platform.
Write the core flow of a Playwright automated test script for the whole business loop,
from advertiser budget top-up to creator video upload, viewer playback and ad cost deduction/payout.
🎯 Real Mission Tasks
1
Company-wide E2E test scenario spec (e2e_test_scenarios.md)
State 5 critical user journeys where viewer, creator, advertiser and admin roles interact, with preconditions, test steps and expected results.
2
Launch Readiness Checklist & Go/No-Go table (launch_readiness_checklist.md)
Write 20 check items covering features, security, performance and operations, and a launch approve/hold decision matrix.
3
Core business loop E2E automation script (e2e_core_flow.spec.js)
Build an automation script with Playwright/Cypress or a similar framework that checks video playback → ad impression → payout event publishing.
4
AI QA feedback and launch risk assessment (ai_review.md)
Record the results of further checking real-world edge cases missing from AI's optimistic test scenarios (cookie blocking, network throttling, etc.).
📊 Grading (50 pts):Complete E2E business loop scenarios 15 ptsClear Launch Readiness criteria 15 ptsRunnable E2E automation script 10 ptsChecking AI QA advice and risk analysis 10 pts
DAY 10 • Assignment 2 (HW-D10-02)
HW-D10-02. Circuit Breaker & Zero-Downtime Rollback for Large Traffic Failures
🚨 Real business situation (Production Context)
At 8 p.m. on launch day, a big creator's exclusive new video was released and concurrent users spiked to 150,000. The AI personalized recommendation server and targeted ad server response times shot past 8 seconds, the back-end API thread pool ran out, and you faced a blackout where even the core video streaming API went down in a chain (Cascading Failure).
// A cascading failure architecture flaw!
Video detail page call → AdService.getAd() waits 8 sec → RecommendationService waits 8 sec
Result: all API threads that return video playback URLs are stuck waiting on Timeouts,
so users can't play videos at all — the whole service is down!
Operations recovery requirement: when a subsystem's (ads/recommendations) error rate goes over 50% or responses exceed 1 second, immediately open the Circuit Breaker to block ad calls and do Graceful Degradation to default cached videos. You also need a zero-downtime rollback runbook to return to the previous version within 1 minute without DB loss when a bug is found in a new version.
💡 Self-Reflection Questions
In the circuit breaker's 3 states (Closed, Open, Half-Open), what share of trial requests will you let through when switching to the recovery state (Half-Open)?
When rolling back a version that includes a database schema migration (e.g. dropping or changing a column), what Expand/Contract deployment strategy keeps backward compatibility so the old app doesn't break?
How should you set automated Health Check probe criteria so the ops team can roll back within 3 minutes of a failure on launch day without panicking?
🤖 Example AI question (reference prompt)
⚠️ This is a reference example: don't copy the prompt below; ask specifically, reflecting your architecture stack and circuit breaker Failure Threshold.
Write circuit breaker (Closed, Open, Half-Open) middleware code that stops outside ad/recommendation API failures
from spreading to main video streaming during a big traffic surge.
Include Fallback logic that returns default cached data right away if there's no response within 1 second,
and an SRE runbook that does a zero-downtime rollback within 1 minute when a canary deployment fails.
🎯 Real Mission Tasks
1
Circuit breaker & isolation architecture doc (circuit_breaker_architecture.md)
Describe the structure that blocks failure spread, the circuit state machine (Closed → Open → Half-Open), failure rate thresholds and the Fallback default policy.
2
Build circuit breaker middleware (CircuitBreaker.js or .py)
Write resilient code that measures failure rate/timeout frequency in a set time window, opens the circuit, and immediately returns local default cached data when an outside service is blocked.
3
Write a zero-downtime rollback runbook (zero_downtime_rollback_runbook.md)
Write rollback steps that immediately switch traffic to the previous stable version in Kubernetes/cloud when Health Checks fail, and a guide to keeping DB backward compatibility.
4
AI check of SRE resilience and chaos engineering analysis (ai_review.md)
Have AI simulate a scenario where the ad server is forced down, and record the results confirming main streaming continues without interruption.
📊 Grading (50 pts):Circuit breaker architecture and Fallback 15 ptsResilience implementation code 15 ptsEffectiveness of the zero-downtime rollback runbook 10 ptsAI chaos test checks and judgment 10 pts