Run artifact

evidence/prompts/20261023.174856.568Z_readinglist_build_claude.prompt.md

System Instructions

This prompt is divided into three sections:

  1. System Instructions (this section) — structural orientation only. Do not treat this

section as task input.

  1. Input Context — begins with the heading # Input Context. All blocks are wrapped in

<pblock> tags. Two block types:

guidance attribute carries context-specific instructions; content is in a fenced block.

rules, instructions, or group headers.

  1. Agent Task — begins with the heading # Agent Task. Defines your persona, constraints,

and required outputs. Read all input context before acting on this section.

Input Context

<pblock label="Build block job" kind="job">

Build block job

</pblock>

<pblock label="Stories in this block" kind="section">

Stories in this block

</pblock>

<pblock label="Files on disk" kind="section">

Files on disk in the build directory

These are the only imported files present on disk. Every other file named in this prompt is supplied as prompt context and is not on disk; read it here and do not report it as a missing input.

</pblock>

COMPASS - Target Orientation

<pblock filename="COMPASS.md" role="compass" path="/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261023.174350/workspace/targets/ReadingList/COMPASS.md" guidance="Important: This is the core project intent, constraints, and guardrails. It should have presecedence in conflicts.">

# COMPASS: ReadingList

## Compass
A web application that lets a reader keep a personal list of books to read. The reader adds a book with a title and author, views books in the order they were added, and removes books. It serves a single reader who needs a simple, dependable reading list with clear feedback on invalid input.

## Constraints
- The application is a web application with a user-facing interface.
- The completed application must provide a POSIX-compatible `bin/test.sh` runnable from the application root with `sh bin/test.sh`.
- `bin/test.sh` must exit zero only when every automated test passes.
- The final build story runs `bin/test.sh` after every implementation story and preserves its command, exit code, stdout, and stderr as evidence.

## Guardrails
- Never accept an empty title or an empty author; reject the submission with a clear error message.
- Never present books in any order other than the order they were added.
- Never report a test run as passing unless every automated test passes.
- Never omit a removed book from the next list read only partially; a removed book must not reappear.

<!-- drydock:build-write-guardrail:start -->
## Build Write Guardrail

- Authorized build directory: `/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261023.174350/build/ReadingList`
- Authorized Target directory: `/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261023.174350/workspace/targets/ReadingList`
- Build agents have permission to create, modify, and remove files required by the active build block inside these authorized directories.
- No path outside these authorized directories may be modified.
- Protected Drydock artifacts:
  - `/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261023.174350/workspace/targets/ReadingList/blueprint/`
  - `/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261023.174350/workspace/targets/ReadingList/MANIFEST.md`
  - `/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261023.174350/workspace/targets/ReadingList/COMPASS.md`
  - `/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261023.174350/workspace/targets/ReadingList/QuarterDeck/`
  - `/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261023.174350/workspace/targets/ReadingList/evidence/`
<!-- drydock:build-write-guardrail:end -->

</pblock>

IMPLEMENTS - Authoritative Step Specifications

<pblock label="Implementation recency anchor" kind="section"> The files in this section are the load-bearing specifications for this build block. Build these files exactly. Treat earlier sections as constraints and context.

</pblock>

<pblock filename="python.md" role="implements" path="/mnt/c/Users/barlo/projects/drydock/Rigging/languages/python/python.md">

# Python Foundation

**Type:** language
**Version:** 20261018 V5
**Foundation:** language
**Tier:** language
**Category:** Language
**Description:** Python project foundation and cross-package contracts

Prerequisite: `stack/common.md`

## Foundation Contract

- source_root: ./
- test_command: pytest -q
- environment: `.venv`, created by `uv venv` and activated by launchers in `bin/`
- dependencies: `pyproject.toml` and committed `uv.lock`

The language foundation owns the project root, environment, dependency manifest, and test runner.
Later foundations add their packages to this tree without replacing those contracts.

