AI Lab / Put it to work
Build something.
Check what changed.
Six engineering tasks with staged hints with real files and testable outcomes. Practice fixing a bug, reviewing a change, designing tests, automating release evidence, rejecting stale deployment observations, and recovering an ordered tenant stream.
Your browser is the workspace
Read. Change. Run.
Try all 6 exercises here. Your code runs locally; an AI account is optional.
The acceptance contract
Read the worked guide ↗Edit the exported function. Ctrl/⌘ + Enter runs tests; Tab moves to the next control. Code and test output stay on your device.
Acceptance tests
Choose an exercise to load its starter.
Need a hint?
Read the tests
Compare the reference solution
Try your own change first. This reference does not replace your code.
Reset this exercise
Open your own JavaScript file
The file stays on this device. Review before replacing your draft.
Compare my code with the reference
Removed lines are your current code; added lines are the teaching reference. Different code can still satisfy the contract.
The browser editor needs JavaScript. Download the files below to work in your own terminal.
One small, local workspace
For the downloadable workspace, you need Node.js 20+ and a terminal. The editor above runs the same exercise assertions in your browser. The exercises have no dependencies to install, make no network calls, and need no API key. Codex CLI is the documented coding-assistant surface; you can also solve the tasks yourself. Using an AI assistant requires that tool's own installation and account.
Each starter intentionally fails its tests. Edit its app.mjs, rerun the check, and compare the worked solution after your attempt. A passing test demonstrates the stated exercise contract.
unzip ai-workshops.zip
cd ai-workshops
node verify.mjs bugfixWork through the stages
Each stage groups acceptance tests and offers two hints. The instructions also work with the downloadable files.
Fix a priority bug
Sort finite numeric priorities from largest to smallest, preserve arrival order for ties, and return a new array without changing the input.
Reproduce order and ownership
Run the starter. Identify who observes the mutated input and what order equal priorities should keep.
Hint 1
Compare the input before and after the call.
Hint 2
Copy the array before sorting; retain arrival order when priorities tie.
Repair the numeric boundary
Handle finite numeric priorities and tie order without changing the acceptance tests.
Hint 1
String comparison gives a different order for 2 and 10.
Hint 2
Validate numbers before comparing them.
Review a counterexample
Read the final diff and describe one input outside the exercise contract.
Hint 1
Correct order does not establish ownership.
Hint 2
Use a frozen array to expose an accidental in-place sort.
Review a logging change
Return exactly event, method, path, status, and duration_ms. Strip query strings and fragments from the URL. Never retain headers, bodies, or future fields; preserve the input.
Trace serialized output
Follow a synthetic request through the builder and identify which values reach JSON serialization.
Hint 1
Inspect the field names, not just the dashboard.
Hint 2
A spread copies current sensitive fields and unknown future fields.
Make the contract explicit
Construct only the five allowed fields and strip query and fragment data from the path.
Hint 1
Choose permitted fields before constructing the result.
Hint 2
Split the local path at the first question mark or hash.
Challenge future changes
Explain why a new synthetic sensitive field stays outside the output.
Hint 1
Deleting known fields requires continuing maintenance.
Hint 2
Check input preservation as well as the absence of a token.
Design retry tests
Accept whole nonnegative delay-seconds or a canonical HTTP date using the supplied finite clock. Clamp past dates to zero; return null for invalid, fractional, partial, negative, missing, or overflowing values.
Classify accepted inputs
Separate whole nonnegative seconds, canonical HTTP dates, and invalid values.
Hint 1
Parsing a numeric prefix is not validation.
Hint 2
List a fraction, a negative string, and an overflowing number.
Control the clock
Use the supplied clock to compare an HTTP date and clamp dates in the past.
Hint 1
Never wait for wall-clock seconds in this fixture.
Hint 2
Format a parsed date back to UTC to check its canonical form.
Inspect rejection evidence
Explain why a malformed value returns null rather than silently becoming a delay.
Hint 1
A partially accepted string can change retry behavior.
Hint 2
Keep the invalid-input table beside the passing result.
Automate release evidence
Return a version-1 manifest with files sorted by name, lowercase 64-digit SHA-256 hashes, and positive safe-integer byte sizes. Reject duplicates and unsafe filenames; exclude clocks and unknown fields without mutating input.
Define artifact identity
Identify permitted fields, names, byte sizes, and hash representation.
Hint 1
Unknown fields must not change the manifest.
Hint 2
A clock value makes identical artifact lists serialize differently.
Validate before publishing
Reject unsafe names, duplicates, invalid sizes, and invalid SHA-256 strings.
Hint 1
Use a set for names and safe integers for sizes.
Hint 2
A hexadecimal SHA-256 has exactly 64 digits; lowercase the output.
Prove reproducibility
Compare equivalent inputs in a different order and verify input preservation.
Hint 1
Sort by name before serialization.
Hint 2
Stable output does not prove file bytes match the supplied hashes.
Reject stale deployment evidence
Permit a deployment only for a valid contract and an available, satisfied observation matching namespace, Secret name, generation, and current resource version. Return only allowed and a static reason; preserve inputs.
Check identity and availability
Classify malformed contracts, absent observations, and evidence from another namespace or Secret.
Hint 1
A true condition can describe the wrong object.
Hint 2
Static reasons keep observation errors outside the output.
Reject stale evidence
Compare generation and resource version with the exact current contract and Secret.
Hint 1
Rotation can change a Secret without changing contract generation.
Hint 2
A missing version is not evidence of equality.
Close the deployment decision
Require a current positive observation and preserve inputs. Explain the time-of-check boundary.
Hint 1
A Kubernetes condition does not itself stop a deployment.
Hint 2
The caller must enforce this decision; the function does not reconcile a cluster.
Recover an ordered tenant stream
Apply a contiguous tenant-scoped event buffer to an independent snapshot. Ignore already-covered events and exact duplicate deliveries. A gap, conflicting delivery ID, invalid event, or cross-tenant message returns the original snapshot with resync. Reject invalid snapshots.
Establish the snapshot boundary
Validate tenant identity, cursor, and position values before applying events.
Hint 1
The snapshot covers every earlier stream position.
Hint 2
Clone state so a failed replay can return the original snapshot.
Recover order and duplicate delivery
Require contiguous sequences and exact duplicate identity; request a snapshot on a gap.
Hint 1
Sequence numbers order the stream; event IDs identify deliveries.
Hint 2
An event ID reused with another payload is not an exact duplicate.
Keep failure atomic
Refuse invalid or cross-tenant messages without exposing partial state. Check arbitrary subject keys.
Hint 1
Keep the candidate result private until the buffer is validated.
Hint 2
An own data property handles a subject named __proto__ without changing the prototype.
AI workshop: reject stale deployment evidence
Build a deployment decision in three stages: check identity, reject stale observations, and keep the decision independent of sensitive diagnostics.
Intermediate · Codex CLI · Browser exercise
AI workshop: recover an ordered tenant stream
Repair a reconnect reducer that trusts every message. Check snapshot identity, duplicate delivery, sequence gaps, and atomic recovery with eight acceptance tests.
Intermediate · Codex CLI · Browser exercise
AI workshop: review a logging change for data exposure
Review a short request-event function, identify how new fields can leak into logs, and verify a deliberate output contract with regression tests.
Intermediate · Codex CLI · Browser exercise
AI workshop: fix a priority bug without changing the input
Use a small failing test suite to separate numeric ordering, stable ties, and input ownership before asking a coding agent for a patch.
Beginner · Codex CLI · Browser exercise
AI workshop: design retry tests before fixing the parser
Turn retry timing into a table of deterministic cases, inject the clock, and use failures to review an AI-generated implementation.
Intermediate · Codex CLI · Browser exercise
AI workshop: automate a reproducible release manifest
Build a deterministic artifact manifest, validate its inputs, and use byte-for-byte checks to evaluate an AI-assisted automation change.
Intermediate · Codex CLI · Browser exercise
Keep your evidence
For each task, save the initial failure, your patch, the final test result, and a sentence explaining what remains outside the tests. Keep credentials and private repository data out of shared examples.
Follow the complete AI learning path →