Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ jobs:
npx tsx src/cli.ts manifest validate --tests-dir tests/api-python

- name: Fault injection - the generated tests must catch every injected defect (TS and Python)
# The demo API runs once per DEMO_FAULT (ignored filter, wrong sort, hidden record, duplicates, wrong field,
# overlapping pages, a required optional field, an accepted expired token, an ignored suspension) on its own
# port: clean without a fault, at least one failure with each.
# The demo API runs once per DEMO_FAULT (17 defects: collection, body variants, auth, parameter validation,
# total, persistence, search, decimal truncation) on its own port: clean without a fault, at least one failure
# with each. Exploratory probes record and never fail, so they cannot hide a clean run.
run: |
npx tsx scripts/mutation-check.ts --lang typescript --port 3200 tests/api/items tests/api/me
npx tsx scripts/mutation-check.ts --lang python --port 3300 tests/api-python/items tests/api-python/me
npx tsx scripts/mutation-check.ts --lang typescript --port 3200 --show tests/api/items tests/api/items-search tests/api/me
npx tsx scripts/mutation-check.ts --lang python --port 3300 --show tests/api-python/items tests/api-python/items_search tests/api-python/me
node -e '
for (const l of ["typescript", "python"]) { const r = require("./reports/mutation-" + l + ".json"); console.log(l, r.detected + "/" + r.injected); if (r.detected !== r.injected) process.exit(1); }
'
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Unreleased

