Repository navigation
fix(gateway): a directory under a site's /_decdn/ serves its index.html - #2941
Merged
Merged
Conversation
Under /_decdn/, a trailing / inside a bundle maps to …/index.html before parsing, for GET and HEAD, as a site's own paths already do. The /_decdn/ directory redirect keeps the request's query, so its ns= hint survives (Location: docs/?ns=7). Ask::Get carries the query to Gateway::entry. Closes #2818
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Code coverage overviewLanguages: Rust, Solidity Rust / code-coverage/cargo-llvm-cov
Solidity / code-coverage/forge
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
A site's own-path directory redirect keeps the request's query, as the /_decdn/ one does (/docs?tab=2 redirects to docs/?tab=2), on GET and HEAD. A navigation or HEAD of a directory under /_decdn/ redirects to the directory on the bundle's site (/docs/), not to its index.html.
A Named enum (Directory, AsIs) replaces the bare directory bool that head_blob and to_site take, so a call site reads as what it means.
yigitdot
added a commit
to decdn/sdk-python
that referenced
this pull request
Nov 23, 2026
… its index.html The fake gateway mirrors decdn/decdn#2941. On a site, a path naming a directory with an index.html answers 302 to `<dir>/`, with the request's query kept, for GET and HEAD. Under /_decdn/, a trailing `/` inside a bundle serves the directory's index.html. HEAD of a bundle or an entry under /_decdn/ redirects to its site at no pull, to the directory itself when the request named one. The contract fixture bundle gains docs/index.html, and a public contract test covers these cases. It sends Sec-Fetch-Mode: cors and Sec-Fetch-Site: same-origin, as a page's own request does. Closes #16 Co-Authored-By: Claude Opus 5.5 <[email protected]>
yigitdot
added a commit
to decdn/sdk-python
that referenced
this pull request
Nov 23, 2026
… its index.html The fake gateway mirrors decdn/decdn#2941. On a site, a path naming a directory with an index.html answers 302 to `<dir>/`, with the request's query kept, for GET and HEAD. Under /_decdn/, a trailing `/` inside a bundle serves the directory's index.html. HEAD of a bundle or an entry under /_decdn/ redirects to its site at no pull, to the directory itself when the request named one. The contract fixture bundle gains docs/index.html, and a public contract test covers these cases. It sends Sec-Fetch-Mode: cors and Sec-Fetch-Site: same-origin, as a page's own request does. Closes #16 Co-Authored-By: Claude Opus 5.5 <[email protected]>
yigitdot
added a commit
to decdn/sdk-python
that referenced
this pull request
Nov 23, 2026
… its index.html (#17) Closes #16. The fake gateway now mirrors decdn/decdn#2941. ## What changed **Fake gateway (`tests/fake_gateway.py`)** - **Site directory redirect:** on a site, a path that names a directory with an `index.html` (and no entry of its own) answers `302 Location: <dir>/`. The request's query is kept (`/docs?tab=2` → `docs/?tab=2`), for GET and HEAD. - **`/_decdn/` directory index:** a trailing `/` inside a bundle maps to `index.html` before parsing. So `/_decdn/<h>/docs/` serves `docs/index.html`, and `/_decdn/<h>/docs?ns=7` redirects to `docs/?ns=7`. The bundle root `<h>/` is unchanged. - **HEAD or navigation under `/_decdn/`:** a request with no `Sec-Fetch-Mode`, or with `navigate`, counts as a navigation, as `site::is_navigation` does. - A HEAD or a navigation of a bundle or an entry redirects to that bundle's site, without reading the manifest or charging the allowance. - When the request named a directory, the redirect goes to the directory itself (`/_decdn/<h>/docs/` → `http://<site>/docs/`). - A blob is still served. Before this, a HEAD of a bundle or entry here served the content, and so did a navigation. **Contract** - The fixture bundle gains `docs/index.html`, with no `docs` entry. - A new public contract test, gated on `shipped_after("0.3.1")` since v0.3.1 is decdn's latest release, checks: - the site's own `/docs`, `/docs?tab=2`, `/docs/` and `/docs/?tab=2`, plus `HEAD /docs?tab=2`; - `/_decdn/<h>/docs`, `…/docs?ns=7` and `…/docs/`; - `HEAD /_decdn/<h>/docs/` redirecting to the site's `/docs/`. - It sends `sec-fetch-mode: cors` and `sec-fetch-site: same-origin`, as sdk-typescript does, so the real gateway treats each request as the page's own. - It doesn't fetch `/_decdn/<h>/docs/?ns=7` from the real gateway: there, `?ns=` routes the fetch through a namespace the e2e network may not serve. The unit tests cover that case against the fake. ## Where this follows #2941 rather than the issue text - A site's own directory redirect also keeps the query. - HEAD of a `/_decdn/` directory goes to the directory on the site, not to `docs/index.html`. ## Order of changes This PR lands first. decdn/decdn#2941 then adds `docs/index.html` to the bundle in `crates/e2e/src/sdk_contract.rs` and moves both SDK pins. `harness-floor` is empty, so the floor doesn't change. ## Known gaps (not in this PR) #20 tracks two older fake/real mismatches that nothing reads today: - a blob navigation's `Content-Disposition`; - the loopback site gate refusing a link from another site. ## Testing - `uv run ruff check .`, `uv run ruff format --check .` and `uv run mypy` are clean. - `uv run pytest --ignore=tests/scripts`: 359 passed. - The new contract test has run against the fake, not yet against the real gateway. That needs #2941's harness change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
… SDK pins The contract bundle gains docs/index.html, with no docs entry, which the SDK contract suites read for the directory cases. Both pins move to SDK main commits whose fake gateway and contract suite carry the directory behavior: sdk-typescript b88eb266 and sdk-python 55aceecd.
Gas snapshotNo gas changes vs base. |
thiras
approved these changes
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

On a site origin, a same-origin request for
/_decdn/<h>/docs(a bundle withdocs/index.htmland nodocs) redirected todocs/. The browser then asked for/_decdn/<h>/docs/, which the/_decdn/branch parsed as-is, anddecode_pathrefused the trailing empty segment with a 400. The redirect also dropped the?ns=hint./_decdn/, a trailing/inside a bundle maps to…/index.htmlbefore parsing, for GET and HEAD, as a site's own paths already do./_decdn/(Location: docs/?ns=7) and on a site's own path (/docs?tab=2→docs/?tab=2, GET and HEAD).Ask::Getcarries the query toGateway::entry./_decdn/redirects to the directory on the bundle's site (https://<site>/docs/), not to itsindex.html.No SDK contract test at the pinned commits requests a directory, so the pins do not move. The TypeScript and Python fake gateways still mirror the old redirect; decdn/sdk-typescript#29 and decdn/sdk-python#16 track them.
Closes #2818