Skip to content

Conversation

@MayankBansal12
Copy link
Member

@MayankBansal12 MayankBansal12 commented Jan 10, 2026

Date: 11-01-26

Developer Name: @MayankBansal12


Issue Ticket Number

Description

  • Add CF function to disable staging deployment and return error
  • Added a DEPRECATED flag for easy rollback when set to 'false'
  • All navigation and references have been changed for staging environment

Tech Doc Link

https://docs.google.com/document/d/1XAb4T6GxCciZSPbO_ji1-cqnsOiwH3vFH2V6wJFhB9Y/

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

working proof

Deployed a version of website my to test the changes


Screencast.from.2026-01-13.20-35-59.mp4

@netlify
Copy link

netlify bot commented Jan 10, 2026

Deploy Preview for staging-my ready!

Name Link
🔨 Latest commit 1539a4d
🔍 Latest deploy log https://app.netlify.com/projects/staging-my/deploys/6966533b28db860008e094ce
😎 Deploy Preview https://deploy-preview-641--staging-my.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 10, 2026

Walkthrough

A middleware function is added to functions/_middleware.js that checks a deprecation environment variable. If deprecated mode is enabled, it returns a 410 Gone response; otherwise, it forwards the request to the next handler.

Changes

Cohort / File(s) Summary
Deprecation Middleware
functions/_middleware.js
Introduces onRequest(context) middleware that evaluates env.DEPRECATED to determine if the service is deprecated. Returns 410 response with no-store cache directive if deprecated; forwards request via next() if active.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A rabbit checks the deprecated flag with glee,
410 Gone or forward—the request's decree!
No fancy cache, just a plain text reply,
Deprecation's handled as requests fly by! 🚀

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a Cloud Function (CF) for edge-level deprecation handling by returning a 410 status when deprecated.
Description check ✅ Passed The pull request description clearly relates to the changeset, explaining the addition of a middleware function to deprecate the staging deployment with a DEPRECATED flag.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In @functions/_middleware.js:
- Around line 7-16: The Response currently sets only 'Cache-Control: no-store'
which may not be honored by some CDNs/proxies; update the headers in the
Response creation (the Response return in _middleware.js) to use a stricter
cache policy such as adding 'Cache-Control: no-store, no-cache, must-revalidate,
max-age=0' and also add a CDN/proxy-focused header like 'Surrogate-Control:
no-store' (or your CDN's recommended header) to ensure edge caches don't retain
the 410 response.
- Line 19: Update the middleware to await the downstream handler by changing the
final statement from `return next()` to `return await next()` so any future
try/catch or cleanup around the call can properly observe rejections; locate the
return in the middleware function (the `return next()` statement) in
functions/_middleware.js and replace it with `return await next()`.
- Around line 2-5: The IS_DEPRECATED logic currently treats any undefined or
non-'false' value as deprecated; change it to default to not deprecated by
guarding against a missing context.env and normalizing the value before
comparison: read context.env (ensure it's not undefined), convert
context.env.DEPRECATED to a string, trim and toLowerCase it, and set
IS_DEPRECATED to true only when that normalized string equals 'true' (otherwise
false). Use the existing symbol names (context, env, IS_DEPRECATED,
env.DEPRECATED) so the change is localized and clear.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f0fd49 and cd3cd39.

📒 Files selected for processing (1)
  • functions/_middleware.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build (16.x)

@iamitprakash iamitprakash merged commit 97ea93e into develop Jan 15, 2026
7 of 8 checks passed
@iamitprakash iamitprakash deleted the chore/deprecate branch January 15, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants