Skip to content

feat: Add logLevels support to suppress deprecation warnings - #10599

Open
anaghroy wants to merge 4 commits into
parse-community:alphafrom
anaghroy:feat/acknowledge-future-defaults
Open

feat: Add logLevels support to suppress deprecation warnings#10599
anaghroy wants to merge 4 commits into
parse-community:alphafrom
anaghroy:feat/acknowledge-future-defaults

Conversation

@anaghroy

@anaghroy anaghroy commented Jul 21, 2026

Copy link
Copy Markdown

Pull Request

Issue

Closes #10584

Approach

Screenshot 2026-07-28 110813

Following the maintainers' suggestions, this PR integrates the suppression of deprecation warnings directly into the existing logLevels configuration in ParseServerOptions.

Developers can now suppress all deprecation warnings globally:

{
  logLevels: { deprecation: 'silent' }
}

@parse-github-assistant

Copy link
Copy Markdown

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant Bot changed the title feat: add acknowledgeFutureDefaults option to suppress future default deprecation warnings feat: Add acknowledgeFutureDefaults option to suppress future default deprecation warnings Jul 21, 2026
@parse-github-assistant

Copy link
Copy Markdown

🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review.

Tip

  • Keep pull requests small. Large PRs will be rejected. Break complex features into smaller, incremental PRs.
  • Use Test Driven Development. Write failing tests before implementing functionality. Ensure tests pass.
  • Group code into logical blocks. Add a short comment before each block to explain its purpose.
  • We offer conceptual guidance. Coding is up to you. PRs must be merge-ready for human review.
  • Our review focuses on concept, not quality. PRs with code issues will be rejected. Use an AI agent.
  • Human review time is precious. Avoid review ping-pong. Inspect and test your AI-generated code.

Note

Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect.

Caution

Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds configurable deprecation log levels, including global and per-option suppression. Deprecator now passes options into log dispatch, supports silent and other logger levels, and retains warning fallback behavior. Configuration typing, definitions, documentation, and suppression tests are updated.

Changes

Configurable deprecation logging

