codapact 0.5.0__tar.gz → 0.5.2__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 → codapact-0.5.2}/.github/workflows/mutation.yml +14 -5
- codapact-0.5.2/.release-please-manifest.json +1 -0
- {codapact-0.5.0 → codapact-0.5.2}/CHANGELOG.md +14 -0
- {codapact-0.5.0 → codapact-0.5.2}/PKG-INFO +1 -1
- {codapact-0.5.0 → codapact-0.5.2}/docs/configuration.md +4 -2
- {codapact-0.5.0 → codapact-0.5.2}/docs/testing.md +1 -1
- {codapact-0.5.0 → codapact-0.5.2}/pyproject.toml +1 -1
- {codapact-0.5.0 → codapact-0.5.2}/pyproject.toml.orig +1 -1
- {codapact-0.5.0 → codapact-0.5.2}/scripts/mutation_score.py +25 -7
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/__init__.py +1 -1
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/core/errors.py +9 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/core/net.py +2 -2
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/__init__.py +2 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/cli.py +90 -16
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/cli_tools.py +4 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/client.py +10 -1
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/errors.py +2 -1
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/selftest.py +3 -1
- codapact-0.5.2/tests/unit/test_cli_auth.py +331 -0
- codapact-0.5.2/tests/unit/test_cli_options.py +316 -0
- codapact-0.5.2/tests/unit/test_live_ynab_findings.py +217 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_mutation_score.py +22 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_public_api_findings.py +2 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_usability.py +1 -1
- {codapact-0.5.0 → codapact-0.5.2}/uv.lock +1 -1
- codapact-0.5.0/.release-please-manifest.json +0 -1
- {codapact-0.5.0 → codapact-0.5.2}/.github/workflows/ci.yml +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/.github/workflows/codeql.yml +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/.github/workflows/nightly.yml +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/.github/workflows/release.yml +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/LICENSE +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/README.md +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/docs/architecture.md +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/docs/branding/README.md +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/docs/branding/mark.svg +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/docs/branding/wordmark.svg +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/examples/library/codapact.yaml +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/examples/library/operations.graphql +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/examples/library/schema.graphql +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/examples/petstore/codapact.yaml +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/examples/petstore/openapi.yaml +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/release-please-config.json +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/scripts/extract_openapi_subset.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/scripts/verify_dist.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/__main__.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/commands/__init__.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/commands/derive.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/commands/model.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/core/__init__.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/core/diagnostics.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/core/naming.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/model/__init__.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/model/api.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/model/authspec.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/model/migrations.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/model/rewrite.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/model/serialize.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/model/types.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/model/validate.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/model/values.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/pipeline/__init__.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/pipeline/cli.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/pipeline/config.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/pipeline/defaults.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/pipeline/pipeline.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/pipeline/writer.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/plugins/__init__.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/plugins/external.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/plugins/protocol.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/plugins/registry.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/py.typed +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/abstractions.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/arguments.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/auth.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/cli_auth.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/codec.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/credentials.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/middleware.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/oauth.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/protocols/__init__.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/protocols/base.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/protocols/graphql.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/runtime/protocols/http.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/shaping/__init__.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/shaping/base.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/shaping/engine.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/shaping/transforms.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/sources/__init__.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/sources/base.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/sources/graphql/__init__.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/sources/graphql/translator.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/sources/loader.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/sources/openapi/__init__.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/sources/openapi/translator.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/surface/__init__.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/surface/derive.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/surface/model.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/targets/__init__.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/targets/python/__init__.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/targets/python/cli.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/targets/python/e2e.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/targets/python/library.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/targets/python/naming.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/targets/typescript/__init__.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/targets/typescript/library.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/src/codapact/targets/typescript/runtime.ts +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/authlab.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/conftest.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/e2e/test_auth_e2e.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/e2e/test_cli_e2e.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/e2e/test_public_apis.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/authlab/authlab_plugin.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/authlab/codapact.yaml +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/authlab/fake_browser.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/authlab/openapi.yaml +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/authlab_smoke.ts +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/contracts/wire.yaml +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/corpus/README.md +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/corpus/countries/codapact.yaml +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/corpus/countries/operations.graphql +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/corpus/countries/schema.graphql +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/corpus/github/codapact.yaml +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/corpus/github/openapi.json +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/corpus/pokeapi/codapact.yaml +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/corpus/pokeapi/openapi.yml +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/corpus/ynab/README.md +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/corpus/ynab/codapact.yaml +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/corpus/ynab/openapi.yaml +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/library_smoke.ts +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/outline_plugin.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/petstore_smoke.ts +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/fixtures/wire_parity.ts +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/integration/test_cli_conformance.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/integration/test_cli_conventions.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/integration/test_contract_properties.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/integration/test_corpus.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/integration/test_generated_code_properties.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/integration/test_generation.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/integration/test_public_api_cli.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/integration/test_wire_parity.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/integration/test_ynab_contract.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/perf/test_scaling.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/public_api_contract.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/strategies.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/support.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_architecture.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_auth_and_graphql_sources.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_auth_sources.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_bundle_e2e.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_cli_builtins.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_codec_serialize.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_core.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_guards.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_model.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_oauth.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_openapi_edges.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_openapi_translator_units.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_plugins_pipeline.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_runtime.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_runtime_edges.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_runtime_pagination.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_shaping_surface_commands.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_sources.py +0 -0
- {codapact-0.5.0 → codapact-0.5.2}/tests/unit/test_target_rendering.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
name: Mutation
|
|
2
2
|
# Mutation testing measures whether the tests notice behavior changes. It is slow
|
|
3
|
-
# (~
|
|
3
|
+
# (~18k mutants), so it runs in parallel shards after merges to main, weekly, and on
|
|
4
4
|
# demand; it never gates a PR. Each shard must finish and meet the score floor.
|
|
5
5
|
on:
|
|
6
6
|
push:
|
|
@@ -25,9 +25,17 @@ jobs:
|
|
|
25
25
|
- {name: openapi, patterns: 'codapact.sources.openapi.*'}
|
|
26
26
|
- {name: sources, patterns: 'codapact.sources.graphql.* codapact.sources.loader.* codapact.sources.base.*'}
|
|
27
27
|
- {name: targets, patterns: 'codapact.targets.*'}
|
|
28
|
-
# runtime is split
|
|
29
|
-
#
|
|
30
|
-
|
|
28
|
+
# runtime is split seven ways: as one shard it outgrew the 65-minute cap, and
|
|
29
|
+
# the CLI modules (~3.8k slow mutants) did too, cli.py alone included. cli.py is
|
|
30
|
+
# split by mutant name: module functions and small classes, CliRuntime's private
|
|
31
|
+
# methods, and its public ones.
|
|
32
|
+
# A new codapact.runtime module, or a cli.py class starting with C, must be added
|
|
33
|
+
# to one of these patterns.
|
|
34
|
+
- {name: runtime-cli, patterns: 'codapact.runtime.cli.x_* codapact.runtime.cli.xǁ[!C]* codapact.runtime.cli.xǁCliParserǁ*'}
|
|
35
|
+
- {name: runtime-cli-run, patterns: 'codapact.runtime.cli.xǁCliRuntimeǁ_*'}
|
|
36
|
+
- {name: runtime-cli-runtime, patterns: 'codapact.runtime.cli.xǁCliRuntimeǁ[!_]*'}
|
|
37
|
+
- {name: runtime-cli-auth, patterns: 'codapact.runtime.cli_auth.*'}
|
|
38
|
+
- {name: runtime-cli-tools, patterns: 'codapact.runtime.cli_tools.*'}
|
|
31
39
|
- {name: runtime-auth, patterns: 'codapact.runtime.oauth.* codapact.runtime.auth.* codapact.runtime.credentials.*'}
|
|
32
40
|
- {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
41
|
- {name: pipeline, patterns: 'codapact.pipeline.* codapact.plugins.* codapact.commands.*'}
|
|
@@ -59,8 +67,9 @@ jobs:
|
|
|
59
67
|
PATTERNS: ${{ matrix.shard.patterns }}
|
|
60
68
|
run: |
|
|
61
69
|
test "$run_exit" = 0 || { echo "mutmut did not finish (exit $run_exit)"; exit 1; }
|
|
70
|
+
read -ra patterns <<< "$PATTERNS"
|
|
62
71
|
args=()
|
|
63
|
-
for pattern in $
|
|
72
|
+
for pattern in "${patterns[@]}"; do args+=(--pattern "$pattern"); done
|
|
64
73
|
uv run python scripts/mutation_score.py --results mutation-report/results.txt "${args[@]}"
|
|
65
74
|
- if: always()
|
|
66
75
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{".":"0.5.2"}
|
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- markdownlint-configure-file { "MD024": { "siblings_only": true } } -->
|
|
4
4
|
|
|
5
|
+
## [0.5.2](https://github.com/mikejhill/codapact/compare/v0.5.1...v0.5.2) (2026-11-14)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **cli:** fail when --query matches nothing ([#39](https://github.com/mikejhill/codapact/issues/39)) ([08bd3aa](https://github.com/mikejhill/codapact/commit/08bd3aa5a3e45192461633c084feb7d9438cb193))
|
|
11
|
+
|
|
12
|
+
## [0.5.1](https://github.com/mikejhill/codapact/compare/v0.5.0...v0.5.1) (2026-11-14)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **cli:** configurable response limit, UTF-8 pipes, jsonl records ([#37](https://github.com/mikejhill/codapact/issues/37)) ([f8a3b72](https://github.com/mikejhill/codapact/commit/f8a3b72ac2d95f2d873cfa65db2104a4750b029a))
|
|
18
|
+
|
|
5
19
|
## [0.5.0](https://github.com/mikejhill/codapact/compare/v0.4.0...v0.5.0) (2026-11-12)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -104,6 +104,7 @@ Precedence: flag, then environment, then settings file.
|
|
|
104
104
|
| Timeout | `--timeout` | `<PREFIX>_TIMEOUT` | `timeout` |
|
|
105
105
|
| Private network | `--allow-private` | `<PREFIX>_ALLOW_PRIVATE` | `allow_private` |
|
|
106
106
|
| Response validation | `--response-validation strict\|warn\|off` | `<PREFIX>_RESPONSE_VALIDATION` | `response_validation` |
|
|
107
|
+
| Response size limit | none | `<PREFIX>_MAX_RESPONSE_BYTES` | `max_response_bytes` (default 100 MB) |
|
|
107
108
|
| Output format | `-o`/`--output json\|jsonl\|yaml\|table\|raw` | `<PREFIX>_OUTPUT` | `output` |
|
|
108
109
|
| Error format | `--error-format text\|json` | `<PREFIX>_ERROR_FORMAT` | `error_format` |
|
|
109
110
|
| Credentials | none | `<PREFIX>_<SCHEME>`; basic uses `_USERNAME`/`_PASSWORD`; full chain under [Authentication](#authentication) | `auth_plugin`; secrets are never read from the file |
|
|
@@ -115,11 +116,12 @@ credential variables for the contract's auth schemes.
|
|
|
115
116
|
|
|
116
117
|
Global options work before or after the command: `--base-url`, `--timeout`, `--config`,
|
|
117
118
|
`-o/--output`, `--query PATH` (`data.items[].name`, `data.items[0]`; with `--all` the
|
|
118
|
-
result is the item list, so `[].name
|
|
119
|
+
result is the item list, so `[].name`; a path that matches nothing fails with exit 2 and lists the keys that exist), `--dry-run`, `-v/--verbose`, `--error-format`,
|
|
119
120
|
`--allow-private`, and `--response-validation`. Command help lists them in one line;
|
|
120
121
|
`<program> --help` describes each.
|
|
121
122
|
`table` renders a list of objects, unwrapping single-list envelopes such as `{"data": {"items": [...]}}`.
|
|
122
|
-
`jsonl` prints one JSON value per line
|
|
123
|
+
`jsonl` prints one JSON value per line, unwrapping the same envelopes as `table`, and streams
|
|
124
|
+
`--all` results page by page. Output to a pipe or file is UTF-8 on every platform.
|
|
123
125
|
|
|
124
126
|
### Conventions every generated CLI follows
|
|
125
127
|
|
|
@@ -28,7 +28,7 @@ make sure they keep running.
|
|
|
28
28
|
| Auth | `e2e/test_auth_e2e.py` | Generated CLIs, bundle suites, and TypeScript clients authenticate against AuthLab (`tests/authlab.py`), a loopback server that answers 401 unless the scheme is satisfied: API keys (header, query, cookie), basic, bearer, OAuth 2.0 client credentials, device code, authorization code + PKCE, refresh, and an HMAC-signing plugin | every PR |
|
|
29
29
|
| Live | marker `live`, `CODAPACT_LIVE=1` | PokeAPI and Countries GraphQL respond as the generated CLI expects; the GitHub corpus bundle runs its own live suite with `GITHUB_TOKEN` (authenticated quota, invalid token rejected) | nightly |
|
|
30
30
|
| Performance | `tests/perf`, `perf` | Translation, generation, and decoding scale linearly; throughput floors | every PR |
|
|
31
|
-
| Mutation | `mutmut`,
|
|
31
|
+
| Mutation | `mutmut`, 12 parallel shards | Tests notice behavior changes in `src/codapact` | after merge to main, weekly |
|
|
32
32
|
|
|
33
33
|
Suite markers come from the directory (`tests/conftest.py`); a new file needs no marker.
|
|
34
34
|
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
Usage::
|
|
4
4
|
|
|
5
5
|
mutmut results --all true > results.txt
|
|
6
|
-
python scripts/mutation_score.py --results results.txt [--
|
|
6
|
+
python scripts/mutation_score.py --results results.txt [--pattern 'codapact.runtime.*']
|
|
7
7
|
|
|
8
8
|
The score is killed / (killed + survived + timeout + suspicious + no tests). Within
|
|
9
|
-
``--
|
|
9
|
+
``--pattern`` (one CI shard, matched like ``mutmut run`` arguments) or ``--prefix``,
|
|
10
|
+
mutants left unchecked make the result incomplete,
|
|
10
11
|
which fails too: a run that did not finish is not evidence of a good suite. Writes
|
|
11
12
|
a Markdown summary to ``$GITHUB_STEP_SUMMARY`` when set.
|
|
12
13
|
"""
|
|
@@ -14,6 +15,7 @@ a Markdown summary to ``$GITHUB_STEP_SUMMARY`` when set.
|
|
|
14
15
|
from __future__ import annotations
|
|
15
16
|
|
|
16
17
|
import argparse
|
|
18
|
+
import fnmatch
|
|
17
19
|
import os
|
|
18
20
|
import sys
|
|
19
21
|
from pathlib import Path
|
|
@@ -21,12 +23,20 @@ from pathlib import Path
|
|
|
21
23
|
DEFAULT_FLOOR = 80.0
|
|
22
24
|
|
|
23
25
|
|
|
24
|
-
def count(
|
|
25
|
-
|
|
26
|
+
def count(
|
|
27
|
+
results: str, prefix: str | tuple[str, ...] = "", patterns: tuple[str, ...] = ()
|
|
28
|
+
) -> dict[str, int]:
|
|
29
|
+
"""Tally ``mutmut results --all true`` lines (``name: status``) under ``prefix``.
|
|
30
|
+
|
|
31
|
+
``patterns``, when given, also keeps only names matching one of them (fnmatch,
|
|
32
|
+
as ``mutmut run`` selects mutants).
|
|
33
|
+
"""
|
|
26
34
|
stats: dict[str, int] = {}
|
|
27
35
|
for line in results.splitlines():
|
|
28
36
|
name, sep, status = line.strip().rpartition(": ")
|
|
29
|
-
if sep and name.startswith(prefix):
|
|
37
|
+
if not (sep and name.startswith(prefix)):
|
|
38
|
+
continue
|
|
39
|
+
if not patterns or any(fnmatch.fnmatch(name, pattern) for pattern in patterns):
|
|
30
40
|
key = status.strip().replace(" ", "_")
|
|
31
41
|
stats[key] = stats.get(key, 0) + 1
|
|
32
42
|
return stats
|
|
@@ -63,12 +73,20 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
63
73
|
parser.add_argument(
|
|
64
74
|
"--prefix", action="append", default=[], help="only mutants under this name (repeatable)"
|
|
65
75
|
)
|
|
76
|
+
parser.add_argument(
|
|
77
|
+
"--pattern",
|
|
78
|
+
action="append",
|
|
79
|
+
default=[],
|
|
80
|
+
help="only mutants matching this mutmut name pattern (repeatable)",
|
|
81
|
+
)
|
|
66
82
|
parser.add_argument(
|
|
67
83
|
"--floor", type=float, default=float(os.environ.get("MUTATION_FLOOR", DEFAULT_FLOOR))
|
|
68
84
|
)
|
|
69
85
|
args = parser.parse_args(argv)
|
|
70
86
|
try:
|
|
71
|
-
stats = count(
|
|
87
|
+
stats = count(
|
|
88
|
+
args.results.read_text("utf-8"), tuple(args.prefix) or "", tuple(args.pattern)
|
|
89
|
+
)
|
|
72
90
|
except OSError as error:
|
|
73
91
|
print(f"cannot read mutation results: {error}", file=sys.stderr)
|
|
74
92
|
return 1
|
|
@@ -77,7 +95,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
77
95
|
target = os.environ.get("GITHUB_STEP_SUMMARY")
|
|
78
96
|
if target:
|
|
79
97
|
with Path(target).open("a", encoding="utf-8") as handle:
|
|
80
|
-
title = f"Mutation score: {', '.join(args.prefix) or 'codapact'}"
|
|
98
|
+
title = f"Mutation score: {', '.join(args.pattern + args.prefix) or 'codapact'}"
|
|
81
99
|
handle.write(f"## {title}\n\n{summary}\n")
|
|
82
100
|
return 0 if passed else 1
|
|
83
101
|
|
|
@@ -41,6 +41,15 @@ class TransportError(CodapactError):
|
|
|
41
41
|
"""A request could not be sent or the response was rejected before decoding."""
|
|
42
42
|
|
|
43
43
|
|
|
44
|
+
class ResponseTooLargeError(TransportError):
|
|
45
|
+
"""The response body is larger than the client's ``max_bytes`` limit."""
|
|
46
|
+
|
|
47
|
+
def __init__(self, limit: int) -> None:
|
|
48
|
+
"""Record the limit that was exceeded."""
|
|
49
|
+
super().__init__(f"response exceeds {limit} bytes")
|
|
50
|
+
self.limit = limit
|
|
51
|
+
|
|
52
|
+
|
|
44
53
|
def expect[T](value: T | None, what: str) -> T:
|
|
45
54
|
"""Return ``value`` or raise when an internal invariant is broken."""
|
|
46
55
|
if value is None:
|
|
@@ -22,7 +22,7 @@ import urllib.request
|
|
|
22
22
|
from dataclasses import dataclass, field
|
|
23
23
|
from urllib.parse import SplitResult, urlsplit
|
|
24
24
|
|
|
25
|
-
from codapact.core.errors import ConfigError, TransportError
|
|
25
|
+
from codapact.core.errors import ConfigError, ResponseTooLargeError, TransportError
|
|
26
26
|
|
|
27
27
|
DEFAULT_MAX_BYTES = 10_000_000
|
|
28
28
|
|
|
@@ -153,7 +153,7 @@ class SafeHttpClient:
|
|
|
153
153
|
finally:
|
|
154
154
|
connection.close()
|
|
155
155
|
if len(body) > self.max_bytes:
|
|
156
|
-
raise
|
|
156
|
+
raise ResponseTooLargeError(self.max_bytes)
|
|
157
157
|
if 300 <= response.status < 400:
|
|
158
158
|
raise TransportError("redirects are not followed")
|
|
159
159
|
return HttpResponse(response.status, dict(response.getheaders()), body)
|
|
@@ -28,6 +28,7 @@ from codapact.runtime.errors import (
|
|
|
28
28
|
AuthError,
|
|
29
29
|
ClientError,
|
|
30
30
|
GraphQLResponseError,
|
|
31
|
+
ResponseTooLargeError,
|
|
31
32
|
TransportError,
|
|
32
33
|
ValidationError,
|
|
33
34
|
)
|
|
@@ -64,6 +65,7 @@ __all__ = [
|
|
|
64
65
|
"HttpRequest",
|
|
65
66
|
"HttpResponse",
|
|
66
67
|
"Middleware",
|
|
68
|
+
"ResponseTooLargeError",
|
|
67
69
|
"Retry",
|
|
68
70
|
"RuntimeClient",
|
|
69
71
|
"StaticAuth",
|
|
@@ -26,12 +26,13 @@ from urllib.parse import quote, quote_plus
|
|
|
26
26
|
import yaml
|
|
27
27
|
|
|
28
28
|
from codapact import __version__
|
|
29
|
-
from codapact.core.errors import CodapactError, TransportError
|
|
29
|
+
from codapact.core.errors import CodapactError, ResponseTooLargeError, TransportError
|
|
30
30
|
from codapact.core.net import HttpRequest, HttpResponse, SafeHttpClient
|
|
31
31
|
from codapact.model.api import Api, AuthKind, AuthScheme
|
|
32
32
|
from codapact.runtime import cli_auth, cli_tools
|
|
33
33
|
from codapact.runtime.abstractions import CallContext, Credential, Next, Secret
|
|
34
34
|
from codapact.runtime.auth import ChainAuth, EnvAuth, FunctionAuthenticator
|
|
35
|
+
from codapact.runtime.client import DEFAULT_MAX_RESPONSE_BYTES
|
|
35
36
|
from codapact.runtime.credentials import cli_auth as build_cli_auth
|
|
36
37
|
from codapact.runtime.errors import (
|
|
37
38
|
ApiError,
|
|
@@ -69,6 +70,7 @@ SETTINGS_KEYS = frozenset(
|
|
|
69
70
|
"base_url",
|
|
70
71
|
"timeout",
|
|
71
72
|
"allow_private",
|
|
73
|
+
"max_response_bytes",
|
|
72
74
|
"response_validation",
|
|
73
75
|
"output",
|
|
74
76
|
"error_format",
|
|
@@ -101,6 +103,32 @@ def json_value(text: str) -> Any:
|
|
|
101
103
|
raise argparse.ArgumentTypeError("expected JSON or @file") from None
|
|
102
104
|
|
|
103
105
|
|
|
106
|
+
def _utf8(stream: TextIO) -> TextIO:
|
|
107
|
+
"""Write UTF-8 to pipes and files, whatever the locale (cp1252 on Windows).
|
|
108
|
+
|
|
109
|
+
Consoles keep their own encoding; JSON output with non-ASCII text must not depend
|
|
110
|
+
on the code page of whoever redirects it.
|
|
111
|
+
"""
|
|
112
|
+
encoding = (getattr(stream, "encoding", None) or "").lower().replace("-", "")
|
|
113
|
+
reconfigure = getattr(stream, "reconfigure", None)
|
|
114
|
+
if encoding != "utf8" and reconfigure is not None and not stream.isatty():
|
|
115
|
+
reconfigure(encoding="utf-8", errors="backslashreplace")
|
|
116
|
+
return stream
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def _positive_int(value: Any, name: str) -> int:
|
|
120
|
+
"""Parse a byte limit from a flag, environment variable, or settings file."""
|
|
121
|
+
if value is None or value == "":
|
|
122
|
+
return DEFAULT_MAX_RESPONSE_BYTES
|
|
123
|
+
try:
|
|
124
|
+
number = int(value)
|
|
125
|
+
except (TypeError, ValueError):
|
|
126
|
+
raise CodapactError(f"{name} must be a whole number of bytes, not {value!r}") from None
|
|
127
|
+
if number <= 0 or isinstance(value, bool):
|
|
128
|
+
raise CodapactError(f"{name} must be a positive number of bytes")
|
|
129
|
+
return number
|
|
130
|
+
|
|
131
|
+
|
|
104
132
|
def integer(text: str) -> int:
|
|
105
133
|
"""Parse an integer argument."""
|
|
106
134
|
try:
|
|
@@ -546,6 +574,10 @@ class CliRuntime:
|
|
|
546
574
|
)
|
|
547
575
|
if allow_private in (True, "1", "true", "yes"):
|
|
548
576
|
options["allow_private"] = True
|
|
577
|
+
limit, sources["max_response_bytes"] = self._setting(
|
|
578
|
+
args, file_settings, "max_response_bytes"
|
|
579
|
+
)
|
|
580
|
+
options["max_response_bytes"] = _positive_int(limit, "max_response_bytes")
|
|
549
581
|
mode, sources["response_validation"] = self._setting(
|
|
550
582
|
args, file_settings, "response_validation"
|
|
551
583
|
)
|
|
@@ -755,8 +787,8 @@ class CliRuntime:
|
|
|
755
787
|
) -> int:
|
|
756
788
|
"""Parse ``argv`` and run one generated or built-in command; return the exit code."""
|
|
757
789
|
words = list(sys.argv[1:] if argv is None else argv)
|
|
758
|
-
out = stdout or sys.stdout
|
|
759
|
-
err = stderr or sys.stderr
|
|
790
|
+
out = stdout or _utf8(sys.stdout)
|
|
791
|
+
err = stderr or _utf8(sys.stderr)
|
|
760
792
|
token = _error_format.set(self._error_mode(self._pre_scan(words).error_format))
|
|
761
793
|
try:
|
|
762
794
|
parser = build_parser()
|
|
@@ -902,6 +934,13 @@ class CliRuntime:
|
|
|
902
934
|
|
|
903
935
|
def _client_options(self, args: argparse.Namespace, err: TextIO) -> dict[str, Any]:
|
|
904
936
|
options = self.settings(args)
|
|
937
|
+
# The CLI builds the transport so the response cap also applies to clients
|
|
938
|
+
# generated before ``max_response_bytes`` existed.
|
|
939
|
+
options["transport"] = SafeHttpClient(
|
|
940
|
+
allow_private=bool(options.get("allow_private")),
|
|
941
|
+
timeout=float(options.get("timeout") or 30.0),
|
|
942
|
+
max_bytes=options.pop("max_response_bytes"),
|
|
943
|
+
)
|
|
905
944
|
if getattr(args, "dry_run", False):
|
|
906
945
|
options["transport"] = DryRunTransport()
|
|
907
946
|
options["auth"] = PlaceholderAuth(
|
|
@@ -999,7 +1038,7 @@ class CliRuntime:
|
|
|
999
1038
|
if streamed:
|
|
1000
1039
|
return EXIT_OK
|
|
1001
1040
|
if query:
|
|
1002
|
-
result = select(result, query)
|
|
1041
|
+
result = select(result, query, strict=True)
|
|
1003
1042
|
elif fields:
|
|
1004
1043
|
result = _pick_target(result, fields)
|
|
1005
1044
|
result = pick(result, fields)
|
|
@@ -1021,6 +1060,12 @@ class CliRuntime:
|
|
|
1021
1060
|
args.placeholders = True # show where the missing credential would go
|
|
1022
1061
|
return self._run(args, make_client, handler, stdout, stderr)
|
|
1023
1062
|
return emit_error(p, "auth", str(error), EXIT_AUTH, err, hint=f"run {p} doctor")
|
|
1063
|
+
except ResponseTooLargeError as error:
|
|
1064
|
+
hint = (
|
|
1065
|
+
f"raise the limit with {self.env_prefix}_MAX_RESPONSE_BYTES or "
|
|
1066
|
+
"max_response_bytes in the settings file"
|
|
1067
|
+
)
|
|
1068
|
+
return emit_error(p, "transport", str(error), EXIT_TRANSPORT, err, hint=hint)
|
|
1024
1069
|
except TransportError as error:
|
|
1025
1070
|
hint = f"run {p} doctor to check the base URL, proxy, and connectivity"
|
|
1026
1071
|
return emit_error(p, "transport", str(error), EXIT_TRANSPORT, err, hint=hint)
|
|
@@ -1199,36 +1244,65 @@ def describe_invalid(error: ValidationError, flags: dict[str, str]) -> str:
|
|
|
1199
1244
|
|
|
1200
1245
|
|
|
1201
1246
|
_STEP = re.compile(r"(?P<key>[^.\[\]]*)(?P<index>\[(?:-?\d+)?\])?")
|
|
1247
|
+
_QUERY_SYNTAX = "--query takes a dotted path: a.b, a[0], a[-1], a[] (not JMESPath)"
|
|
1248
|
+
_MISSING = object()
|
|
1202
1249
|
|
|
1203
1250
|
|
|
1204
|
-
def select(value: Any, query: str) -> Any:
|
|
1251
|
+
def select(value: Any, query: str, *, strict: bool = False) -> Any:
|
|
1205
1252
|
"""Return the part of ``value`` at a dotted path.
|
|
1206
1253
|
|
|
1207
1254
|
``a.b`` reads keys, ``a[0]`` / ``a[-1]`` index a list, and ``a[]`` maps the
|
|
1208
|
-
rest of the path over every element (the result is then a list).
|
|
1255
|
+
rest of the path over every element (the result is then a list). A part that
|
|
1256
|
+
is absent reads as ``None``; with ``strict``, a path that matches nothing at
|
|
1257
|
+
all raises instead, naming the step that failed.
|
|
1209
1258
|
"""
|
|
1210
1259
|
current: list[Any] = [value]
|
|
1211
1260
|
spread = False
|
|
1212
|
-
|
|
1261
|
+
miss: tuple[str, Any] | None = None # first step that found nothing, and what it looked in
|
|
1262
|
+
for number, raw in enumerate(query.split(".")):
|
|
1213
1263
|
step = _STEP.fullmatch(raw)
|
|
1214
1264
|
if step is None:
|
|
1215
|
-
raise CodapactError(f"invalid --query step {raw!r}")
|
|
1265
|
+
raise CodapactError(f"invalid --query step {raw!r}; {_QUERY_SYNTAX}")
|
|
1216
1266
|
key, index = step.group("key"), step.group("index")
|
|
1217
1267
|
nxt: list[Any] = []
|
|
1218
1268
|
for item in current:
|
|
1219
|
-
|
|
1220
|
-
|
|
1269
|
+
parent = item
|
|
1270
|
+
if key and item is not _MISSING:
|
|
1271
|
+
item = item.get(key, _MISSING) if isinstance(item, dict) else _MISSING
|
|
1272
|
+
parent = parent if item is _MISSING else item
|
|
1221
1273
|
if index == "[]":
|
|
1222
|
-
|
|
1223
|
-
|
|
1274
|
+
if isinstance(item, list):
|
|
1275
|
+
nxt.extend(item)
|
|
1276
|
+
continue
|
|
1277
|
+
item = _MISSING
|
|
1278
|
+
elif index and item is not _MISSING:
|
|
1224
1279
|
position = int(index[1:-1])
|
|
1225
1280
|
ok = isinstance(item, list) and -len(item) <= position < len(item)
|
|
1226
|
-
|
|
1227
|
-
|
|
1281
|
+
item = item[position] if ok else _MISSING
|
|
1282
|
+
if item is _MISSING and parent is not _MISSING and miss is None:
|
|
1283
|
+
miss = (".".join(query.split(".")[: number + 1]), parent)
|
|
1284
|
+
if item is not _MISSING or index != "[]":
|
|
1228
1285
|
nxt.append(item)
|
|
1229
1286
|
current = nxt
|
|
1230
1287
|
spread = spread or index == "[]"
|
|
1231
|
-
|
|
1288
|
+
if strict and miss is not None and all(item is _MISSING for item in current):
|
|
1289
|
+
raise CodapactError(_no_match(query, *miss))
|
|
1290
|
+
found = [None if item is _MISSING else item for item in current]
|
|
1291
|
+
return found if spread else found[0]
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
def _no_match(query: str, path: str, parent: Any) -> str:
|
|
1295
|
+
"""Explain a ``--query`` that matched nothing."""
|
|
1296
|
+
message = f"--query {query!r} matched nothing at {path!r}"
|
|
1297
|
+
if isinstance(parent, dict) and parent:
|
|
1298
|
+
keys = list(parent)
|
|
1299
|
+
more = f", ... ({len(keys)} keys)" if len(keys) > 12 else ""
|
|
1300
|
+
message += f"; available keys: {', '.join(map(str, keys[:12]))}{more}"
|
|
1301
|
+
elif isinstance(parent, list):
|
|
1302
|
+
message += f"; that is a list of {len(parent)}, index it with [N] or []"
|
|
1303
|
+
if re.search(r"[()@|*?=!&\s'\"`]", query):
|
|
1304
|
+
message += f"; {_QUERY_SYNTAX}"
|
|
1305
|
+
return message
|
|
1232
1306
|
|
|
1233
1307
|
|
|
1234
1308
|
def render(value: Any, fmt: str, out: TextIO) -> None:
|
|
@@ -1245,7 +1319,7 @@ def render(value: Any, fmt: str, out: TextIO) -> None:
|
|
|
1245
1319
|
if isinstance(value, bytes):
|
|
1246
1320
|
value = value.decode("utf-8", errors="replace")
|
|
1247
1321
|
if fmt == "jsonl":
|
|
1248
|
-
items = value if isinstance(value, list) else [value]
|
|
1322
|
+
items = value if isinstance(value, list) else (_rows(value) or [value])
|
|
1249
1323
|
for item in items:
|
|
1250
1324
|
out.write(json.dumps(item, ensure_ascii=False, default=str) + "\n")
|
|
1251
1325
|
return
|
|
@@ -503,6 +503,10 @@ class Doctor:
|
|
|
503
503
|
mode = options.get("response_validation", "warn")
|
|
504
504
|
source = sources.get("response_validation", "default")
|
|
505
505
|
checks.append(Check("response validation", "info", f"{mode} (from {source})"))
|
|
506
|
+
limit = options.get("max_response_bytes")
|
|
507
|
+
if limit:
|
|
508
|
+
source = sources.get("max_response_bytes", "default")
|
|
509
|
+
checks.append(Check("response limit", "info", f"{limit} bytes (from {source})"))
|
|
506
510
|
if offline:
|
|
507
511
|
checks.append(Check("connectivity", "skip", "skipped (--offline)"))
|
|
508
512
|
elif base_ok:
|
|
@@ -28,6 +28,8 @@ from codapact.runtime.protocols.http import HttpAdapter
|
|
|
28
28
|
AdapterFactory = Callable[[Exchange], ProtocolAdapter]
|
|
29
29
|
DEFAULT_ADAPTERS: tuple[AdapterFactory, ...] = (HttpAdapter, GraphQLAdapter)
|
|
30
30
|
MAX_PAGES = 10_000
|
|
31
|
+
DEFAULT_MAX_RESPONSE_BYTES = 100_000_000
|
|
32
|
+
"""Largest response body the default transport accepts (100 MB)."""
|
|
31
33
|
|
|
32
34
|
|
|
33
35
|
def load_model(resource: Traversable) -> Api:
|
|
@@ -53,12 +55,14 @@ class RuntimeClient:
|
|
|
53
55
|
user_agent: str | None = None,
|
|
54
56
|
response_validation: str = "strict",
|
|
55
57
|
proxy: str | None = None,
|
|
58
|
+
max_response_bytes: int = DEFAULT_MAX_RESPONSE_BYTES,
|
|
56
59
|
) -> None:
|
|
57
60
|
"""Configure the client; ``base_url`` defaults to the model's first server.
|
|
58
61
|
|
|
59
62
|
``response_validation`` is ``strict`` (mismatching responses raise
|
|
60
63
|
``ResponseValidationError``), ``warn`` (emit ``ResponseValidationWarning`` and
|
|
61
64
|
return the data), or ``off``. ``proxy`` overrides the ``HTTPS_PROXY`` environment.
|
|
65
|
+
``max_response_bytes`` caps each response body of the default transport.
|
|
62
66
|
"""
|
|
63
67
|
if response_validation not in RESPONSE_VALIDATION_MODES:
|
|
64
68
|
raise ConfigError(
|
|
@@ -78,7 +82,12 @@ class RuntimeClient:
|
|
|
78
82
|
codec=self._codec,
|
|
79
83
|
base_url=self.base_url,
|
|
80
84
|
transport=transport
|
|
81
|
-
or SafeHttpClient(
|
|
85
|
+
or SafeHttpClient(
|
|
86
|
+
allow_private=allow_private,
|
|
87
|
+
timeout=timeout,
|
|
88
|
+
proxy=proxy,
|
|
89
|
+
max_bytes=max_response_bytes,
|
|
90
|
+
),
|
|
82
91
|
auth=auth,
|
|
83
92
|
middleware=tuple(middleware) if middleware is not None else (Retry(),),
|
|
84
93
|
validate=validate,
|
|
@@ -4,13 +4,14 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
from typing import Any
|
|
6
6
|
|
|
7
|
-
from codapact.core.errors import CodapactError, TransportError
|
|
7
|
+
from codapact.core.errors import CodapactError, ResponseTooLargeError, TransportError
|
|
8
8
|
|
|
9
9
|
__all__ = [
|
|
10
10
|
"ApiError",
|
|
11
11
|
"AuthError",
|
|
12
12
|
"ClientError",
|
|
13
13
|
"GraphQLResponseError",
|
|
14
|
+
"ResponseTooLargeError",
|
|
14
15
|
"ResponseValidationError",
|
|
15
16
|
"ResponseValidationWarning",
|
|
16
17
|
"TransportError",
|
|
@@ -151,11 +151,13 @@ class Suite:
|
|
|
151
151
|
input=stdin,
|
|
152
152
|
capture_output=True,
|
|
153
153
|
text=True,
|
|
154
|
+
encoding="utf-8", # generated CLIs write UTF-8 to pipes on every platform
|
|
155
|
+
errors="replace",
|
|
154
156
|
timeout=TIMEOUT,
|
|
155
157
|
check=False,
|
|
156
158
|
)
|
|
157
159
|
shown = (str(self.data["program"]), *argv)
|
|
158
|
-
return Result(shown, completed.returncode, completed.stdout, completed.stderr)
|
|
160
|
+
return Result(shown, completed.returncode, completed.stdout or "", completed.stderr or "")
|
|
159
161
|
|
|
160
162
|
def credential_variables(self) -> list[str]:
|
|
161
163
|
"""Every environment variable that can carry a credential for this CLI."""
|