Practical Roadmap

AI Research and Careful Automation

Research with traceable sources, organise synthetic data, and automate small tasks with previews, validation, and human review.

Before You Begin

  • Read the AI foundations lessons on evidence and uncertain output.
  • For the automation lessons, install Python 3 and understand variables, lists, dictionaries, functions, and basic exceptions.
  • Use the supplied fictional sources while building the workflow; verify original provider pages before substituting real resources.

What You Will Build

A source-backed resource comparison and a dry-run automation that produces a reviewable local file.

YOUR COURSE PROJECT · 7 CONNECTED STAGES

Evidence-Backed Resource Comparison

Compare three fictional learning resources with a traceable source ledger, then build a Python tool that validates records and creates a local Markdown draft. The fictional fixtures make every expected result reproducible; replacing them with real research is a later, explicitly checked extension.

What You Need

  • A text editor and a folder called resource-comparison
  • Python 3; lessons use its standard library only
  • A browser for the official reference reading; no browser or AI account is required by the scripts

Set Up Your Project

  1. Create resource-comparison and run each Python example from that folder. Use python or python3 according to the installed interpreter; confirm the command with --version.
  2. Create sources.txt with these fictional cards: S1 SeedNotes is a beginner HTML text guide, freely readable without an account. S2 LabBench offers free starter HTML exercises that require an account; the full course price is unspecified. S3 QuickCards is a freely readable HTTP reference without an account and assumes basic HTTP vocabulary.
  3. Use example.org URLs only as fixture identifiers. They are not working resource recommendations and must not be presented as verified provider pages.
  4. Keep sources.txt, raw.json, validated.json, and report-preview.md separate. The script creates a local draft and never publishes it.

Markdown file · all lessons, examples and project steps · no account needed

01

Turn a Broad Topic into a Decision

Define a beginner’s first HTML learning decision and compare three clearly labelled fictional resource candidates.

What You Will Learn

  • Turn a broad recommendation request into an explicit decision.
  • Distinguish mandatory requirements, preferences, and missing evidence.

Understand the Idea

Research is easier to evaluate when it supports a specific decision. In this project, the decision is which resource a beginner should open first to build a simple HTML page. The learner has a laptop, can read text comfortably, and does not want to create an account for the first session. These details matter because a useful HTTP reference and an account-based exercise platform may both be good resources while serving different needs. Define the decision before collecting attractive-looking links.

A criterion is a property used to compare candidates. Some criteria are mandatory: the first resource must cover beginner HTML and allow reading without an account. Others are preferences, such as short lessons or downloadable material. If a source does not mention downloads, mark the value unknown. Unknown is neither a verified yes nor a verified no. For a mandatory requirement, unknown means you need more evidence before claiming the candidate satisfies it.

The supplied source cards are fictional so you can practise the method with known facts. Their example.org addresses identify fixtures, not real recommendations. Write that distinction at the top of the project. An AI assistant may help identify ambiguous criteria, but it should not invent missing provider details. The first deliverable is a decision brief that another learner could use to perform the same comparison without reading your conversation.

WORKED EXAMPLE

Write the Decision Before the Comparison

Save this as brief.md. Keep the candidate facts in sources.txt, using the three source cards from project setup.

text
Decision: Choose the first resource for building a basic HTML page.
Learner: Beginner with a laptop; comfortable reading text.
Required: Beginner HTML; no account for the first lesson.
Preferred: Short explanations; low-bandwidth reading.
Unknown to investigate: Downloadable lessons and exact completion time.
Candidates: SeedNotes, LabBench, QuickCards.
Dataset: Fictional teaching fixtures; not real provider claims.
  1. SeedNotes matches the stated topic and account requirement in S1.
  2. LabBench requires an account, which conflicts with this learner’s first-session requirement.
  3. QuickCards covers HTTP and assumes vocabulary; being free does not make it the right first HTML lesson.

Expected Result

A decision brief whose requirements explain why the three candidates are not interchangeable.

PROJECT STAGE 01 / 7

Create the Comparison Brief