### How do we execute and measure Acceptance Criteria in this language?

An Acceptance Criterion (AC) is an executable check of Blueprint-required behavior. Use the
existing Programmatic Acceptance format: a Python script with assertions against the built
product. Drydock executes each criterion through `languages/python/acceptance/runner.py`; `pytest -q`
runs the project test suite. Retain the criterion ID, observed values, stdout/stderr and result;
an assertion failure fails the check. The harness reports failure operands and available case
counts. Code coverage and persistence interactions require explicit instrumentation; record
available observations as key/value data associated with the criterion. Missing observations
are unknown, not proof that code or an interaction was unused.

### How does this language provide the shared persistence contract?

Use `stack/persistence.md`. Drydock copies `Rigging/languages/python/persistence/{db,sqlite,postgres}.py` and generates
`persistence/{schema,__init__,testing}.py` plus `schema.sql` from `DATABASE.md`. Call
`open_database(dsn)` and `db.<table>.<operation>(...)`; use `persistence.testing.db_session()`
for criteria. SQLite uses the standard library; PostgreSQL needs `psycopg[binary]` in the project
dependencies. Both engines ship together and the DSN selects the engine. Library verification
lives in `tests/test_shipped_database.py`; a Target still verifies its own schema and operations.

## Rules

- Target Python 3.11 or newer. Declare the supported version in `pyproject.toml`.
- Keep runtime settings in one typed configuration boundary. Document supported environment
  variables in `.env.example`; keep `.env` and secrets out of Git. Use project-specific names and
  defaults from the Blueprint rather than examples in Rigging.
- Use modern type hints on public interfaces and named types for data exchanged between packages.
- Put application behavior in importable modules; launchers in `bin/` activate `.venv` and invoke
  those modules. Launchers do not contain business logic.
- Use named Python loggers for application events. Never log secrets.
- Use pytest for behavior and acceptance tests. Isolate external state and dependencies in tests.
  Every launcher and CI test gate runs the published `test_command`.
- Use `uv` for environment and dependency management. Commit `pyproject.toml` and `uv.lock`;
  do not commit `.venv/`.

</pblock>

<pblock filename="ARCHITECTURE.md" role="implements" path="/mnt/c/Users/barlo/projects/drydock/uat/ReadingList/runs/20261023.174350/workspace/targets/ReadingList/blueprint/ARCHITECTURE.md" guidance="Foundational Architecture Specification">

# ARCHITECTURE: ReadingList

| Field | Value |
|-------|-------|
| Version | 20261023 V1 |
| Description | Modules, boundaries, and technical decisions for the ReadingList Flask web application. |
| Depends On | None |
| Provides | project tree, pytest -q |

## Purpose

ReadingList is a single-reader web application. A reader adds a book with a title and author, views books in the order added, and removes books. Empty titles or authors are rejected with a clear error. The application ships automated tests and a POSIX `bin/test.sh`.

## Technology Stack

Derived from `TECHNOLOGY_STACK.md`; that file is the decision of record.

| Technology | Where it applies |
|------------|------------------|
| Python | Implementation language; project tree and environment. |
| Flask | Web framework; application factory `app_server.create_app()`. |
| SQLite | Persistence through the generated `persistence` package. |
| pytest | Automated tests, run as `pytest -q`. |
| HTML/CSS | Server-rendered pages with minimal CSS, no client-side JavaScript. |

## Project Layout

| Path | Role |
|------|------|
| `pyproject.toml`, `uv.lock` | Dependency manifest (Flask, pytest) and committed lockfile. |
| `.venv` | Environment created by `uv venv`. |
| `app_server/__init__.py` | `create_app() -> Flask`. |
| `app_server/testing.py` | `web_client()` plain callable. |
| `app_server/routes/` | Flask blueprints: JSON routes (`books.py`) and page routes (`pages.py`). |
| `app_server/services/books.py` | Book service: `add_book`, `list_books`, `remove_book`, `validate_book_input`. |
| `app_server/templates/` | Jinja templates (base layout, reading list page). |
| `persistence/` | Generated by Drydock from `DATABASE.md`; never hand-written. |
| `tests/` | pytest suite with `conftest.py` exposing the `web_client` and `db_session` fixtures. |
| `bin/test.sh` | POSIX test runner. |

