Skip to content

Update shutdown.ts#9

Open
hearhour wants to merge 1 commit intoR44VC0RP:mainfrom
hearhour:patch-1
Open

Update shutdown.ts#9
hearhour wants to merge 1 commit intoR44VC0RP:mainfrom
hearhour:patch-1

Conversation

@hearhour
Copy link

@hearhour hearhour commented Mar 25, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Corrected default shutdown behavior. The shutdown feature is now disabled by default instead of enabled, requiring explicit configuration to activate. Previously, shutdown was enabled unless explicitly disabled; this change reverses that default, improving security by requiring intentional enablement.

@vercel
Copy link
Contributor

vercel bot commented Mar 25, 2026

@hearhour is attempting to deploy a commit to the exon Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Mar 25, 2026

📝 Walkthrough

Walkthrough

The parseShutdownFlag function in lib/shutdown.ts now defaults to returning false instead of true when the shutdown flag value is undefined or missing, inverting the default behavior for the PROJECT_SHUTDOWN_ENABLED feature flag.

Changes

Cohort / File(s) Summary
Shutdown Flag Logic
lib/shutdown.ts
Modified parseShutdownFlag to return false by default when the environment variable is undefined, instead of true. Values in DISABLED_VALUES ("0", "false", "off", "no") continue to be treated as disabled.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A rabbit flips the switch with glee, 🐰
The shutdown flag now defaults free,
From true to false it turns today,
No more unwanted slowdowns' way! 🚫✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Update shutdown.ts' is vague and generic, describing only the file being modified without conveying the meaningful change (default behavior reversal for shutdown flag). Consider a more descriptive title like 'Default PROJECT_SHUTDOWN_ENABLED to false' or 'Change shutdown flag default behavior' to better communicate the functional change.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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: 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 `@lib/shutdown.ts`:
- Line 5: Restore the fail-closed default by changing the return in
lib/shutdown.ts from false back to true so that missing/undefined
PROJECT_SHUTDOWN_ENABLED results in shutdown enabled; update any code that reads
PROJECT_SHUTDOWN_ENABLED (see references in proxy.ts and app/page.ts) to rely on
this centralized behavior, and ensure next.config.ts remains consistent with the
same default; keep the constant/variable name PROJECT_SHUTDOWN_ENABLED and the
existing function in lib/shutdown.ts (the one returning the boolean) as the
single source of truth for this gating change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 21e9b82c-2c48-4c21-8db8-d1cfe85a1b42

📥 Commits

Reviewing files that changed from the base of the PR and between d7673de and 36e014f.

📒 Files selected for processing (1)
  • lib/shutdown.ts

function parseShutdownFlag(value: string | undefined): boolean {
if (!value) {
return true;
return false;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Defaulting shutdown to false introduces fail-open behavior and inconsistent gating.

Line 5 flips missing/undefined env handling to live mode. That enables traffic in paths using PROJECT_SHUTDOWN_ENABLED (proxy.ts, app/page.tsx), while next.config.ts still treats missing as shutdown by default, creating split behavior across modules.

Please either keep fail-closed default (true) or update all shutdown checks together with an explicit migration plan.

Suggested fix (restore fail-closed default)
 function parseShutdownFlag(value: string | undefined): boolean {
   if (!value) {
-    return false;
+    return true;
   }

   return !DISABLED_VALUES.has(value.trim().toLowerCase());
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return false;
function parseShutdownFlag(value: string | undefined): boolean {
if (!value) {
return true;
}
return !DISABLED_VALUES.has(value.trim().toLowerCase());
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/shutdown.ts` at line 5, Restore the fail-closed default by changing the
return in lib/shutdown.ts from false back to true so that missing/undefined
PROJECT_SHUTDOWN_ENABLED results in shutdown enabled; update any code that reads
PROJECT_SHUTDOWN_ENABLED (see references in proxy.ts and app/page.ts) to rely on
this centralized behavior, and ensure next.config.ts remains consistent with the
same default; keep the constant/variable name PROJECT_SHUTDOWN_ENABLED and the
existing function in lib/shutdown.ts (the one returning the boolean) as the
single source of truth for this gating change.

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.

1 participant