Builds on: Start with the supplied fictional source cards and an empty comparison folder.

  1. Create sources.txt containing S1, S2, and S3 exactly as supplied, and label them fictional.
  2. Write brief.md with the learner, decision, two requirements, and at least one preference.
  3. Define what counts as satisfying each requirement rather than using vague words such as best.
  4. List missing facts separately and decide which would prevent a confident recommendation.
  5. Write a provisional choice using only the stated facts, then note what could change that choice.

Keep This Deliverable

brief.md, sources.txt, and a provisional recommendation linked to explicit learner needs.

Check Your Build

  • The brief separates free access from account requirements and topic suitability.
  • Unknown download or timing information is not silently converted into a positive feature.

Common Mistakes and Fixes

Comparing every candidate on whichever feature looks strongest.
Write one shared criterion list before evaluating any candidate.
Calling fixture URLs verified real providers.
Keep the fictional-data label visible until you replace every claim with checked original sources.

Check Your Understanding

Can a free HTTP reference be the wrong first resource for this learner?

Reveal the explanation

Yes. Price is only one criterion. The learner needs introductory HTML and an initial task they can complete; a reference that assumes HTTP vocabulary may serve a later stage.

Ready to Move On?

Your brief states the topic and no-account requirements, preserves unknowns, and explains a conditional first choice.

Open the learning resource
02

Build a Source Ledger

Connect each resource claim to a fictional source card, separating access facts, unanswered questions, and your recommendation.

What You Will Learn

  • Record the evidence supporting each factual claim.
  • Keep an observation separate from an interpretation or unanswered question.

Understand the Idea

A source ledger is a table connecting claims to the evidence used to support them. Record one claim per row rather than pasting a whole paragraph into a single cell. For the fictional cards, the source identifier is S1, S2, or S3 and the evidence is the relevant phrase. For real research, record the original page URL and the passage that supports the claim. Do not imply that a page was checked when only a search snippet was seen.

Access terminology needs precision. Freely readable material does not establish that its code or content is open source. A free starter exercise does not establish that an entire course is free. An account requirement is separate from a price requirement. These distinctions directly affect the learner in the brief. If a later comparison compresses all three candidates into one “free” column, the ledger should make the missing distinctions obvious.

Record your interpretation in its own column. “SeedNotes is a suitable first choice” is a judgement based on the learner and the evidence, not a sentence from S1. The judgement may be reasonable, but it should remain identifiable as yours. When evidence changes, this separation tells you which factual rows to update and which recommendations to reconsider. An assistant can format the ledger; you remain responsible for checking that each row preserves the source meaning.

WORKED EXAMPLE

Separate a Fact from a Recommendation

Create ledger.csv manually or in a spreadsheet. This example uses commas safely through quoted fields and does not claim live website verification.

csv
candidate,claim,source,evidence,verdict
SeedNotes,No account for reading,S1,"freely readable without an account",supported
LabBench,Entire course is free,S2,"free starter HTML exercises",unknown
QuickCards,Assumes HTTP vocabulary,S3,"assumes basic HTTP vocabulary",supported
  1. The LabBench row is unknown because the evidence covers starter exercises only.
  2. The source column points to a specific fictional card; no external page was opened.
  3. The CSV is a ledger for review, not a substitute for reading the source cards.

Expected Result

Three auditable claims, including one deliberately unresolved access question.

PROJECT STAGE 02 / 7

Build the Evidence Ledger

Builds on: Use the decision brief to decide which provider facts actually matter.

  1. Create two claim rows for each candidate covering topic and account or access conditions.
  2. Attach the exact source identifier and a short evidence phrase to every factual row.
  3. Add one unknown detail per candidate where the supplied source does not answer a relevant question.
  4. Write your provisional recommendation in a separate judgement section rather than presenting it as a source quotation.
  5. Check each row against sources.txt and correct any broader claim than the evidence supports.

Keep This Deliverable

A ledger containing at least six supported claims and clearly labelled unknowns.

Check Your Build

  • No row equates free reading with an open-source license.
  • LabBench’s full-course price remains unknown, and the account requirement stays visible.

Common Mistakes and Fixes

Using the existence of a URL as proof for every adjacent statement.
Record the specific evidence that supports each claim and inspect its scope.
Copying a source’s marketing language as your factual conclusion.
Describe observable access and learning properties in plain language, then label your judgement separately.

