Skip to content

chore: regenerate api-client, fix local docker stack, re-record cassettes#1507

Open
tychtjan wants to merge 10 commits intomasterfrom
regen-test
Open

chore: regenerate api-client, fix local docker stack, re-record cassettes#1507
tychtjan wants to merge 10 commits intomasterfrom
regen-test

Conversation

@tychtjan
Copy link
Copy Markdown
Contributor

@tychtjan tychtjan commented Mar 31, 2026

Summary

Brings the SDK in sync with latest staging: regenerated api-client, added a new feature field, fixed the local docker-compose stack, fixed data source credential handling, and re-recorded all VCR cassettes.

1. Remove accidental Pydantic v2 model files

Cleans up Pydantic v2 model files that were accidentally committed and don't belong in the codebase.

2. Regenerate api-client from latest staging OpenAPI spec

Re-generates gooddata-api-client from the latest staging OpenAPI spec, picking up new endpoints and schema changes.

3. Add parameters field to CatalogDeclarativeAnalyticsLayer

Exposes the new parameters field from the API in the high-level SDK model.

4. Fix docker-compose api-gw cache duration format

The latest api-gw ECR image switched to Kotlin duration parsing — bare numbers like 60 are no longer accepted. Changed CACHE_EXPIRE_AFTER_WRITE and USER_CACHE_EXPIRE_AFTER_WRITE from 60 to 1m (matching gdc-nas). Without this fix, api-gw crashes on startup with Invalid duration string format: '60'.

5. Persist DS password after layout upload + fix local credential patching

Two issues fixed:

  • Layout PUT doesn't persist passwords: upload_demo_layout.py uploads data sources via PUT /api/v1/layout/dataSources, but the layout API does not persist the password. Added an entities PATCH call after the layout PUT to explicitly set passwords. Without this, calcique cannot connect to PostgreSQL and all execution/scan/export tests fail with 400: Incorrect credentials.
  • Local credential patching: The _patch_ds_credentials conftest fixture only activated when DS_PASSWORD env var was set (staging). For local tests, the credentials file placeholder secret was never replaced with the actual password passw0rd. Changed the fixture to fall back to test_config["ds_password"] when the env var is absent.

6. Re-record VCR cassettes against latest staging

All VCR cassettes re-recorded against latest staging with the regenerated api-client. This is the source of truth for test fixtures going forward.

Test plan

  • Local docker-compose stack starts successfully (api-gw no longer crashes)
  • OVERWRITE=1 make test TEST_ENVS=py314 passes all 364 tests against local stack
  • make test-staging passes all 364 tests against staging
  • Switching between local and staging environments works correctly

JIRA: TRIVIAL
risk: low

The models/ (plural) directory contained ~1145 Pydantic v2 model files
accidentally committed during an openapi-generator v7.0 test. These are
dead code — all SDK imports go through models/__init__.py which
re-exports from model/ (singular, the actual generated client).

risk: low
Download OpenAPI schemas from staging DEX and regenerate the
gooddata-api-client. Adds new fields including `parameters` on
DeclarativeAnalyticsLayer and `isNullable` on LDM entities.

risk: low
The staging API now returns a `parameters` field on
DeclarativeAnalyticsLayer. Without this field on the SDK wrapper class,
it was silently dropped during the round-trip conversion, causing test
assertion failures.

risk: low
@tychtjan tychtjan force-pushed the regen-test branch 3 times, most recently from a4ad747 to e81ff59 Compare April 1, 2026 08:47
tychtjan added 3 commits April 1, 2026 10:50
Latest api-gw image expects Kotlin duration strings (e.g. "1m")
instead of bare numbers for CACHE_EXPIRE_AFTER_WRITE.
Layout PUT API does not persist data source passwords. Add entities
PATCH in upload_demo_layout.py to set the password explicitly.

Make _patch_ds_credentials conftest fixture use ds_password from test
config as fallback when DS_PASSWORD env var is not set.
Update load YAML files, expected JSON files, and refresh data to match
the current staging API which now returns isNullable on LDM entities
and parameters on DeclarativeAnalyticsLayer.

risk: low
@tychtjan tychtjan changed the title chore: regenerate api-client and update test fixtures for latest staging API chore: regenerate api-client, fix local docker stack, re-record cassettes Apr 1, 2026
Add configure_normalization() to vcrpy_utils that rewrites environment-specific
values (host, org_id, org_name, hostname) to canonical local equivalents during
cassette recording. This ensures cassettes recorded from staging or local
docker-compose produce identical files.

Regenerate all cassettes from local to establish clean canonical baseline.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
risk: low
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.33%. Comparing base (35605f6) to head (0c4a5b3).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1507   +/-   ##
=======================================
  Coverage   77.32%   77.33%           
=======================================
  Files         227      227           
  Lines       14768    14770    +2     
=======================================
+ Hits        11420    11422    +2     
  Misses       3348     3348           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

tychtjan and others added 3 commits April 1, 2026 13:30
Re-record all gooddata-sdk test fixtures from staging environment.
Cassettes are now normalized to canonical localhost values by the
new configure_normalization() in vcrpy_utils.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
risk: low
VCR passes response body as bytes, not str. The isinstance(body_string, str)
check silently skipped normalization, leaving staging values in cassettes.
Now handles both bytes and str body types.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
risk: low
Re-record all gooddata-sdk cassettes from staging with the bytes body
normalization fix active. Cassettes now have canonical localhost values
in both URIs and response bodies.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
risk: low
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant