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
33 changes: 29 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
API_LOGIN_BODY: '{"username":"${API_USER}","password":"${API_PASSWORD}"}'
API_USER: demo
API_PASSWORD: demo-password
# Reviewed auth cases (demo-api/deps.json "auth"): fixed demo sessions, an expired one and a suspended account.
API_EXPIRED_TOKEN: demo-expired-token
API_FORBIDDEN_TOKEN: demo-suspended-token
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -50,6 +53,9 @@ jobs:
console.log("kitchen sink cases:", ts.length, "TypeScript /", py.length, "Python");
if (JSON.stringify(ts) !== JSON.stringify(py)) process.exit(1);
'
# Quality gates: no lost active case, no unexplained gap (ci/coverage-baseline.*.json), parity, cleanup.
npx tsx scripts/coverage-summary.ts --spec tests/fixtures/coverage/kitchen-sink.yaml --coverage reports/ks/coverage-gaps.json --registry tests/api-ks/_support/cases.json --parity tests/api-ks-python/_support/cases.json --tests-dir tests/api-ks --baseline ci/coverage-baseline.kitchen-sink.json --out reports/coverage-summary-kitchen-sink.md
npx tsx scripts/coverage-summary.ts --spec tests/fixtures/coverage/kitchen-sink.yaml --coverage reports/ks-python/coverage-gaps.json --registry tests/api-ks-python/_support/cases.json --tests-dir tests/api-ks-python > /dev/null
rm -rf tests/api-ks tests/api-ks-python

- name: Start demo API
Expand Down Expand Up @@ -122,16 +128,35 @@ jobs:
npx tsx src/cli.ts registry validate tests/api-python/_support/cases.json --spec demo-api/openapi.yaml --require-spec > /dev/null
npx tsx src/cli.ts manifest validate --tests-dir tests/api-python

- name: Fault injection - the collection tests must catch every injected defect (TS and 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) on its own port: clean without a fault, at least one failure with each.
# 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.
run: |
npx tsx scripts/mutation-check.ts --lang typescript --port 3200 tests/api/items/get
npx tsx scripts/mutation-check.ts --lang python --port 3300 tests/api-python/items/get
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
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); }
'

- name: Quality gates - coverage baseline, parity, cleanup, coverage summary (demo API)
# A lost active case ID or a gap the reviewed baseline does not list fails: update ci/coverage-baseline.demo.json
# in the PR that intends it (npx tsx scripts/coverage-summary.ts ... --write-baseline).
run: |
npx tsx scripts/coverage-summary.ts --spec demo-api/openapi.yaml --coverage reports/generate/coverage-gaps.json --registry tests/api/_support/cases.json --parity tests/api-python/_support/cases.json --tests-dir tests/api --baseline ci/coverage-baseline.demo.json --out reports/coverage-summary-demo.md
npx tsx scripts/coverage-summary.ts --spec demo-api/openapi.yaml --coverage reports/generate-python/coverage-gaps.json --registry tests/api-python/_support/cases.json --tests-dir tests/api-python > /dev/null

- name: Coverage summary artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-summary
path: |
reports/coverage-summary-*.md
reports/coverage-summary-*.json
reports/mutation-*.json
if-no-files-found: ignore

- name: Maintenance - a spec change is regenerated, validated and summarized (no PR in CI)
run: |
sed 's/enum: \[name, -name, price, -price\]/enum: [name, -name, price]/' demo-api/openapi.yaml > reports/openapi.changed.yaml
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

