Free self-study · No account needed · Progress stays in this browser. Back it up before clearing site data or changing devices.

← Week 24: Final Engineering Capstone

Week 24 / Lesson 2

Integrating and proving the critical path

Demonstrate the complete authorized workflow and its failure recovery.

Section 2.1 1 of 7

Overview

Focus

Demonstrate the complete authorized workflow and its failure recovery.

Your route through the lesson

  • 2.2 Connecting model, retrieval, memory, skills, tools, and orchestration
  • 2.3 Success, denial, and recovery paths
  • 2.4 Reproduction from a clean local environment
  • 2.5 Put it into practice
  • 2.6 Guided comparison
  • 2.7 A passing test double beside an untested integration

All required teaching is included here. Review selections are saved. Choose a correct answer for every question to continue; retries are unlimited. Study time and personal notes are optional.

Section 2.2 2 of 7

Connecting model, retrieval, memory, skills, tools, and orchestration

Focus

Connect retrieval, planning, memory, skills, tools, and orchestration through concrete interfaces.

System integration connects components so outputs from one become validated inputs to another. In the starter, HTTP admission establishes the owner. SQLite retrieval selects that owner's synthetic document. A planner fixture proposes create_ticket when the text contains failed. A skill contract allowlists that tool and requires evidence. The executor writes a ticket, updates operation status, and stores the owner's last operation as memory.

Orchestration controls this order and handles failure. Memory is durable application state, not proof of model learning. Retrieval returns evidence, not authority to change policy. The skill defines a procedure, while authorization determines who may execute it. Keeping these meanings separate prevents one component from accidentally acquiring another's privileges.

The integration uses actual local HTTP and database interfaces. Its external ticket tool is represented by a real local tickets table rather than a remote service. The planner remains a labeled deterministic fixture. This boundary map makes the result reviewable: actual state transitions can be inspected, and every substituted boundary is named. Replacing one component later must preserve the surrounding request, permission, and operation contracts.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. What is the starter’s memory component?
2. Which component controls execution order?
3. The local tickets table receives real writes. What is still substituted?

Section 2.3 3 of 7

Success, denial, and recovery paths

Focus

Preserve operation identity through success, denial, interruption, and recovery.

The success path authenticates, retrieves permitted evidence, validates the proposal, records intent, and commits one ticket. The denial path stops before retrieval or mutation for an invalid identity. The interruption path commits a pending intent and then returns a controlled failure before ticket creation. The recovery path reuses the same operation identifier after service restart.

The local tool effect and completion record share one SQLite transaction. INSERT OR IGNORE uses the operation primary key to avoid a second ticket on replay. Updating memory occurs in the same transaction, so the local demonstration avoids a partial ticket-without-completion state. This is a deliberate bounded design, not a general solution for remote effects.

A real external tool cannot usually share the application's database transaction. It needs its own idempotency support or a durable outbox and reconciliation process. The local recovery proof should therefore state its atomicity assumption. A response timeout alone never proves no effect occurred. Recovery begins by checking durable operation and effect state rather than choosing a fresh identifier and repeating work.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. Why reuse an operation identifier during recovery?
2. The local ticket and completion share one transaction. What assumption limits this proof?
3. What should an invalid identity leave in operation storage?

Section 2.4 4 of 7

Reproduction from a clean local environment

Focus

Prepare clean reproduction with explicit dependencies, lifecycle, and evidence locations.

A reproducible run names the interpreter, dependency versions, input cases, configuration, commands, expected invariants, and cleanup behavior. The starter uses only the Python standard library, so a clean environment needs no model download or account. Save the script in a local folder and run it from that folder.

http.server provides the listener, urllib.request sends actual client calls, threading runs the listener temporarily, and sqlite3 persists state. contextlib.closing closes database connections in addition to transaction handling. This matters on Windows because an open connection can prevent temporary database deletion. tempfile creates an isolated directory; the script cleans it after verification.