Check Your Understanding

What evidence would justify changing LabBench’s full-course price from unknown to free?

Reveal the explanation

A checked original provider statement covering the entire course and its conditions. The existing statement about free starter exercises is too narrow.

Ready to Move On?

At least six supported claims have evidence references, while full-course pricing and other unstated details remain unknown.

Open the learning resource
03

Compare Like with Like

Turn the ledger into one consistent comparison table and explain when each fictional resource would suit the learner.

What You Will Learn

  • Compare candidates using the same definitions and missing-value policy.
  • Explain a recommendation as a conditional judgement.

Understand the Idea

A comparison table is a compressed view of the ledger. Compression should remove repetition, not hide important differences. Use consistent columns for topic, intended learner, account requirement, and access scope. A curriculum, a short guide, and a reference are different formats; record that difference instead of scoring them all by the number of pages. For this brief, the relevant question is whether the learner can begin an HTML task under the stated conditions.

Do not create a numeric ranking merely because numbers look objective. A score requires a clear scale, weights, and a policy for unknown values. Those choices can change the winner without changing the underlying evidence. A small comparison is often clearer with explicit requirement checks and a written trade-off. Here, SeedNotes fits the first-session constraints; LabBench may become useful if the learner accepts an account; QuickCards belongs later when HTTP concepts become relevant.

A good recommendation says when it would change. If the learner primarily wants interactive practice and accepts an account, LabBench may be a sensible next option. If the task becomes looking up an HTTP response concept, QuickCards may fit better. These are conditional judgements based on the fictional cards. Keep unknown facts such as offline availability visible so a reader does not mistake silence for a verified feature.

WORKED EXAMPLE

Compare the Same Four Properties

Save this Markdown table in comparison.md and keep the ledger alongside it.

markdown
| Resource | Topic and Format | Account | Access Scope |
| --- | --- | --- | --- |
| SeedNotes | Beginner HTML text guide | Not required | Reading is free |
| LabBench | HTML exercises | Required | Starter exercises are free |
| QuickCards | HTTP reference | Not required | Reading is free |

First choice for this brief: SeedNotes.
Reason: It matches beginner HTML and the no-account requirement.
Unknown for all three: Downloadable lessons and completion time.
  1. Every row uses the same columns, so the account constraint can be compared directly.
  2. The recommendation follows the brief rather than an invented overall quality score.
  3. Unknowns are stated after the table so they cannot be mistaken for absent costs or guaranteed features.

Expected Result

A short comparison with one justified first choice and clearly documented limits.

PROJECT STAGE 03 / 7

Write a Conditional Recommendation

Builds on: Every factual cell should trace back to a ledger row from the previous lesson.

  1. Create comparison.md with the shared table and a visible fictional-fixture notice.
  2. Check every table cell against the ledger, including the exact scope of free access.
  3. Write a first-choice paragraph explaining which requirements it satisfies.
  4. Add two sentences describing a learner or task for which another candidate would be more suitable.
  5. Ask an assistant or another reader to find unsupported cells, then resolve findings using the ledger.

Keep This Deliverable

A comparison document with traceable facts, a conditional recommendation, and explicit unknowns.

Check Your Build

  • The same criterion means the same thing in every row.
  • The recommendation includes a reason and a circumstance under which it would change.

Common Mistakes and Fixes

Replacing unknown values with zero in a score.
Preserve unknown as a separate state and explain whether it blocks the decision.
Treating a reference and a beginner course as interchangeable.
Record format and prerequisites, then compare them against the actual learner’s task.

Check Your Understanding

Why is “SeedNotes is the best resource” weaker than the project’s recommendation?

Reveal the explanation

It hides the criteria and audience. The project can justify SeedNotes as the first choice for a beginner HTML task without an account; it cannot establish universal superiority.

Ready to Move On?

Every factual cell traces to the ledger and your recommendation names the conditions under which it would change.

Open the learning resource
04

Turn Messy Synthetic Input into a Schema

Convert the checked comparison into three JSON records, define their contract, and prepare invalid fixtures before writing a validator.

