Level 6 / Project 11 - Dead Letter Row Handler¶
Home: README
Learn Your Way¶
| Read | Build | Watch | Test | Review | Visualize | Try |
|---|---|---|---|---|---|---|
| — | This project | — | — | Flashcards | — | — |
Focus¶
- bad row pipeline and quarantine
Why this project exists¶
This project gives you level-appropriate practice in a realistic operations context. Goal: run the baseline, alter behavior, break one assumption, recover safely, and explain the fix.
Run (copy/paste)¶
Use <repo-root> as the folder containing this repository's README.md.
cd <repo-root>/projects/level-6/11-dead-letter-row-handler
python project.py --input data/sample_input.txt --output data/output_summary.json
pytest -q
Expected terminal output¶
{
"input_records": 6,
"processed": 3,
"dead_lettered": 3,
"dead_letter_stats": {"total": 3, "unresolved": 3, "resolved": 0}
}
Expected artifacts¶
data/output_summary.json— processing results with dead-letter details- Passing tests (
pytest -q→ 6+ passed) - Updated
notes.md
Alter it (required)¶
- Add a
--max-retriesflag: dead-letter rows with retry_count >= max should be marked as permanently failed. - Add a
retry_allCLI command that re-runs validation on every unresolved dead-letter row. - Add a
reason_summarythat counts how many dead-letters failed for each error type. - Re-run script and tests after each change.
Break it (required)¶
- Process a record with
value: nulland observe the error path. - Retry a dead-letter row that still has the same validation issue — confirm retry_count increments.
- Delete the dead_letters table mid-run and observe the crash.
Fix it (required)¶
- Handle
nullvalues explicitly invalidate_record. - Add a
--create-tablesflag that ensures tables exist before processing (idempotent). - Add a test for the retry-increment behavior.
Explain it (teach-back)¶
- What is a dead-letter queue, and where does the name come from?
- Why store the original payload alongside the error, instead of just logging?
- When should dead-letter rows be retried vs. permanently discarded?
- How does this pattern apply to message queues like RabbitMQ or SQS?
Mastery check¶
You can move on when you can: - run baseline without docs, - explain one core function line-by-line, - break and recover in one session, - keep tests passing after your change.
Related Concepts¶
- Collections Explained
- Errors and Debugging
- Files and Paths
- Virtual Environments
- Quiz: Collections Explained
| ← Prev | Home | Next → |
|---|---|---|