- compose.yml: add postgres service with profiles, healthcheck, pg_isready
- compose.yml: add DATABASE_URL env var and conditional depends_on (required: false)
- compose.yml: add postgres-data volume; default deploy remains SQLite-only
- compose.dev.yml: add postgres service with port 5432 exposed for local dev
- compose.dev.yml: add DATABASE_URL env var and conditional depends_on
- pkg/diunwebhook/postgres_test.go: build-tagged NewTestPostgresServer helper
- Add DATABASE_URL env var branching: pgx/PostgreSQL when set, SQLite when absent
- Blank-import github.com/jackc/pgx/v5/stdlib to register 'pgx' driver
- Log 'Using PostgreSQL database' or 'Using SQLite database at {path}' on startup
- Replace RunMigrations with RunSQLiteMigrations (rename from Plan 01)
- Fix TagsHandler UNIQUE detection to use strings.ToLower for cross-dialect compat
- Add 03-01-SUMMARY.md with full execution record
- Update STATE.md: advance to plan 2, record metrics and decisions
- Update ROADMAP.md: phase 03 in progress (1/2 plans complete)
- Update REQUIREMENTS.md: mark DB-01 and DB-03 complete
- PostgresStore struct with *sql.DB field (no mutex needed for PostgreSQL)
- NewPostgresStore constructor with pool config: MaxOpenConns(25), MaxIdleConns(5), ConnMaxLifetime(5m)
- UpsertEvent with $1..$15 positional params and ON CONFLICT DO UPDATE
- GetUpdates identical SQL to SQLiteStore (TEXT timestamps, COALESCE)
- AcknowledgeUpdate uses NOW() instead of datetime('now')
- ListTags identical to SQLiteStore
- CreateTag uses RETURNING id (pgx does not support LastInsertId)
- DeleteTag, UnassignTag, TagExists use $1 positional param
- AssignTag uses ON CONFLICT (image) DO UPDATE SET tag_id = EXCLUDED.tag_id
- Add github.com/jackc/pgx/v5 v5.9.1 dependency
- Add golang-migrate pgx/v5 driver
- Create migrations/postgres/0001_initial_schema.up.sql with SERIAL PRIMARY KEY
- Create migrations/postgres/0001_initial_schema.down.sql
- Rename RunMigrations to RunSQLiteMigrations in migrate.go
- Add RunPostgresMigrations with pgxmigrate driver and 'pgx5' name
- Update export_test.go to use RunSQLiteMigrations (go vet compliance)
- Remove TestMain (no longer needed; each test is isolated)
- Replace all diun.UpdatesReset() with diun.NewTestServer() per test
- Replace all diun.SetWebhookSecret/ResetWebhookSecret with NewTestServerWithSecret
- Replace all diun.WebhookHandler etc with srv.WebhookHandler (method calls)
- Replace diun.UpdateEvent with srv.TestUpsertEvent
- Replace diun.GetUpdatesMap with srv.TestGetUpdatesMap
- Update helper functions postTag/postTagAndGetID to accept *diun.Server parameter
- Change t.Fatalf to t.Errorf inside goroutine in TestConcurrentUpdateEvent
- Add error check on second TestUpsertEvent in TestDismissHandler_ReappearsAfterNewWebhook
- All 32 tests pass with zero failures
- RunMigrations applies versioned SQL files via golang-migrate + embed.FS (iofs)
- ErrNoChange handled correctly - not treated as failure
- Migration 0001 creates full current schema with CREATE TABLE IF NOT EXISTS
- All three tables (updates, tags, tag_assignments) with acknowledged_at and ON DELETE CASCADE
- Uses database/sqlite sub-package (modernc.org/sqlite, no CGO)
- go mod tidy applied after adding dependencies
- Store interface with 9 methods covering all persistence operations
- SQLiteStore implements all 9 methods with exact SQL from current handlers
- NewSQLiteStore sets MaxOpenConns(1) and PRAGMA foreign_keys = ON
- UpsertEvent uses ON CONFLICT DO UPDATE with acknowledged_at reset to NULL
- AssignTag uses INSERT OR REPLACE for tag_assignments table
- golang-migrate v4.19.1 dependency added to go.mod
- TestUpdateEventAndGetUpdates: UpdateEvent error now fails test
- TestUpdatesHandler: UpdateEvent error now fails test
- TestConcurrentUpdateEvent goroutine: UpdateEvent error now fails test
- TestDismissHandler_Success: UpdateEvent error now fails test
- TestDismissHandler_SlashInImageName: UpdateEvent error now fails test
- TestDismissHandler_ReappearsAfterNewWebhook: bare UpdateEvent call now checked
All 6 silent-return sites replaced; test failures are always visible to CI
- Add maxBodyBytes constant (1 << 20 = 1 MB)
- Add errors import to production file
- Apply http.MaxBytesReader + errors.As(err, *http.MaxBytesError) pattern in:
WebhookHandler, TagsHandler POST, TagAssignmentHandler PUT and DELETE
- Return HTTP 413 RequestEntityTooLarge when body exceeds limit
- Fix oversized body test strategy: use JSON prefix so decoder reads past limit
(Rule 1 deviation: all-x body fails at byte 1 before MaxBytesReader triggers)
- TestWebhookHandler_OversizedBody: POST /webhook with >1MB body expects 413
- TestTagsHandler_OversizedBody: POST /api/tags with >1MB body expects 413
- TestTagAssignmentHandler_OversizedBody: PUT /api/tag-assignments with >1MB body expects 413
- Create 01-01-SUMMARY.md documenting both bug fixes and test addition
- Advance plan counter to 2/2 in STATE.md
- Record decisions and metrics in STATE.md
- Update ROADMAP.md plan progress (1/2 summaries)
- Mark requirements DATA-01 and DATA-02 complete
- Verifies tag survives a second UpdateEvent() for the same image (DATA-01)
- Verifies acknowledged_at is reset to NULL by the new event
- Verifies event fields (Status) are updated by the new event
- Add PRAGMA foreign_keys = ON in InitDB() after SetMaxOpenConns(1)
- Replace INSERT OR REPLACE INTO updates with named-column INSERT ON CONFLICT UPSERT
- UPSERT preserves tag_assignments rows on re-insert (fixes DATA-01)
- FK enforcement makes ON DELETE CASCADE fire on tag deletion (fixes DATA-02)
Investigates SQLite UPSERT semantics, FK enforcement per-connection
requirement, http.MaxBytesReader behavior, and t.Fatal test patterns.
All four DATA-0x bugs confirmed with authoritative sources and line
numbers. No open blockers; ready for planning.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Parallel analysis of tech stack, architecture, structure,
conventions, testing patterns, integrations, and concerns.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Introduce `Dockerfile` for building and serving static site using Bun and Nginx
- Add `nginx.conf` for configuring static file caching and routing rules
- Expose port 80 for containerized deployment
- Add detailed architecture and workflow diagram to explain dashboard functionality
- Include a "Quick Start" section with Docker Compose setup instructions
- Document tech stack and layers used in the project
- Enhance feature descriptions for better clarity and user guidance
- Add `.gitignore` to exclude `node_modules/`, `.vitepress/cache/`, and `.vitepress/dist/` directories
- Include `bun.lock` for dependency management with Bun
- Introduced `compose.yml` for deployment, pulling the image from the registry
- Added `compose.dev.yml` for local development, building the image from source
- Updated `README.md` and `.claude/CLAUDE.md` with instructions for both configurations
- Introduced `DB_PATH` environment variable to customize SQLite database file location
- Updated `main.go` to use `DB_PATH` with a default fallback (`./diun.db`)
- Protect `/webhook` endpoint using the `Authorization` header
- Update `README.md` with setup instructions and examples for authentication
- Warn when `WEBHOOK_SECRET` is not configured
- Add tests for valid, missing, and invalid token scenarios
- Update `docker-compose.yml` to support `WEBHOOK_SECRET` configuration
- Reflect addition of React SPA, SQLite persistence, and tag management
- Update quick start guide for backend and frontend setup
- Document full API routes and database schema
- Revise project structure for recent refactor
- Improve production and testing notes for clarity