codapact 0.3.0__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codapact-0.5.0/.github/workflows/ci.yml +148 -0
- codapact-0.5.0/.github/workflows/mutation.yml +71 -0
- codapact-0.5.0/.github/workflows/nightly.yml +50 -0
- codapact-0.5.0/.release-please-manifest.json +1 -0
- {codapact-0.3.0 → codapact-0.5.0}/CHANGELOG.md +27 -0
- {codapact-0.3.0 → codapact-0.5.0}/PKG-INFO +4 -2
- {codapact-0.3.0 → codapact-0.5.0}/README.md +1 -1
- {codapact-0.3.0 → codapact-0.5.0}/docs/architecture.md +16 -7
- codapact-0.5.0/docs/configuration.md +276 -0
- codapact-0.5.0/docs/testing.md +90 -0
- {codapact-0.3.0 → codapact-0.5.0}/pyproject.toml +67 -3
- codapact-0.5.0/pyproject.toml.orig +126 -0
- codapact-0.5.0/scripts/extract_openapi_subset.py +93 -0
- codapact-0.5.0/scripts/mutation_score.py +86 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/__init__.py +1 -1
- codapact-0.5.0/src/codapact/__main__.py +5 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/commands/derive.py +90 -2
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/commands/model.py +11 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/core/naming.py +5 -0
- codapact-0.5.0/src/codapact/core/net.py +254 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/model/__init__.py +6 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/model/api.py +70 -6
- codapact-0.5.0/src/codapact/model/authspec.py +98 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/model/migrations.py +22 -1
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/model/rewrite.py +25 -1
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/model/serialize.py +1 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/model/validate.py +1 -3
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/pipeline/cli.py +10 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/pipeline/config.py +17 -1
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/pipeline/pipeline.py +31 -5
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/plugins/protocol.py +3 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/runtime/__init__.py +27 -1
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/runtime/abstractions.py +28 -2
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/runtime/arguments.py +5 -0
- codapact-0.5.0/src/codapact/runtime/auth.py +256 -0
- codapact-0.5.0/src/codapact/runtime/cli.py +1347 -0
- codapact-0.5.0/src/codapact/runtime/cli_auth.py +241 -0
- codapact-0.5.0/src/codapact/runtime/cli_tools.py +563 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/runtime/client.py +28 -4
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/runtime/codec.py +88 -0
- codapact-0.5.0/src/codapact/runtime/credentials.py +331 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/runtime/errors.py +22 -0
- codapact-0.5.0/src/codapact/runtime/oauth.py +849 -0
- codapact-0.5.0/src/codapact/runtime/protocols/base.py +113 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/runtime/protocols/graphql.py +3 -1
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/runtime/protocols/http.py +31 -8
- codapact-0.5.0/src/codapact/runtime/selftest.py +339 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/shaping/transforms.py +236 -44
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/sources/graphql/translator.py +108 -15
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/sources/loader.py +58 -19
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/sources/openapi/translator.py +179 -26
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/surface/derive.py +126 -23
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/surface/model.py +19 -1
- codapact-0.5.0/src/codapact/targets/python/cli.py +423 -0
- codapact-0.5.0/src/codapact/targets/python/e2e.py +383 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/targets/python/library.py +71 -13
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/targets/typescript/library.py +60 -9
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/targets/typescript/runtime.ts +201 -23
- codapact-0.5.0/tests/authlab.py +288 -0
- codapact-0.5.0/tests/conftest.py +53 -0
- codapact-0.5.0/tests/e2e/test_auth_e2e.py +308 -0
- codapact-0.5.0/tests/e2e/test_cli_e2e.py +251 -0
- codapact-0.5.0/tests/e2e/test_public_apis.py +214 -0
- codapact-0.5.0/tests/fixtures/authlab/authlab_plugin.py +41 -0
- codapact-0.5.0/tests/fixtures/authlab/codapact.yaml +21 -0
- codapact-0.5.0/tests/fixtures/authlab/fake_browser.py +26 -0
- codapact-0.5.0/tests/fixtures/authlab/openapi.yaml +82 -0
- codapact-0.5.0/tests/fixtures/authlab_smoke.ts +63 -0
- codapact-0.5.0/tests/fixtures/contracts/wire.yaml +50 -0
- codapact-0.5.0/tests/fixtures/corpus/README.md +15 -0
- codapact-0.5.0/tests/fixtures/corpus/countries/codapact.yaml +12 -0
- codapact-0.5.0/tests/fixtures/corpus/countries/operations.graphql +15 -0
- codapact-0.5.0/tests/fixtures/corpus/countries/schema.graphql +24 -0
- codapact-0.5.0/tests/fixtures/corpus/github/codapact.yaml +41 -0
- codapact-0.5.0/tests/fixtures/corpus/github/openapi.json +4724 -0
- codapact-0.5.0/tests/fixtures/corpus/pokeapi/codapact.yaml +66 -0
- codapact-0.5.0/tests/fixtures/corpus/pokeapi/openapi.yml +10450 -0
- codapact-0.5.0/tests/fixtures/corpus/ynab/README.md +6 -0
- codapact-0.5.0/tests/fixtures/corpus/ynab/codapact.yaml +13 -0
- codapact-0.5.0/tests/fixtures/corpus/ynab/openapi.yaml +4027 -0
- codapact-0.5.0/tests/fixtures/wire_parity.ts +17 -0
- codapact-0.5.0/tests/integration/test_cli_conformance.py +268 -0
- codapact-0.5.0/tests/integration/test_cli_conventions.py +188 -0
- codapact-0.5.0/tests/integration/test_contract_properties.py +123 -0
- codapact-0.5.0/tests/integration/test_corpus.py +118 -0
- codapact-0.5.0/tests/integration/test_generated_code_properties.py +85 -0
- {codapact-0.3.0/tests → codapact-0.5.0/tests/integration}/test_generation.py +11 -40
- codapact-0.5.0/tests/integration/test_public_api_cli.py +106 -0
- codapact-0.5.0/tests/integration/test_wire_parity.py +104 -0
- codapact-0.5.0/tests/integration/test_ynab_contract.py +276 -0
- codapact-0.5.0/tests/perf/test_scaling.py +166 -0
- codapact-0.5.0/tests/public_api_contract.py +122 -0
- codapact-0.5.0/tests/strategies.py +204 -0
- {codapact-0.3.0 → codapact-0.5.0}/tests/support.py +204 -1
- {codapact-0.3.0/tests → codapact-0.5.0/tests/unit}/test_architecture.py +3 -1
- codapact-0.5.0/tests/unit/test_auth_and_graphql_sources.py +126 -0
- codapact-0.5.0/tests/unit/test_auth_sources.py +529 -0
- codapact-0.5.0/tests/unit/test_bundle_e2e.py +507 -0
- codapact-0.5.0/tests/unit/test_cli_builtins.py +532 -0
- codapact-0.5.0/tests/unit/test_guards.py +233 -0
- {codapact-0.3.0/tests → codapact-0.5.0/tests/unit}/test_model.py +28 -1
- codapact-0.5.0/tests/unit/test_mutation_score.py +60 -0
- codapact-0.5.0/tests/unit/test_oauth.py +590 -0
- {codapact-0.3.0/tests → codapact-0.5.0/tests/unit}/test_openapi_edges.py +164 -3
- codapact-0.5.0/tests/unit/test_openapi_translator_units.py +388 -0
- {codapact-0.3.0/tests → codapact-0.5.0/tests/unit}/test_plugins_pipeline.py +3 -3
- codapact-0.5.0/tests/unit/test_public_api_findings.py +932 -0
- {codapact-0.3.0/tests → codapact-0.5.0/tests/unit}/test_runtime_edges.py +22 -3
- codapact-0.5.0/tests/unit/test_runtime_pagination.py +116 -0
- {codapact-0.3.0/tests → codapact-0.5.0/tests/unit}/test_sources.py +42 -2
- codapact-0.5.0/tests/unit/test_target_rendering.py +346 -0
- codapact-0.5.0/tests/unit/test_usability.py +304 -0
- {codapact-0.3.0 → codapact-0.5.0}/uv.lock +541 -1
- codapact-0.3.0/.github/workflows/ci.yml +0 -53
- codapact-0.3.0/.release-please-manifest.json +0 -1
- codapact-0.3.0/docs/configuration.md +0 -91
- codapact-0.3.0/pyproject.toml.orig +0 -79
- codapact-0.3.0/src/codapact/core/net.py +0 -121
- codapact-0.3.0/src/codapact/runtime/auth.py +0 -113
- codapact-0.3.0/src/codapact/runtime/cli.py +0 -196
- codapact-0.3.0/src/codapact/runtime/protocols/base.py +0 -59
- codapact-0.3.0/src/codapact/targets/python/cli.py +0 -189
- {codapact-0.3.0 → codapact-0.5.0}/.github/workflows/codeql.yml +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/.github/workflows/release.yml +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/LICENSE +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/docs/branding/README.md +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/docs/branding/mark.svg +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/docs/branding/wordmark.svg +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/examples/library/codapact.yaml +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/examples/library/operations.graphql +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/examples/library/schema.graphql +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/examples/petstore/codapact.yaml +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/examples/petstore/openapi.yaml +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/release-please-config.json +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/scripts/verify_dist.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/commands/__init__.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/core/__init__.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/core/diagnostics.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/core/errors.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/model/types.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/model/values.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/pipeline/__init__.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/pipeline/defaults.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/pipeline/writer.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/plugins/__init__.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/plugins/external.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/plugins/registry.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/py.typed +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/runtime/middleware.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/runtime/protocols/__init__.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/shaping/__init__.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/shaping/base.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/shaping/engine.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/sources/__init__.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/sources/base.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/sources/graphql/__init__.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/sources/openapi/__init__.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/surface/__init__.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/targets/__init__.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/targets/python/__init__.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/targets/python/naming.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/src/codapact/targets/typescript/__init__.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/tests/fixtures/library_smoke.ts +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/tests/fixtures/outline_plugin.py +0 -0
- {codapact-0.3.0 → codapact-0.5.0}/tests/fixtures/petstore_smoke.ts +0 -0
- {codapact-0.3.0/tests → codapact-0.5.0/tests/unit}/test_codec_serialize.py +0 -0
- {codapact-0.3.0/tests → codapact-0.5.0/tests/unit}/test_core.py +0 -0
- {codapact-0.3.0/tests → codapact-0.5.0/tests/unit}/test_runtime.py +0 -0
- {codapact-0.3.0/tests → codapact-0.5.0/tests/unit}/test_shaping_surface_commands.py +0 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
workflow_call:
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
jobs:
|
|
11
|
+
title:
|
|
12
|
+
name: Conventional PR title
|
|
13
|
+
if: github.event_name == 'pull_request'
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Check title
|
|
17
|
+
env:
|
|
18
|
+
TITLE: ${{ github.event.pull_request.title }}
|
|
19
|
+
run: |
|
|
20
|
+
pattern='^(feat|fix|perf|docs|build|ci|refactor|test|chore|style|revert)(\([^)]+\))?!?: .+'
|
|
21
|
+
[[ "$TITLE" =~ $pattern ]]
|
|
22
|
+
check:
|
|
23
|
+
name: Python ${{ matrix.python }} on ${{ matrix.os }}
|
|
24
|
+
runs-on: ${{ matrix.os }}
|
|
25
|
+
strategy:
|
|
26
|
+
fail-fast: false
|
|
27
|
+
matrix:
|
|
28
|
+
os: [ubuntu-latest, windows-latest]
|
|
29
|
+
python: ['3.13', '3.14']
|
|
30
|
+
env:
|
|
31
|
+
# TypeScript runtime tests must run, not skip, in CI.
|
|
32
|
+
CODAPACT_REQUIRE_NODE: '1'
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
35
|
+
with:
|
|
36
|
+
persist-credentials: false
|
|
37
|
+
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
|
|
38
|
+
with:
|
|
39
|
+
python-version: ${{ matrix.python }}
|
|
40
|
+
enable-cache: false
|
|
41
|
+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
42
|
+
with:
|
|
43
|
+
node-version: '24'
|
|
44
|
+
- name: Install TypeScript compiler
|
|
45
|
+
shell: bash
|
|
46
|
+
run: |
|
|
47
|
+
npm install --no-save --no-package-lock --prefix "$RUNNER_TEMP/tools" typescript@6.0.2
|
|
48
|
+
echo "$RUNNER_TEMP/tools/node_modules/.bin" >> "$GITHUB_PATH"
|
|
49
|
+
- run: uv sync --locked
|
|
50
|
+
- run: uv run poe check
|
|
51
|
+
- run: uv build
|
|
52
|
+
- run: uv run twine check --strict dist/*
|
|
53
|
+
|
|
54
|
+
coverage:
|
|
55
|
+
name: Coverage of changed lines
|
|
56
|
+
if: github.event_name == 'pull_request'
|
|
57
|
+
runs-on: ubuntu-latest
|
|
58
|
+
env:
|
|
59
|
+
CODAPACT_REQUIRE_NODE: '1'
|
|
60
|
+
HYPOTHESIS_PROFILE: ci
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
63
|
+
with:
|
|
64
|
+
persist-credentials: false
|
|
65
|
+
fetch-depth: 0
|
|
66
|
+
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
|
|
67
|
+
with:
|
|
68
|
+
python-version: '3.13'
|
|
69
|
+
enable-cache: false
|
|
70
|
+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
71
|
+
with:
|
|
72
|
+
node-version: '24'
|
|
73
|
+
- run: |
|
|
74
|
+
npm install --no-save --no-package-lock --prefix "$RUNNER_TEMP/tools" typescript@6.0.2
|
|
75
|
+
echo "$RUNNER_TEMP/tools/node_modules/.bin" >> "$GITHUB_PATH"
|
|
76
|
+
- run: uv sync --locked
|
|
77
|
+
- name: Full suite with more property examples
|
|
78
|
+
run: uv run poe test
|
|
79
|
+
- name: Every changed source line is covered
|
|
80
|
+
env:
|
|
81
|
+
BASE_REF: ${{ github.base_ref }}
|
|
82
|
+
run: |
|
|
83
|
+
git fetch --no-tags origin "$BASE_REF"
|
|
84
|
+
uv run diff-cover coverage.xml --compare-branch="origin/$BASE_REF" --fail-under=100 \
|
|
85
|
+
--markdown-report diff-coverage.md
|
|
86
|
+
cat diff-coverage.md >> "$GITHUB_STEP_SUMMARY"
|
|
87
|
+
|
|
88
|
+
prism:
|
|
89
|
+
name: E2E against Prism mock (PokeAPI)
|
|
90
|
+
runs-on: ubuntu-latest
|
|
91
|
+
steps:
|
|
92
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
93
|
+
with:
|
|
94
|
+
persist-credentials: false
|
|
95
|
+
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
|
|
96
|
+
with:
|
|
97
|
+
python-version: '3.13'
|
|
98
|
+
enable-cache: false
|
|
99
|
+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
100
|
+
with:
|
|
101
|
+
node-version: '24'
|
|
102
|
+
- run: npm install --no-save --no-package-lock --prefix "$RUNNER_TEMP/tools" @stoplight/prism-cli@5.16.0
|
|
103
|
+
- run: uv sync --locked
|
|
104
|
+
- name: Start Prism (validates every request against the pinned spec)
|
|
105
|
+
run: |
|
|
106
|
+
"$RUNNER_TEMP/tools/node_modules/.bin/prism" mock --errors -p 4010 \
|
|
107
|
+
tests/fixtures/corpus/pokeapi/openapi.yml > "$RUNNER_TEMP/prism.log" 2>&1 &
|
|
108
|
+
for _ in $(seq 60); do curl -s -o /dev/null http://127.0.0.1:4010/ && break; sleep 1; done
|
|
109
|
+
- run: uv run pytest tests/e2e/test_public_apis.py -v
|
|
110
|
+
env:
|
|
111
|
+
CODAPACT_PRISM_URL: http://127.0.0.1:4010
|
|
112
|
+
- if: always()
|
|
113
|
+
run: cat "$RUNNER_TEMP/prism.log"
|
|
114
|
+
|
|
115
|
+
perf:
|
|
116
|
+
name: Performance budgets
|
|
117
|
+
runs-on: ubuntu-latest
|
|
118
|
+
steps:
|
|
119
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
120
|
+
with:
|
|
121
|
+
persist-credentials: false
|
|
122
|
+
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
|
|
123
|
+
with:
|
|
124
|
+
python-version: '3.13'
|
|
125
|
+
enable-cache: false
|
|
126
|
+
- run: uv sync --locked
|
|
127
|
+
- run: uv run poe test-perf
|
|
128
|
+
env:
|
|
129
|
+
CODAPACT_PERF_REPORT: perf-report.json
|
|
130
|
+
- if: always()
|
|
131
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
132
|
+
with:
|
|
133
|
+
name: perf-report
|
|
134
|
+
path: perf-report.json
|
|
135
|
+
if-no-files-found: warn
|
|
136
|
+
retention-days: 30
|
|
137
|
+
|
|
138
|
+
passed:
|
|
139
|
+
name: CI passed
|
|
140
|
+
if: always()
|
|
141
|
+
needs: [check, coverage, prism, perf, title]
|
|
142
|
+
runs-on: ubuntu-latest
|
|
143
|
+
steps:
|
|
144
|
+
- name: Require all checks
|
|
145
|
+
env:
|
|
146
|
+
RESULTS: ${{ toJSON(needs) }}
|
|
147
|
+
run: |
|
|
148
|
+
echo "$RESULTS" | jq -e 'to_entries | all(.value.result == "success" or .value.result == "skipped")'
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: Mutation
|
|
2
|
+
# Mutation testing measures whether the tests notice behavior changes. It is slow
|
|
3
|
+
# (~9k mutants), so it runs in parallel shards after merges to main, weekly, and on
|
|
4
|
+
# demand; it never gates a PR. Each shard must finish and meet the score floor.
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches: [main]
|
|
8
|
+
schedule:
|
|
9
|
+
- cron: '23 6 * * 1'
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
concurrency:
|
|
14
|
+
group: mutation-${{ github.ref }}
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
jobs:
|
|
17
|
+
mutmut:
|
|
18
|
+
name: mutmut ${{ matrix.shard.name }}
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
timeout-minutes: 75
|
|
21
|
+
strategy:
|
|
22
|
+
fail-fast: false
|
|
23
|
+
matrix:
|
|
24
|
+
shard:
|
|
25
|
+
- {name: openapi, patterns: 'codapact.sources.openapi.*'}
|
|
26
|
+
- {name: sources, patterns: 'codapact.sources.graphql.* codapact.sources.loader.* codapact.sources.base.*'}
|
|
27
|
+
- {name: targets, patterns: 'codapact.targets.*'}
|
|
28
|
+
# runtime is split three ways: as one shard it outgrew the 65-minute cap.
|
|
29
|
+
# A new codapact.runtime module must be added to one of these patterns.
|
|
30
|
+
- {name: runtime-cli, patterns: 'codapact.runtime.cli.* codapact.runtime.cli_*'}
|
|
31
|
+
- {name: runtime-auth, patterns: 'codapact.runtime.oauth.* codapact.runtime.auth.* codapact.runtime.credentials.*'}
|
|
32
|
+
- {name: runtime-core, patterns: 'codapact.runtime.arguments.* codapact.runtime.middleware.* codapact.runtime.errors.* codapact.runtime.abstractions.* codapact.runtime.protocols.* codapact.runtime.client.* codapact.runtime.codec.* codapact.runtime.selftest.*'}
|
|
33
|
+
- {name: pipeline, patterns: 'codapact.pipeline.* codapact.plugins.* codapact.commands.*'}
|
|
34
|
+
- {name: model, patterns: 'codapact.model.* codapact.shaping.* codapact.surface.* codapact.core.*'}
|
|
35
|
+
env:
|
|
36
|
+
# Baseline 2026-11-11: ~74% overall. Raise as survivors are fixed; never lower.
|
|
37
|
+
MUTATION_FLOOR: '70'
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
40
|
+
with:
|
|
41
|
+
persist-credentials: false
|
|
42
|
+
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
|
|
43
|
+
with:
|
|
44
|
+
python-version: '3.13'
|
|
45
|
+
enable-cache: false
|
|
46
|
+
- run: uv sync --locked --group mutation
|
|
47
|
+
- name: Run mutmut
|
|
48
|
+
env:
|
|
49
|
+
PATTERNS: ${{ matrix.shard.patterns }}
|
|
50
|
+
run: |
|
|
51
|
+
set +e
|
|
52
|
+
read -ra patterns <<< "$PATTERNS"
|
|
53
|
+
timeout --signal=TERM --kill-after=30s 65m uv run mutmut run --max-children 4 "${patterns[@]}"
|
|
54
|
+
echo "run_exit=$?" >> "$GITHUB_ENV"
|
|
55
|
+
mkdir -p mutation-report
|
|
56
|
+
uv run mutmut results --all true > mutation-report/results.txt
|
|
57
|
+
- name: Enforce mutation score floor
|
|
58
|
+
env:
|
|
59
|
+
PATTERNS: ${{ matrix.shard.patterns }}
|
|
60
|
+
run: |
|
|
61
|
+
test "$run_exit" = 0 || { echo "mutmut did not finish (exit $run_exit)"; exit 1; }
|
|
62
|
+
args=()
|
|
63
|
+
for pattern in $PATTERNS; do args+=(--prefix "${pattern%\*}"); done
|
|
64
|
+
uv run python scripts/mutation_score.py --results mutation-report/results.txt "${args[@]}"
|
|
65
|
+
- if: always()
|
|
66
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
67
|
+
with:
|
|
68
|
+
name: mutation-report-${{ matrix.shard.name }}
|
|
69
|
+
path: mutation-report/
|
|
70
|
+
if-no-files-found: warn
|
|
71
|
+
retention-days: 30
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Nightly
|
|
2
|
+
# Slow and networked suites that should not gate every PR:
|
|
3
|
+
# live public APIs, deep property-based fuzzing, and the full TypeScript fuzz.
|
|
4
|
+
on:
|
|
5
|
+
schedule:
|
|
6
|
+
- cron: '17 5 * * *'
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
jobs:
|
|
11
|
+
live:
|
|
12
|
+
name: Live public APIs (PokeAPI, Countries, GitHub with auth)
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
timeout-minutes: 20
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
17
|
+
with:
|
|
18
|
+
persist-credentials: false
|
|
19
|
+
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
|
|
20
|
+
with:
|
|
21
|
+
python-version: '3.13'
|
|
22
|
+
enable-cache: false
|
|
23
|
+
- run: uv sync --locked
|
|
24
|
+
- run: uv run poe test-live -v
|
|
25
|
+
env:
|
|
26
|
+
# The generated GitHub CLI's live e2e suite proves the token is sent
|
|
27
|
+
# (authenticated rate limit) and that GitHub rejects a bad one.
|
|
28
|
+
GHX_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
29
|
+
deep:
|
|
30
|
+
name: Deep property-based fuzzing
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
timeout-minutes: 60
|
|
33
|
+
env:
|
|
34
|
+
CODAPACT_REQUIRE_NODE: '1'
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
37
|
+
with:
|
|
38
|
+
persist-credentials: false
|
|
39
|
+
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
|
|
40
|
+
with:
|
|
41
|
+
python-version: '3.13'
|
|
42
|
+
enable-cache: false
|
|
43
|
+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
44
|
+
with:
|
|
45
|
+
node-version: '24'
|
|
46
|
+
- run: |
|
|
47
|
+
npm install --no-save --no-package-lock --prefix "$RUNNER_TEMP/tools" typescript@6.0.2
|
|
48
|
+
echo "$RUNNER_TEMP/tools/node_modules/.bin" >> "$GITHUB_PATH"
|
|
49
|
+
- run: uv sync --locked
|
|
50
|
+
- run: uv run poe test-deep
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{".":"0.5.0"}
|
|
@@ -2,6 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- markdownlint-configure-file { "MD024": { "siblings_only": true } } -->
|
|
4
4
|
|
|
5
|
+
## [0.5.0](https://github.com/mikejhill/codapact/compare/v0.4.0...v0.5.0) (2026-11-12)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **cli:** pick unwraps envelopes; keyring for generated CLIs ([#32](https://github.com/mikejhill/codapact/issues/32)) ([f1c5104](https://github.com/mikejhill/codapact/commit/f1c51040a9bd5c21aa3e634955f2b5c0b7a4a6a1))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **e2e:** fill a required body whose fields are all optional in dry-run cases ([#31](https://github.com/mikejhill/codapact/issues/31)) ([c9a4ebb](https://github.com/mikejhill/codapact/commit/c9a4ebbad4338443689c0bf732c4b1e4cb266826))
|
|
16
|
+
|
|
17
|
+
## [0.4.0](https://github.com/mikejhill/codapact/compare/v0.3.0...v0.4.0) (2026-11-12)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **auth:** pluggable auth (OAuth 2.0 flows, bespoke authenticators) and generated bundle e2e suites ([#27](https://github.com/mikejhill/codapact/issues/27)) ([b42cb61](https://github.com/mikejhill/codapact/commit/b42cb61165c58895893c1a50a5515d5dc39a88aa))
|
|
23
|
+
* **cli:** conventional help, version, describe, doctor, completion, dry-run, JSON errors ([#25](https://github.com/mikejhill/codapact/issues/25)) ([809c9da](https://github.com/mikejhill/codapact/commit/809c9da83102ebaa5ae41a0cd0d60177e10c286f))
|
|
24
|
+
* **cli:** name commands in errors, describe --brief and schemas, CLI conformance suite ([#26](https://github.com/mikejhill/codapact/issues/26)) ([8780dfc](https://github.com/mikejhill/codapact/commit/8780dfcf1607f267cf59c9d39e8dd4c61a895da7))
|
|
25
|
+
* fix YNAB-evaluation findings (nullability, allOf, naming, CLI usability) ([#22](https://github.com/mikejhill/codapact/issues/22)) ([d8caaf3](https://github.com/mikejhill/codapact/commit/d8caaf33d084770993a5ad45d7bfb3d01d5d7cf9))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* address defects found by generating clients for PokeAPI and GitHub ([#23](https://github.com/mikejhill/codapact/issues/23)) ([b0693c3](https://github.com/mikejhill/codapact/commit/b0693c370d0fbfc6483cdc82adc4015c375a05a1))
|
|
31
|
+
|
|
5
32
|
## [0.3.0](https://github.com/mikejhill/codapact/compare/v0.2.0...v0.3.0) (2026-11-10)
|
|
6
33
|
|
|
7
34
|
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codapact
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Contracts into callable tools: generate libraries, then CLIs, from OpenAPI, GraphQL, and other API contracts.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
Requires-Dist: pyyaml>=6.0.3,<7
|
|
8
8
|
Requires-Dist: graphql-core>=3.2.6,<4
|
|
9
|
+
Requires-Dist: keyring>=25,<26 ; extra == 'keyring'
|
|
9
10
|
Requires-Python: >=3.13
|
|
10
11
|
Project-URL: Homepage, https://github.com/mikejhill/codapact
|
|
11
12
|
Project-URL: Documentation, https://github.com/mikejhill/codapact#readme
|
|
12
13
|
Project-URL: Changelog, https://github.com/mikejhill/codapact/blob/main/CHANGELOG.md
|
|
13
14
|
Project-URL: Issues, https://github.com/mikejhill/codapact/issues
|
|
15
|
+
Provides-Extra: keyring
|
|
14
16
|
Description-Content-Type: text/markdown
|
|
15
17
|
|
|
16
18
|
---
|
|
@@ -70,7 +72,7 @@ uv run codapact inspect commands -c examples/library/codapact.yaml
|
|
|
70
72
|
| Output | Contents |
|
|
71
73
|
| --- | --- |
|
|
72
74
|
| `python` | Installable package: `TypedDict` types, a resource-per-namespace client, paging iterators, `py.typed` |
|
|
73
|
-
| `python-cli` | argparse CLI calling the Python library
|
|
75
|
+
| `python-cli` | argparse CLI calling the Python library: `--help` with examples, `--version`, `describe` (JSON catalog for agents), `doctor`, shell `completion`, `--dry-run`, JSON/JSONL/YAML/table output, JSON errors, documented exit codes; env + XDG settings |
|
|
74
76
|
| `typescript` | Fetch-based client with bundled runtime; strict `tsc` clean |
|
|
75
77
|
| external plugin | Any executable speaking the JSON plugin protocol |
|
|
76
78
|
|
|
@@ -55,7 +55,7 @@ uv run codapact inspect commands -c examples/library/codapact.yaml
|
|
|
55
55
|
| Output | Contents |
|
|
56
56
|
| --- | --- |
|
|
57
57
|
| `python` | Installable package: `TypedDict` types, a resource-per-namespace client, paging iterators, `py.typed` |
|
|
58
|
-
| `python-cli` | argparse CLI calling the Python library
|
|
58
|
+
| `python-cli` | argparse CLI calling the Python library: `--help` with examples, `--version`, `describe` (JSON catalog for agents), `doctor`, shell `completion`, `--dry-run`, JSON/JSONL/YAML/table output, JSON errors, documented exit codes; env + XDG settings |
|
|
59
59
|
| `typescript` | Fetch-based client with bundled runtime; strict `tsc` clean |
|
|
60
60
|
| external plugin | Any executable speaking the JSON plugin protocol |
|
|
61
61
|
|
|
@@ -51,7 +51,7 @@ place that names concrete implementations.
|
|
|
51
51
|
|
|
52
52
|
### Dependency rules
|
|
53
53
|
|
|
54
|
-
Enforced by `tests/test_architecture.py` (AST import scan):
|
|
54
|
+
Enforced by `tests/unit/test_architecture.py` (AST import scan):
|
|
55
55
|
|
|
56
56
|
- `core` depends on nothing in the package.
|
|
57
57
|
- `model` depends only on `core`.
|
|
@@ -87,6 +87,7 @@ Enforced by `tests/test_architecture.py` (AST import scan):
|
|
|
87
87
|
| HTTP sending | `Transport.send(HttpRequest)` | `RuntimeClient(transport=…)` |
|
|
88
88
|
| Cross-cutting | `Middleware(request, context, next)` | `RuntimeClient(middleware=…)` |
|
|
89
89
|
| Credentials | `AuthProvider.credential(scheme)` | `RuntimeClient(auth=…)` |
|
|
90
|
+
| Bespoke auth | `Authenticator.authenticate(request, scheme)`, optional `refresh` | returned by an `AuthProvider`; CLI `auth_plugin` |
|
|
90
91
|
| Protocol | `ProtocolAdapter.supports/call` | `RuntimeClient(adapters=…)` |
|
|
91
92
|
|
|
92
93
|
### Plugin protocol
|
|
@@ -113,8 +114,12 @@ that silently mishandles the feature.
|
|
|
113
114
|
rebinding, private and plaintext addresses only with explicit opt-in.
|
|
114
115
|
- `Retry` middleware: idempotent operations only, exponential backoff, honors
|
|
115
116
|
`Retry-After`.
|
|
116
|
-
- Auth: `StaticAuth`, `EnvAuth
|
|
117
|
-
|
|
117
|
+
- Auth: sources (`StaticAuth`, `EnvAuth`, `ChainAuth`, `CommandAuth`, `StoreAuth`) return a
|
|
118
|
+
`Credential` or an `Authenticator`. `OAuth2` (in `runtime.oauth`) is an `Authenticator`
|
|
119
|
+
over a grant (client credentials, password, device code, authorization code + PKCE) and a
|
|
120
|
+
`TokenStore` (memory, file, keyring). Authenticators run after middleware; a 401 triggers
|
|
121
|
+
one `refresh()` and resend. `Credential.__repr__` never renders secrets.
|
|
122
|
+
- `runtime.selftest`: the suite generated bundles ship (offline dry runs, live scenarios).
|
|
118
123
|
- Errors: `ValidationError`, `AuthError`, `ApiError` (status, named error case, decoded
|
|
119
124
|
payload), `GraphQLResponseError`, `TransportError`.
|
|
120
125
|
|
|
@@ -139,8 +144,12 @@ Deliberate differences:
|
|
|
139
144
|
|
|
140
145
|
## Testing strategy
|
|
141
146
|
|
|
147
|
+
Summary; the full strategy, suites, and gates are in [testing](testing.md).
|
|
148
|
+
|
|
142
149
|
- Each layer has unit tests against hand-built inputs from the layer below.
|
|
143
|
-
-
|
|
144
|
-
|
|
145
|
-
- Generated Python
|
|
146
|
-
|
|
150
|
+
- Property tests check translation against an independent JSON Schema oracle, and fuzz
|
|
151
|
+
whole contracts through every target.
|
|
152
|
+
- Generated Python and TypeScript are compiled, type-checked, and run against loopback
|
|
153
|
+
servers; the two runtimes must put identical requests on the wire.
|
|
154
|
+
- Real contracts (PokeAPI, YNAB) are generated in strict mode on every PR; public APIs are
|
|
155
|
+
called nightly.
|