Commit Graph
66 Commits
Author SHA1 Message Date
ik 868278fdba security: restrict MinIO app to one bucket 2026-09-12 16:01:00 +07:00
ik 1ffaf7478d fix: synchronize normalized records on import revisions 2026-09-11 07:50:31 +07:00
ik 0b7bbc78a6 fix: make report and idempotency insert transactional 2026-09-11 07:47:36 +07:00
ik fc963101b3 fix: handle concurrent idempotency key conflicts 2026-09-11 07:46:50 +07:00
ik 5b2db1cf48 fix: reject idempotency key payload conflicts 2026-09-11 07:44:07 +07:00
ik 531f1aa82f fix: replay idempotent upload token safely 2026-09-11 07:42:41 +07:00
ik bea3b9ccbb fix: align recovery schema idempotency and record counts 2026-09-11 07:40:58 +07:00
ik 13e04e6c66 A12: Add meaningful changes/provenance to ImportRecordEvent, skip events for unchanged data
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s
2026-09-11 07:36:21 +07:00
ik 5107a7c467 A11: Use requirements-lock.txt in Dockerfile for reproducible builds 2026-09-11 07:35:35 +07:00
ik 641374ddbc A05: Add server-side idempotency for catch report creation via Idempotency-Key header 2026-09-11 07:35:01 +07:00
ik f29ec706fd R09: Add PaginatedOfficialRecordOut schema and paginated /api/v1/records endpoint 2026-09-10 20:27:45 +07:00
ik ec3a1ca516 A09: Use static registry for CLI choices, check enabled at runtime
Bug: 'choices=configured_sources()' in argparse opened DB session at
import time, causing --help to fail when DB was unavailable.

Fix:
- Added STATIC_SOURCE_CHOICES list with known source keys
- argparse uses static choices — no DB required for --help
- fetch-community command now checks enabled status at runtime
- Disabled sources return error: 'source X is disabled or not configured'
- run_source still handles locked/cooling down state

Verification:
- CLI --help works without DB
- fetch-community --help shows all known sources
- Disabled sources are rejected at runtime with clear error
- 124/124 Python tests pass (1 skipped)
2026-09-10 19:53:15 +07:00
ik e2223c6f24 A07: Fix _auto_publish to allow fish name fallback without external_id
Bug: 'observation.fish_external_id is None' in early return prevented
auto-publishing observations that only have fish_name (no external_id),
even when name-based fallback matching was available.

Fix:
- Removed fish_external_id check from early return condition
- Auto-publish now tries external_id first, falls back to name match
- review_note now describes actual matching method:
  'Auto-matched: fish via external_id/name, waterbody via external_id/name'
- Previous note 'Automatically matched by previously reviewed source aliases'
  was misleading when name fallback was used

Verification:
- 14/14 community_importer tests pass
- 124/124 Python tests pass (1 skipped)
- Observations without fish_external_id can now auto-publish via name match
- review_note accurately describes matching method
2026-09-10 19:42:56 +07:00
ik 883e63aa8b A01: Fix scheduler aggregation to not mask stale/failed sources
Bug: has_any_success allowed one healthy source to give overall 'ready'
when another source was stale/not_started/running — masking failures.

Fix:
- Added has_any_stale and has_any_running tracking
- Overall status is 'degraded' if ANY source is failed/stale/running
- Overall status is 'ready' ONLY when ALL enabled sources are healthy
- 'not_started' when no sources are enabled
- readiness (ready flag) still NOT blocked by import health (A01 requirement)

Verification:
- 7/7 readiness tests pass
- 124/124 Python tests pass (1 skipped)
- Stale source now shows 'degraded' instead of 'ready'
- Failed source still shows 'degraded'
- All healthy sources show 'ready'
2026-09-10 19:32:33 +07:00
ik 56ce498eac A07: Improve review_note to explain matching method
Bug: review_note was empty or contained arbitrary text, not explaining
how the observation was matched to fish/waterbody.

