Awesome Testing

Markdown document

Raport pokrycia i statusu dla zespołu

Lekcja 22: Weryfikacja i raportowanie pokrycia API

Historical artifacts may name disposable training credentials and environments. Do not reuse credentials, target course systems, or execute archived prompts without authorization.

L17 API Coverage & Quality Status

Last updated: 2026-08-30

Audience: developers, QA, and technical leads

Live Swagger audited: https://aitesters.byst.re/swagger-ui/index.html

Authoritative course API: https://awesome.byst.re

This is the single current developer report for L17. It replaces the former active/history test plans. Detailed defect evidence lives in bug-reports/; stale implementation chronology belongs in git history.

Stakeholder view: api-coverage-report.html

Current Status

SignalResult
Live route templates with automation32 / 44 (72.7%)
Live endpoint operations with automation42 / 55 (76.4%)
Completely unautomated operations13
Operations with every documented status automated24 / 55 (43.6%)
Documented response paths automated121 / 191 (63.4%)
Partially covered operations18
Missing documented response paths70
Automated API checks142
Playwright spec files47
Non-admin checks against the course API101
Admin checks against staging41
Latest full L17 run142 passed
Confirmed open backend defects2

Assessment: the existing customer and admin regression suite is green, but its contract baseline was stale. The live Swagger now contains 55 operations across 44 route templates. Thirteen operations have no endpoint-focused automation and 18 more are only partially covered at the documented response-code level. Inventory, 2FA, SSO, and the local outbox are the material breadth gaps.

For the course-authoritative awesome.byst.re contract, which omits the two local outbox operations, the equivalent figures are 32 / 43 route templates (74.4%), 42 / 53 operations (79.2%), and 121 / 188 response paths (64.4%).

What “Covered” Means

An endpoint operation is one HTTP method + route template. It counts as covered when it has a dedicated Playwright regression spec for verified live behavior, including its primary success or stable negative path. Route-template coverage is also reported separately so a multi-method route cannot inflate the result.

Operation coverage does not mean every documented status or edge case is safe to assert. The coverage exceptions table is therefore part of the status, not a footnote.

Response-path coverage compares the distinct documented status codes for every method + path with status groups present in endpoint-focused specs. Multiple test scenarios for the same status count once in this metric.

Endpoints Without Automated Coverage

These 13 live Swagger operations have no endpoint-focused L17 automation:

Endpoint operationDocumented statusesGap / recommended next action
GET /api/v1/admin/inventory200, 401, 403Add admin inventory list, auth, and authorization coverage
GET /api/v1/admin/inventory/{productId}200, 401, 403Add generated-product detail coverage and cleanup
GET /api/v1/admin/inventory/{productId}/movements200, 401, 403Add movement-history coverage around a controlled adjustment
POST /api/v1/admin/inventory/{productId}/adjustments201, 401, 403Add reversible adjustment coverage with before/after verification
GET /api/v1/users/2fa/status200, 401Add authenticated status and unauthenticated coverage
POST /api/v1/users/2fa/setup200, 401, 409, 429Add disposable-user setup flow; isolate limiter state
POST /api/v1/users/2fa/confirm200, 400, 401, 409, 410, 429Add TOTP confirmation flow with observable setup secret
POST /api/v1/users/2fa/disable200, 400, 401, 409, 429Add confirmed-2FA teardown flow and guaranteed cleanup
POST /api/v1/users/2fa/recovery-codes200, 400, 401, 409, 429Add recovery-code lifecycle coverage without logging secrets
POST /api/v1/users/signin/2fa200, 400, 401, 429Add the second-stage signin flow using a disposable 2FA user
POST /api/v1/users/sso/exchange200, 400, 401, 404, 409Define a test identity-provider token strategy, then automate
GET /api/v1/local/email/outbox200aitesters-only: confirm intended test scope and key handling
DELETE /api/v1/local/email/outbox200, 500aitesters-only: isolate outbox state before adding a destructive check

Partially Covered Endpoints

These 18 operations have automation, but not for every live documented status:

