AI-Powered Full Stack Tutorial 0/70 lessons ~6 min read Lesson 68

    Project 5: Production-Ready AI Full-Stack Platform

    Launch week put five TechLearningPro products in one browser: the lesson player, the tutor, the knowledge assistant, the operations reminder, and the document cabinet.

    Course progress0%
    Focus
    24 guided sections
    Practice signal
    Examples included
    Career prep
    Interview Q&A included

    AI-Powered Full Stack Development · Lesson 68 · Production AI Products, Capstones and Career Readiness

    Lesson Overview

    Launch week put five TechLearningPro products in one browser: the lesson player, the tutor, the knowledge assistant, the operations reminder, and the document cabinet. Each had shipped in its own package with its own rules. The demo compose file called five model hosts, stored two provider credentials in a shared .env that a pull request almost committed, and let the tutor route import the completion writer "just for this cohort." When the provider timed out during an enrollment spike, the player spinner waited on the tutor. The Monday board then showed completions that existed only in a draft.

    Project 5 is the platform that makes those products one system. Modules 1 through 5 already defined the player, the model port, retrieval, the agent, identity, tests, and deploy. Lessons 59 through 63 add observability, cost, jobs, cache, and resilience. Projects 1 through 4 are the product surfaces. This lesson does not rebuild them. It registers each surface with a trust class, a timeout, a budget key, a fallback, and a flag, then fails readiness when any registration would let model output write lesson_progress or when a secret would ship to the browser.

    Planning assumptions:

    • One API process hosts the routes. Workers run extraction and reminders off the player request.
    • The lab uses an in-memory registry and a fake model port. No live key and no cloud account.
    • Illustrative timeouts (player 300 ms for facts, tutor 8 s, jobs unbounded on the request) are design ratios. Replace them with measured budgets before production.
    • A kill switch is per surface. Stopping the tutor does not stop reading.
    • Synthetic tenants are Northwind and Contoso. Fixtures share no credentials.

    You will leave with assessReadiness and a route map you can defend in the system-design lesson that follows.

    Learning Objectives

    By the end of this lesson you will be able to:

    1. Name the five surfaces and the trust class of each: fact, draft, grounded read, side effect, and extract.
    2. Explain why they share identity, tenant scope, a model port, and a budget, and why they do not share a write path.
    3. Register a surface with auth, tenant scope, timeout, budget key, fallback, and writesProgress.
    4. Fail readiness when a draft, a grounded read, or an extract surface sets writesProgress.
    5. Fail readiness when a side effect has no approval step or no idempotency key.
    6. Fail readiness when secretPlacement is anything other than server.
    7. Keep the player available when the tutor, the assistant, the reminder, or extraction is flagged off.
    8. Place model calls for documents and reminders on workers, and keep fact reads on the request.
    9. Attach a trace field set that omits prompts, file bytes, and message bodies.
    10. State the degraded response for a provider outage per surface.
    11. Point each rule at the earlier lesson that remains the authority for that rule.
    12. Refuse a shared cache key that omits tenant id or prompt version.
    13. Describe a rollout that enables one tenant and one surface at a time.
    14. Hand a design interview a single diagram with trust boundaries drawn.
    15. List the production checklist a reviewer can mark without running the product.

    Prerequisites

    What is the Production-Ready AI Full-Stack Platform?

    The platform is the TechLearningPro learning product as one deployable system: a browser, an API, workers, PostgreSQL, object storage, and a model port behind the API. Production-ready means each user-visible capability has an owner, a failure mode, a budget, and a test that the registration matches those rules. It does not mean every feature is finished. It means the ones you turn on cannot silently take the others down or rewrite facts.

    The purpose is launch control. Five correct packages can still form an unsafe product if the compose root wires them with a shared secret and a shared database write. The registry is that compose root, small enough to test.

    A platform exists because teams otherwise integrate by importing each other's services until the dependency graph is a circle. The registry is a list. The player does not import the reminder orchestrator. The reminder does not import the tutor. They meet at the process boundary and at PostgreSQL, under different tables.

    TermMeaning in this lesson
    SurfaceOne product capability with a route and a trust class
    Trust classfact, draft, grounded_read, side_effect, or extract
    RegistryThe list assessReadiness reads
    FallbackWhat the user still gets when this surface is off or failing
    Budget keyThe meter name from the cost lesson, unique per surface
    FlagA switch that stops this surface's model and side effects
    ReadinessA pass or a list of violations before traffic

    Why Do We Need It?

    text
    Five packages, five credentials, one completion writer
    |
    v
    Provider timeout stalls the player
    Draft text becomes a completion
    |
    v
    One registry: trust class, timeout, budget, fallback, flag
    |
    v
    Readiness fails closed
    The player still returns the checkpoint

    Benefits:

    • A reviewer can see every model call site on one page.
    • Disabling the tutor spends nothing and still serves the lesson.
    • Contoso and Northwind cannot share a cache entry or a job row.
    • Secrets stay in the server environment. The registry records that placement so a client bundle fails the check.
    • The next incident has a surface name, a budget key, and a fallback already written down.

    Real World Example

    A learner at Northwind opens a lesson. The player route is trust class fact. It reads lesson_progress for that tenant and user and returns the checkpoint in a few hundred milliseconds. It does not call the model. The tutor panel calls a second route, trust class draft, with an 8-second timeout. On timeout the panel hides and the lesson remains. The knowledge assistant is grounded_read: it may answer from pages the learner can access and must cite them, and it cannot mark the lesson complete. The instructor's reminder is side_effect: it pauses for approval and uses one idempotency key. The certificate upload is extract: it returns a job id.

    When the provider errors, readiness has already required a fallback for every non-fact surface. On-call flips tutor off. Player metrics stay flat. Document jobs sit in extract_failed until replay. No route writes a completion because the model said the learner understood the page.

    Google-scale products separate the document view from the assistant chip. Amazon-style order pages do not wait on a recommendation model to show the order. Netflix keeps playback independent of the row ranker. A bank shows the balance from the ledger when the explainer model is down. Microsoft 365 opens the file when the copilot pane times out. TechLearningPro's version is the lesson and the checkpoint, still there when every AI surface is dark.

    Internal Working

    1. Load the registry. An empty registry fails readiness. Shipping nothing is not a silent pass.
    2. Every surface must set auth: true, tenantScoped: true, a positive timeoutMs for request-bound work, a non-empty budgetKey, a non-empty fallback, and secretPlacement: "server".
    3. Trust class fact must set callsModel: false and may set writesProgress: true only for the player completion route. This lab's player surface reads progress and does not write it; the completion route is a separate fact surface if you add it.
    4. draft, grounded_read, and extract must set writesProgress: false. A violation is draft_writes_fact.
    5. side_effect must set requiresApproval: true and a non-empty idempotencyKey. Otherwise the violation is side_effect_uncontrolled.
    6. extract and side_effect must set runsOn: "worker". A model or mail call on the player request is blocks_player.
    7. Flags default off in the lab. isSurfaceOpen returns false when the flag is off or the tenant is not in enabledTenants.
    8. The player route does not consult other flags. Its handler returns the checkpoint even when every other surface is closed.
    9. Cache keys, when a surface sets them, must include tenantId and a version. The checker rejects a key template that lacks both.
    10. Traces may include surface id, tenant id, latency, token counts, and a reason code. The checker rejects a trace field named prompt, bytes, or body.

    Architecture

    flowchart TB
      subgraph browser [Browser]
        Player[Lesson player]
      end
    
      subgraph api [API process]
        Gate[Session and tenant]
        Reg[Surface registry]
        Facts[Player route]
        Drafts[Tutor and assistant routes]
      end
    
      subgraph workers [Workers]
        Jobs[Extract and reminder jobs]
      end
    
      subgraph data [Data]
        DB[(PostgreSQL)]
        Obj[(Object store)]
      end
    
      subgraph model [Model boundary]
        Port[ModelGateway]
      end
    
      Player --> Gate
      Gate --> Reg
      Reg --> Facts
      Reg --> Drafts
      Facts --> DB
      Drafts --> Port
      Jobs --> Port
      Jobs --> DB
      Jobs --> Obj
    text
    Browser
    -> session cookie only
    API
    -> registry lookup per route
    Fact route
    -> PostgreSQL checkpoint
    Draft and grounded routes
    -> ModelGateway or typed fallback
    Worker routes
    -> queue, then model or mail, then status row

    The provider credential is read by the model adapter inside the API and the worker. The registry's secretPlacement field is how readiness remembers that decision. A future route that sets browser fails the build.

    Deep Dive

    Trust classes are product law

    A trust class is not a folder name. It is the set of writes the surface is allowed to attempt.

    ClassExampleMay writeMust not write
    factPlayer checkpointProgress, via the completion serviceTutor prose
    draftTutor panelOptional non-authoritative draft rowcompleted_at
    grounded_readKnowledge assistantNothing about the learner's gradePassages the user cannot access
    side_effectCohort reminderAn approval ticket, then one sendA model-chosen recipient list
    extractDocument cabinetA job, then a reviewed recordScores and roles

    If two classes need the same table, they need different columns and different writers. Sharing lesson_progress because it was convenient is the launch bug.

    Readiness is a test, not a slide

    assessReadiness runs in unit tests and in CI beside the contract tests from CI/CD for AI-Powered Full-Stack Applications. A registry edit that sets writesProgress: true on the tutor fails the pipeline with draft_writes_fact. That is cheaper than a Monday board incident. The function does not call a model and does not need a secret.

    Flags and tenants

    enabledTenants is how Northwind can use document intake while Contoso cannot. The flag is not a substitute for authorization. A tenant on the list still passes through the session check inside the surface package. Taking a tenant off the list stops new model spend for that surface. It does not delete jobs or tickets. The runbook says which route still drains an approved reminder.

    Degraded modes you can say out loud

    SurfaceProvider downUser sees
    PlayerUnaffected if the database is upThe lesson and the checkpoint
    TutorTimeout or flag offLesson without the panel
    AssistantTimeout or empty retrieval"No grounded answer" and the lesson
    Remindermodel_unavailable or flag offNo new ticket; existing tickets stay
    Documentsextract_failedThe file, no new fields

    There is no mode in which the tutor's fallback text is written as completion.

    Observability without the prompt

    Each surface emits the meters from the observability lesson: latency, errors, and for model surfaces, token counts and the budget key. The platform adds surface as a dimension so a tutor incident is not paged as a player incident. Field lists are allow-listed in the registry so a new log line that includes prompt fails readiness.

    Code Examples

    Files belong in packages/platform/src/. Surfaces from earlier packages are described, not imported, so this lesson stays runnable with Node's test runner and no network.

    Simple example: one surface, fully named

    packages/platform/src/types.ts

    typescript
    export type TrustClass = "fact" | "draft" | "grounded_read" | "side_effect" | "extract";
    export type SecretPlacement = "server";
    export type RunOn = "request" | "worker";
    export interface Surface {
    id: "player" | "tutor" | "assistant" | "reminder" | "documents";
    trust: TrustClass;
    /** Session required. A false value fails readiness. */
    auth: boolean;
    tenantScoped: boolean;
    callsModel: boolean;
    writesProgress: boolean;
    requiresApproval: boolean;
    /** Required when trust is side_effect. Example: idem_${runId}. */
    idempotencyKey: string;
    timeoutMs: number;
    budgetKey: string;
    fallback: string;
    runsOn: RunOn;
    secretPlacement: SecretPlacement;
    /** Template must include tenantId and a version when non-empty. */
    cacheKeyTemplate: string;
    traceFields: string[];
    enabledTenants: string[];
    flag: boolean;
    }
    export interface Readiness {
    ok: boolean;
    violations: string[];
    }

    SecretPlacement has one member on purpose. A "browser" alternative would need a cast to compile, and the checker still rejects anything that is not "server".

    Intermediate example: the launch registry

    packages/platform/src/registry.ts

    typescript
    import type { Surface } from "./types.js";
    const TRACE = ["surface", "tenantId", "latencyMs", "tokens", "reason"];
    export const PLATFORM: Surface[] = [
    {
    id: "player",
    trust: "fact",
    auth: true,
    tenantScoped: true,
    callsModel: false,
    writesProgress: false,
    requiresApproval: false,
    idempotencyKey: "",
    timeoutMs: 300,
    budgetKey: "player_read",
    fallback: "Show the last checkpoint or a typed error",
    runsOn: "request",
    secretPlacement: "server",
    cacheKeyTemplate: "",
    traceFields: ["surface", "tenantId", "latencyMs", "reason"],
    enabledTenants: ["northwind", "contoso"],
    flag: true,
    },
    {
    id: "tutor",
    trust: "draft",
    auth: true,
    tenantScoped: true,
    callsModel: true,
    writesProgress: false,
    requiresApproval: false,
    idempotencyKey: "",
    timeoutMs: 8_000,
    budgetKey: "tutor_draft",
    fallback: "Hide the tutor panel",
    runsOn: "request",
    secretPlacement: "server",
    cacheKeyTemplate: "tutor:{tenantId}:{promptVersion}:{lessonId}",
    traceFields: TRACE,
    enabledTenants: ["northwind"],
    flag: true,
    },
    {
    id: "assistant",
    trust: "grounded_read",
    auth: true,
    tenantScoped: true,
    callsModel: true,
    writesProgress: false,
    requiresApproval: false,
    idempotencyKey: "",
    timeoutMs: 8_000,
    budgetKey: "assistant_read",
    fallback: "No grounded answer",
    runsOn: "request",
    secretPlacement: "server",
    cacheKeyTemplate: "rag:{tenantId}:{indexVersion}:{queryHash}",
    traceFields: TRACE,
    enabledTenants: ["northwind"],
    flag: true,
    },
    {
    id: "reminder",
    trust: "side_effect",
    auth: true,
    tenantScoped: true,
    callsModel: true,
    writesProgress: false,
    requiresApproval: true,
    idempotencyKey: "idem_${runId}",
    timeoutMs: 20_000,
    budgetKey: "reminder_workflow",
    fallback: "Leave the existing ticket; do not send",
    runsOn: "worker",
    secretPlacement: "server",
    cacheKeyTemplate: "",
    traceFields: TRACE,
    enabledTenants: ["northwind"],
    flag: false,
    },
    {
    id: "documents",
    trust: "extract",
    auth: true,
    tenantScoped: true,
    callsModel: true,
    writesProgress: false,
    requiresApproval: true,
    idempotencyKey: "idem_${jobId}",
    timeoutMs: 60_000,
    budgetKey: "doc_extract",
    fallback: "Keep the object; status extract_failed",
    runsOn: "worker",
    secretPlacement: "server",
    cacheKeyTemplate: "",
    traceFields: TRACE,
    enabledTenants: ["northwind"],
    flag: false,
    },
    ];

    The reminder and the cabinet start flagged off. Review on documents is the approval step: no field becomes a record until a person accepts it. The player flag defaults on because reading is the product.

    Enterprise example: readiness and the player path

    packages/platform/src/readiness.ts

    typescript
    import type { Readiness, Surface } from "./types.js";
    const FORBIDDEN_TRACE = new Set(["prompt", "bytes", "body", "secret", "apiKey"]);
    export function assessReadiness(surfaces: Surface[]): Readiness {
    const violations: string[] = [];
    if (surfaces.length === 0) violations.push("empty_registry");
    const ids = new Set<string>();
    for (const surface of surfaces) {
    if (ids.has(surface.id)) violations.push(`duplicate:${surface.id}`);
    ids.add(surface.id);
    if (!surface.auth) violations.push(`no_auth:${surface.id}`);
    if (!surface.tenantScoped) violations.push(`no_tenant:${surface.id}`);
    if (!surface.budgetKey) violations.push(`no_budget:${surface.id}`);
    if (!surface.fallback) violations.push(`no_fallback:${surface.id}`);
    if (surface.secretPlacement !== "server") violations.push(`secret_placement:${surface.id}`);
    if (surface.timeoutMs <= 0) violations.push(`timeout:${surface.id}`);
    if (
    (surface.trust === "draft" || surface.trust === "grounded_read" || surface.trust === "extract") &&
    surface.writesProgress
    ) {
    violations.push(`draft_writes_fact:${surface.id}`);
    }
    if (surface.trust === "fact" && surface.callsModel) {
    violations.push(`fact_calls_model:${surface.id}`);
    }
    if (surface.trust === "side_effect" && (!surface.requiresApproval || !surface.idempotencyKey)) {
    violations.push(`side_effect_uncontrolled:${surface.id}`);
    }
    if ((surface.trust === "side_effect" || surface.trust === "extract") && surface.runsOn !== "worker") {
    violations.push(`blocks_player:${surface.id}`);
    }
    if (surface.cacheKeyTemplate && !surface.cacheKeyTemplate.includes("{tenantId}")) {
    violations.push(`cache_tenant:${surface.id}`);
    }
    if (surface.cacheKeyTemplate && !/version|Version/.test(surface.cacheKeyTemplate)) {
    violations.push(`cache_version:${surface.id}`);
    }
    for (const field of surface.traceFields) {
    if (FORBIDDEN_TRACE.has(field)) violations.push(`trace_field:${surface.id}:${field}`);
    }
    }
    if (!ids.has("player")) violations.push("missing_player");
    return { ok: violations.length === 0, violations };
    }
    export function isSurfaceOpen(surface: Surface, tenantId: string): boolean {
    return surface.flag && surface.enabledTenants.includes(tenantId);
    }
    export interface Checkpoint {
    lessonId: string;
    completed: boolean;
    }
    /** Fact path. Ignores model flags on purpose. */
    export function readCheckpoint(
    tenantId: string,
    lessonId: string,
    rows: Checkpoint[],
    player: Surface,
    ): { ok: true; checkpoint: Checkpoint | undefined } | { ok: false; reason: "surface_closed" | "unauthorized" } {
    if (!tenantId) return { ok: false, reason: "unauthorized" };
    if (!isSurfaceOpen(player, tenantId)) return { ok: false, reason: "surface_closed" };
    return { ok: true, checkpoint: rows.find((row) => row.lessonId === lessonId) };
    }

    A test builds PLATFORM, expects ok: true, then clones the tutor with writesProgress: true and expects draft_writes_fact:tutor. Another clones the reminder with runsOn: "request" and expects blocks_player:reminder. A third calls readCheckpoint while the tutor flag is off and still receives the row. None of these tests read an environment variable named like a secret.

    Architecture Diagram

    text
    Registry
    |
    +-- player -------- request -- PostgreSQL checkpoint
    |
    +-- tutor --------- request -- ModelGateway -- or hide panel
    |
    +-- assistant ----- request -- retrieval + ModelGateway -- or no answer
    |
    +-- reminder ------ worker --- template id, approval, one send
    |
    +-- documents ----- worker --- job, schema, review, record
    Readiness
    auth, tenant, server secret, timeout, budget, fallback
    no draft/extract/read writes progress
    side effects approve and use an idempotency key
    workers for mail and extraction
    cache keys carry tenant and version
    traces omit prompt, bytes, body
    sequenceDiagram
      participant Learner
      participant API
      participant DB
      participant Model
      Learner->>API: GET lesson
      API->>DB: checkpoint for session tenant
      DB-->>Learner: lesson and checkpoint
      Learner->>API: POST tutor
      API->>Model: draft with timeout
      alt timeout or flag off
        API-->>Learner: panel hidden
      else ok
        API-->>Learner: draft text
      end

    The completion POST, when you add it, is a third arrow into PostgreSQL that the tutor sequence never joins.

    Real-Time Enterprise Example

    The API process constructs the registry at boot and runs assessReadiness before it listens. A violation refuses to boot. Northwind's learner gets the player because player.enabledTenants includes northwind and the flag is on. The tutor calls the model port with the server credential injected from the secret store. Contoso is not in tutor.enabledTenants, so Contoso's panel does not spend tokens, and Contoso's checkpoint still loads.

    On-call sees tutor_draft token errors rise. They set the tutor flag off. readCheckpoint is unchanged. Reminder stays off until a support lead is ready; an approved ticket still drains on the Lesson 45 route, and the runbook says so. Document jobs already in needs_review stay reviewable. New uploads stop while the flag is off.

    Challenge: enrollment week, provider outage, and a double-clicked reminder. The player timeout stays 300 ms and does not include the model. The tutor returns the fallback inside 8 seconds. The reminder worker does not mint a second idempotency key. You do not point the player at a backup model to "keep the AI feeling alive."

    Performance Optimization

    Fact reads stay small: identity check, one indexed progress query, no model, no object store. Tutor and assistant timeouts are budgets, not hopes. Streaming from Streaming AI Responses with Server-Sent Events can paint tokens inside that budget. It must not start a write. Cache templates that include tenant and version avoid stampedes across tenants and avoid serving doc-fields-v1 output after you shipped v2.

    Workers scale separately from the API. A document backlog adds consumers. It does not add player replicas for a CPU problem the player does not have. Cost is the sum of budget keys. The platform does not hide spend inside a single "AI" meter, because you cannot disable what you cannot name.

    Connection pools, page caps, and queue depth belong to the lessons that own those resources. This registry points at them with budgetKey and runsOn. It does not reimplement the pool.

    Security

    • Authentication. Every surface sets auth. The player returns unauthorized without a tenant. How the cookie is issued stays in Lesson 48.
    • Authorization. Each package keeps its role checks. The registry cannot grant a learner the reminder route by setting a flag.
    • Tenant. tenantScoped is mandatory. Cache templates without {tenantId} fail readiness. Queries still need the predicate from Lesson 49. The checker does not prove the SQL.
    • Secrets. secretPlacement: "server" is the only legal value. Source control holds the registry, not the credential. A .env with a live key is a mistake the secrets lesson already forbids.
    • Writes. Draft, read, and extract cannot set writesProgress. Side effects need approval and an idempotency key.
    • Traces. Forbidden field names fail the build so prompts and files do not land in the log vendor.
    • OWASP. Broken access control and security misconfiguration show up as flags that skip auth, secrets in the client, and shared caches. Unrestricted resource consumption shows up as a missing budget key or a model call on the player path.

    Prompt injection inside a document is still Project 4's problem. The platform's job is to make sure that package cannot reach the completion writer even if the model is persuaded.

    Common Mistakes

    1. Importing the completion writer into the tutor. Symptom: drafts become completions. Cause: one service "handled learning." Fix: writesProgress false, and no import.
    2. One provider key in the frontend env. Symptom: the credential is in the bundle and in git history. Cause: a demo called the host from the browser. Fix: secretPlacement server, and rotate the leaked key.
    3. Waiting on the tutor before painting the lesson. Symptom: a provider outage is a player outage. Cause: one request did both. Fix: fact route first, draft route second, with its own timeout.
    4. A global kill switch. Symptom: maintenance mode hides lessons. Cause: one flag wrapped the process. Fix: per-surface flags. The player stays on.
    5. Cache key lessonId only. Symptom: Contoso sees Northwind's tutor text. Cause: the template omitted the tenant. Fix: readiness violation cache_tenant.
    6. Reminder on the request thread. Symptom: the API blocks on approval that takes hours. Cause: runsOn: "request". Fix: blocks_player fails the check. Return a job or a ticket.
    7. Logging the prompt to debug a launch. Symptom: lesson text in the log vendor. Cause: prompt was added to traceFields. Fix: the forbidden-field check.
    8. Enabling every tenant on day one. Symptom: a bad prompt ships to all customers. Cause: enabledTenants copied the player list onto the tutor. Fix: Northwind first, then expand.
    9. Treating readiness as documentation. Symptom: the wiki says the tutor cannot write progress, and the code does. Cause: the registry was a slide. Fix: CI runs assessReadiness.
    10. Booting with an empty registry in a test harness that production inherited. Symptom: all routes 404 or, worse, a default route calls the model. Cause: empty was treated as pass. Fix: empty_registry fails.
    11. Sharing one budget key. Symptom: document extraction spends the tutor's money and nobody can tell. Cause: every surface used ai. Fix: a key per surface.
    12. Retrying a side effect with a new idempotency key during the outage. Symptom: two emails. Cause: the platform "helped" by minting keys. Fix: the surface package owns the key. The registry only requires that it exists.

    Best Practices

    1. Keep one registry the process boots with.
    2. Run assessReadiness in CI and before listen.
    3. Give every surface a trust class.
    4. Require auth and tenant scope on every row.
    5. Keep the player free of model calls.
    6. Forbid writesProgress on draft, grounded read, and extract.
    7. Require approval and an idempotency key for side effects.
    8. Run mail and extraction on workers.
    9. Write a fallback sentence that a UI can implement.
    10. Use a distinct budget key per surface.
    11. Place secrets on the server and make the type say so.
    12. Include tenant and version in any cache template.
    13. Allow-list trace fields. Ban prompt, bytes, body, and secrets.
    14. Default new AI surfaces to flag off.
    15. Enable a single tenant before the rest.
    16. Leave role rules inside the surface package.
    17. Do not import the completion writer from AI packages.
    18. Page on the surface dimension, not on a blended "API" error rate alone.
    19. Keep draining rules for approved tickets in the runbook.
    20. Test the violation strings, not only the happy registry.
    21. Refuse to boot on violation.
    22. Point each surface at the lesson that owns its internal rules.

    Interview Questions & Answers

    Beginner

    1. What is a surface?
      One product capability with a route, a trust class, and a written fallback. The lesson player, the tutor, the assistant, the reminder, and the document cabinet are the five in this launch.

    2. Why does the player avoid the model?
      Reading the lesson and the checkpoint must work when the provider is down. Model calls have their own timeout and their own flag.

    3. What does readiness fail on first?
      A draft, grounded read, or extract surface that writes progress; a side effect without approval; a secret that is not on the server; a missing player.

    Intermediate

    1. What does the learner see if the tutor times out?
      The lesson and the checkpoint. The tutor panel hides. Nothing is written to lesson_progress.

    2. Why are reminder and documents flagged off in the lab registry?
      Side effects and extraction need a tenant-by-tenant enablement. The player is the default product. New spend starts dark.

    3. How does Contoso avoid Northwind's cached tutor text?
      The cache template includes {tenantId}. A template without it fails readiness. The query path still filters by tenant inside the package.

    Senior

    1. How do you test the platform without five live vendors?
      Test assessReadiness against PLATFORM and against mutated copies. Test readCheckpoint with the tutor flag off. Contract-test each surface package in its own lesson. A boot test asserts the process refuses to listen when violations are non-empty.

    2. What is the difference between the registry and the feature flag?
      The registry is the allowed shape of a surface. The flag is whether that surface spends money for a tenant right now. A flag does not waive auth, and readiness does not turn a flag on.

    Architect

    1. How do you roll the tutor out during enrollment week?
      Boot with the tutor flag on only for Northwind. Watch tutor_draft latency, timeouts, and token counts. The player SLO stays on its own chart. Expand tenants when the fallback rate is understood. A prompt change bumps {promptVersion} so caches do not mix.

    2. What should you refuse to merge to "make the demo smoother"?
      One request that paints the lesson only after the model returns; a client-side provider call; writesProgress: true on the tutor; a shared budget key; trace fields that copy the prompt. Each of those fails readiness or fails the product boundary from Lesson 1.

    3. How does this sit on the deployment choice from Lesson 58?
      The API process and the workers can be separate runtimes. Readiness cares that extract and side effects are worker, not which vendor hosts the process. A serverless tutor that still shares a completion write is still draft_writes_fact.

    4. What do you tell finance the platform costs?
      The sum of the budget keys, priced from the current provider card, plus database, object storage, and egress. Illustrative timeouts are not a forecast. The registry makes the meters nameable. It does not invent a dollar figure.

    Knowledge Check

    1. What problem does this capability solve?

    It makes the five TechLearningPro products one launchable system whose model paths cannot stall reading or rewrite completion, with a test that fails when a registration breaks those rules.

    2. What alternatives exist, and when would you choose each?

    A single-surface demo can live in one package with the same boundaries and no registry. A registry is what you want once a second model route exists. A mesh of services per surface is reasonable at a later scale. It still needs the same trust classes. Hiding AI inside the player request is the alternative this lesson rejects.

    3. Which data, identity, and trust boundaries matter?

    The session supplies the tenant. PostgreSQL holds facts. The model port holds drafts and extractions. Object storage holds files. Workers hold mail and extraction. Secrets stay on the server. Traces omit content. Flags select tenants. They do not select roles.

    4. What can fail, and how should the system respond?

    Registry violations refuse boot. Provider failures return the surface fallback. A closed flag stops new spend and leaves existing tickets and jobs in place. The player still reads the checkpoint when other flags are off. Empty identity is unauthorized.

    5. How would you test quality, security, performance, and cost?

    Readiness tests cover each violation string. A player test asserts a checkpoint returns while the tutor flag is off and that no model fake was called. Security tests assert cache templates carry the tenant and trace fields reject prompt. A latency budget test asserts the fact timeout is 300 ms in the registry. Cost tests assert each surface has its own budget key and that a closed flag is the off switch for that key.

    Practical Exercise

    Implement packages/platform/src/ and assert assessReadiness(PLATFORM).ok. Add three mutations: tutor writesProgress: true, reminder runsOn: "request", and a cache template tutor:{lessonId}. Assert the violation ids. Call readCheckpoint for Northwind with the tutor flag forced off and show the checkpoint still returns. Write three sentences on which flag you would flip first during a provider outage, and which route must stay up.

    Deliverable and Rubric

    Submit the platform diagram, the registry package, the test output, a one-page runbook (which flag, what the user sees, what keeps draining), and a note of illustrative timeouts you would replace with measurements.

    AreaWeight
    Conceptual accuracy and architecture20%
    Working implementation and code quality25%
    Security, privacy, and responsible AI20%
    Testing, reliability, and observability20%
    Documentation and decision rationale15%

    Production checklist:

    • Readiness runs before listen and in CI.
    • The player does not call the model.
    • Draft, assistant, and documents do not write progress.
    • Reminder and documents run on workers and require approval.
    • Idempotency keys are named for side effects.
    • Secrets are server-side.
    • Cache templates include tenant and version.
    • Trace fields omit prompts, bytes, and bodies.
    • New AI surfaces default flag off.
    • Northwind can be enabled without enabling Contoso.
    • Fallbacks are sentences the UI implements.
    • Budget keys are unique.
    • An empty registry cannot pass.

    Key Takeaways

    1. Project 5 is the registry and the boot check, not a sixth model feature.
    2. The five surfaces are player, tutor, assistant, reminder, and documents.
    3. Trust classes decide the legal writes.
    4. The player is a fact route with no model call.
    5. Drafts and extracts cannot write progress.
    6. Side effects need approval, an idempotency key, and a worker.
    7. Every surface has auth, tenant scope, a timeout, a budget, and a fallback.
    8. Secrets stay on the server.
    9. Flags are per surface and per tenant.
    10. Closing the tutor leaves the checkpoint in place.
    11. Cache keys carry tenant and version.
    12. Traces are allow-listed.
    13. Readiness fails closed, including on an empty list.
    14. CI should run the checker.
    15. Earlier lessons remain the authority inside each package.

    Summary

    Lesson 68 closes the build sequence of AI-Powered Full Stack Development's product work. The learning platform is one registry: facts stay fast and authoritative, model surfaces fail in ways the UI can explain, and a small function stops the integrations that caused the launch-week incident. Projects 1 through 4 keep their internal rules. This lesson makes those rules visible at the process boundary.

    Next Lesson Preview

    AI-Powered Full-Stack System Design Interviews uses this platform as the system you design out loud. You will practice a 45-minute structure: requirements, APIs, data, the model boundary, failure, cost, and security, scored against a checklist so a fluent diagram cannot hide a missing fallback.

    Further Reading

    Ready to mark this lesson complete?Track your journey across the entire course.