Safe Remediation & Recovery.
Write eight independent Python helpers that validate the approval contract, block stale plans, build read-only previews, save rollback checkpoints, avoid duplicate changes, verify recovery and keep incidents open when results are uncertain.
Real Python, simulated remediation: The browser workbench validates your functions against fictional change records only. No target is modified, no SSH or HTTP commands are executed, and no live ticket is updated. The written lesson contains an independent offline recovery project.
Write it. Run it. Understand it.
Real Python execution, a variable trace and feedback against the requirements. You write the code—answers aren't revealed up front.
Validate an exact, approved change request
Implement validate_change(req). Require a dictionary with exactly change_id, target, environment, action, expected_revision, desired_mode, approved. All six string fields must be nonempty strings without newline or carriage return; approved must be the actual boolean True. Only environment 'lab', action 'set-mode' and desired_mode 'enabled' or 'disabled' are permitted. Return a NEW dictionary with uppercase trimmed change_id/target, unchanged expected_revision (trimmed), normalized environment/action, normalized desired_mode and approved=True. Reject any missing/extra fields, wrong types, or invalid values. Print the sample normalized change ID.
CHG-201Try solving it before asking for help. Hints never show a completed program.
Your printed output and errors will appear here.
Run the code, then step through the executed lines to watch variable values change.
When you finish Practice, use the shared Continue Your Learning Path panel below to mark this milestone complete. Your next guided milestone is Lesson 06 — Integrated Operations Capstone, followed by the independent final coding assessment.
