Skip to content

test(contract): expect Content-Encoding among the exposed headers - #25

Merged
alpergundogdu merged 4 commits into
mainfrom
fix/expose-content-encoding
Nov 11, 2026
Merged

alpergundogdu merged 4 commits into
mainfrom
fix/expose-content-encoding

Conversation

@alpergundogdu

@alpergundogdu alpergundogdu commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

The public gateway adds Content-Encoding to Access-Control-Expose-Headers (decdn/decdn#2817, gateway change in decdn/decdn#2870). A page on another origin then sees that a proxy in front encoded the body, so the client skips Content-Length as a lower bound and as contentLength (the logic from #21).

Changes

  • test/fake-gateway.ts: EXPOSED lists Content-Encoding after Content-Length, as the gateway does.
  • test/contract/public.test.ts: a blob read from another origin finds content-encoding and content-length in access-control-expose-headers.
  • test/contract/fixture.ts: shippedAfter(version) says whether the gateway under test carries behaviour decdn shipped after that release. scripts/decdn-contract.sh --tag sets DECDN_CONTRACT_RELEASE; the fake and --ref runs (including decdn's own contract run) carry everything.
  • The new test is declared inside if (shippedAfter("0.3.1")). It is left out, not skipped, because decdn's harness fails a run where any collected test is skipped. CONTRIBUTING.md describes the pattern.

Order

This PR merges first. decdn/decdn#2870 pins .github/sdk-typescript.sha to this branch's head.

Gateway floor

decdn.gatewayFloor stays at 0.3.0. The SDK code does not change, and the release-gateway runs against v0.3.0 and v0.3.1 do not collect the new test.

Tests

  • pnpm lint, pnpm build, shellcheck scripts/decdn-contract.sh: pass.
  • vitest run test/contract test/unit: 155 passed.
  • Public contract against the fake with DECDN_CONTRACT_RELEASE set to 0.3.0 or 0.3.1: 16 tests, none skipped. Set to 0.3.2: 17.
  • test/scripts/* fail locally on macOS (BSD tar --mtime, changelog tool), unrelated to this change.

🤖 Generated with Claude Code

alpergundogdu and others added 3 commits November 11, 2026 17:20
The public gateway lists Content-Encoding in Access-Control-Expose-Headers
(decdn/decdn#2817), so a page on another origin can tell a body was decoded
on the way and skip Content-Length as a bound. The fake mirrors the list and
the public contract asserts it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scripts/decdn-contract.sh --tag names its release in DECDN_CONTRACT_RELEASE,
and shippedAfter(version) in the fixture gates a contract test on it. The
Content-Encoding expose test runs only on gateways after v0.3.1, the fake
and every --ref run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
decdn's harness counts every collected test and fails a run that skips one,
so a test gated by shippedAfter is declared only when the gateway carries it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alpergundogdu
alpergundogdu merged commit bb4c9fd into main Nov 11, 2026
17 checks passed
@alpergundogdu
alpergundogdu deleted the fix/expose-content-encoding branch November 11, 2026 19:47
@alpergundogdu
alpergundogdu requested a review from thiras November 11, 2026 19:57
alpergundogdu added a commit to decdn/sdk-python that referenced this pull request Nov 11, 2026
The public gateway adds `Content-Encoding` to
`Access-Control-Expose-Headers` (decdn/decdn#2817, gateway change in
decdn/decdn#2870), so a page on another origin can tell that a proxy in
front encoded the body.

## Changes

- `tests/fake_gateway.py` and `tests/unit/test_fake_gateway.py`:
`EXPOSED` lists `Content-Encoding` after `Content-Length`, as the
gateway does.
- `tests/contract/test_public.py`: a blob read with an `Origin` finds
`content-encoding` and `content-length` in
`access-control-expose-headers`.
- `tests/contract/fixture.py`: `shipped_after(version)` says whether the
gateway under test carries behaviour decdn shipped after that release.
`scripts/decdn-contract.sh --tag` sets `DECDN_CONTRACT_RELEASE`; the
fake and `--ref` runs carry everything.
- The new test is declared inside `if shipped_after("0.3.1"):`. It is
left out, not skipped, because decdn's harness fails a run where any
collected test is skipped. CONTRIBUTING.md describes the pattern. This
is the same gate as decdn/sdk-typescript#25.

## Order

This PR merges first. decdn/decdn#2870 pins `.github/sdk-python.sha` to
this branch's head.

## Gateway floor

`gateway-floor` stays as is: the SDK code does not change, and the
weekly release-gateway runs do not collect the new test.

## Tests

- `uv run ruff check .`, `uv run ruff format --check .`, `uv run mypy`,
`shellcheck scripts/decdn-contract.sh`: pass.
- `uv run pytest tests/unit tests/contract`: 354 passed.
- With `DECDN_CONTRACT_RELEASE=0.3.1` the new test is not collected;
with 0.3.2 or 0.4.0-rc.1 it runs and passes.
- `tests/scripts/test_decdn_contract.py` fails locally on macOS,
unrelated to this change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
alpergundogdu added a commit to decdn/decdn that referenced this pull request Nov 13, 2026
decdn/sdk-typescript#25 and decdn/sdk-python#12 squash-merged, so the
pins move from the PR branch heads to the commits on each SDK's main.
The trees are identical.

Co-authored-by: Claude Fable 5.2 <[email protected]>
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