Repository navigation
test(fake): redirect a site directory and serve one under /_decdn/ as its index.html - #17
Merged
Merged
Conversation
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.
yigitdot
force-pushed
the
test/fake-directory-redirect
branch
from
November 23, 2026 02:53
5714cbb to
f4f4793
Compare
… 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]>
The real gateway takes a request with no Sec-Fetch-Mode, or with Sec-Fetch-Mode: navigate, as a navigation. Under /_decdn/ it redirects a navigation of a bundle or an entry to that bundle's site, to the directory itself when the request named one. The fake now does the same. The unit tests now send a page's own request where they mean one, and they cover the navigation redirect, the bundle root, a folder with no index.html, and the bare-host location. The contract test adds HEAD of a site directory with a query and builds the site origin from the gateway URL. Comments are clarified. Co-Authored-By: Claude Opus 5.5 <[email protected]>
yigitdot
force-pushed
the
test/fake-directory-redirect
branch
from
November 23, 2026 03:11
f4f4793 to
714acef
Compare
Under /_decdn/, ?ns= becomes the URI's namespace, so on the real gateway the pull of docs/index.html is routed through a namespace the e2e network need not serve. It passes now only because an earlier request in the same test cached the entry. The contract test keeps checking the ?ns=7 redirect, which pulls nothing, and fetches the index without the query. The unit test still covers the hinted index against the fake. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Closes #16. The fake gateway now mirrors decdn/decdn#2941.
What changed
Fake gateway (
tests/fake_gateway.py)index.html(and no entry of its own) answers302 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 toindex.htmlbefore parsing. So/_decdn/<h>/docs/servesdocs/index.html, and/_decdn/<h>/docs?ns=7redirects todocs/?ns=7. The bundle root<h>/is unchanged./_decdn/: a request with noSec-Fetch-Mode, or withnavigate, counts as a navigation, assite::is_navigationdoes./_decdn/<h>/docs/→http://<site>/docs/).Contract
docs/index.html, with nodocsentry.shipped_after("0.3.1")since v0.3.1 is decdn's latest release, checks:/docs,/docs?tab=2,/docs/and/docs/?tab=2, plusHEAD /docs?tab=2;/_decdn/<h>/docs,…/docs?ns=7and…/docs/;HEAD /_decdn/<h>/docs/redirecting to the site's/docs/.sec-fetch-mode: corsandsec-fetch-site: same-origin, as sdk-typescript does, so the real gateway treats each request as the page's own./_decdn/<h>/docs/?ns=7from 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
/_decdn/directory goes to the directory on the site, not todocs/index.html.Order of changes
This PR lands first. decdn/decdn#2941 then adds
docs/index.htmlto the bundle incrates/e2e/src/sdk_contract.rsand moves both SDK pins.harness-flooris empty, so the floor doesn't change.Known gaps (not in this PR)
#20 tracks two older fake/real mismatches that nothing reads today:
Content-Disposition;Testing
uv run ruff check .,uv run ruff format --check .anduv run mypyare clean.uv run pytest --ignore=tests/scripts: 359 passed.🤖 Generated with Claude Code