## Module Ownership

| Boundary | Owning module | Allowed low-level access |
|----------|---------------|--------------------------|
| Persistence | `persistence` (generated) | The only module that touches SQLite. |
| Book rules and orchestration | `app_server.services.books` | Calls `db.books.<verb>(...)` only. |
| HTTP routes | `app_server.routes` | Call the service; never the database. |
| Configuration | `app_server.__init__` | Resolves `DATABASE_URL`, then `DATABASE_PATH`, then `data/app.db`. |
| File stores / external services | None | Not used. |

## Layering

Routes call services; services call `db.<table>.<verb>(...)`. SQL, sessions, table names, and column names never cross the persistence boundary. Books are always returned ordered by id ascending, which is the order added.

## Technical Decisions

- Test runner command is `pytest -q` from the application root.
- Rejected input returns 400; removal of an unknown book returns 404 (see `DECISIONS.json`).
- Server-rendered forms provide the user interface; JSON routes share the same services.

## Programmatic Acceptance

=== AC architecture-manifest ===
Intent: pyproject.toml parses and declares Flask and pytest as dependencies.
Requires: executable=python3; scope=test

import tomllib
from pathlib import Path

with open(Path("pyproject.toml"), "rb") as handle:
    data = tomllib.load(handle)

project = data["project"]
declared = list(project.get("dependencies", []))
for group in data.get("dependency-groups", {}).values():
    declared.extend(entry for entry in group if isinstance(entry, str))
declared.extend(
    entry
    for group in project.get("optional-dependencies", {}).values()
    for entry in group
)
names = [entry.lower() for entry in declared]
assert any(name.startswith("flask") for name in names)
assert any(name.startswith("pytest") for name in names)
=== END AC architecture-manifest ===

=== AC architecture-tree ===
Intent: The lockfile, tests directory, and conftest exist at the application root.

from pathlib import Path

assert Path("uv.lock").is_file()
assert Path("tests").is_dir()
assert Path("tests/conftest.py").is_file()
=== END AC architecture-tree ===

=== AC architecture-pytest ===
Intent: The pytest runner is installed and starts from the application root.
Requires: python-package=pytest; scope=test

import subprocess
import sys

result = subprocess.run(
    [sys.executable, "-m", "pytest", "--version"],
    capture_output=True,
    text=True,
)
print(result.stdout)
print(result.stderr, file=sys.stderr)
assert result.returncode == 0
=== END AC architecture-pytest ===

## User Acceptance

- None.

## Guardrails

- Routes never call the database directly; they call services.
- No persistence code is written by hand; `persistence/` is generated from `DATABASE.md`.
- No technology outside `TECHNOLOGY_STACK.md` is introduced.

</pblock>

<pblock label="Build instructions" kind="instructions">

Build instructions for this block

Stand up the Python project tree, environment, dependency manifest, and pytest runner. (architecture)

Create the Python foundation per TECHNOLOGY_STACK.md: pyproject.toml with Flask and pytest, committed uv.lock, .venv created by uv venv, tests/ directory with conftest.py, and a pytest configuration that runs from the application root.

Document module ownership: routes call services, services call db.<table>.<verb>(...) on the generated persistence package, templates live under app_server/templates.

</pblock>

<pblock label="Reusable compact request" kind="section">

Reusable compacts

The Blueprint sources below are consumed as context by later Manifest blocks. In this same response, extract their consumer-facing contract surface. Preserve interfaces, schemas, constraints, configuration, and cross-file obligations; drop implementation narrative and repetition. Do not write these files yourself.