Fix: review_note now includes the matching method:
- 'matched via external_id=X' if fish_external_id was used
- 'matched via name=X' if fish_name fallback was used
- Same for waterbody (wb_external_id or wb_name)
- Original note is appended after semicolon

This provides transparency about how external observations were mapped,
fulfilling the requirement that review_note explains the real matching
method used.

Verification:
- 124/124 Python tests pass
- Existing tests still pass (review_note is optional parameter)
- New review_note format is machine-readable and human-friendly
2026-09-10 18:13:27 +07:00
ik 05d1f1616f A06: Add Docker chain rate limit tests for proxy scenarios
Added 3 new tests for A06 proxy chain verification:
1. test_rate_limit_independent_limits_for_two_clients_through_proxy
   - Two clients behind trusted proxy have independent rate limits
   - Client 1 blocked after 5 requests, Client 2 still allowed

2. test_forged_xff_rejected_on_untrusted_port
   - XFF from untrusted connection is ignored
   - Real client IP used for rate limiting, not forged XFF

3. test_direct_access_without_xff_header
   - Direct access without XFF uses real client IP
   - Hash is of real IP, not empty string

Verification:
- 8/8 rate limit tests pass
- Docker network CIDR (172.17.0.0/16) tested
- Forged XFF properly rejected from untrusted sources
- Independent rate limits verified for multiple clients
2026-09-10 18:12:32 +07:00
ik f2ad5ecfa3 A01: Per-source health affects community_scheduler overall status
Bug: community_scheduler always had status='ready' even when individual
sources were failed or stale. Success of one source masked failure of another.

Fix:
- Overall status is 'degraded' if any enabled source has failed
- Overall status is 'stale' if all sources are stale but none failed
- Overall status is 'ready' only when at least one source is healthy
- Overall status is 'not_started' when no sources are enabled
- Readiness (ready flag) still NOT blocked by import health (A01 requirement)

Verification:
- 7/7 readiness tests pass
- 121/121 Python tests pass (1 skipped)
- Failed/stale sources are now visible in JSON without blocking scheduler
2026-09-10 18:08:31 +07:00
ik 779d554057 A01: Separate API readiness from import health diagnostics
- Infrastructure (DB/MinIO) blocks readiness; imports are diagnostic only
- Per-source community scheduler health with backoff detection
- Stale/failed imports never block /ready — scheduler can recover them
- Add 'blocking: false' to all import components
- 4 new tests: per-source health, backoff detection, stale/failed non-blocking
- 108 Python tests pass
2026-09-10 06:10:01 +07:00
ik 4f68d6b004 D09: Import record event history for revision tracking
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s
- Add ImportRecordEvent model to track per-record import changes
- Log created/updated events for each official record import
- Add alembic migration 0014 for import_record_event table
- Enables audit trail for which import run modified which records
2026-09-10 05:54:31 +07:00
ik 2c7dd27b4f T08: Python lock files, CI web unit tests, dependency audit
- Generate requirements-lock.txt and requirements-dev-lock.txt via pip-compile
- CI uses locked files for reproducible installs
- Add web unit tests to CI (npm run test:unit)
- Add dependency-audit job using pip-audit
- Add Makefile with lock/lock-dev targets for regeneration
2026-09-10 05:53:15 +07:00
ik f550639456 R15: Fix D04/D06/D07 partial completion
D04: Add fish name-based fallback in _auto_publish (was external_id only)
D06: Cap confidence at 50% for 1 player, 65% for 2 players
D07: Set caught_at=None for community imports (not published_at)
D08: Already OK - activity_rows has no top-100 limit

