feat(ingestion): add Phase 1 database and application foundation

Add the scoped PostgreSQL/pgvector schema, independent ingestion settings and ports, embedding profile checks, and trusted administrator bootstrap.

Include repository contracts and guidance, organized provider-free and PostgreSQL tests, deployment setup, and byte-preserving migration attributes.

Validation: 163 tests passed; all 48 PostgreSQL cases passed with pgvector Python 0.5.0 and 0.3.6. No production schema or historical metadata was changed.
This commit is contained in:
amirhosein mazaheri
2026-10-05 16:38:28 +03:30
parent cb54a35c90
commit baf58da562
50 changed files with 4628 additions and 3 deletions
+38
View File
@@ -0,0 +1,38 @@
---
name: implement-feature
description: "Implement or modify a scoped application capability in this repository, including necessary regression tests. Use for behavior changes; exclude tests-only requests, review-only requests, and skill authoring."
---
# Implement a Phase 1 feature
Read applicable AGENTS.md instructions and the [shared reference map](../../../data/documents/agent-reference-map.md). Use its implement-feature reading route and current implementation inventory; planned modules are not proof of existing code.
## Workflow
1. Identify the requested behavior, acceptance criteria, and Phase 1 boundary. Select the relevant plan, workflow, API, and database sections. Use scenario examples for observable behavior, not as a replacement for contracts.
2. Inspect Git status, affected code, callers, tests/fixtures, and integration boundaries. Preserve unrelated changes. Recheck the map's inventory before choosing commands or introducing tooling.
3. State a short plan proportional to the change and continue without routine permission requests. Isolate genuinely missing product decisions; continue independent work while requesting the needed decision.
4. Implement the smallest complete behavior across affected transport, application, persistence/provider, and UI boundaries. Do not create layers or edit consumers the task does not affect. Preserve provider-neutral application interfaces and one retrieval implementation for text and Live.
5. For affected flows, implement permissions, state transitions, error mapping, bounded failure handling, and concurrency/replay contracts together. Read the precise contract before choosing status codes, schema fields, locking, or retry behavior.
6. Add meaningful tests for changed behavior and regressions using existing fixtures and conventions. Test externally observable results or invariants, not private implementation wording. No test harness exists in the initial inventory; do not claim a runner is available without checking.
7. Run targeted repository checks and necessary integration checks. Verify PostgreSQL-specific behavior on isolated PostgreSQL/pgvector when applicable; mocks are not database constraint evidence. Keep ordinary tests deterministic and network-free. Treat real-provider quality evaluation as separate, authorized work with prerequisites.
8. For an intentional contract change, update API/schema documentation, affected consumers, and tests coherently. Do not rewrite expected behavior to hide a defect. Update the map when source locations or verified commands change.
9. Inspect the final diff for unrelated edits, leaked secrets, broken links, and incomplete behavior. Report actual checks and limitations.
## Relevant contract checks
Select checks according to the affected flow; do not mechanically expand scope.
- Upload/retry: independent identity, stable replay, changed-payload conflict, same-document retry, no searchable partial chunks.
- Worker: durable claim, lease/token fencing, duplicate-free atomic publication, bounded retries, provider calls outside long transactions.
- Search: backend-derived scope, ready/active/undeleted filtering, compatible embeddings, document/chunk evidence identities.
- Conversations: owner checks, deduplicated turns/provider work, source references unique across the turn, stale-context invalidation and finalization races.
- Live: shared retrieval, trusted tool dispatch, duplicate events, observable close/failure, server-side secrets; consult provisional provider contracts before implementation.
## Stop or narrow work
If a required reference is missing, mark its dependent work blocked and name the missing path. If authoritative contracts conflict, surface the concrete conflict instead of inventing policy. Missing provider access blocks live validation, not unrelated implementation. Do not claim release readiness from mocks or absent checks. Do not implement deferred roadmap features to complete a scoped task.
## Report
State changed behavior and acceptance coverage, list affected files, give exact checks with outcomes, and identify remaining decisions, unrun checks, or risks. Separate completed implementation from unverified runtime behavior. Do not invoke other skills recursively.