- **Query parameters and GET collections** (docs/SUPPORT_MATRIX.md):
- confirmed: a decimal case for integer parameters (inside the documented bounds, so only the type is broken); every query case checks that the value really went over HTTP; accepted values also check the response contract; values over the limits are `CASE_LIMIT_REACHED` gaps instead of being dropped silently; Python sends query booleans as `true` / `false`;
- exploratory probes for scalar query parameters of GET / HEAD operations (empty, text, decimal, zero, negative, large, special characters, another spelling of a boolean or enum value, a missing required parameter): deduplicated against confirmed cases and the documented range, never failing on the API's behavior, recorded in the report (`exploratory.jsonl`, "Exploratory query probes");
- collections: `"match": "search"` (case-insensitive substring), `total` (the same on every page and equal to the number listed), `sort-reverse` (descending is ascending reversed), several mappings per resource (`"collections": [...]`);
- case ID vocabulary v5: `sort-reverse`, `total`, `probe`, the decimal `type` case;
- CI gate: a Python test that reassigns its own fixture fails (found here: a generated test shadowed the `items` resource fixture, so its cleanup would not have run);
- demo API: `GET /items/search` (required `q`), and the faults `ignore-max`, `loose-types`, `ignore-enum`, `ignore-required`, `truncate-decimal`, `wrong-total`, `drop-update`, `broken-search`; fault injection 17/17 in TypeScript and Python (the previous generator: 14/17 on the same spec).
- **Coverage depth** (docs/SUPPORT_MATRIX.md):
- positive request-body variants for create / update of a confirmed chain: only the required fields, and every other `oneOf` / `anyOf` branch with a valid sample; each checked with ajv before a test is written, cleanup in `finally`; closes `UNCOVERED_VARIANT` where a branch can be sent;
- reviewed auth cases from a deps `auth` section (environment variable names only): 403 for the operations named (`auth.forbidden`), 401 with an expired credential (`auth.expired`); skipped with the reason when the variable is unset; mismatches with the spec are `INVALID_REVIEWED_CONFIG`;
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ Coverage is reported, never implied. The full keyword-by-keyword table is in [do

**Derived from the spec alone (deterministic):**
- request bodies, recursively (`request.body#/items/*/sku`): required, type, null, enum, const, lengths, pattern, format, bounds, multipleOf, array and object size, uniqueItems, additionalProperties; one broken rule per case;
- query, header, cookie and path parameters, arrays in their documented style;
- query, header, cookie and path parameters, arrays in their documented style; each case checks that the value really went over HTTP; integers also get a decimal;
- exploratory query probes (empty, non-numeric, decimal, zero, negative, huge, special characters): what the API answers is recorded in the report, never treated as a confirmed defect;
- documented successes, documented enum values and valid limits of query parameters (one test and one case ID each);
- responses: status, Content-Type, headers, JSON / text schema, no body where none is documented, writeOnly;
- documented errors with a safe trigger: 400 / 422, 401 (missing and invalid credentials), 404, 405 (GET only), 412, 415.
Expand Down
36 changes: 36 additions & 0 deletions ci/coverage-baseline.demo.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
{
"schemaVersion": 1,
"activeCaseIds": [
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/limit/decimal:type",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/limit/empty:probe",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/limit:maximum",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/limit:minimum",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/limit:type",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/offset/decimal:type",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/offset/empty:probe",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/offset/large:probe",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/offset:minimum",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/offset:type",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/sort/case:probe",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/sort/empty:probe",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/sort:enum",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/tag/special:probe",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/tag:maxLength",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/tag:minLength",
"ata:op_4PIO72ZI3SIY:contract:positive:response.body#:schema",
Expand All @@ -23,12 +31,15 @@
"ata:op_4PIO72ZI3SIY:functional:positive:request.query#/sort/-price:sort",
"ata:op_4PIO72ZI3SIY:functional:positive:request.query#/sort/name:accepted-value",
"ata:op_4PIO72ZI3SIY:functional:positive:request.query#/sort/name:sort",
"ata:op_4PIO72ZI3SIY:functional:positive:request.query#/sort/name:sort-reverse",
"ata:op_4PIO72ZI3SIY:functional:positive:request.query#/sort/price:accepted-value",
"ata:op_4PIO72ZI3SIY:functional:positive:request.query#/sort/price:sort",
"ata:op_4PIO72ZI3SIY:functional:positive:request.query#/sort/price:sort-reverse",
"ata:op_4PIO72ZI3SIY:functional:positive:request.query#/tag/x:accepted-value",
"ata:op_4PIO72ZI3SIY:functional:positive:request.query#/tag/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:accepted-value",
"ata:op_4PIO72ZI3SIY:functional:positive:request.query#/tag:filter",
"ata:op_4PIO72ZI3SIY:functional:positive:response.body#/items/*/id:unique",
"ata:op_4PIO72ZI3SIY:functional:positive:response.body#/total:total",
"ata:op_7P2UH7UKQRHC:contract:positive:response.body#:schema",
"ata:op_7P2UH7UKQRHC:contract:positive:response.status#/404:documented",
"ata:op_7P2UH7UKQRHC:functional:negative:request.path#/itemId:not-found",
Expand All @@ -41,6 +52,30 @@
"ata:op_FXHMYSJVVHAU:functional:negative:request.path#/reportId:not-found",
"ata:op_OT5MMXZVBZK4:contract:positive:response.body#:schema",
"ata:op_OT5MMXZVBZK4:functional:positive:operation:documented-success",
"ata:op_RCUGPMGR7MCO:contract:negative:request.query#/limit/decimal:type",
"ata:op_RCUGPMGR7MCO:contract:negative:request.query#/limit/empty:probe",
"ata:op_RCUGPMGR7MCO:contract:negative:request.query#/limit:maximum",
"ata:op_RCUGPMGR7MCO:contract:negative:request.query#/limit:minimum",
"ata:op_RCUGPMGR7MCO:contract:negative:request.query#/limit:type",
"ata:op_RCUGPMGR7MCO:contract:negative:request.query#/offset/decimal:type",
"ata:op_RCUGPMGR7MCO:contract:negative:request.query#/offset/empty:probe",
"ata:op_RCUGPMGR7MCO:contract:negative:request.query#/offset/large:probe",
"ata:op_RCUGPMGR7MCO:contract:negative:request.query#/offset:minimum",
"ata:op_RCUGPMGR7MCO:contract:negative:request.query#/offset:type",
"ata:op_RCUGPMGR7MCO:contract:negative:request.query#/q/special:probe",
"ata:op_RCUGPMGR7MCO:contract:negative:request.query#/q:maxLength",
"ata:op_RCUGPMGR7MCO:contract:negative:request.query#/q:minLength",
"ata:op_RCUGPMGR7MCO:contract:negative:request.query#/q:required",
"ata:op_RCUGPMGR7MCO:contract:positive:response.body#:schema",
"ata:op_RCUGPMGR7MCO:functional:positive:operation:collection-contains",
"ata:op_RCUGPMGR7MCO:functional:positive:operation:documented-success",
"ata:op_RCUGPMGR7MCO:functional:positive:request.query#/limit/1:accepted-value",
"ata:op_RCUGPMGR7MCO:functional:positive:request.query#/limit/50:accepted-value",
"ata:op_RCUGPMGR7MCO:functional:positive:request.query#/offset/0:accepted-value",
"ata:op_RCUGPMGR7MCO:functional:positive:request.query#/offset:pagination",
"ata:op_RCUGPMGR7MCO:functional:positive:request.query#/q:filter",
"ata:op_RCUGPMGR7MCO:functional:positive:response.body#/items/*/id:unique",
"ata:op_RCUGPMGR7MCO:functional:positive:response.body#/total:total",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#/name:maxLength",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#/name:minLength",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#/name:nullable",
Expand Down Expand Up @@ -94,6 +129,7 @@
],
"gaps": [
"CANNOT_ISOLATE_RULE GET /items request.query#/sort type",
"CANNOT_ISOLATE_RULE GET /items/search lifecycle",
"MISSING_CLEANUP POST /admin/reset response.status#/204",
"MISSING_CLEANUP POST /admin/reset response.status#/401",
"MISSING_CLEANUP POST /admin/reset suite#/contract",
Expand Down
10 changes: 10 additions & 0 deletions ci/coverage-baseline.kitchen-sink.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,22 @@
"ata:op_MDAZRDJNDE6Z:contract:negative:request.cookie#/session:minLength",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.header#/x-request-id:format",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.header#/x-request-id:required",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/code/empty:probe",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/code/large:probe",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/code/special:probe",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/code:pattern",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/ids:uniqueItems",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/limit/decimal:type",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/limit/empty:probe",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/limit:maximum",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/limit:minimum",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/limit:type",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/since/empty:probe",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/since/large:probe",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/since/special:probe",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/since:format",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/status/case:probe",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/status/empty:probe",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/status:enum",
"ata:op_MDAZRDJNDE6Z:contract:negative:request.query#/tags:maxItems",
"ata:op_MDAZRDJNDE6Z:contract:positive:response.body#:schema",
Expand Down
129 changes: 79 additions & 50 deletions demo-api/deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,60 +18,89 @@
"read": "getItem",
"update": "updateItem",
"delete": "deleteItem",
"collection": {
"operationId": "listItems",
"items": "/items",
"id": "/id",
"fields": {
"/name": "exact",
"/price": "tolerance:0.001",
"/tags": "exact",
"/createdAt": "ignore"
},
"unique": [
"/id"
],
"filters": [
{
"param": "tag",
"field": "/tags",
"match": "contains"
}
],
"sorts": [
{
"param": "sort",
"value": "name",
"field": "/name",
"order": "asc"
"collections": [
{
"operationId": "listItems",
"items": "/items",
"id": "/id",
"fields": {
"/name": "exact",
"/price": "tolerance:0.001",
"/tags": "exact",
"/createdAt": "ignore"
},
{
"param": "sort",
"value": "-name",
"field": "/name",
"order": "desc"
"unique": [
"/id"
],
"filters": [
{
"param": "tag",
"field": "/tags",
"match": "contains"
}
],
"sorts": [
{
"param": "sort",
"value": "name",
"field": "/name",
"order": "asc"
},
{
"param": "sort",
"value": "-name",
"field": "/name",
"order": "desc"
},
{
"param": "sort",
"value": "price",
"field": "/price",
"order": "asc"
},
{
"param": "sort",
"value": "-price",
"field": "/price",
"order": "desc"
}
],
"page": {
"style": "offset",
"offsetParam": "offset",
"limitParam": "limit",
"maxPages": 20
},
{
"param": "sort",
"value": "price",
"field": "/price",
"order": "asc"
"deletedDisappears": true,
"total": "/total"
},
{
"operationId": "searchItems",
"items": "/items",
"id": "/id",
"fields": {
"/name": "exact",
"/price": "tolerance:0.001"
},
{
"param": "sort",
"value": "-price",
"field": "/price",
"order": "desc"
"total": "/total",
"unique": [
"/id"
],
"filters": [
{
"param": "q",
"field": "/name",
"match": "search"
}
],
"page": {
"style": "offset",
"offsetParam": "offset",
"limitParam": "limit",
"maxPages": 20
}
],
"page": {
"style": "offset",
"offsetParam": "offset",
"limitParam": "limit",
"maxPages": 20
},
"deletedDisappears": true
}
}
]
}
]
}
2 changes: 1 addition & 1 deletion demo-api/expected-gaps.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"CANNOT_ISOLATE_RULE": 1,
"CANNOT_ISOLATE_RULE": 2,
"MISSING_CLEANUP": 2,
"MISSING_RESOURCE_SOURCE": 1,
"MISSING_RESPONSE_SCHEMA": 1
Expand Down
49 changes: 49 additions & 0 deletions demo-api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,55 @@ paths:
itemId: '$response.body#/id'
'400':
$ref: '#/components/responses/BadRequest'
/items/search:
get:
operationId: searchItems
summary: Search items by name
description: Items whose name contains q, ignoring case.
tags: [items]
parameters:
- name: q
in: query
required: true
description: Text the name must contain (case-insensitive).
schema:
type: string
minLength: 1
maxLength: 30
example: keyboard
- name: limit
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 50
default: 20
- name: offset
in: query
required: false
schema:
type: integer
minimum: 0
default: 0
responses:
'200':
description: Matching items
content:
application/json:
schema:
type: object
required: [items, total]
properties:
items:
type: array
items:
$ref: '#/components/schemas/Item'
total:
type: integer
minimum: 0
'400':
$ref: '#/components/responses/BadRequest'
/items/{itemId}:
parameters:
- name: itemId
Expand Down
Loading
Loading