Commit Graph

14 Commits

Author SHA1 Message Date
5c2aadaab6 fix: address code review findings
- Add is_ignored=0 filter to GetUnnotifiedReleases query per spec section 4.4
  (notification lifecycle must exclude ignored releases)
- Add FK constraint on notifications_sent.rgid referencing external_releases(rgid)
  per spec schema definition
- Wrap migration application + recording in transactions for atomicity
- Add config.yaml to .gitignore to prevent accidental secret commits
- Pin Dockerfile base image to alpine:3.21 and add non-root appuser
- Add test TestGetUnnotifiedReleases_IgnoredExcluded

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 11:46:51 +03:00
c23b698f67 fix: address code review findings
- Fix notifications_sent schema: change to composite PK (rgid, sent_at) per plan spec, remove FK constraint
- Change MarkNotificationSent from INSERT OR REPLACE to INSERT (composite PK semantics)
- Update test: replace idempotent test with duplicate-second and different-time tests
- Refactor UpdateArtistSettings to use switch-based column validation instead of fmt.Sprintf with map lookup
- Remove generated coverage.out from repo, add to .gitignore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 11:23:22 +03:00
47d4ec4e32 fix: address code review findings
- Fix notifications_sent PK: changed from (rgid, sent_at) to rgid-only PK
  to prevent duplicate RGID rows across seconds. Use INSERT OR REPLACE
  instead of INSERT OR IGNORE for true idempotency.
- Add foreign key constraints to DDL (artist_id references artist_settings,
  rgid references external_releases) per specification.
- Enable PRAGMA foreign_keys=ON and PRAGMA busy_timeout=5000 for concurrent
  access safety.
- Fix GetNotificationSentAt query: add ORDER BY sent_at DESC LIMIT 1 for
  deterministic results.
- Fix config test: change YAML key from 'chat' to 'chat_id' to match struct
  tag, add ChatID assertion.
- Fix migration tracking test: correct error message from "expected 4" to
  "expected 3".
- Remove dead code in TestLoadConfig_InvalidPort: eliminate unused YAML
  template and remove port 0 case (valid, not invalid).
- Remove unused path parameter from buildConfigWithPort helper.
- Remove pointless 100ms sleep in run() and unused time import.
- Remove tautological TestDefaultConfigPath test.
- Update README.md: Go version 1.21+ to 1.25+, placeholder passwords to
  CHANGE_ME.
- Update config.yaml.example: placeholder passwords to CHANGE_ME.
- Update all database tests to insert parent rows first for FK satisfaction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 11:07:28 +03:00
fb74b5fbba feat: complete foundation layer documentation update (task 9)
Mark Task 9 checkboxes complete: README already has accurate build/run/test
instructions, config.yaml.example matches spec, no deviations from
specification found in the foundation layer implementation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 09:54:40 +03:00
2cb377614f feat: verify acceptance criteria for foundation layer
Mark Task 8 complete after verifying: go build succeeds, config loads
from YAML, all 3 database tables created via migrations, all CRUD
operations work, Docker builds, all 53 tests pass, go vet clean,
gofmt clean, coverage exceeds 70% for foundation packages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 09:51:02 +03:00
3206b10bd9 feat: add Docker setup with multi-stage build and docker-compose
- Add Dockerfile with golang:1.25-alpine build stage + alpine runtime stage
- Add docker-compose.yml with naviwatcher service and data volume
- Add .dockerignore for build context cleanup
- Add .gitignore for build artifacts and data directory
- Update plan: mark Task 7 checkboxes as complete

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 09:41:54 +03:00
68660e4d83 feat: add CRUD operations for notifications_sent table
Implement MarkNotificationSent, IsNotificationSent, and
GetUnnotifiedReleases with LEFT JOIN query. Includes 10
table-driven tests covering success, error, idempotent,
and edge cases. Also go fmt cleanup on existing files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 09:27:08 +03:00
3b87bfce96 feat: add CRUD operations for external_releases table
Implement GetExternalRelease, SaveExternalRelease,
GetExternalReleasesByArtist, GetIgnoredReleases, and
SetReleaseIgnored with 12 table-driven tests covering
success and error cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 09:15:37 +03:00
a052ccf11e feat: add CRUD operations for artist_settings table
Implements GetArtistSettings, SaveArtistSettings, GetAllArtistSettings,
and UpdateArtistSettings with full test coverage (10 new tests).
All 17 database tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 09:04:51 +03:00
da6668204f feat: add database layer with schema migrations
Add internal/database package with SQLite3 connection management,
versioned migration system, and three schema tables (artist_settings,
external_releases, notifications_sent). Includes 7 tests covering
initialization, migration idempotency, Close() behavior, and schema
validation using in-memory SQLite.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 08:58:23 +03:00
6ff4ec3045 feat: add configuration management with YAML parsing and validation
Add internal/config package with Config struct (Server, Navidrome,
MusicBrainz, Telegram, Scanner sections), LoadConfig function for
YAML parsing, config validation (required fields, port range,
threshold range), and defaults. Include config.yaml.example matching
spec. Update main.go to use real config package instead of
placeholders. Add comprehensive tests covering valid configs,
defaults, missing files, malformed YAML, and validation boundaries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 08:47:04 +03:00
eb266ed5ec feat: initialize Go module and project skeleton
- Initialize naviwatcher Go module
- Create directory structure: internal/config/, internal/database/, cmd/naviwatcher/
- Add main.go entry point with flag parsing, config loading placeholder, and graceful shutdown skeleton
- Add dependencies: go-sqlite3, yaml.v3
- Write tests for config loading and flag parsing
- All tests pass, go vet clean

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 08:33:08 +03:00
44f2652e7c add plan: foundation-layer 2026-05-20 08:27:13 +03:00
001f9ce691 Initial commit 2026-05-19 17:42:12 +03:00