- Add Fish import to community_importer.py
- Add 2 unit tests for D06 confidence caps
- Update test_community_importer.py for D04 name match behavior
2026-09-10 05:51:50 +07:00
ik e2bed0db89 R13: Fix X-Forwarded-For trust boundary — only trust from known proxies
- Add _is_trusted_proxy() to check client IP against trusted CIDRs
- Only use X-Forwarded-For if connection came from trusted proxy
- Add TRUSTED_PROXY_CIDRS config (default: 127.0.0.1/32, ::1/128)
- Add parse_comma_separated_lists for env var parsing
- Add 3 unit tests: trusted CIDR check, untrusted ignores forwarded, trusted uses forwarded
2026-09-10 05:49:23 +07:00
ik cc3b42eaf6 R12: Fix readiness — stale/failed community_scheduler blocks ready
- Add 'ready = ready and healthy' for community_scheduler check
- Add 'ready = False' for community_scheduler exception path
- Add 3 unit tests: success=ready, stale=not_ready, failed=not_ready
- Monitoring now correctly reports community import health
2026-09-10 05:46:49 +07:00
ik 0b3a5ece4b fix: R06 community_observations filters by fish/waterbody slug via JOIN (#1788956171115) 2026-09-10 05:38:22 +07:00
ik fc878c81d4 fix: R04 site cooldown uses full registry for disabled sources; R05 remove proxy/scheduler from bootstrap (#1788956171115) 2026-09-10 05:37:38 +07:00
ik d962ba2f90 fix: R02 activity API contract — PaginatedActivity + all consumers (#1788956171115) 2026-09-09 20:58:42 +07:00
ik 63e33e1861 fix: audit P0-P1 — T03-T07, D01-D08, U01-U02 (#1788956171115) 2026-09-09 20:02:52 +07:00
ik 486b4e9645 fix: enforce community cooldown per site 2026-09-08 16:32:42 +07:00
ik 18855644a4 build: separate API development dependencies 2026-09-08 16:16:09 +07:00
ik 1f63f71600 Fix review queue pagination and API fallback handling
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s
2026-09-08 13:24:58 +07:00
ik ddb6909c4d sync
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s
2026-09-08 09:31:41 +07:00
ik 8b2d7e2e1c feat: suggest confirmed external aliases
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s
2026-09-07 18:57:09 +07:00
ik 214b328cd2 perf: cache public activity aggregates 2026-09-07 18:54:58 +07:00
ik fa3b24fb1f feat: add safe diagnostics export 2026-09-07 18:49:53 +07:00
ik 02b67741f8 feat: expose deployment build identity 2026-09-07 18:43:20 +07:00
ik 486016d977 feat: expose safe source health status
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s
2026-09-07 16:57:14 +07:00
ik 0701383c28 feat: schedule authorized community imports 2026-09-07 16:45:49 +07:00
ik 4e037eb7e8 feat: add canonical spot URLs 2026-09-07 16:43:12 +07:00
ik 9275799ce7 feat: display provenance and incomplete signals
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s
2026-09-07 13:21:15 +07:00
ik 7217356594 feat: enable safe community auto publishing 2026-09-07 13:00:58 +07:00
ik c4d1c8b87b feat: audit full alpha catalog
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s
2026-09-07 09:37:01 +07:00
ik 600abd81f5 test: define open alpha acceptance gates 2026-09-07 09:31:35 +07:00
ik 5e27a5b066 perf: stabilize list queries for pilot
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s
2026-09-07 08:02:37 +07:00
ik c45b4511b7 feat: serialize official record imports
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s
2026-09-07 07:54:07 +07:00
ik 687b4c9cb5 feat: harden production security boundaries 2026-09-07 07:51:25 +07:00
ik 2200336524 feat: add production data retention 2026-09-06 14:37:58 +07:00
ik 870d9cc7f9 feat: harden production data and backups
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s
2026-09-06 14:08:07 +07:00
ik a4bd395856 feat: add production deployment for rf4spotter.ru 2026-09-06 13:52:30 +07:00
ik 3f468799bd feat: enforce community source cooldown
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s
2026-09-05 07:52:37 +07:00
ik 398b35e843 feat: add privacy-safe structured logging 2026-09-04 07:49:14 +07:00