- **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`;
- unchecked-status codes state the actual reason (`MISSING_CLEANUP` for an operation no request is sent to, the success call's blocking reason for its status) instead of `NO_DOCUMENTED_REJECTION` / `UNCONFIRMED_BUSINESS_RULE`;
- case ID vocabulary v4: `optional-omitted`, `variant`, `expired-credentials`;
- CI quality gates (`scripts/coverage-summary.ts`): reviewed baselines of active case IDs and exact gaps (`ci/coverage-baseline.*.json`), TypeScript / Python parity, guaranteed cleanup of write tests, a per-operation coverage summary as an artifact;
- demo API: a documented 403 on `GET /me` (suspended account), fixed expired / suspended sessions for the reviewed auth cases, and three more fault modes (`require-optional`, `accept-expired`, `ignore-suspension`); fault injection runs over `items` and `me`: 9/9 in TypeScript and Python (the previous generator: 7/9 on the same spec).
- **Collection testing** (docs/SUPPORT_MATRIX.md, "Collections"):
- reviewed deps `collection` mapping, checked strictly against the spec (`INVALID_REVIEWED_CONFIG` gap on a mismatch);
- strategy A (create & verify): controlled datasets with a unique marker in an isolating filter, cleanup in `finally`; strategy C (read-only) with explicit skips; strategy recorded per list operation in `coverage-gaps.json`;
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ Coverage is reported, never implied. The full keyword-by-keyword table is in [do

**Needs your confirmation (deps or scenarios file):** CRUD chains and cleanup, 409 conflicts (`conflictOn`), fields a create returns as sent (`echoes`), values taken from existing data (`fill`), collection semantics (`collection`: identifier, persisted fields and their comparison policy, filters, sorts, paging, uniqueness, eventual consistency), approved fixtures (`--fixtures`), and every other business flow (`--scenarios`): state transitions, parent → child, login / refresh.

**Also derived, with a confirmed chain:** positive body variants: only the required fields, and every other `oneOf` / `anyOf` branch, each validated before it is sent and cleaned up after. **With a reviewed deps `auth` section:** 403 for an account that must be refused and 401 with an expired credential (credentials from environment variables only).

**Never generated (reported as gaps):** 403 without a reviewed role setup, 429, a 405 that would need an unsafe method, oneOf / anyOf branches other than the one sent, rules that cannot be broken without breaking another, media types other than JSON / text, and anything the spec does not state.

## Collections, fixtures and maintenance
Expand Down
108 changes: 108 additions & 0 deletions ci/coverage-baseline.demo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"schemaVersion": 1,
"activeCaseIds": [
"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:minimum",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/offset:type",
"ata:op_4PIO72ZI3SIY:contract:negative:request.query#/sort:enum",
"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",
"ata:op_4PIO72ZI3SIY:functional:positive:operation:collection-contains",
"ata:op_4PIO72ZI3SIY:functional:positive:operation:documented-success",
"ata:op_4PIO72ZI3SIY:functional:positive:operation:fixture",
"ata:op_4PIO72ZI3SIY:functional:positive:request.query#/limit/100:accepted-value",
"ata:op_4PIO72ZI3SIY:functional:positive:request.query#/limit/1:accepted-value",
"ata:op_4PIO72ZI3SIY:functional:positive:request.query#/offset/0:accepted-value",
"ata:op_4PIO72ZI3SIY:functional:positive:request.query#/offset:pagination",
"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/-price:accepted-value",
"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/price:accepted-value",
"ata:op_4PIO72ZI3SIY:functional:positive:request.query#/sort/price:sort",
"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_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",
"ata:op_7P2UH7UKQRHC:functional:positive:operation:documented-success",
"ata:op_EDRRXKOK26ZL:contract:positive:response.status#/204:documented",
"ata:op_EDRRXKOK26ZL:contract:positive:response.status#/404:documented",
"ata:op_EDRRXKOK26ZL:functional:negative:request.path#/itemId:not-found",
"ata:op_EDRRXKOK26ZL:functional:positive:operation:documented-success",
"ata:op_FXHMYSJVVHAU:contract:positive:response.status#/404:documented",
"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_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",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#/name:required",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#/name:type",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#/price:minimum",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#/price:nullable",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#/price:required",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#/price:type",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#/tags/*:maxLength",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#/tags/*:minLength",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#/tags/*:nullable",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#/tags/*:type",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#/tags:maxItems",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#/tags:nullable",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#/tags:type",
"ata:op_UPN7JLUXYUZ7:contract:negative:request.body#:additionalProperties",
"ata:op_UPN7JLUXYUZ7:contract:positive:response.body#:schema",
"ata:op_UPN7JLUXYUZ7:functional:positive:operation:documented-success",
"ata:op_UPN7JLUXYUZ7:functional:positive:request.body#:optional-omitted",
"ata:op_VSDJU55WRH4A:contract:positive:response.body#:schema",
"ata:op_VSDJU55WRH4A:functional:positive:operation:documented-success",
"ata:op_WRZHS7HTMVON:contract:positive:response.body#:schema",
"ata:op_WRZHS7HTMVON:contract:positive:response.status#/401:documented",
"ata:op_WRZHS7HTMVON:functional:negative:request.security:expired-credentials",
"ata:op_WRZHS7HTMVON:functional:negative:request.security:forbidden",
"ata:op_WRZHS7HTMVON:functional:negative:request.security:invalid-credentials",
"ata:op_WRZHS7HTMVON:functional:negative:request.security:unauthorized",
"ata:op_WRZHS7HTMVON:functional:positive:operation:documented-success",
"ata:op_Z4MCICNBZN3S:contract:negative:request.body#/name:maxLength",
"ata:op_Z4MCICNBZN3S:contract:negative:request.body#/name:minLength",
"ata:op_Z4MCICNBZN3S:contract:negative:request.body#/name:nullable",
"ata:op_Z4MCICNBZN3S:contract:negative:request.body#/name:type",
"ata:op_Z4MCICNBZN3S:contract:negative:request.body#/price:minimum",
"ata:op_Z4MCICNBZN3S:contract:negative:request.body#/price:nullable",
"ata:op_Z4MCICNBZN3S:contract:negative:request.body#/price:type",
"ata:op_Z4MCICNBZN3S:contract:negative:request.body#:additionalProperties",
"ata:op_Z4MCICNBZN3S:contract:negative:request.body#:minProperties",
"ata:op_Z4MCICNBZN3S:contract:positive:response.body#:schema",
"ata:op_Z4MCICNBZN3S:contract:positive:response.status#/404:documented",
"ata:op_Z4MCICNBZN3S:functional:negative:request.path#/itemId:not-found",
"ata:op_Z4MCICNBZN3S:functional:positive:operation:documented-success",
"ata:op_Z4MCICNBZN3S:functional:positive:request.body#:optional-omitted",
"ata:scn_4EG5AXFZY2YS:scenario:positive:lifecycle:crud",
"ata:scn_6I3KELJAMGYP:scenario:positive:lifecycle:business-rule",
"ata:scn_7MN4FYBHZCZQ:scenario:positive:lifecycle:crud",
"ata:scn_I6MIGZS3ULNR:scenario:positive:lifecycle:crud",
"ata:scn_RKQFWGP26Y3B:scenario:positive:lifecycle:crud",
"ata:scn_V2OYCQUW2VKW:scenario:negative:lifecycle:business-rule",
"ata:scn_VQLGIE5JMTBU:scenario:negative:lifecycle:business-rule"
],
"gaps": [
"CANNOT_ISOLATE_RULE GET /items request.query#/sort type",
"MISSING_CLEANUP POST /admin/reset response.status#/204",
"MISSING_CLEANUP POST /admin/reset response.status#/401",
"MISSING_CLEANUP POST /admin/reset suite#/contract",
"MISSING_CLEANUP POST /admin/reset suite#/functional",
"MISSING_CLEANUP POST /auth/login response.status#/200",
"MISSING_CLEANUP POST /auth/login response.status#/401",
"MISSING_CLEANUP POST /auth/login suite#/contract",
"MISSING_CLEANUP POST /auth/login suite#/functional",
"MISSING_RESOURCE_SOURCE GET /reports/{reportId} response.status#/200",
"MISSING_RESPONSE_SCHEMA GET /reports/{reportId} response.content-type#/application~1json"
]
}
Loading
Loading