Skip to content

chore: pyt contract tests for transformations auth - #7239

Merged
fracasula merged 8 commits into
masterfrom
pyt-contract-tests
Aug 4, 2026
Merged

fracasula merged 8 commits into
masterfrom
pyt-contract-tests

Conversation

@fracasula

@fracasula fracasula commented Jul 31, 2026 •

Copy link
Copy Markdown
Collaborator

Description

See this PR.

Contract tests for how rudder-pytransformer talks to the config backend: hosted-secret
authentication and redirect responses. Tests only — no production code changes in this repo.

Both behaviours matter to rudder-server specifically because they decide whether a config backend misconfiguration is retryable or terminal. rudder-server aborts any per-event status that is not 200/298, so a terminal answer here means every event for every Python transformation is destroyed with nothing to replay from.

Config backend authentication — config_backend_auth_test.go

Pins both variants of pytransformer's CONFIG_BACKEND_HOSTED_SECRET:

  • Unset (today's deployments, and every self-hosted one) — the request must be unchanged from the build that didn't know about the variable. Asserted by inspecting what the config backend received: no Authorization header at all. A build sending Basic Og== (base64 of ":") would pass a "does it still work" check against a permissive backend and 401 against a strict one; only looking at the received header separates the two.
  • Set — the header is exactly Basic base64("<secret>:"), on the transformation fetch and the library fetch, and it authenticates against a backend enforcing the real check. The empty password is load-bearing: the config backend rejects any decoded token that doesn't hold
    exactly one colon.
    • Wrong secret (stale after a rotation) → 503 + X-Rudder-Should-Retry + X-Rudder-Error-Reason: config_backend_auth_failed, so events are held rather than aborted. Same for an anonymous fetch against an authenticated backend; a blocked public route (403) reports config_backend_forbidden so a bad secret and a missed repoint page differently.
  • Trailing newline in the secret is trimmed — the shape it actually arrives in when mounted from a k8s secret file.

The mock config backend is a port of rudder-config-backend, not an invention: RudderKoaBasicAuth (including the exactly-one-colon rule and the non-short-circuiting constant-time comparison), hostedSecretConfig's comma-split/trim/drop-blanks parsing with empty passwords, verifyHostedDataPlaneSecret collapsing every rejection into one 401, and blockHostedPublicAccess's 403. Provenance is listed file-by-file in the mock's doc comment.

TestConfigBackendAuthMockMatchesConfigBackend pins the port itself against cases taken from rudder-config-backend's own suites, and runs without containers — the container tests are only worth their runtime if the thing they authenticate against enforces the real rules.

Config backend redirects — redirects_test.go

pytransformer does not follow redirects, so a 3xx from a misconfigured proxy raises ConfigBackendRedirectError → 503 + retry headers.

TestConfigBackendRedirectIsRetriedNotDropped is the regression test for the data loss: it holds the config backend broken through a full rudder-server pipeline, asserts nothing is aborted, then repairs it and shows the original events come out the far end transformed. Under the previous terminal behaviour those events were gone. It also asserts the redirect target is never contacted.

Running

These need a rudder-pytransformer image; build it from that repo with make build-ecr-latest,
then:

go test -v -count 1 -race ./integration_test/pytransformer_contract -timeout=10m

Linear Ticket

< Fixes PIPE-3229 >

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

@fracasula
fracasula marked this pull request as ready for review August 3, 2026 08:45

@ktgowtham ktgowtham left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test are failing. pl check

@fracasula

Copy link
Copy Markdown
Collaborator Author

test are failing. pl check

@ktgowtham As usual they should pass once we merge the pyt PR (the one with the secret support) and then create a release. Then these tests will pull main and should pass 🤞 (they do pass locally in fact).

@codecov

codecov Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.90%. Comparing base (a6e29f2) to head (3ab4c46).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7239      +/-   ##
==========================================
+ Coverage   79.88%   79.90%   +0.01%     
==========================================
  Files         600      600              
  Lines       67013    67013              
==========================================
+ Hits        53534    53544      +10     
+ Misses      10335    10332       -3     
+ Partials     3144     3137       -7     

☔ View full report in Codecov by Harness.
📢 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.

@fracasula
fracasula merged commit ac4a859 into master Aug 4, 2026
113 of 115 checks passed
@fracasula
fracasula deleted the pyt-contract-tests branch August 4, 2026 15:00
mihir20 pushed a commit that referenced this pull request Aug 17, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.83.0-rc.1](v1.82.0...v1.83.0-rc.1)
(2026-08-17)


### Features

* add OriginalID and OriginalDestinationID to support replay event
transformations
([#7274](#7274))
([28d38e9](28d38e9))
* bingads integration tests
([#7253](#7253))
([fdb8c0a](fdb8c0a))
* **processor:** fork event processing for rsources pipelines
([#7235](#7235))
([707ea06](707ea06))


### Bug Fixes

* pyt contract tests data race
([#7247](#7247))
([9e62d0c](9e62d0c))


### Miscellaneous

* bump sqlconnect-go to v1.30.2
([#7251](#7251))
([f5d6175](f5d6175))
* **jobsdb:** multi-consumer compaction improvements
([#7248](#7248))
([b4af86c](b4af86c))
* pyt contract tests for candidate releases
([#7252](#7252))
([149e91a](149e91a))
* pyt contract tests for transformations auth
([#7239](#7239))
([ac4a859](ac4a859))
* **router:** support per-partition noOfWorkers override
([#7270](#7270))
([9d6f7cf](9d6f7cf))
* sync release v1.82.0 to main branch
([#7243](#7243))
([a6e29f2](a6e29f2))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
mihir20 pushed a commit that referenced this pull request Aug 18, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.83.0](v1.82.0...v1.83.0)
(2026-08-17)


### Features

* add OriginalID and OriginalDestinationID to support replay event
transformations
([#7274](#7274))
([28d38e9](28d38e9))
* bingads integration tests
([#7253](#7253))
([fdb8c0a](fdb8c0a))
* **processor:** fork event processing for rsources pipelines
([#7235](#7235))
([707ea06](707ea06))


### Bug Fixes

* pyt contract tests data race
([#7247](#7247))
([9e62d0c](9e62d0c))


### Miscellaneous

* bump sqlconnect-go to v1.30.2
([#7251](#7251))
([f5d6175](f5d6175))
* **jobsdb:** multi-consumer compaction improvements
([#7248](#7248))
([b4af86c](b4af86c))
* pyt contract tests for candidate releases
([#7252](#7252))
([149e91a](149e91a))
* pyt contract tests for transformations auth
([#7239](#7239))
([ac4a859](ac4a859))
* **router:** support per-partition noOfWorkers override
([#7270](#7270))
([9d6f7cf](9d6f7cf))
* sync release v1.82.0 to main branch
([#7243](#7243))
([a6e29f2](a6e29f2))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
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.

2 participants