What You Will Learn

  • Represent resource records with a defined set of fields and allowed values.
  • Reject malformed or duplicate records without inventing missing facts.

Understand the Idea

A schema is a description of the structure a record must have. Our records contain id, title, topic, url, access, and sourceId. The ID is a stable machine-friendly name; the title is display text. Topic is limited to web or security for this exercise. SourceId points back to the fictional evidence card. JSON stores this structure as objects inside an array. Valid JSON syntax only means the file can be parsed; it does not establish that the fields satisfy our rules or that the provider claims are true.

Create raw.json with the three objects in the example. Keep the source cards and ledger as the evidence layer. The validator checks structure and simple consistency, while your manual source review checks factual meaning. It deliberately rejects an unexpected field rather than silently treating it as a command or metadata. Duplicate IDs would make later links ambiguous, so they are rejected. URL parsing verifies the expected scheme and a host; it does not prove that a page exists or is safe.

For this small exercise, stop on the first invalid row and explain the row number. A larger importer could collect all errors, but silently repairing missing titles would conceal uncertainty. Preserve raw.json and only write validated.json after every row passes. You will add executable checks in the next lesson; first predict which changed records should fail. This separation makes the validation rules reviewable before they become code.

WORKED EXAMPLE

Define Three Traceable Records

Save exactly this JSON as raw.json in the project folder. The addresses are fictional identifiers, not fetched websites.

json
[
  {"id":"seed","title":"SeedNotes","topic":"web","url":"https://example.org/seed","access":"Free reading; no account","sourceId":"S1"},
  {"id":"lab","title":"LabBench","topic":"web","url":"https://example.org/lab","access":"Free starter exercises; account required","sourceId":"S2"},
  {"id":"quick","title":"QuickCards","topic":"security","url":"https://example.org/quick","access":"Free HTTP reference; no account","sourceId":"S3"}
]
  1. The title, access text, and sourceId preserve the distinctions established in the ledger.
  2. All three IDs are unique; a copied row with id seed would violate that rule.
  3. Changing a title to an empty string leaves valid JSON but produces an invalid resource record.

Expected Result

A three-record fixture with stable IDs and explicit source references, ready for structural validation.

PROJECT STAGE 04 / 7

Specify the Import Contract

Builds on: Use the checked table and ledger as the source of the three records.

  1. Save raw.json and parse it with python -m json.tool raw.json to check JSON syntax.
  2. Write schema-notes.md listing the six required fields, allowed topics, and unique-ID requirement.
  3. State that all field values must be nonempty strings and URLs must use HTTPS with a hostname.
  4. Create a separate invalid-blank.json with one blank title and invalid-duplicate.json with a repeated ID.
  5. Predict the expected error for each invalid fixture and confirm no original source fact was invented during conversion.

Keep This Deliverable

One valid JSON fixture, two deliberately invalid fixtures, and a written validation contract.

Check Your Build

  • Each record traces to S1, S2, or S3 and preserves its access conditions.
  • A blank title is recognised as invalid content even though the JSON parser accepts its syntax.

Common Mistakes and Fixes

Confusing successful JSON parsing with complete validation.
Check required fields, types, allowed values, uniqueness, and source meaning separately.
Automatically filling a missing title with a plausible provider name.
Reject or flag the record and request evidence instead of creating a fact.

Check Your Understanding

Does an HTTPS URL passing this schema prove the resource is genuine?

Reveal the explanation

No. It checks a structural property of the address. Existence, ownership, content, and whether the page supports a claim require separate review.

Ready to Move On?

Valid JSON is distinguished from valid records, and blank titles or repeated IDs have explicit expected errors.

Open the learning resource
05

Automate a Reversible Local Step

Create a standard-library Python validator and Markdown draft generator with fixed local inputs and outputs.

What You Will Learn

  • Validate records before producing a local draft.
  • Make file-writing behaviour explicit and repeatable.

Understand the Idea

Automation means making a repeatable operation executable. Here the operation is narrow: read raw.json, validate its records, and render a Markdown table. It does not browse the URLs, send messages, or publish the result. A preview is still a file write, so its destination is fixed and visible. Keep any handwritten comparison in comparison.md; report-preview.md is a generated file that may be overwritten on the next successful run.

