EPMRPP-114309 || Fix incorrect redirect for release documentation URLs#1106
EPMRPP-114309 || Fix incorrect redirect for release documentation URLs#1106maria-hambardzumian wants to merge 4 commits into
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (60)
WalkthroughDocusaurus redirect configuration and redirect-generation were normalized: redirect entries now expand source variants and consistently use trailing slashes (including correct placement before hash fragments). CI deploy workflow now uploads per-dot-named redirect HTML pages to the S3 docs prefix. Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer / CI
participant Build as Docusaurus Build
participant Expander as expandRedirectFromVariants
participant S3 as AWS S3 (docs/)
participant Browser as End-User Browser
Dev->>Build: run build (uses docusaurus.config.js)
Build->>Expander: pass redirect entries
Expander-->>Build: expanded redirects (from variants + normalized paths)
Build->>S3: aws s3 sync upload of build/
Dev->>S3: upload generated dot-path redirect HTML files (via workflow step)
Browser->>S3: request dot-path URL
S3-->>Browser: serve redirect HTML
Browser->>Browser: JS reads location and redirects to intended `./<name>/` (preserving search/hash)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Review rate limit: 0/1 reviews remaining, refill in 13 minutes and 29 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/deploy-dev.yml:
- Around line 87-95: The current "Create dot-path redirect stubs in S3" step
uploads stub objects into the bucket which later collides with the Amplify
redeploy step that syncs the bucket back to a local filesystem; instead of
creating those stubs in S3 with the aws s3 cp loop, build the Amplify deployment
artifact directly from ./build and inject the dotted-path stub entries into the
ZIP (e.g., use a zip writer such as Python's zipfile.writestr or equivalent) so
the archive contains both "foo" and "foo/index.html" without creating
conflicting S3 objects; remove or disable the existing stub-creation loop and
update the workflow to produce the final zip with appended stub entries before
the Amplify deploy step.
🪄 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: CHILL
Plan: Pro
Run ID: 240f736b-09cd-47be-9e14-c0d5bafb9c01
📒 Files selected for processing (3)
.github/workflows/deploy-dev.ymldocusaurus.config.jsscripts/expand-redirect-from-variants.js
| - name: Create dot-path redirect stubs in S3 | ||
| run: | | ||
| find ./build -mindepth 1 -type d | while IFS= read -r dir; do | ||
| name=$(basename "$dir") | ||
| if [[ "$name" == *.* ]]; then | ||
| rel="${dir#./build/}" | ||
| printf '<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0;url=./%s/"><script>window.location.replace(location.pathname.replace(/\/?$/,"/")+location.search+location.hash)</script></head></html>' "$name" \ | ||
| | aws s3 cp - "s3://${{ env.AWS_S3_BUCKET_NAME }}/docs/$rel" \ | ||
| --content-type "text/html; charset=utf-8" |
There was a problem hiding this comment.
Don't round-trip these stub objects through a filesystem.
aws s3 sync at Line 85 already uploads docs/<rel>/index.html for dotted directories. This step adds a second S3 object at docs/<rel>, but the later Amplify redeploy step (Lines 101-111) syncs the bucket back to /tmp/full-site, where <rel> cannot be both a file and a directory. That will break or truncate the redeploy artifact for dotted release paths.
One workable fix
Build the Amplify zip directly from ./build and append the dotted-path stub entries to the zip archive itself (for example with Python's zipfile.writestr(...)) instead of syncing the bucket back to a local directory. ZIP archives can hold both foo and foo/index.html; a local filesystem cannot.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/deploy-dev.yml around lines 87 - 95, The current "Create
dot-path redirect stubs in S3" step uploads stub objects into the bucket which
later collides with the Amplify redeploy step that syncs the bucket back to a
local filesystem; instead of creating those stubs in S3 with the aws s3 cp loop,
build the Amplify deployment artifact directly from ./build and inject the
dotted-path stub entries into the ZIP (e.g., use a zip writer such as Python's
zipfile.writestr or equivalent) so the archive contains both "foo" and
"foo/index.html" without creating conflicting S3 objects; remove or disable the
existing stub-creation loop and update the workflow to produce the final zip
with appended stub entries before the Amplify deploy step.
Summary by CodeRabbit