Skip to content

Add Docker Compose setup, data loading script, and update route tests - #19

Merged
gibahjoe merged 2 commits into
mainfrom
datasette-editor-sentry-bug
Jul 28, 2026
Merged

Add Docker Compose setup, data loading script, and update route tests#19
gibahjoe merged 2 commits into
mainfrom
datasette-editor-sentry-bug

Conversation

@gibahjoe

@gibahjoe gibahjoe commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Adds a Docker Compose development environment containing the Flask application, PostgreSQL database, frontend asset watcher, migrations, and automatic loading of the bundled database dump.

The README now documents the recommended Docker workflow, the native Python workflow, and how to restore the bundled PostgreSQL dump.

This also fixes malformed update IDs causing PostgreSQL UUID conversion errors. Update IDs are now explicitly validated before database queries, returning a 404 for invalid values across the preview, apply, and cancel routes.

Additional changes:

  • Add persistent PostgreSQL and Node modules volumes.
  • Wait for PostgreSQL health and successful data loading before starting Flask.
  • Skip restoring the bundled dump when the database already contains dataset data.
  • Remove a duplicated update-not-found check.

Related Tickets & Documents

QA Instructions, Screenshots, Recordings

Docker Compose

Start the complete local environment:

docker compose up --build

Confirm:

  1. The database service becomes healthy.
  2. The load-data service completes successfully.
  3. The app and assets services remain running.
  4. The application loads at http://localhost:5050/.
  5. The bundled database contains dataset records.

Stop the environment with:

docker compose down

No screenshots are required because this PR does not introduce a visual UI change.

Added/updated tests?

  • Yes
  • No, and this is why:
  • I need help with writing tests

Added acceptance coverage for:

  • Invalid update IDs on preview, apply, and cancel routes
  • Successfully previewing a pending update
  • Successfully applying an update
  • Successfully cancelling an update

Run with:

pytest -q tests/acceptance/test_upload_routes.py

Test result:

6 passed

[optional] Are there any post deployment tasks we need to perform?

None. The Docker Compose configuration is for local development and does not change the production deployment configuration.

[optional] Are there any dependencies on other PRs or Work?

None.

- Introduced a Docker Compose configuration for the application and database services.
- Added a script to load a local database backup.
- Implemented tests for update routes to ensure proper handling of invalid update IDs and status changes.
- Refactored update retrieval logic in views to improve code clarity.
Comment thread scripts/docker-load-data.sh
@gibahjoe
gibahjoe merged commit 595f008 into main Jul 28, 2026
2 checks passed
@gibahjoe
gibahjoe deleted the datasette-editor-sentry-bug branch July 28, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants