fix: implement hard 404 responses for invalid .json/ URL paths and empty taxonomy pages - #940
Conversation
📝 WalkthroughWalkthroughFive Astro workflow route pages replace ChangesWorkflow Pages: Redirect → 404 Hardening
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@site/src/pages/`[locale]/workflows/[slug].astro:
- Around line 71-74: The current error handling in both files is incorrectly
returning a 404 status for all upstream detail-fetch failures, regardless of the
actual failure type. At site/src/pages/[locale]/workflows/[slug].astro lines
71-74, check the is404 flag or variable to distinguish between true not-found
errors and other dependency/upstream failures: if is404 is true, return the 404
response as currently implemented; otherwise, log the actual error and return a
503 or 502 response to properly indicate a server error. Apply the identical
error mapping logic at site/src/pages/workflows/[username].astro lines 60-63 to
ensure consistent handling across both creator routes and prevent false
hard-404s for non-404 upstream failures.
- Around line 143-146: The 404 response fallback does not distinguish between a
genuine missing resource and an upstream fetch failure, which masks service
outages. At site/src/pages/[locale]/workflows/[slug].astro lines 143-146
(anchor), add a check for successful upstream fetch status before returning the
404 response; if the fetch failed, return a 5xx status instead to indicate a
server error. Apply the identical fetch-status gating logic at the sibling
location site/src/pages/workflows/[username].astro lines 110-113 before
returning its hard 404 response. This ensures that ambiguous absence (caused by
fetch failures) is properly distinguished from genuine 404 scenarios.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 81650f30-614f-4838-be2a-24d58e5c5501
📒 Files selected for processing (5)
site/src/pages/[locale]/workflows/[slug].astrosite/src/pages/[locale]/workflows/category/[type].astrosite/src/pages/[locale]/workflows/model/[name].astrosite/src/pages/[locale]/workflows/tag/[tag].astrosite/src/pages/workflows/[username].astro
434dbc3 to
52862d7
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
site/src/pages/[locale]/workflows/category/[type].astro (1)
133-152: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winRemove unreachable “no templates” UI branch.
Since Line 64-69 already returns 404 for
templates.length === 0, the fallback branch here cannot execute. Pruning it will keep behavior clear and reduce maintenance drift.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@site/src/pages/`[locale]/workflows/category/[type].astro around lines 133 - 152, The fallback branch of the ternary operator that displays the "No templates found" message is unreachable because an earlier check at Line 64-69 already returns a 404 response when templates is empty. Remove this dead code by simplifying the conditional to render only the WorkflowGrid component directly without the ternary operator, since the function will have already exited with a 404 if templates.length === 0.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@site/src/pages/`[locale]/workflows/[slug].astro:
- Around line 70-73: 502 error responses are being cached due to inherited
page-level CDN cache policy, allowing temporary upstream failures to be replayed
from cache. Add explicit no-store semantics to prevent caching at all four
affected locations: In site/src/pages/[locale]/workflows/[slug].astro at lines
70-73, add headers: { 'CDN-Cache-Control': 'no-store' } to the detail-fetch 502
Response object. In site/src/pages/[locale]/workflows/[slug].astro at lines
149-152, add the same no-store header to the bogus-slug/index-failure 502
Response object. In site/src/pages/workflows/[username].astro at lines 59-62,
add no-store header to the detail-fetch 502 Response object. In
site/src/pages/workflows/[username].astro at lines 117-120, add no-store header
to the bogus-slug/index-failure 502 Response object.
---
Outside diff comments:
In `@site/src/pages/`[locale]/workflows/category/[type].astro:
- Around line 133-152: The fallback branch of the ternary operator that displays
the "No templates found" message is unreachable because an earlier check at Line
64-69 already returns a 404 response when templates is empty. Remove this dead
code by simplifying the conditional to render only the WorkflowGrid component
directly without the ternary operator, since the function will have already
exited with a 404 if templates.length === 0.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 43826dfe-ee74-419d-b119-1314f3abdf8a
📒 Files selected for processing (5)
site/src/pages/[locale]/workflows/[slug].astrosite/src/pages/[locale]/workflows/category/[type].astrosite/src/pages/[locale]/workflows/model/[name].astrosite/src/pages/[locale]/workflows/tag/[tag].astrosite/src/pages/workflows/[username].astro
64e9bfa to
b89f1ae
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@site/src/pages/`[locale]/workflows/category/[type].astro:
- Around line 64-69: The early 404 response guard checking if templates.length
=== 0 prevents the empty-state template fallback UI from ever being rendered,
making that code unreachable. Remove the guard that returns a 404 response when
templates is empty so that the "No templates found" message and fallback UI can
be displayed to users when there are no templates available.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: b4694b03-2377-4ed7-99ac-2307025f6351
📒 Files selected for processing (5)
site/src/pages/[locale]/workflows/[slug].astrosite/src/pages/[locale]/workflows/category/[type].astrosite/src/pages/[locale]/workflows/model/[name].astrosite/src/pages/[locale]/workflows/tag/[tag].astrosite/src/pages/workflows/[username].astro
|
I have read and agree to the Contributor License Agreement |
|
@coderabbitai review |
✅ Action performedReview finished.
|
✅ Action performedReview finished.
|
|
@nav-tej @christian-byrne could you please check this? |
dante01yoon
left a comment
There was a problem hiding this comment.
issue: This head no longer merges cleanly into current main, so it is not safe to land as reviewed. A test merge against origin/main (bbe3015) conflicts in site/src/pages/[locale]/workflows/model/[name].astro and site/src/pages/workflows/[username].astro.
These are semantic conflicts, not just formatting: current main resolves model families and preserves variant-slug 301 redirects, and creator serialization now passes rankingMap. Please rebase/merge current main, keep the family/alias redirect behavior and ranking-aware serializeIndexEntry(..., rankingMap), then reapply the hard-404/502 behavior around those current paths.
The standalone PR head otherwise passes astro check, focused ESLint, and astro build; the blocker is integration with current main and the regression risk in resolving these conflicts.
…ges and block .json path access
8a28c54 to
ffcbe99
Compare
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
|
Rebased on current main (bbe3015) and resolved the semantic conflicts. Maintained model family resolution & variant 301 redirects in model/[name].astro, kept rankingMap serialization in creator routes, and reapplied the hard 404/502 and .json/ path blocking. Verified clean with astro check, eslint, and astro build. Ready to review/land! |
|
Thank you!
Navtej Singh
***@***.***
(408)-512-3813 <http://voice.google.com/calls?a=nc,%2B14085123813>
…On Fri, Jul 24, 2026 at 8:12 AM Dante ***@***.***> wrote:
***@***.**** approved this pull request.
—
Reply to this email directly, view it on GitHub
<#940?email_source=notifications&email_token=AIVA4VR6IF7PYR2OI6F7NL35GN4FHA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINZXGQ2DKNBWGM3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#pullrequestreview-4774454636>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIVA4VVA63HVZASOFTB3UJ35GN4FHAVCNFSNUABFKJSXA33TNF2G64TZHM4TIMBYGI3DSNZTHNEXG43VMU5TINRWGQ3DANRXHE4KC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AIVA4VRCLZXJQZW6S3OXWWT5GN4FHA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINZXGQ2DKNBWGM3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/AIVA4VUJC6IBVCIAPRQEM3T5GN4FHA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINZXGQ2DKNBWGM3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
@dante01yoon @DrJKL @christian-byrne @deepme987 could any of you please review and approve this again? |
Summary
This PR addresses soft 404 flags by ensuring that the Astro site's server-side rendered (SSR) dynamic pages return a hard 404 HTTP status code (instead of rendering a blank UI shell with
200 OKor triggering a302redirect) when a request is made with invalid data, an empty taxonomy, or an appended trailing slash.Changes Made
Astro.url.pathname.endsWith('.json/')at the top of the dynamic pages' frontmatter to return a hard 404Responseimmediately, blocking bad trailing slash Vercel redirects from matching dynamic layouts.Verification
SKIP_AI_GENERATION=true npm run buildsuccessfully on the local environment.