Endpoint operationAutomated statusesMissing documented statusesWhy missingBest next action
DELETE /api/v1/cart/items/{productId}200, 401, 404400Added after the repository contract snapshotExplore malformed product-id behavior and add the stable case
DELETE /api/v1/products/{id}204, 401, 403, 404400Added after the repository contract snapshotAdd malformed-id admin coverage
GET /api/v1/orders/{id}200, 401, 404400Added after the repository contract snapshotAdd malformed-id customer coverage
GET /api/v1/products200, 401404Contract now documents an unusual collection 404Reproduce live and align contract or add a stable scenario
GET /api/v1/products/{id}200, 401, 404400Added after the repository contract snapshotAdd malformed-id coverage
GET /api/v1/traffic/logs200400Added after the repository contract snapshotIdentify and automate the documented invalid-query trigger
POST /api/v1/products201, 400, 401, 403404Contract now documents an unclear create 404Reproduce live and clarify the missing dependency/resource case
POST /api/v1/users/signup201, 400429Shared rate-limit exhaustion is statefulAdd an isolated rate-limit environment or reset hook
POST /api/v1/users/signin200, 400, 422429Shared rate-limit exhaustion is statefulAdd deterministic limiter reset/control
POST /api/v1/users/refresh200, 400, 401429Shared rate-limit exhaustion is statefulAdd deterministic limiter reset/control
POST /api/v1/users/password/forgot202, 400429Shared rate-limit exhaustion is statefulTest in an isolated limiter scope
POST /api/v1/users/password/reset400200, 429Success token is not observable; limiter path is statefulExpose a safe token/outbox hook, then isolate rate-limit coverage
POST /api/v1/email200, 400, 401429Exhaustion would poison the disposable user's bucketAdd deterministic limiter reset/control
POST /api/v1/qr/create200, 400, 401429Shared rate-limit exhaustion is statefulAdd deterministic limiter reset/control
POST /api/v1/ollama/generate200, 400, 401404, 429, 500Mock returns 200 for unknown model; limiter and 500 need safe controlsAlign mock/contract; add limiter control and backend fault injection
POST /api/v1/ollama/chat200, 400, 401404, 429, 500Mock returns 200 for unknown model; limiter and 500 need safe controlsAlign mock/contract; add limiter control and backend fault injection
POST /api/v1/ollama/chat/tools200, 400, 401429, 500Limiter and internal failure lack safe deterministic triggersAdd limiter control and backend fault-injection coverage
GET /api/v1/traffic/logs/{correlationId}404200Live existing-record request returns confirmed 500Fix backend, deploy, reverify, then add 200 test

The 70 missing response paths break down into:

  • 46 paths belong to the 13 completely unautomated operations;
  • 10 paths were added to already automated operations after the repository OpenAPI snapshot, including three Ollama 429 paths;
  • 14 paths were already known gaps in the former 42-operation baseline.

Six behaviors previously described as “live-only” are now documented by the live Swagger: 400 for customer/admin order filters, refresh-token validation, user update validation, and both prompt-update length validations. This is why the live re-audit, rather than the checked-in api-docs.json, is the metric baseline.

Coverage By Domain

DomainOpenAPI operationsAutomated checksStatusImportant scope
Identity, users, prompts17 / 2455Gap: 7 operations2FA and SSO operations are unautomated
Inventory0 / 40UncoveredAdmin list, detail, adjustment, and movement history
Products5 / 518CoveredAuthenticated reads and admin create/update/delete
Cart5 / 516CoveredEmpty/populated state, add/update/remove/clear, validation and auth
Orders6 / 631CoveredCustomer and admin flows, ownership, cancellation, status transitions
Email delivery1 / 13Covered with exclusionSuccess, validation, auth; rate-limit exhaustion excluded
Local email outbox0 / 20Uncovered on aitestersConfirm test-only scope before automation
Ollama4 / 411Covered with discrepancyDefinitions and deterministic SSE generate/chat/tool flows
QR1 / 13CoveredPNG response, validation, auth
Traffic3 / 33DegradedInfo/list covered; existing correlation detail success blocked by backend 500
OpenAPI and Swagger UI2CoveredContract and documentation smoke checks
Total42 / 55142Green existing suite; breadth gaps openTwo Playwright projects, fully parallel

Validation Evidence

Latest L17 checkpoint validation on 2026-08-30:

  • Playwright discovery: 142 tests in 47 files.
  • Full network-enabled npm test: 142 passed across api and admin-api in 1.9 minutes.
  • A prior sandboxed run failed before reaching the API because DNS access was restricted; it was not an assertion or product failure.
  • No credentials, local environment files, node_modules, or test artifacts were promoted into L17.

Validation commands:

cd l17
npm test
npm run test:api
npm run test:admin

Confirmed Backend Defects

1. Traffic log detail returns 500

  • Endpoint: GET /api/v1/traffic/logs/{correlationId}
  • Expected: documented 200 for an existing, freshly listed correlation id.
  • Actual: reproducible 500 { "message": "Internal server error" }.
  • Impact: diagnostic consumers cannot open a log entry returned by the list API; the documented success path remains blocked from regression coverage.
  • Report: bug-reports/traffic-log-detail-returns-500.md

