Skip to content

Consolidate route rewrites to netlify.toml#12

Open
harbourviewcompany-create wants to merge 1 commit into
mainfrom
codex/remove-duplicate-rewrite-definitions
Open

Consolidate route rewrites to netlify.toml#12
harbourviewcompany-create wants to merge 1 commit into
mainfrom
codex/remove-duplicate-rewrite-definitions

Conversation

@harbourviewcompany-create
Copy link
Copy Markdown
Owner

@harbourviewcompany-create harbourviewcompany-create commented May 20, 2026

Motivation

  • Remove duplicate route rewrite definitions by choosing a single source of truth for rewrites to avoid conflicting configuration.
  • Centralize Netlify configuration with build settings in netlify.toml so routing and build settings live together.
  • Enforce the chosen source via the static-site check to prevent regressions in CI.

Description

  • Removed the route entries from _redirects and replaced them with a short note telling maintainers to keep rewrites in netlify.toml.
  • Added a Rewrite configuration note to README.md stating that rewrites are maintained only in netlify.toml.
  • Updated scripts/check-site.js to remove "_redirects" from the required files list, add a requiredRouteRewrites mapping, parse [[redirects]] blocks in netlify.toml, and validate required 200-status rewrites point to the correct .html files.
  • Added a check in scripts/check-site.js that fails if _redirects contains duplicate rewrite entries for any required route.

Testing

  • Ran npm run check which executes node scripts/check-site.js, and the static site check passed.
  • The updated check-site.js validated that all required routes are configured in netlify.toml and that _redirects no longer duplicates those rewrites.

Codex Task


Open in Devin Review

@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Deploy Preview for wurx-can ready!

Name Link
🔨 Latest commit e230595
🔍 Latest deploy log https://app.netlify.com/projects/wurx-can/deploys/6a0de65d97669b00096c1a5c
😎 Deploy Preview https://deploy-preview-12--wurx-can.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Warning

Rate limit exceeded

@harbourviewcompany-create has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 59 minutes and 40 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 43c43ae0-cca9-471c-bdf2-3fca82480f24

📥 Commits

Reviewing files that changed from the base of the PR and between 6e00de5 and e230595.

📒 Files selected for processing (3)
  • README.md
  • _redirects
  • scripts/check-site.js

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Deploy Preview for wurx-otta ready!

Name Link
🔨 Latest commit e230595
🔍 Latest deploy log https://app.netlify.com/projects/wurx-otta/deploys/6a0de65dbab90500087b2ec8
😎 Deploy Preview https://deploy-preview-12--wurx-otta.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

Open in Devin Review

Comment thread scripts/check-site.js
failures.push('netlify.toml must contain command = ""');
}

const redirectBlocks = [...netlifyConfig.matchAll(/\[\[redirects\]\]([\s\S]*?)(?=\n\[\[redirects\]\]|$)/g)];
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Redirect block regex assumes no other TOML array sections follow [[redirects]]

The regex at line 103 (/\[\[redirects\]\]([\s\S]*?)(?=\n\[\[redirects\]\]|$)/g) captures everything from a [[redirects]] marker until the next [[redirects]] or end-of-string. For the last redirect block, the lazy quantifier consumes all remaining content to the end of the file. If other TOML array-of-tables sections (e.g. [[headers]], [[plugins]]) are ever added after the last [[redirects]] block, their content would be included in the last captured block. This doesn't cause a false positive today because the inner field matchers (from, to, status) wouldn't accidentally match unrelated TOML keys, but it's a fragility worth noting if netlify.toml grows.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread scripts/check-site.js
Comment on lines +111 to +113
if (!fromMatch || !toMatch || !statusMatch) {
continue;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Silently skipping malformed redirect blocks is intentional but could mask config errors

At lines 111-113, redirect blocks that are missing any of from, to, or status are silently skipped via continue. This means a partially defined redirect (e.g., missing status = 200) would not be counted as a configured rewrite, and the script would correctly report it as missing. However, it also means truly malformed blocks (e.g., typos like fron = ...) produce no specific diagnostic—the only signal is the downstream 'missing rewrite' failure, which may not clearly point to the root cause. This is acceptable for the current scope but could be improved with a warning.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread scripts/check-site.js
Comment on lines +134 to +140
for (const fromPath of Object.keys(requiredRouteRewrites)) {
const escapedPath = fromPath.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
const duplicatePattern = new RegExp(`^\\s*${escapedPath}\\s+`, "m");
if (duplicatePattern.test(redirectsFile)) {
failures.push(`_redirects must not duplicate rewrite for ${fromPath}; use netlify.toml only`);
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: _redirects duplicate detection correctly ignores comment lines

The duplicate detection pattern at line 136 (^\s*${escapedPath}\s+ with m flag) correctly avoids matching commented-out lines like # /start-a-project ... because the # character does not match the expected / at the start of the path. I verified this works correctly even with the \s* prefix (which includes \n) since ^ with the m flag anchors to line boundaries. The \s+ suffix after the path also prevents false matches against longer paths like /start-a-project-v2.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant