[P0] F03: Wire PostgreSQL migrations, bounded pooling and canonical repositories #8
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Depends on
#9 [P0] F04: Integrate trusted identity, secure browser sessions and development-only identity
primatekuntech/rag-rust
#12 [P0] F07: Replace startup-only readiness with dependency-aware health and safe telemetry
primatekuntech/rag-rust
#11 [P0] F06: Implement the protected tamper-evident audit trail
primatekuntech/rag-rust
#13 [P1] C01: Deliver authorized conversation creation, history and recent-context reads
primatekuntech/rag-rust
#17 [P1] I01: Register authorized document uploads, markings and quarantined versions
primatekuntech/rag-rust
#20 [P1] R01: Implement embedding-profile-aware Qdrant indexing and filtered search
primatekuntech/rag-rust
#32 [P2] K03: Integrate approved at-rest encryption, KMS and recoverable backups
primatekuntech/rag-rust
#40 [P0] Enforce 80% Rust and frontend coverage with explained shortfalls
primatekuntech/rag-rust
#6 [P0] F01: Complete the reproducible Rust/React baseline and CI checks
primatekuntech/rag-rust
#7 [P0] F02: Complete typed security values and policy-owned authorization contracts
primatekuntech/rag-rust
Reference
primatekuntech/rag-rust#8
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Backlog ID: F03 | Priority: P0 | Phase: M1 — Secure build and persistence foundation
Outcome and scope
Integrate migration execution and SQLx repository boundaries with bounded pools. Audit the initial conversation/message/audit/outbox schema and add incremental migrations for missing invariants.
Dependencies and gates
Engineering prerequisites: #6 (F01), #7 (F02)
Synthetic-data development may proceed. Production use remains subject to the decision gates in the SRS.
Starting points
migrations/0001_initial.sql; crates/storage-postgres/; crates/api/src/
These are current files or proposed responsibility boundaries; finalize a focused implementation plan before coding. Existing local scaffolding is uncommitted and is not evidence of completion.
Acceptance criteria
Empty supported PostgreSQL initializes repeatably and migration failure prevents readiness; applied migration integrity is verified.
Pool limits, acquisition timeouts and graceful shutdown are explicit; database rows stay behind domain-owned repository interfaces.
Conversation ownership/scope and unique message ordering are enforced transactionally; recent-history query plans use bounded indexed reads.
Production database roles are least privilege; document RLS defense-in-depth and prove the selected role cannot bypass intended policies if enabled.
Application-generated identifiers use UUIDv7 throughout (FR-DATA-006); PostgreSQL stores UUID-valued entity IDs and UUID-only references natively and migration preserves existing IDs.
Verification
Run real-PostgreSQL integration tests for fresh/repeated migration, concurrent message sequence allocation, ownership isolation, transaction rollback and pool exhaustion.
Behavior changes follow Red → Green → Refactor. Run affected Rust shared contract/unit tests and real PostgreSQL/Qdrant/runtime integration tests where applicable; frontend changes run typecheck/build and the relevant browser tests. Record exact commands/results in the implementation PR. Documentation/decision tasks use recorded review evidence.
Requirements and design
FR-DATA-001, FR-DATA-006; NFR-MAINT-005; architecture §§3, 7; implementation plan increment A
Sources: SRS, system design. Local planning context:
docs/implementation-plan.mdanddocs/development-backlog.md(not published by this task).Security impact: Use synthetic fixtures until approved for operational data. Preserve current authorization, markings, provenance and default-deny behavior; exclude protected payloads/secrets from operational telemetry. No classified-deployment or PQC-compliance claim is implied by closing this issue.
Parent roadmap: #1
Additional user specification: NFR-MAINT-007 sets an 80% line-coverage minimum with explained shortfalls. Rust application-only coverage is 87.29%; frontend coverage is unmeasured because the scaffold has no behavior-test/coverage tooling. The concrete reason, risk and P0 #40 remediation are recorded in
docs/verification/2026-10-22-coverage.md; CI coverage enforcement is tracked in #40.Implemented in draft PR #39 at
e12e70a78a209359f0da985336f26d4b6930b478; leaving this issue open pending review/merge.cargo fmt --all -- --check, workspace Clippy with-D warnings, workspace tests (20 behavioral + 6 compile-fail doctests),bash scripts/test-postgres.sh --local(14 real PostgreSQL tests), frontend typecheck/build, Compose and normalized actionlint all passed.Owner selectors remain internal query scope; trusted identity/ABAC and chat endpoints are subsequent issues. Existing deployments must follow
docs/operations/postgres.mdfor bootstrap and migration review.CI provisioning runs PostgreSQL 17 inside each isolated job container over loopback. Pinned runner source confirmed missing service-port context and ignored workflow host mappings; the original bridge-network approach was replaced. No shared runner settings or fixed host ports are changed.
User-requested UUIDv7 standard (FR-DATA-006) is in specs and implementation, with forward migration 0003 and legacy ID/reference preservation. User-requested 80% line coverage (NFR-MAINT-007) is in specs; Rust is 87.29% (632/724 application lines), with a recorded unmeasured frontend shortfall because instrumentation is absent. P0 #40 addresses frontend tests and CI enforcement; report/reason/risk/remediation are committed in
docs/verification/2026-10-22-coverage.md. No frontend coverage compliance claim is made.