Skip to content

Conversation

@mtrezza
Copy link
Member

@mtrezza mtrezza commented Nov 17, 2025

Pull Request

Issue

The deprecator incorrectly handles nested option keys like databaseOptions.allowPublicExplain as it doesn't consider the dot notation to access nested properties.

Approach

Parse dot notation of deprecated option keys.

@parse-github-assistant
Copy link

parse-github-assistant bot commented Nov 17, 2025

🚀 Thanks for opening this pull request!

@parseplatformorg
Copy link
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@coderabbitai
Copy link

coderabbitai bot commented Nov 17, 2025

📝 Walkthrough

Walkthrough

This pull request introduces support for nested option key deprecation handling. A new utility method getNestedProperty is added to traverse objects using dot notation, the Deprecator is updated to use this method for checking nested option values, and comprehensive tests are added for both the new utility and the updated deprecation logic.

Changes

Cohort / File(s) Change Summary
Utility Implementation
src/Utils.js
Added new static method getNestedProperty(obj, path) that traverses an object using dot-separated keys, returning the nested value or undefined if any step is missing or non-object.
Deprecator Update
src/Deprecator/Deprecator.js
Modified the deprecation check to use Utils.getNestedProperty(options, optionKey) instead of direct property access options[optionKey], enabling support for nested option keys.
Test Suite for Utility
spec/Utils.spec.js
Added comprehensive test suite for Utils.getNestedProperty covering: top-level access, nested dot notation, undefined results, non-object traversal, null inputs, empty paths, and primitive values.
Test Suite for Deprecator
spec/Deprecator.spec.js
Added two new tests: one verifying deprecation warnings for nested option keys with dot notation, and one verifying no warning is logged when a nested option is manually set.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10–15 minutes

  • src/Utils.js: The utility function is straightforward with clear input validation and early returns; review the traversal logic and edge case handling.
  • src/Deprecator/Deprecator.js: Single-line functional change with minimal impact; verify the replacement is semantically equivalent and handles nested keys correctly.
  • spec/Utils.spec.js and spec/Deprecator.spec.js: Test files follow existing patterns and are well-structured; verify test assertions align with the utility behavior.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains the required template structure but the Approach section is empty and the Issue field shows 'FILL_THIS_OUT' instead of an actual issue link. Fill in the Issue field with an actual issue link and provide a detailed description of the changes in the Approach section.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main fix: addressing deprecation warnings for nested Parse Server options that are explicitly set.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@mtrezza mtrezza changed the title fix: Deprecator warning logged at server launch despite explicitly set Parse Server options fix: Deprecation warning logged at server launch for nested Parse Server option even if option is explicitly set Nov 17, 2025
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: 0

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

62-72: Remove unused Config variable.

Line 68 retrieves the Config but never uses it. This appears to be leftover code from development.

Apply this diff:

   spyOn(Deprecator, '_getDeprecations').and.callFake(() => deprecations);
   const logSpy = spyOn(Deprecator, '_logOption').and.callFake(() => {});
-  const Config = require('../lib/Config');
-  const config = Config.get('test');
   // Directly test scanParseServerOptions with nested option set
   Deprecator.scanParseServerOptions({ databaseOptions: { allowPublicExplain: true } });
   expect(logSpy).not.toHaveBeenCalled();

Note: The direct call to scanParseServerOptions is a valid unit testing approach, though it differs from the pattern used in the earlier test (lines 29-36) which uses reconfigureServer. Both approaches are acceptable.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e15403 and 2fd7c12.