2. Repeated account-forgetting request returns 500

  • Endpoint: DELETE /api/v1/users/{username}/right-to-be-forgotten
  • Sequence: first self-delete returns 204; retrying with the deleted user's JWT returns 500.
  • Reproduction: 3 / 3 direct curl attempts plus one fixture-teardown signal.
  • Impact: safe client retry/cleanup looks like an infrastructure failure after the account was already removed.
  • Report: bug-reports/right-to-be-forgotten-repeat-returns-500.md

The Playwright suite asserts intended first-request behavior and does not encode either 500 as an accepted regression result.

Coverage Constraints And Contract Discrepancies

AreaCurrent evidenceCoverage decisionUnblock condition
Password reset successAuthoritative deployment returns token=null and exposes no documented outbox/token read pathKeep verified 400 cases; do not invent a 200 flowProvide a safe test token or local outbox visibility
Traffic detail 200Freshly listed ids return 500Keep stable unknown-id 404; success remains blockedBackend fix deployed and live behavior reverified
Email 429Requires exhausting a per-user rate-limit bucketExcluded from routine regression to avoid poisoning state and unnecessary loadIsolated rate-limit environment or deterministic reset hook
Admin order unknown statusLive staging exploration returned 401 despite a valid admin JWT; adjacent valid requests succeededUse verified invalid-transition 400; reverify before formalizingReproduce safely and file/update a backend report if still present
Ollama unknown modelControlled mock returns 200 while OpenAPI documents 404Do not assert the documented 404Align mock behavior or update the published contract

Test Architecture

  • api project: non-admin specs against API_BASE_URL, defaulting to https://awesome.byst.re.
  • admin-api project: tests/api/admin/** against API_ADMIN_BASE_URL, defaulting to https://aitesters.byst.re.
  • Projects are independent and run in parallel.
  • HTTP clients are initialized in test.beforeEach.
  • Specs use // given, // when, // then and order cases by ascending response status.
  • Dynamic ids, timestamps, pagination, traffic, and streams use structural assertions; stable request-derived fields use exact assertions.
  • Ollama responses use an SSE parser and deterministic mock prompts.

Data Safety And Cleanup

  • Admin mutations use generated disposable products and users; seeded entities are never deleted.
  • Customer order fixtures cancel cancellable orders before cleanup to restore inventory.
  • Admin order fixtures delete the generated owner/order before the generated product and verify cleanup statuses.
  • Right-to-be-forgotten coverage uses a dedicated generated-user fixture that tolerates intentional deletion while preserving primary setup/test failures.
  • Exploratory calls use generated identifiers and record cleanup outcomes.
  • Credentials are loaded only from ignored local environment files.

Recent L17 Increment

  • Added endpoint-focused coverage for POST /api/v1/email: 200, 400, 401.
  • Added endpoint-focused coverage for right-to-be-forgotten: 204, 401, 403, 404, including observable post-deletion signin failure.
  • Hardened generated-user cleanup after independent review.
  • Completed e-commerce operation coverage: Products 5/5, Cart 5/5, Orders 6/6.
  • Added and reconfirmed the two backend defect reports above.
  • Restored explicit // given phases in legacy specs found by the style audit.
  • Re-audited against both live Swagger contracts and corrected the stale 42-operation baseline to 55 operations on aitesters and 53 on the course API.

Next Actions

  1. QA automation: add the four inventory operations first, using a generated product and a reversible adjustment with verified cleanup.
  2. QA + security: implement the seven 2FA/SSO operations with disposable users, secret-safe evidence, and deterministic teardown.
  3. Backend: fix traffic correlation-detail retrieval, deploy, reverify with list-to-detail curl, then add the documented 200 Playwright path.
  4. Backend/security: map a JWT for a deleted principal to a handled 401 or documented 404; add a backend retry regression test.
  5. Testability: expose a safe password-reset token/outbox mechanism and add the success flow without weakening anti-enumeration behavior.
  6. Contract: reverify the ten newly documented statuses on existing operations, unknown admin order status, and Ollama missing-model behavior.
  7. Scope decision: decide whether the two aitesters-only local-outbox operations belong in L17 automation; if yes, add isolated key-protected checks.
  8. Maintenance: refresh the checked-in contract baseline and this report after every API surface change.

Reporting Rule

Every unexpected 5xx, contract mismatch, auth/validation inconsistency, cleanup failure, or flaky response is a defect signal. Preserve evidence, attempt up to three safe isolated reproductions, create or update a Markdown report under bug-reports/, link it here, and avoid turning broken behavior into a regression expectation.