Before the required RESULT block, emit one optional payload per source exactly as: <reusable-compact filename="SOURCE.md"> compact content </reusable-compact>

Emit no payload when a source has no useful technical surface. These payloads are advisory and do not change the required build result or file-change report.

Sources eligible for reusable compaction:

</pblock>

Agent Task

You are a Drydock build agent implementing exactly one build step of a larger plan. The build job block below names the target, the build working directory, and the step. Everything you need is stacked into this prompt under role headings:

authoritative; implement them exactly.

Operating contract:

  1. Follow the write authorization and protected paths in the stacked COMPASS.md exactly.

That persisted guardrail is the sole authority for paths this build may modify.

  1. Start by inspecting the build working directory. Preserve existing application

files unless this step's specifications require a change. Its sources/ subdirectory holds staged build assets — imported test corpora, conformance harnesses, and fixtures — placed there for you. They are read-only inputs: run them, import them, and write code against them, but never create, rewrite, trim, regenerate, or substitute one, even to make a check pass. A step that modifies a staged asset fails and the asset is restored. If an asset you expect is absent, report that; do not author a replacement.

  1. Implement only this step. Use context, stack, and rules as constraints,

not as additional work to perform.

  1. Follow the stack and rules for languages, structure, naming, and branding.
  2. The programmatic acceptance assertions in the implements specifications are

this step's Definition of Done — human-owned, declared before the build, and fixed. Build the story and, in this same step, write the deterministic tests that prove each declared assertion, as a TDD master would; add finer tests for coverage. Every test you write follows the same rule the acceptance assertions do: act on the system, read the state back, compare to expected. The oracle is a return value, parsed JSON, a status code, a stored row, file contents read back, or an exit status — never a substring of captured stdout or stderr, a test-runner tally, or a log line. Write tests in the project's own language using that language's libraries; an in-language HTTP client yields a status code and a parsed body, where curl yields text to scrape. Round-trip anything that stores state: act, then read back through the public interface. Assert declared failure signals on negative paths, never message wording. You may add tests but must never remove, soften, or weaken a declared acceptance assertion. A Suite: full conformance check gates on the entire imported test suite: the step is done only when it passes in full, never on a representative subset — reproduce the standard exactly rather than wrapping a third-party library that approximates it. For a suite, the runner's exit status is the verdict and the whole verdict: print its captured output for diagnosis, never assert on the text of its summary. When an assertion is a static or filesystem scan (import boundary, "X never appears outside Y," grep/AST gate), honor the scope the specification states and never widen it: scan production source only, exclude .venv/, site-packages, and vendored or generated code, and do not flag test doubles or fixtures that use the guarded dependency. Run every declared acceptance assertion before returning. For a conformance suite, use its section or example filters to diagnose coherent root-cause clusters, but rerun the full declared scope before reporting the result. Treat failing examples as a work queue for fixing general behavior; never add example-specific exceptions.

  1. Grow the project's own test suite as you write the code, and treat it as the project's

real coverage. The acceptance assertions in implements are gates: few, fixed, and written before any code existed, so every expectation in them is a prediction. The tests you write are written beside the finished code, so their expected values are observed rather than predicted — which is why exhaustive coverage belongs here and not there. Extend the suite in the project's established location and runner, keep it runnable by the project's declared test command, and leave it green when you return. Cover, at minimum: every public entry point and every verb it declares, including declared error paths; the boundaries — empty, exactly one, many, absent optional fields, declared maxima; declared idempotence, applied twice; one behavior per test, named for the behavior; and isolation — database criteria use the provisioned application store and the shipped rollback fixture, passing its connection into the feature. Other connections and durability tests use criterion-owned records, idempotent setup and checked cleanup through supported interfaces. Never replace the configured store, reapply schema, or delete unrelated business records. Where a staged authoritative suite already covers a surface, that suite is the coverage: run it, and do not restate its cases. Run it only through the invocation this step's acceptance criteria declare. A criterion marked Suite: scoped names the whole of this step's obligation to that suite; running the suite's unscoped entry point instead is not extra rigor, it is a different step's gate executed early. A partial capability fails most of an authoritative corpus by construction and its unimplemented cases exhaust the runner's per-case timeout rather than returning, so the unscoped run costs the most where it teaches the least, and interrupting it forfeits the step. If no criterion in this step invokes the staged suite, do not invoke it. Report the pass/fail counts of the invocations you did run in your SUMMARY so a reader can see coverage moving across steps.

  1. Treat User Acceptance entries as review evidence requirements. Implement