📒 Files selected for processing (4)
  • spec/Deprecator.spec.js (1 hunks)
  • spec/Utils.spec.js (1 hunks)
  • src/Deprecator/Deprecator.js (2 hunks)
  • src/Utils.js (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: mtrezza
Repo: parse-community/parse-server PR: 0
File: :0-0
Timestamp: 2025-11-08T13:46:04.940Z
Learning: When reviewing Parse Server PRs that add new features, always check whether the feature is documented in the README.md file, though for new Parse Server options this is optional rather than required.
Learnt from: mtrezza
Repo: parse-community/parse-server PR: 0
File: :0-0
Timestamp: 2025-11-17T15:02:24.824Z
Learning: For Parse Server PRs, always suggest an Angular-style PR title that would make a meaningful changelog entry for developers. Update the PR title suggestion with every new commit to the PR.
Learnt from: mtrezza
Repo: parse-community/parse-server PR: 0
File: :0-0
Timestamp: 2025-11-08T13:46:04.940Z
Learning: For new Parse Server options, verify that the option is documented in src/Options/index.js and that npm run definitions has been executed to reflect changes in src/Options/docs.js and src/Options/Definitions.js. README.md documentation is a bonus but not required for new options.
Learnt from: mtrezza
Repo: parse-community/parse-server PR: 0
File: :0-0
Timestamp: 2025-11-17T15:02:48.786Z
Learning: For Parse Server PRs, always suggest an Angular commit convention PR title that would make a meaningful changelog entry for developers. Update the PR title suggestion on every commit. The format should be: type(scope): description. Common types include feat, fix, perf, refactor, docs, test, chore. The scope should identify the subsystem (e.g., graphql, rest, push, security). The description should be action-oriented and clearly convey the change's impact to developers.
📚 Learning: 2025-11-08T13:46:04.940Z
Learnt from: mtrezza
Repo: parse-community/parse-server PR: 0
File: :0-0
Timestamp: 2025-11-08T13:46:04.940Z
Learning: For new Parse Server options, verify that the option is documented in src/Options/index.js and that npm run definitions has been executed to reflect changes in src/Options/docs.js and src/Options/Definitions.js. README.md documentation is a bonus but not required for new options.

Applied to files:

  • spec/Deprecator.spec.js
📚 Learning: 2025-10-16T19:27:05.311Z
Learnt from: Moumouls
Repo: parse-community/parse-server PR: 9883
File: spec/CloudCodeLogger.spec.js:410-412
Timestamp: 2025-10-16T19:27:05.311Z
Learning: In spec/CloudCodeLogger.spec.js, the test "should log cloud function triggers using the silent log level" (around lines 383-420) is known to be flaky and requires the extra `await new Promise(resolve => setTimeout(resolve, 100))` timeout after awaiting `afterSavePromise` for reliability, even though it may appear redundant.

Applied to files:

  • spec/Deprecator.spec.js
📚 Learning: 2025-05-04T20:41:05.147Z
Learnt from: mtrezza
Repo: parse-community/parse-server PR: 9445
File: spec/ParseLiveQuery.spec.js:1312-1338
Timestamp: 2025-05-04T20:41:05.147Z
Learning: New tests in the parse-server repository should use async/await with promise-based patterns rather than callback patterns with `done()`.

Applied to files:

  • spec/Deprecator.spec.js
📚 Learning: 2025-05-09T09:59:06.289Z
Learnt from: mtrezza
Repo: parse-community/parse-server PR: 9445
File: spec/ParseLiveQuery.spec.js:1340-1375
Timestamp: 2025-05-09T09:59:06.289Z
Learning: Tests in the parse-server repository should use promise-based approaches rather than callback patterns with `done()`. Use a pattern where a Promise is created that resolves when the event occurs, then await that promise.

Applied to files:

  • spec/Deprecator.spec.js
📚 Learning: 2025-05-09T09:59:06.289Z
Learnt from: mtrezza
Repo: parse-community/parse-server PR: 9445
File: spec/ParseLiveQuery.spec.js:1340-1375
Timestamp: 2025-05-09T09:59:06.289Z
Learning: New tests in the parse-server repository should use async/await with promise-based patterns rather than callback patterns with `done()`. The preferred pattern is to create a Promise that resolves when an expected event occurs, then await that Promise.

Applied to files:

  • spec/Deprecator.spec.js
🧬 Code graph analysis (3)
spec/Deprecator.spec.js (1)
spec/helper.js (1)
  • reconfigureServer (180-214)
src/Deprecator/Deprecator.js (1)
src/cli/utils/commander.js (1)
  • options (77-77)
src/Utils.js (1)
src/Controllers/DatabaseController.js (1)
  • path (1836-1836)
⏰ 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). (15)
  • GitHub Check: Node 18
  • GitHub Check: PostgreSQL 15, PostGIS 3.3
  • GitHub Check: Docker Build
  • GitHub Check: PostgreSQL 15, PostGIS 3.4
  • GitHub Check: Redis Cache
  • GitHub Check: Node 22
  • GitHub Check: MongoDB 7, ReplicaSet
  • GitHub Check: PostgreSQL 18, PostGIS 3.6
  • GitHub Check: Node 20
  • GitHub Check: PostgreSQL 15, PostGIS 3.5
  • GitHub Check: MongoDB 6, ReplicaSet
  • GitHub Check: MongoDB 8, ReplicaSet
  • GitHub Check: PostgreSQL 16, PostGIS 3.5
  • GitHub Check: PostgreSQL 17, PostGIS 3.5
  • GitHub Check: Benchmarks
🔇 Additional comments (5)
spec/Utils.spec.js (1)

126-175: LGTM! Comprehensive test coverage for the new utility.

The test suite thoroughly covers all relevant scenarios including edge cases (null objects, empty paths, falsy values). The tests follow existing patterns and properly validate the nested property access functionality.

src/Deprecator/Deprecator.js (2)

3-3: LGTM! Correct import for nested property access.

The Utils import is properly added to support nested option key traversal.


25-25: LGTM! Correctly implements nested option key support.

Replacing direct property access with Utils.getNestedProperty enables the Deprecator to correctly handle dot-notated option keys like databaseOptions.allowPublicExplain, fixing the issue where deprecation warnings were incorrectly logged for explicitly set nested options.

src/Utils.js (1)

448-471: LGTM! Clean and well-documented utility method.

The implementation correctly handles nested property traversal with proper edge case handling (null objects, non-object traversal, empty paths). The JSDoc documentation is clear and includes a helpful example.

spec/Deprecator.spec.js (1)

49-60: LGTM! Correct test for nested option deprecation.

The test properly validates that deprecation warnings are logged for nested option keys when they are not explicitly set. Uses the existing test pattern with reconfigureServer() and logger spy.

@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.06%. Comparing base (5e15403) to head (2fd7c12).
⚠️ Report is 2 commits behind head on alpha.

Additional details and impacted files
@@           Coverage Diff           @@
##            alpha    #9934   +/-   ##
=======================================
  Coverage   93.05%   93.06%           
=======================================
  Files         187      187           
  Lines       15243    15253   +10     
  Branches      177      177           
=======================================
+ Hits        14185    14195   +10     
  Misses       1046     1046           
  Partials       12       12           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mtrezza mtrezza merged commit c22cb0a into parse-community:alpha Nov 17, 2025
26 of 28 checks passed
@mtrezza mtrezza deleted the fix/deprecator-log branch November 17, 2025 18:43
parseplatformorg pushed a commit that referenced this pull request Nov 17, 2025
# [8.5.0-alpha.11](8.5.0-alpha.10...8.5.0-alpha.11) (2025-11-17)

### Bug Fixes

* Deprecation warning logged at server launch for nested Parse Server option even if option is explicitly set ([#9934](#9934)) ([c22cb0a](c22cb0a))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 8.5.0-alpha.11

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:released-alpha Released as alpha version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants