fix: route project roots (/<slug>/) to a landing page
The home index and every page breadcrumb link a project root
`<a href="/<slug>/">`, but the router declared only `/`, `/assets/theme.css`,
and the `/{slug}/{*page}` catch-all (which requires a concrete page segment),
so every project-root link 404'd. Add a `/{slug}/` route and a project_index
handler that renders a landing page listing the project's sections and pages
(unknown slug -> 404); the index and breadcrumb root links are now live.
RED-first via the debug skill: tests/e2e.rs
`project_root_resolves_to_landing_with_section_nav` (a GET to /aura/ asserting
200 + the section/page nav) failed 404 before the fix, passes after.
cargo test green (42); clippy clean.
This commit is contained in:
@@ -192,6 +192,24 @@ docs="docs"
|
||||
);
|
||||
}
|
||||
|
||||
/// A registered project's root URL (`/<slug>/`) must resolve to a landing page
|
||||
/// that lists that project's sections/pages — not 404. Both the home index
|
||||
/// (`index`, src/server/mod.rs) and every page breadcrumb (`page_html`,
|
||||
/// src/theme/mod.rs) emit `<a href="/<slug>/">` for the project root, so it has
|
||||
/// to be a live route. The router declares only `/`, `/assets/theme.css`, and a
|
||||
/// `/{slug}/{*page}` catch-all that requires a concrete page segment, leaving a
|
||||
/// bare project root such as `/aura/` unrouted (404) while a concrete page like
|
||||
/// `/aura/design/INDEX` resolves — so every index and breadcrumb root link is dead.
|
||||
#[tokio::test]
|
||||
async fn project_root_resolves_to_landing_with_section_nav() {
|
||||
let (status, body) = get(router(state()), "/aura/").await;
|
||||
assert_eq!(status, StatusCode::OK, "a project root must resolve, not 404: {body}");
|
||||
assert!(
|
||||
body.contains("<a href=\"/aura/design/INDEX\">"),
|
||||
"project landing must list the project's sections/pages: {body}"
|
||||
);
|
||||
}
|
||||
|
||||
/// A Fetcher that counts `fetch_raw` calls, wrapping a MockFetcher. Lets the
|
||||
/// E2E layer prove the cache-before-fetch data-flow.
|
||||
struct CountingFetcher {
|
||||
|
||||
Reference in New Issue
Block a user