generate-fixtures drops a redirect on a route that also has a page
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start with Fixture/Generator/Site/SiteReader::orderRedirects(), where the !isset($available[spl_object_id($route)]) check skips redirects on routes that also belong to a page, and check how $unresolvedRedirects is populated. Pull request #468 is already open against this issue, so review it before starting. Done means the generated scaffold sets the redirect after the routes exist, or the route is reported under could not be reproduced.
Written by the indexing model from the issue text.
Description
silverback:api-components:generate-fixtures (2.0.0-alpha.22) silently leaves out a redirect when the redirecting route also belongs to a page. Nothing appears in the could not be reproduced list.
Example (smoking-and-alcohol-websites production)
| Route | Page | Redirects to |
|---|---|---|
/ (home) |
Home | /graphs |
/graphs (graphs) |
Graphs | /graphs/top-line-findings |
/resources (resources) |
Resources | /resources/latest-statistics |
The generated scaffold creates all three pages with their routes, but contains no $cwa->redirect() call and no other redirect. A site loaded from it serves an empty Home page at / instead of redirecting.
Cause
In Fixture/Generator/Site/SiteReader::orderRedirects(), only routes not already in $siteRoutes become pending redirects:
if (null !== $route->getRedirect() && !isset($available[spl_object_id($route)])) {
A page's own route is in $siteRoutes, so its redirect is skipped. It isn't added to $unresolvedRedirects either, so nothing gets reported.
Expected
The redirect is carried. For a route that is both a page's route and a redirect, the scaffold should set the redirect after the routes exist, for example in an onRoutesCreated() / afterRoutes() callback ($cwa->getRoute('home')->setRedirect($cwa->getRoute('graphs')), or a builder equivalent). Failing that, it should at least be listed under could not be reproduced.
Downstream workaround: a small fixture that depends on the generated scaffold and sets the three redirects when they're missing.
- Dominant language
- PHP
- Stars
- 32
- Forks
- 8
- Avg merge
- 40m
- Merged PRs (30d)
- 133
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from components-web-app/api-components-bundle
-
Codecov project status fails before the Behat coverage upload landsPossibly taken @silverbackdan claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 20/100
components-web-app/api-components-bundle#472 ·
Maintainers usually reply within 1 day
-
Fixture builder: accept a PageBuilder or PageDataBuilder as the target of linkRoute(), linkIri() and redirect(to:)Possibly taken @silverbackdan claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 15/100
components-web-app/api-components-bundle#471 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
components-web-app/api-components-bundle#469 ·
Maintainers usually reply within 1 day
-
Component groups: a maximum number of components (e.g. exactly one CTA)Possibly taken @silverbackdan claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 20/100
components-web-app/api-components-bundle#464 · 1 comment ·
Maintainers usually reply within 1 day
-
generate-fixtures: configurable asset store (local folder or Flysystem) with a content-hash manifest and pruningPossibly taken @silverbackdan claimed this today. Open
Difficulty 5/5 Over a week Newbie friendliness 10/100
components-web-app/api-components-bundle#462 · 1 comment ·
Maintainers usually reply within 1 day
All issues in components-web-app/api-components-bundle
Similar issues
-
major-release
Difficulty 1/5 Under an hour Newbie friendliness 67/100
Intervention/image#1553 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
omegaup/omegaup#10353 · 1 comment ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
effort: low graphiql ide impact: low scope: code quality type: chore
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
wp-graphql/wp-graphql#4486 ·
Maintainers usually reply within 1 day