IntentGuard

S06.1 — Implement API schemas, stable errors, request IDs, and safe logging

Planning / historicaltaskdelivery

Historical

Planning material. It summarizes and links to the authoritative specification and the current measured state — it does not replace either, and it is not current engineering truth.

Migration identity#

  • Canonical identifier: S06.1 (GitHub issue type: subtask).
  • Legacy identifier: C06.1 (retained as old_identifier).
  • Parent epic: E06.
  • Milestone: M1 — IntentGuard Weekend MVP.

Objective#

Encode the interface contract with typed Pydantic models, deterministic validation/errors, request-ID behavior, and structured logs that omit raw text.

Rationale#

The public boundary must be testable, observable, and safe independently of predictor implementation.

Parent identifier#

E06.

Source task#

T-006.

Traceability#

Primary: T-006, NFR-004, NFR-005, AC-008. Secondary: FR-006, FR-007.

Prerequisites#

Request-ID, control-character, normalization, error-body, and tie-breaking decisions resolved from the interface contract.

Likely files#

src/intentguard/schemas.py, src/intentguard/api.py, src/intentguard/logging.py, tests/contract/test_api_contract.py, tests/unit/test_logging.py.

Implementation boundary#

HTTP/schema/logging boundary only; predictor may be injected for contract tests but is not strict serving evidence.

MUST scope#

Request/response fields, bounds, empty/control input handling, status codes, stable error shape, request-ID propagation/generation, structured sanitized logs.

Explicit non-goals#

Authentication, persistence, raw-text logging, batch schema, frontend, metrics service, or ticket adapter.

Acceptance criteria#

Valid/invalid payload tests match the contract; errors and IDs are deterministic under declared rules; captured logs contain metadata but not input text or secrets.

Validation commands#

uv run pytest tests/contract/test_api_contract.py tests/unit/test_logging.py -q.

Expected evidence#

Schema assertions, malformed-input matrix, request-ID cases, and sanitized log captures.

Fallback and status consequence#

A mock predictor is allowed for these tests, but schema/logging gaps make U06 Partial and fail strict MVP.

Stop condition#

Stop for unresolved contract ambiguity, sensitive log output, unstable errors, or framework defaults that violate the specification.

Definition of ready#

All boundary ambiguities are explicitly decided and test examples are enumerated.

Definition of done#

NFR-004, NFR-005, and AC-008 pass without depending on a trained model.

Labels#

type:subtask, priority:MUST, area:api

Estimate#

0.5 hour.

Related in repository

Open in full graph →
DOCUMENTED_BY — source: docs/backlog/tasks/C06.1-api-schemas-errors-logging.md § S06.1 — Implement API schemas, stable errors, request IDs, and safe loggingREFERENCES — source: docs/backlog/tasks/C06.1-api-schemas-errors-logging.mdREFERENCES — source: docs/backlog/tasks/C06.1-api-schemas-errors-logging.mdREFERENCES — source: docs/backlog/tasks/C06.1-api-schemas-errors-logging.mdREFERENCES — source: docs/backlog/tasks/C06.1-api-schemas-errors-logging.mdREFERENCES — source: docs/backlog/tasks/C06.1-api-schemas-errors-logging.mdREFERENCES — source: docs/backlog/tasks/C06.1-api-schemas-errors-logging.mdREFERENCES — source: docs/backlog/tasks/C06.1-api-schemas-errors-logging.mdREFERENCES — source: docs/backlog/tasks/C06.1-api-schemas-errors-logging.mdREFERENCES — source: docs/backlog/tasks/C06.1-api-schemas-errors-logging.mdPART_OF — source: docs/backlog/TRACEABILITY.md § Source tasksPART_OF — source: docs/backlog/TRACEABILITY.md § Source tasksPART_OF — source: docs/backlog/TRACEABILITY.md § Non-functional requirementsPART_OF — source: docs/backlog/TRACEABILITY.md § Non-functional requirementsPART_OF — source: docs/backlog/TRACEABILITY.md § Acceptance criteriaREFERENCES — source: docs/backlog/tasks/C06.1-api-schemas-errors-logging.md § TraceabilityREFERENCES — source: docs/backlog/tasks/C06.1-api-schemas-errors-logging.md § TraceabilityREFERENCES — source: docs/backlog/tasks/C06.1-api-schemas-errors-logging.md § TraceabilityREFERENCES — source: docs/backlog/tasks/C06.1-api-schemas-errors-logging.md § TraceabilityREFERENCES — source: docs/backlog/tasks/C06.1-api-schemas-errors-logging.md § TraceabilityREFERENCES — source: docs/backlog/tasks/C06.1-api-schemas-errors-logging.md § TraceabilitySATISFIES — source: docs/specification/docs/TRACEABILITY.md § Functional traceabilitySATISFIES — source: docs/specification/docs/TRACEABILITY.md § Non-functional traceabilityREFERENCES — source: docs/backlog/umbrellas/U06-fastapi-demo.md § TraceabilityREFERENCES — source: docs/backlog/umbrellas/U06-fastapi-demo.md § TraceabilityREFERENCES — source: docs/backlog/umbrellas/U06-fastapi-demo.md § TraceabilityREFERENCES — source: docs/backlog/umbrellas/U06-fastapi-demo.md § TraceabilityREFERENCES — source: docs/backlog/umbrellas/U06-fastapi-demo.md § TraceabilityREFERENCES — source: docs/backlog/umbrellas/U06-fastapi-demo.md § TraceabilityRELATED_TO — source: docs/backlog/umbrellas/U06-fastapi-demo.md § Migration identityCURRENTdocument: S06.1 — Implement API schemas, stable errors, request IDs, and safe loggingS06.1task: S06.1AC-008 — Invalid inputacceptance-criterion: AC-008 — Invalid inputE06epic: E06FR-006 — Inference APIrequirement: FR-006 — Inference APIFR-007 — Health checkrequirement: FR-007 — Health checkNFR-004 — Input safetyrequirement: NFR-004 — Input safetyNFR-005 — Privacy-consci…requirement: NFR-005 — Privacy-conscious loggingT-006 — Typed real-artif…task: T-006 — Typed real-artifact API evidenceU06 — FastAPI inference …capability: U06 — FastAPI inference and real-artifact demo
Hover an edge for its provenance · click a node to open it10 nodes · 30 edges