The script separates validation from rendering. Functions receive values and return results, which makes them easier to test without touching files. The main block performs reading and writing only when the script runs directly. The cell helper converts HTML-significant characters to entities, escapes common Markdown control characters, and replaces line breaks. This keeps the supplied table text from becoming raw HTML or extra cells in ordinary Markdown viewers. It is a narrow output-format boundary, not a general sanitizer for arbitrary web applications; inspect the actual rendered draft too.

A failure should stop generation and produce a useful explanation. The script exits before writing if a row fails validation. An older preview may still exist from a previous run, so never interpret its presence as proof that the latest run succeeded. Read the terminal result and compare the file with the current input. The standard-library approach keeps installation simple and lets you inspect every operation; it does not eliminate the need for review.

WORKED EXAMPLE

Generate a Local Comparison Draft

Save as report.py beside raw.json and run python report.py. Python 3 is required; no extra packages are installed.

python
import html
import json
from pathlib import Path
from urllib.parse import urlsplit

FIELDS = {"id", "title", "topic", "url", "access", "sourceId"}

def validate(rows):
    if not isinstance(rows, list):
        raise ValueError("Expected a list of records")
    seen = set()
    for number, row in enumerate(rows, 1):
        if not isinstance(row, dict) or set(row) != FIELDS:
            raise ValueError(f"Row {number}: unexpected fields")
        if any(not isinstance(v, str) or not v.strip() for v in row.values()):
            raise ValueError(f"Row {number}: empty or non-text value")
        if row["id"] in seen:
            raise ValueError(f"Row {number}: duplicate ID")
        address = urlsplit(row["url"])
        if address.scheme != "https" or not address.hostname:
            raise ValueError(f"Row {number}: invalid HTTPS URL")
        if row["topic"] not in {"web", "security"}:
            raise ValueError(f"Row {number}: unknown topic")
        seen.add(row["id"])
    return rows

def cell(value):
    value = html.escape(value, quote=True)
    value = value.replace("\r", " ").replace("\n", " ")
    for mark in ("\\", "|", chr(96), "*", "_", "[", "]", "!", "~"):
        value = value.replace(mark, "\\" + mark)
    return value

def render(rows):
    lines = ["# Fictional Resource Comparison", "",
             "| Resource | Access | Source |", "| --- | --- | --- |"]
    for row in rows:
        lines.append("| " + " | ".join(cell(row[k]) for k in ("title", "access", "sourceId")) + " |")
    return "\n".join(lines) + "\n"

if __name__ == "__main__":
    try:
        rows = validate(json.loads(Path("raw.json").read_text(encoding="utf-8")))
        draft = render(rows)
        Path("validated.json").write_text(json.dumps(rows, indent=2) + "\n", encoding="utf-8")
        Path("report-preview.md").write_text(draft, encoding="utf-8")
        print(f"Validated {len(rows)} records; wrote report-preview.md")
    except (OSError, ValueError) as error:
        raise SystemExit(f"No new draft: {error}")
  1. validate completes before either output is written. The source file is opened only for reading.
  2. render creates a fixed three-column table without using a record to choose a file path.
  3. The main block writes generated outputs; importing report later will not create files.

Expected Result

For the supplied fixture: Validated 3 records; wrote report-preview.md. The table contains SeedNotes, LabBench, and QuickCards in that order.

PROJECT STAGE 05 / 7

Run and Inspect the Draft Generator

Builds on: Use raw.json and the two invalid fixtures from the previous lesson.

  1. Save report.py and inspect its input and output filenames before running it.
  2. Copy raw.json to raw-backup.json, then run python report.py and read the printed result.
  3. Open report-preview.md and compare every cell with the checked ledger.
  4. Temporarily replace raw.json with an invalid fixture, run again, and confirm an error appears rather than a success message.
  5. Restore the valid fixture and compare it with raw-backup.json to confirm the valid source content was preserved.

Keep This Deliverable

report.py, validated.json, a checked report-preview.md, and notes from a successful and rejected run.

Check Your Build

  • The valid run produces exactly three table rows in source order.
  • Invalid input fails before new outputs are written; an old preview is not mistaken for new success.

