[P1] E01: Define bounded AI Engine contracts and shared adapter test suites #15

Open
opened 2026-10-21 20:29:25 +02:00 by amiryahaya · 0 comments
Owner

Backlog ID: E01 | Priority: P1 | Phase: M2 — Authorized conversations and Engine contracts

Outcome and scope

Define app-owned embedding, reranking, generation and token-budget contracts with a versioned AiEngineClient boundary supporting in-process or private local-service transport.

Dependencies and gates

Engineering prerequisites: #7 (F02), #5 (K01)

Synthetic-data development may proceed. Production use remains subject to the decision gates in the SRS.

Starting points

crates/model-adapters/; crates/ai-engine/; crates/domain/; tests/contracts/model/

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

  • Requests carry bounded authorized inputs, permitted profile IDs, request/security scope, deadline and cancellation; outputs use domain-owned types/errors.
  • Embedding profile IDs/dimensions and tokenization/context compatibility are explicit; incompatible profiles fail before work starts.
  • The Engine has no user-facing route, identity authority, database credentials, unrestricted search or canonical history access.
  • Shared adapter contracts verify streaming terminal events, ordering, timeouts, cancellation, isolation and required capabilities using deterministic fakes.

Verification

Run one shared contract suite against two fake adapters and assert application use cases need no provider types or changes when adapters are exchanged.

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-RAG-003, FR-AUTH-010; NFR-ARCH-001–003, NFR-MAINT-001–005; architecture §§4–5

Sources: SRS, system design. Local planning context: docs/implementation-plan.md and docs/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

**Backlog ID:** E01 | **Priority:** P1 | **Phase:** M2 — Authorized conversations and Engine contracts ## Outcome and scope Define app-owned embedding, reranking, generation and token-budget contracts with a versioned AiEngineClient boundary supporting in-process or private local-service transport. ## Dependencies and gates **Engineering prerequisites:** #7 (F02), #5 (K01) Synthetic-data development may proceed. Production use remains subject to the decision gates in the SRS. ## Starting points crates/model-adapters/; crates/ai-engine/; crates/domain/; tests/contracts/model/ 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 - [ ] Requests carry bounded authorized inputs, permitted profile IDs, request/security scope, deadline and cancellation; outputs use domain-owned types/errors. - [ ] Embedding profile IDs/dimensions and tokenization/context compatibility are explicit; incompatible profiles fail before work starts. - [ ] The Engine has no user-facing route, identity authority, database credentials, unrestricted search or canonical history access. - [ ] Shared adapter contracts verify streaming terminal events, ordering, timeouts, cancellation, isolation and required capabilities using deterministic fakes. ## Verification Run one shared contract suite against two fake adapters and assert application use cases need no provider types or changes when adapters are exchanged. 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-RAG-003, FR-AUTH-010; NFR-ARCH-001–003, NFR-MAINT-001–005; architecture §§4–5 Sources: [SRS](https://forgejo.primatekun.tech/primatekuntech/rag-rust/src/branch/main/docs/SRS.md), [system design](https://forgejo.primatekun.tech/primatekuntech/rag-rust/src/branch/main/docs/architecture.md). Local planning context: `docs/implementation-plan.md` and `docs/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
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
primatekuntech/rag-rust#15
No description provided.