The persistence package and `schema.sql` are already on disk and committed, so this step only needs the project tree, the Flask factory, and tests. I'll set up the environment first, then verify the package names through `uv` resolution.Dependencies resolved through `uv` from PyPI. Before writing tests against the persistence layer, I need the rest of `Database.run` so the assertions match its real return values.I have what I need. Writing the application factory, the test client helper, and the tests. The `.gitignore` keeps `.venv/` out of Git per the Python stack rules.One test I just wrote locks in the wrong behavior: it asserts an empty title is accepted, which contradicts the COMPASS guardrail. I'm removing it, and moving the inline import to the top of the file.Now running the suite through the project environment, plus the three declared acceptance assertions exactly as written in ARCHITECTURE.md.All 16 tests pass and the three declared assertions pass. Checking the working tree for stray residue and confirming the new files are the only changes.
Project: pyproject.toml + committed uv.lock; env .venv via `uv venv`; python >=3.11.
Package app_server:
- create_app() -> Flask. Registers no feature routes; feature stories add blueprints/error handlers.
- app_server.testing.web_client() -> FlaskClient for a fresh app with TESTING=True.
- Unregistered paths answer 404.
Stack: Python (python.md), Flask (flask.md), SQLite via generated `persistence` (sqlite.md), pytest.
Guardrails: no feature routes registered in the factory; no module outside `persistence` imports sqlite3.
Table books: id INTEGER PK (autoincrement; list order ascending id), title TEXT NOT NULL, author TEXT NOT NULL.
Operations (persistence.open_database(dsn) -> Database; db.books.(...)):
- books.create(title, author) -> new id (title/author non-empty after trim, per Blueprint).
- books.list() -> list[Book] in ascending id order.
- books.get(id) -> Book | None.
- books.delete(id) -> rows removed (0 or 1).
Book row: id, title, author. Undeclared verbs (e.g. update) raise UnknownOperation.
Guardrail: no empty title or author stored; callers write no SQL.
RESULT: SUCCESS
FILES CHANGED:
- .gitignore
- pyproject.toml
- uv.lock
- app_server/__init__.py
- app_server/testing.py
- tests/conftest.py
- tests/test_app_factory.py
- tests/test_web_client.py
- tests/test_persistence.py
SUMMARY:
- **Project tree and environment:** `pyproject.toml` declares Python >=3.11, `flask` as a runtime dependency and `pytest` as a dev dependency. Both were added with `uv add`, which resolved them from PyPI, and `uv.lock` is committed-ready. The environment is `.venv`, created with `uv venv` and ignored by `.gitignore`.
- **Application factory:** `app_server/__init__.py` exposes `create_app() -> Flask` and registers no feature routes.
- **Test client:** `app_server/testing.py` exposes `web_client()` exactly as the Foundation Contract shows.
- **Persistence:** the `persistence/` package and `schema.sql` were already on disk and committed. I did not modify them. The persistence tests exercise the declared `books` operations through `db_session()`.
- **Test runner:** `pytest` is configured in `pyproject.toml` with `pythonpath = ["."]`. `tests/conftest.py` provides the `web_client` fixture, which delegates to the helper, and the `db_session` fixture, which uses a fresh temporary store per test.
- **Verification:** `uv run pytest` gives 16 passed, exit 0. The three declared ARCHITECTURE.md acceptance assertions (`architecture-create-app`, `architecture-web-client-testing`, `architecture-web-client-unregistered`) each pass when run as written.
- **Judgment calls:**
- I added `.gitignore` for `.venv/`, `__pycache__/`, and `data/` so the environment and runtime database stay out of Git.
- I did not write `bin/test.sh`. ARCHITECTURE.md assigns it to the terminal story, not this block.
- I did not run `sources/full_test.sh`. None of this block's acceptance criteria invoke it.
- I left the existing `data/app.db` untouched.
- **Test coverage:** the tests cover the factory's return type, instance isolation, the single static route, and the TESTING default. They also cover the test client's TESTING flag and 404 path, plus the store's create, get, list ordering, delete, absent-id, undeclared-verb, and per-session isolation behavior.