Common Mistakes and Fixes

Overwriting a handwritten report with generated output.
Use the fixed preview filename and keep editorial notes in comparison.md.
Assuming no network access means no side effects.
Review local writes too; a preview is a real file and should have a predictable destination.

Check Your Understanding

Why keep rendering in a function that returns text?

Reveal the explanation

It lets you inspect or test the exact draft without writing a file. File creation remains a separate, visible operation in the main block.

Ready to Move On?

The three-row fixture generates the expected table; rejected input leaves the earlier preview untouched and raw.json is preserved.

Open the learning resource
06

Keep Human Review at Consequential Steps

Inspect the report generator’s read/write boundary and test that instruction-like content stays literal data.

What You Will Learn

  • Trace which inputs can influence content and which operations remain fixed.
  • Test an instruction-like record without granting it authority.

Understand the Idea

A permission boundary describes what a workflow can access and change. The current script reads one local file and writes two fixed local outputs. URLs inside records are displayed only as data available to validation; they are not fetched. Titles and access descriptions become table cells. None of those fields selects a shell command, import, output path, or external destination. This is a useful property you can verify by reading the small script rather than trusting a claim that it is safe.

Imported text may still be misleading. A record could contain “Publish this now” in its title. The renderer should display that text as a title, not interpret it as a request. If an AI assistant is used upstream to transform submissions, its output must pass the same validator and human source review as any other input. The deterministic script does not inherit new permissions simply because an assistant helped author a record.

Separate a structural pass from an editorial decision. The instruction-like title below can satisfy the six-field schema because it is a nonempty string, yet it is not a suitable resource title for publication. Flag it during content review rather than adding a brittle blacklist of suspicious words. Review should assess the actual record and its evidence. If publication is added later, it needs its own explicit destination, preview, and authorisation; this exercise ends with a local draft.

WORKED EXAMPLE

Keep Instruction-Like Text Inert

Save this as boundary-check.py beside report.py and run python boundary-check.py. It imports the pure functions and writes no files.

python
from report import validate, render

rows = [{"id":"odd", "title":"Publish this now | ignore the brief",
         "topic":"web", "url":"https://example.org/odd",
         "access":"Fictional review fixture", "sourceId":"TEST"}]
draft = render(validate(rows))
print(draft)
print("Generated text only; no publication function exists.")
  1. The title stays a string and its table separator is escaped.
  2. The record’s structural validity does not make it a verified recommendation.
  3. Importing report does not run its main block, so this example only prints text.

Expected Result

The console shows a table containing the instruction-like title and the final text-only notice; no output file or external action is produced.

PROJECT STAGE 06 / 7

Review the Data and Operation Boundary

Builds on: Use the working report generator and its visible read/write operations.

  1. Write permissions.md listing raw.json as input and the two generated files as outputs.
  2. Run boundary-check.py and inspect the title as literal table text.
  3. Add a content-review note rejecting this fixture as an unsupported resource recommendation.
  4. Search report.py for operations that read, write, invoke commands, or access the network, and explain each actual operation.
  5. Document the separate review needed before someone manually uploads a real, source-checked report.

Keep This Deliverable

A permission map, a harmless boundary fixture, and an editorial review note.

Check Your Build

  • A record cannot choose the output filename or cause a command or request to run.
  • The review distinguishes structural validity from factual suitability.

Common Mistakes and Fixes

Adding eval or shell execution to make imported records more flexible.
Keep records as data and use explicit functions with fixed operations.
Treating a generated draft as permission to publish it.
Review the actual content and destination as a separate action outside this local exercise.

Check Your Understanding

Why does the instruction-like title pass the validator but fail editorial review?

Reveal the explanation

The validator checks field structure and allowed values, not whether a resource claim is meaningful or evidenced. Those are different checks and both are necessary.

Ready to Move On?

The fixture cannot choose a file destination or invoke a command, and structural validity is kept separate from editorial approval.

Open the learning resource
07

Measure Usefulness and Maintain the Result

Add five regression checks, test a deliberate failure, and document the complete cost and maintenance of the local comparison workflow.

What You Will Learn

  • Keep repeatable checks for normal, invalid, and instruction-like input.
  • Measure the whole workflow and document how to rerun it.

