Run artifact

workspace/targets/ReadingList/evidence/block-2.md

Evidence: Block 2 ยท Service (block-2)

Stories built

Stacked context

Build directory changes

Pre-build acceptance observation

intent: A valid submission returns 201 with the stored book's title and author. return code: 1 stderr: Traceback (most recent call last): File "add-book-stores-valid.py", line 8, in <module> assert response.status_code == 201 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError

intent: An empty title returns 400 and names the title field. return code: 1 stderr: Traceback (most recent call last): File "add-book-rejects-empty-title.py", line 7, in <module> assert response.status_code == 400 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError

intent: An empty author returns 400 and names the author field. return code: 1 stderr: Traceback (most recent call last): File "add-book-rejects-empty-author.py", line 7, in <module> assert response.status_code == 400 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError

intent: A whitespace-only title is treated as empty and returns 400. return code: 1 stderr: Traceback (most recent call last): File "add-book-rejects-whitespace-title.py", line 7, in <module> assert response.status_code == 400 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError

Post-build programmatic acceptance

intent: A valid submission returns 201 with the stored book's title and author. target interpreter: /mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261014.051827/build/ReadingList/.venv/bin/python provisioning: not required return code: 0

intent: An empty title returns 400 and names the title field. target interpreter: /mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261014.051827/build/ReadingList/.venv/bin/python provisioning: not required return code: 0

intent: An empty author returns 400 and names the author field. target interpreter: /mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261014.051827/build/ReadingList/.venv/bin/python provisioning: not required return code: 0

intent: A whitespace-only title is treated as empty and returns 400. target interpreter: /mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261014.051827/build/ReadingList/.venv/bin/python provisioning: not required return code: 0

Build summary

The build directory has no routes yet, and create_app() registers nothing. The spec doesn't say where the store lives, and the acceptance checks call web_client() with no arguments, so I'll read the DSN from an environment variable with a data/app.db default. I'll write the settings module, the framework-independent service, the thin blueprint, and the factory wiring.Next, the tests. The existing factory test asserts that no routes are registered, which this feature changes, so I'll update it. I also want the test store isolated from data/, so I'll add an autouse fixture to the conftest. I need to read those files before editing them.Now I'll run the existing suite, then the four declared acceptance checks from FEATURE-AddBook.md, each as its own script outside the build directory.The -I flag also ignores PYTHONPATH, so the import failed on the path, not the code. The scripts live in their own directory, so I'll run them without -I.All four declared acceptance checks pass, and the project suite is green (38 tests, exit 0). I did not run sources/full_test.sh, because no criterion in this block invokes it.

Summary

POST /books now accepts a title and author, stores the book through db.books.create, and returns 201 with id, title, and author. An empty, whitespace-only, missing, or non-string field returns 400 with {"field": "title"} or {"field": "author"}, and nothing is stored. The route is a thin Blueprint. Validation and storage live in a framework-independent service, and no module outside persistence imports sqlite3.

I changed one existing test. test_create_app_registers_no_feature_routes asserted that no routes exist at all. This feature adds /books, so the assertion now expects exactly /books plus static. I also added an autouse fixture in tests/conftest.py that points tests at a temporary store.

Choices I made (the spec didn't settle these)

<blueprint-decisions> [{"spec":"FEATURE-AddBook.md","severity":"Low","subject":"Database location for create_app","decision":"No spec names a DSN. create_app() reads READINGLIST_DATABASE and defaults to data/app.db under the project root. Tests redirect it to a temp store via an autouse fixture. Acceptance checks that call web_client() outside pytest write to data/app.db. Is that acceptable, or should the default become a temp store?"},{"spec":"FEATURE-AddBook.md","severity":"Low","subject":"Trim before storing","decision":"Title and author are trimmed before storage and the trimmed values are returned, following DATABASE.md's non-empty-after-trimming rule. Is that acceptable?"}] </blueprint-decisions>

FILES CHANGED:

SUMMARY:

RESULT: SUCCESS