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.
6.5 KiB
name, description
| name | description |
|---|---|
| write-tests | Create or improve tests for repository behavior, regressions, or release risks. Also use for real-question RAG evaluation before a demo; keep real-provider evaluation optional and separate from ordinary tests. |
Test Phase 1 behavior
Read applicable AGENTS.md instructions and the shared reference map. Follow its write-tests reading route. The initial repository has no automated test runner or fixtures; inspect current files before selecting a harness or reporting commands.
Automated test workflow
- Read intended behavior, affected contracts, existing implementation, and tests before choosing assertions. Identify the failure or release risk and acceptance criterion.
- Choose the smallest useful level: unit, integration, contract, or end-to-end. Reuse the repository's runner, naming, fixtures, and dependency conventions. If still absent, establish a minimal suitable harness within the requested test scope and explain the choice; do not present an invented command as existing.
- Select relevant success, failure, and boundary cases. Assert behavior and important invariants rather than mechanically enumerating combinations or mirroring implementation details.
- Mock external providers at adapter/transport boundaries where appropriate. Do not mock the behavior under test. Avoid importing application singletons that can index files, download embeddings, or contact providers during collection.
- Use an isolated PostgreSQL/pgvector test environment for database-specific constraints, vector queries, transactions, or races. Verify the target is a disposable test database before destructive fixtures. A fake database or SQLite is not evidence for PostgreSQL semantics; never use production.
- Keep ordinary automated tests deterministic and network-free by default. Control time, retries, and randomness through injected dependencies where supported; use explicit synchronization for concurrency assertions.
- Run targeted tests and inspect failures. Do not weaken assertions, skip regressions, or change expected behavior solely to make the suite pass.
- Distinguish product bugs, test defects, and unavailable environments. Report product bugs exposed by tests without silently expanding a tests-only request into a production fix. Explain any regression test that remains failing.
- Inspect the diff and record actual results, including tests not run and why. Do not claim mock output establishes real-model quality.
Choose relevant cases
- Upload: admin authorization, invalid files, empty/failed extraction, no partial publication; same upload replay and changed-payload conflict.
- Search: authorized ready/active/undeleted scope, forged model scope arguments, compatible embedding profile, source document/chunk identity.
- Worker: expired leases, stale claim rejection, retry on the same document/job, duplicate-free publication, deletion during processing.
- Turns: conversation ownership, repeated chat replay, changed-payload conflict, concurrent submissions, interruption/recovery, evidence mapping across multiple searches.
- Revocation: document deactivation/delete, stale context, epoch race during finalization, retained historical answers without reuse.
- Live: dispatch through shared retrieval, duplicate/conflicting tool events, trusted state transitions, close/control failure and revocation.
Read the precise API/database rules for the cases selected. Do not silently treat the prototype's current behavior as the contract.
Real-provider RAG evaluation
This is optional and separate from the default automated suite. Use when real-output quality is requested or release readiness requires it, with authorized environment and data access.
- Check credentials without exposing them, approved corpus, runnable service, selected text/embedding/live profiles, and authorized network/cost limits. For voice, require an actual browser/microphone/WebRTC interaction or explicitly label voice not run.
- Prepare a small, isolated corpus and questions with expected facts and evidence identities. Cover Persian paraphrases, direct facts, missing knowledge, ambiguous questions, follow-ups, and inactive-document cases as relevant. The plan proposes 15-20 questions; do not invent a passing quality threshold.
- Bound requests, tool calls, retries, time, and spend using existing authorization. Stop when the agreed bound or provider failure is reached; do not loop indefinitely or upload sensitive data to unapproved destinations.
- Check extraction separately: recovered text, sections/pages actually available, empty extraction, and chunk boundaries.
- Check retrieval separately: expected evidence is returned, excluded documents remain absent, and document/chunk IDs resolve. Record observed evidence rather than treating plausible prose as successful retrieval.
- Check answers separately: factual support, uncertainty on missing knowledge, follow-up consistency, and citation identity. Prefer fact/evidence assertions over exact full-answer wording.
- Run and report text and voice separately. Voice requires a real backend tool call and spoken result; text-only execution is not voice evidence. Distinguish retrieved voice sources from verified spoken citations.
- Label model-based judging and human checks explicitly. They are assessment methods, not deterministic proof. Record corpus/profile, question, expected evidence, observed extraction/retrieval/answer/source outcome, and failure category; report metrics only from executed cases with denominators.
- If credentials, corpus, service, authorization, or voice interaction are unavailable, mark the affected evaluation not run with the precise prerequisite. Never substitute cached or mock results as real execution.
Protect secrets and sensitive text in artifacts. Preserve only approved evidence and redacted diagnostics. Do not change application features just to complete an evaluation.
Stop or narrow work
Missing authoritative behavior blocks dependent assertions; name the missing reference or product decision and continue independent cases. A provider outage or missing database is an environment limitation, not a passing result. A discovered product bug stays reported unless fixing it is within the user's scope.
Report
Give tested behavior and level, changed test files, exact commands/outcomes, and defects or environment limitations. For real-provider work, add executed case counts, evidence-based observations, text/voice status, judging method, and unrun checks. Do not invoke other skills recursively.