Layer / File(s) Summary
Deprecation log-level contract
src/Options/Definitions.js, src/Options/index.js, src/Options/docs.js
Adds the deprecation log-level configuration and documents acknowledgeFutureDefaults.
Deprecation log dispatch
src/Deprecator/Deprecator.js, spec/Deprecator.spec.js
Passes options into deprecation logging, resolves per-option and global levels, suppresses silent entries, falls back to warn, and tests both suppression forms.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: mtrezza


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Engage In Review Feedback ❌ Error The review note on allow-listing logger levels is still unaddressed; Deprecator.js still dynamically dispatches logger[level] without the suggested safeguard. Engage with the reviewer, then either add a valid-level allow-list before dispatch or document that the reviewer retracted the concern.
✅ Passed checks (6 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes add a dedicated deprecation log level and silent handling that suppress future-default warnings as requested in #10584.
Out of Scope Changes check ✅ Passed The generalized deprecation log-level support and related tests/docs stay aligned with the suppression goal and add no unrelated behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Security Check ✅ Passed PASS: The patch only adjusts deprecation logging/config docs; I found no new prototype-pollution, path-traversal, or command-exec pattern from the advisory classes checked.
Title check ✅ Passed The title matches the required prefix and clearly summarizes the deprecation-warning suppression change.
Description check ✅ Passed The description includes the required Pull Request, Issue, and Approach sections, but omits the Tasks checklist.
✨ 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.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 21, 2026
@anaghroy anaghroy changed the title feat: Add acknowledgeFutureDefaults option to suppress future default deprecation warnings feat: Add logLevels support to suppress deprecation warnings Jul 28, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
spec/Deprecator.spec.js (1)

38-57: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert that silent suppresses every logger method.

These tests spy only on warn, so a regression that logs through info or error would still pass. Spy on all supported logger methods (or inject a logger double) and assert that none were called.

🤖 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 `@spec/Deprecator.spec.js` around lines 38 - 57, Update both silent deprecation
tests around reconfigureServer to monitor every supported logger method, not
only logger.warn, and assert that none are invoked. Keep the existing separate
global and option-specific silent configurations and deprecation setup
unchanged.
🤖 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 `@src/Deprecator/Deprecator.js`:
- Around line 121-146: Restrict the configuration-derived level in the
deprecation logging flow to the documented logger levels plus the special
`silent` value before dynamic dispatch. Update the `logger[level]` check to
reject inherited or unsupported callable properties, while preserving the early
return for `silent` and the existing `logger.warn(output)` fallback for invalid
levels.

---

Nitpick comments:
In `@spec/Deprecator.spec.js`:
- Around line 38-57: Update both silent deprecation tests around
reconfigureServer to monitor every supported logger method, not only
logger.warn, and assert that none are invoked. Keep the existing separate global
and option-specific silent configurations and deprecation setup unchanged.
🪄 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 Plus

Run ID: a329c504-3d40-463f-9838-d7f22ff43b1c

📥 Commits

Reviewing files that changed from the base of the PR and between 4753a72 and 6819b18.

📒 Files selected for processing (4)
  • spec/Deprecator.spec.js
  • src/Deprecator/Deprecator.js
  • src/Options/Definitions.js
  • src/Options/index.js

Comment on lines +121 to +146
// Determine the log level
const logLevels = (options && options.logLevels) || {};
let level = 'warn';
if (key && logLevels[`deprecation_${key}`]) {
level = logLevels[`deprecation_${key}`];
} else if (logLevels['deprecation']) {
level = logLevels['deprecation'];
}

if (level === 'silent') {
return;
}

// Compose message
let output = `DeprecationWarning: The Parse Server ${type} '${key}' `;
output += changeNewKey != null ? `is deprecated and will be ${keyAction} in a future version.` : '';
output += changeNewDefault
? `default will change to '${changeNewDefault}' in a future version.`
: '';
output += solution ? ` ${solution}` : '';
logger.warn(output);

if (typeof logger[level] === 'function') {
logger[level](output);
} else {
logger.warn(output);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Allow-list log levels before dynamic dispatch.

level is configuration-controlled, but typeof logger[level] === 'function' also accepts inherited callable properties such as constructor. Calling logger.constructor(output) can throw during startup, while values like toString silently avoid logging. Restrict dispatch to the documented logger levels plus the special silent value, then retain the warning fallback for invalid values.

Proposed fix
+const validLevels = new Set(['error', 'warn', 'info', 'verbose', 'debug', 'silly']);
+
-    if (typeof logger[level] === 'function') {
+    if (validLevels.has(level) && typeof logger[level] === 'function') {
       logger[level](output);
     } else {
       logger.warn(output);
     }
📝 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
// Determine the log level
const logLevels = (options && options.logLevels) || {};
let level = 'warn';
if (key && logLevels[`deprecation_${key}`]) {
level = logLevels[`deprecation_${key}`];
} else if (logLevels['deprecation']) {
level = logLevels['deprecation'];
}
if (level === 'silent') {
return;
}
// Compose message
let output = `DeprecationWarning: The Parse Server ${type} '${key}' `;
output += changeNewKey != null ? `is deprecated and will be ${keyAction} in a future version.` : '';
output += changeNewDefault
? `default will change to '${changeNewDefault}' in a future version.`
: '';
output += solution ? ` ${solution}` : '';
logger.warn(output);
if (typeof logger[level] === 'function') {
logger[level](output);
} else {
logger.warn(output);
}
// Determine the log level
const logLevels = (options && options.logLevels) || {};
const validLevels = new Set(['error', 'warn', 'info', 'verbose', 'debug', 'silly']);
let level = 'warn';
if (key && logLevels[`deprecation_${key}`]) {
level = logLevels[`deprecation_${key}`];
} else if (logLevels['deprecation']) {
level = logLevels['deprecation'];
}
if (level === 'silent') {
return;
}
// Compose message
let output = `DeprecationWarning: The Parse Server ${type} '${key}' `;
output += changeNewKey != null ? `is deprecated and will be ${keyAction} in a future version.` : '';
output += changeNewDefault
? `default will change to '${changeNewDefault}' in a future version.`
: '';
output += solution ? ` ${solution}` : '';
if (validLevels.has(level) && typeof logger[level] === 'function') {
logger[level](output);
} else {
logger.warn(output);
}
🤖 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 `@src/Deprecator/Deprecator.js` around lines 121 - 146, Restrict the
configuration-derived level in the deprecation logging flow to the documented
logger levels plus the special `silent` value before dynamic dispatch. Update
the `logger[level]` check to reject inherited or unsupported callable
properties, while preserving the early return for `silent` and the existing
`logger.warn(output)` fallback for invalid levels.

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.

Add a way to acknowledge or suppress warnings for upcoming default option changes

1 participant