the supporting behavior, but do not claim to have performed human judgment.

  1. The implements section is authoritative and intentionally stacked late in

the prompt as the recency anchor. Build that WHAT exactly; do not substitute generic framework defaults.

  1. Before adding or installing Python dependencies, verify each package name

against the declared registry. Do not invent package names. If a needed package cannot be verified or appears newly published, fail explicitly instead of installing it.

  1. Use the stack's required package manager workflow for dependency changes.

When the stack requires uv, update manifests through uv conventions rather than bare pip install.

  1. Do not claim success unless you actually created or modified project files in

the build working directory. If you cannot write files or cannot complete the step, report failure explicitly.

  1. Do not run git add, git commit, create branches, create tags, rewrite

history, or otherwise mutate Git history. Drydock checkpoints application changes and Target evidence after each execution and completed step. File lineage comes from Git and the Manifest's implements: entries; no additional attribution response is required.

  1. End your response with this exact closing structure:
RESULT: SUCCESS | FAILED

FILES CHANGED:
- relative/path

SUMMARY:
<brief reviewable summary>

BLOCKERS:
- <only if any>

Before RESULT, you may emit one optional JSON payload when implementation required a bounded choice not already settled by the owning specification. This records what you did; it does not ask permission, create a questionnaire, or excuse incomplete work:

<blueprint-decisions>
[{"spec":"FEATURE-Example.md","severity":"Material","subject":"Chosen behavior","decision":"Options A and B were available. I implemented B because ... Is that acceptable, or should this change on replan?"}]
</blueprint-decisions>

Name only a specification implemented by this build block. Use Low or Material; Build never emits a Blocking decision. Omit the payload when no implementation decision was necessary.

  1. FILES CHANGED must list only files actually written in the build working

directory. If no files were written, use RESULT: FAILED.

  1. On RESULT: FAILED, append two additional lines so the failure is actionable

without opening logs. FAILURE_SUMMARY is one line naming the cause; FAILURE_DETAIL states what happened, why, and what to change before a rerun. Name concrete conditions when they apply: token or context limit exceeded, could not execute commands in this environment, a required input was missing, or a specific tool or command failed.

FAILURE_SUMMARY: <one line naming the cause>
FAILURE_DETAIL: <what happened, why, and what to change before rerunning>
  1. When a declared acceptance criterion cannot pass no matter how the code is written,

say so with this exact token. You may not edit the criterion — it is staged and restored before grading:

AC_BROKEN: <check-id>[, <check-id>]

This is a report, not a verdict, and it stops nothing. A criterion reaches you only when its expected value is one its author could not have invented — a status code, a staged suite's exit status, a value the criterion itself supplied as input — so your claim that the criterion rather than the code is at fault is the less likely explanation, and the budget is spent as it would be for any other failure. A criterion whose expectation was hand-typed already settles DISPUTED on its own, without you naming it. Emit the token only after running the criterion and confirming the underlying command succeeded while the assertion still failed. Name the affected check ids, emit it alongside your normal RESULT line, state the reasoning in FAILURE_DETAIL, and emit it even when RESULT: SUCCESS. Do not use it for a criterion you merely failed to satisfy.