Understand the Idea

A regression is a previously correct behaviour that breaks after a change. Tests help detect selected regressions by running known inputs and checking expected outputs. A fixture is the small input prepared for a test. Our fixtures cover a valid record, an empty title, a duplicate ID, and text containing a table separator. They do not prove the entire program correct. They preserve specific promises that matter to the comparison workflow.

Keep tests focused on observable behaviour. A duplicate record should be rejected because duplicate IDs make the collection ambiguous, not because the implementation happens to use a set. A title containing a vertical bar should remain one table cell. These checks allow you to change internal code later while preserving the contract. To confirm that a test is useful, deliberately disable the relevant check on a disposable copy and observe the test fail, then restore the original implementation.

Maintenance includes the evidence as well as the script. Real provider claims may change even when your code still works. Keep evidence for each real source and explain what should trigger a recheck and how to repeat the comparison. For the fictional fixture, simply state that it is fixed teaching data. Measure preparation, verification, and correction time alongside script runtime. A workflow that automates a table but doubles the checking effort may need simplification rather than more features.

WORKED EXAMPLE

Test the Import Contract

Save as test_report.py beside report.py. Run python -m unittest -v test_report.py from the project folder.

python
import unittest
from report import validate, render

def record(**changes):
    row = {"id":"seed", "title":"SeedNotes", "topic":"web",
           "url":"https://example.org/seed", "access":"Free reading", "sourceId":"S1"}
    row.update(changes)
    return row

class ReportTests(unittest.TestCase):
    def test_valid_record(self):
        self.assertEqual(len(validate([record()])), 1)
    def test_blank_title(self):
        with self.assertRaises(ValueError):
            validate([record(title=" ")])
    def test_duplicate_id(self):
        with self.assertRaises(ValueError):
            validate([record(), record()])
    def test_title_remains_one_cell(self):
        draft = render(validate([record(title="Read | review")]))
        self.assertIn(r"Read \| review", draft)

    def test_html_is_text(self):
        draft = render(validate([record(title="<img src=x>")]))
        self.assertIn("&lt;img src=x&gt;", draft)
        self.assertNotIn("<img", draft)

if __name__ == "__main__":
    unittest.main()
  1. Each test creates fresh data, so one test does not depend on another changing a shared record.
  2. The invalid cases expect ValueError rather than a particular internal implementation.
  3. The rendering check verifies an escaped table separator in the returned draft.

Expected Result

Five tests pass and unittest reports OK. Timing and diagnostic ordering may vary by interpreter.

PROJECT STAGE 07 / 7

Package the Repeatable Workflow

Builds on: Use the validator, renderer, boundary fixture, ledger, and comparison already created.

  1. Save test_report.py and run the five checks before changing the script.
  2. On a disposable copy, remove the duplicate-ID rejection and confirm the duplicate test fails; restore it afterwards.
  3. Write README.md with Python prerequisites, the run command, filenames, expected output, and invalid-input behaviour.
  4. Record manual versus automated preparation, review, and correction time for the same three records.
  5. Add a maintenance note separating fixed fictional fixtures from real claims that would require source rechecking.

Keep This Deliverable

A tested local draft generator with a README, evidence ledger, and maintenance decision.

Check Your Build

  • All five tests pass after the deliberate regression is restored.
  • The README lets another learner reproduce the three-record draft without hidden conversation context.
  • The conclusion includes verification effort and does not claim that passing tests verifies provider facts.

Common Mistakes and Fixes

Keeping tests that only repeat the exact implementation.
Assert meaningful outcomes such as rejection, preserved content, and predictable formatting.
Forgetting that fresh code can render stale research.
Maintain source evidence separately from software test results.

Check Your Understanding

What does a passing test suite say about the truth of a resource’s pricing?

Reveal the explanation

Nothing by itself. The suite checks the import and rendering contract. Pricing claims require current original-source evidence.

Ready to Move On?

The five tests pass after restoration, another learner can reproduce the draft, and source review remains separate from code validation.

Open the learning resource

Project References

HACKTRONIAN_CLI // COMMAND PALETTE
QUICK_EXEC: