Run artifact

workspace/targets/ReadingList/blueprint/SCREEN-ReadingList.md

SCREEN: Reading List

FieldValue
Version20261023 V1
DescriptionServer-rendered page that shows the reading list in the order added, with an add form, error display, and per-book remove buttons.
Depends OnFEATURE-AddBook.md, FEATURE-RejectEmptyFields.md, FEATURE-ListBooks.md, FEATURE-RemoveBook.md, FEATURE-AppShell.md
ProvidesGET /, POST /add, POST /remove/{book_id}
ConsumesGET /books, POST /books, DELETE /books/{book_id}
Route/
Parent—
Main MenuReading List (1)
Tab Order—

Purpose

The single page of the application. A reader sees their books in the order they were added, adds a book with a title and author, sees a clear error when either is empty, and removes books they no longer want.

Layout

Routes

RouteMethodBehavior
/GETRenders the page with all books in the order added; status 200.
/addPOSTForm fields title and author. Valid input stores the book through the book service and redirects 303 to /. Empty or whitespace-only title or author re-renders the page with status 400, a visible error message, and nothing stored.
/remove/{book_id}POSTRemoves the book through the book service and redirects 303 to /. An unknown id also redirects 303 to / without changing state.

The screen calls the same service functions that back POST /books, GET /books, and DELETE /books/{book_id}, so browser and JSON behavior cannot diverge. No client-side JavaScript is used.

Interactions

  1. The reader fills in both fields and submits; the page reloads with the new book at the end of the list.
  2. The reader submits with an empty title or author; the page reloads with an error message and the list unchanged. Entered values are preserved in the form.
  3. The reader presses "Remove" on a book; the page reloads without that book.

Database Interface

Programmatic Acceptance

=== AC screen-index-renders ===
Intent: GET / answers 200 and shows an added book's title and author, and GET /books agrees with it on the same book.
Suite: scoped

import uuid from app_server.testing import web_client

client = web_client() token = uuid.uuid4().hex title = "ac-screen-title-" + token author = "ac-screen-author-" + token created = client.post("/books", json={"title": title, "author": author}) assert created.status_code == 201 book_id = created.get_json()["id"] try: page = client.get("/") assert page.status_code == 200 html = page.get_data(as_text=True) assert title in html assert author in html listed = [b["id"] for b in client.get("/books").get_json()] assert book_id in listed finally: client.delete(f"/books/{book_id}") === END AC screen-index-renders ===

=== AC screen-add-form ===
Intent: POST /add with a title and author redirects 303 and the book then appears on GET / and in GET /books.
Suite: scoped

import uuid from app_server.testing import web_client

client = web_client() token = uuid.uuid4().hex title = "ac-form-title-" + token author = "ac-form-author-" + token added_ids = [] try: before = {b["id"] for b in client.get("/books").get_json()} response = client.post("/add", data={"title": title, "author": author}) assert response.status_code == 303 after = client.get("/books").get_json() added_ids = [b["id"] for b in after if b["id"] not in before] assert len(added_ids) == 1 stored = [b for b in after if b["id"] == added_ids[0]][0] assert stored["title"] == title assert stored["author"] == author html = client.get("/").get_data(as_text=True) assert title in html finally: for book_id in added_ids: client.delete(f"/books/{book_id}") === END AC screen-add-form ===

=== AC screen-add-rejects-empty ===
Intent: POST /add with an empty title, an empty author, or whitespace-only values answers 400 and stores nothing.
Suite: scoped

import uuid from app_server.testing import web_client

client = web_client() token = uuid.uuid4().hex valid_title = "ac-reject-title-" + token valid_author = "ac-reject-author-" + token cases = [ {"title": "", "author": valid_author}, {"title": valid_title, "author": ""}, {"title": "", "author": ""}, {"title": " ", "author": valid_author}, {"title": valid_title, "author": " "}, ] before = [b["id"] for b in client.get("/books").get_json()] try: for form in cases: response = client.post("/add", data=form) assert response.status_code == 400 assert len(response.get_data(as_text=True)) > 0 after = [b["id"] for b in client.get("/books").get_json()] assert after == before finally: current = client.get("/books").get_json() for book in current: if book["id"] not in before: client.delete(f"/books/{book['id']}") === END AC screen-add-rejects-empty ===

=== AC screen-remove-form ===
Intent: POST /remove/{book_id} redirects 303 and the book is gone from GET / and GET /books; an unknown id also redirects 303.
Suite: scoped

import uuid from app_server.testing import web_client

client = web_client() title = "ac-screen-remove-" + uuid.uuid4().hex created = client.post("/books", json={"title": title, "author": "ac-screen-author"}) assert created.status_code == 201 book_id = created.get_json()["id"] try: response = client.post(f"/remove/{book_id}") assert response.status_code == 303 listed = [b["id"] for b in client.get("/books").get_json()] assert book_id not in listed html = client.get("/").get_data(as_text=True) assert title not in html again = client.post(f"/remove/{book_id}") assert again.status_code == 303 finally: client.delete(f"/books/{book_id}") === END AC screen-remove-form ===

=== AC screen-order-added ===
Intent: GET / presents books in the order they were added.
Suite: scoped

import uuid from app_server.testing import web_client

client = web_client() token = uuid.uuid4().hex titles = [f"ac-screen-order-{token}-{n}" for n in range(3)] ids = [] try: for title in titles: resp = client.post("/books", json={"title": title, "author": "ac-screen-author"}) assert resp.status_code == 201 ids.append(resp.get_json()["id"]) html = client.get("/").get_data(as_text=True) positions = [html.index(title) for title in titles] assert positions == sorted(positions) finally: for book_id in ids: client.delete(f"/books/{book_id}") === END AC screen-order-added ===

User Acceptance

Guardrails