The server binds to loopback and an operating-system-selected port, then shuts down and joins its worker thread. No permanent daemon remains. Printed results are the retained evidence because the temporary database is removed. If you add an optional persistent output path, document its contents and protect sensitive records. A clean reproduction should fail clearly on a missing dependency or unsupported integration instead of silently substituting a fake success.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. Why explicitly close SQLite connections before temporary cleanup on Windows?
2. A reproduction script prints structured results, removes its temporary database, and creates no persistent service or dashboard. Which output retains its evidence?
3. A clean environment lacks an optional integration. What should happen?

Section 2.5 5 of 7

Put it into practice

Focus

Execute real local success, denial, service interruption, and replay recovery.

Save week24.py and run python week24.py --lesson 2. The script starts the local service and submits the first three frozen cases. Success returns 200 and creates op-1. Denial returns 403 and creates no op-denied. Interruption returns 503 after committing op-2 as pending, before its ticket effect.

The server then actually stops. A new server opens the same database and receives the recovery request for op-2. It completes the ticket and returns 200. Replaying that request again must return the same result without another ticket. Final queries assert two total tickets, no denied operation, no pending operations, and memory pointing to op-2.

These are executed HTTP calls, committed local state, and actual server restarts. The injected failure is controlled; it is not a physical machine crash. The planner is still a deterministic fixture, and the ticket effect is local. Extend this same path with one new required evidence check, preserving all four original cases and the no-duplicate assertion. If a check fails, keep the actual output for diagnosis instead of editing the report to match expectations.

Download this week’s Python lab ↓

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. After op-1 success and op-2 recovery, how many tickets should exist?
2. What is real in the controlled interruption drill?
3. A final query finds one pending operation. What should the report do?

Section 2.6 6 of 7

Guided comparison

Focus

Trace the actual integrated effects and identify exactly what the fixture does not prove.

The worked run produces two ticket effects because op-1 and op-2 are different intended operations. The repeated op-2 request is replay, not a third operation. The denied request never enters operation storage. A final memory row records op-2 as Alice's most recent completed operation. These state checks connect outputs to actual local effects.

The interruption is placed after the pending intent transaction and before ticket creation. That location matters: it demonstrates recovery of durable intent. It does not test every possible failure point. A failure during the shared local transaction would roll back its uncommitted writes, while a remote tool could commit independently and require reconciliation.

The planner fixture proves the surrounding contract accepts and validates a known proposal. It does not prove a language model will choose the correct tool from difficult text. The local ticket table proves a durable local mutation; it does not prove external credentials or network behavior. Keep these limits in the integration report. A next iteration can replace one boundary with a real dependency and rerun the same success, denial, and recovery requirements, adding cases for the new failure modes.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. Why is repeated op-2 not a third intended operation?
2. The injected fault occurs before ticket creation. What remains untested?
3. A fixture planner picks the correct known tool. Which claim is unsupported?

Section 2.7 7 of 7

A passing test double beside an untested integration

Focus

Distinguish a passing test double from a still-untested real integration.

A team replaces the local ticket table with a hosted ticket service. The old tests still mock the tool and pass. In a manual run, the real service rejects the request because its required project field is missing. The fixture validated the old contract but did not represent the actual dependency's schema.

The repair begins with an adapter translating the application's validated request into the real service's required fields. A controlled integration test uses an authorized sandbox, records the real response and effect identifier, and cleans up only explicitly created test data. Credentials stay in the trusted service, outside model prompts. Retry tests must account for the remote service's idempotency behavior.

If no sandbox or credentials are available, keep the real integration marked unverified. The passing fixture remains useful for regression speed and deterministic failures, but it cannot close that evidence gap. This transfer teaches a precise completion statement: the core workflow works under the tested local tool contract, while the hosted adapter needs actual execution. Clear limits make the artifact more useful because the next engineer knows exactly which boundary still requires proof.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. Mock tests pass but the real tool rejects a missing project field. What failed?
2. No authorized sandbox is available. What status fits the hosted adapter?
3. Where should hosted-tool credentials remain?

Your personal notes

Optional, ungraded, and saved only in this browser. Export a backup from the Academy homepage to keep them.

References and further reading
Ask your own AI assistant

Copy this prompt into an assistant you already use. Nothing is sent automatically, and your personal notes are not included.

Next lesson: Reporting and demonstrating engineering results →