Skip to content

Conversation

swittk
Copy link

@swittk swittk commented Oct 7, 2025

Pull Request

Issue

Closes: #9869

Approach

  • Added an opt-in ignoreIncludeErrors boolean query option that flows from the routers through RestQuery, defaulting to the existing strict behaviour (throws Parse.Error.OBJECT_OBJECT_NOT_FOUND when included fields on Query/FetchWithInclude are no longer accessible).
  • When the ignoreIncludeErrors flag is set; Update include hydration with so unresolved pointers are left in place instead of throwing (current behavior) when the flag is set; arrays keep their original ordering and any missing entries stay as raw pointer JSON.
    • Edited the database controller to bypass the 101 error for nested FETCH/GET operations only when the option is enabled, while preserving all ACL/CLP enforcement.
  • Added REST tests that cover both unreadable pointers and partially missing arrays to prove the relaxed behaviour.

Tasks

  • Add tests
  • Add changes to documentation (guides, repository pages, code comments)

Summary by CodeRabbit

  • New Features

    • Added an optional ignoreIncludeErrors flag for GET/FIND requests. When enabled, responses tolerate unreadable or unresolved included pointers (including inside arrays), returning 200 and preserving placeholder pointers/objects instead of failing.
  • Behavior

    • Default behavior unchanged: without the flag, requests may return 404/OBJECT_NOT_FOUND if includes can’t be hydrated.
  • Tests

    • Added tests verifying unreadable/unresolved include pointers and array scenarios with and without the flag.

Copy link

parse-github-assistant bot commented Oct 7, 2025

🚀 Thanks for opening this pull request!

Copy link

coderabbitai bot commented Oct 7, 2025

📝 Walkthrough

Walkthrough

Adds a per-request ignoreIncludeErrors flag across REST GET/FIND flows. Routers accept and propagate the flag; RestQuery threads a preserveMissing option into pointer replacement to preserve unreadable/unresolved pointers; DatabaseController.find may return [] for get when include filtering removes the target and the flag is true. Tests added.

Changes

Cohort / File(s) Summary of Changes
Tests: include error tolerance
spec/rest.spec.js
Adds tests verifying ignoreIncludeErrors behavior: unreadable pointers preserved as Pointer objects when flag is true; arrays preserve unresolved pointers; 404 returned when include hydration fails without the flag.
Routing / request parsing
src/Routers/ClassesRouter.js
Accepts ignoreIncludeErrors in GET query params and FIND bodies, coerces/validates to boolean, adds it to options passed to REST handling; extends allowed GET query keys.
Query options surface
src/Adapters/Storage/StorageAdapter.js
Adds ignoreIncludeErrors?: boolean to the QueryOptions type.
Database get/find behavior
src/Controllers/DatabaseController.js
Adds ignoreIncludeErrors to find options; when op is 'get' and permission/include filtering yields no query, returns [] instead of throwing OBJECT_NOT_FOUND if the flag is true.
Include resolution and pointer replacement
src/RestQuery.js
Propagates ignoreIncludeErrors via preserveMissing; replacePointers accepts an options param and preserves unresolved/unreadable pointers (including array elements) when requested, threading options through recursive calls.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant R as ClassesRouter
  participant Q as RestQuery
  participant D as DatabaseController
  participant S as StorageAdapter

  Note over C,R: GET /classes/:class/:id?include=...&ignoreIncludeErrors=true
  C->>R: HTTP GET (include + ignoreIncludeErrors=true)
  R->>Q: build RestQuery (ignoreIncludeErrors=true)
  Q->>D: find(op='get', options.ignoreIncludeErrors=true)
  D->>S: query for include targets
  alt include targets unreadable/missing
    S-->>D: no readable matches
    D-->>Q: return [] (instead of OBJECT_NOT_FOUND due to flag)
  else include targets found
    S-->>D: matched records
    D-->>Q: include records
  end
  Q->>Q: replacePointers(preserveMissing=true)
  Note over Q: unresolved/unreadable pointers preserved (Pointer objects remain)
  Q-->>R: result with preserved pointers
  R-->>C: 200 OK
Loading
sequenceDiagram
  autonumber
  participant C as Client
  participant R as ClassesRouter
  participant Q as RestQuery
  participant D as DatabaseController

  Note over C,R: GET with include, ignoreIncludeErrors not set
  C->>R: HTTP GET
  R->>Q: build RestQuery (no ignoreIncludeErrors)
  Q->>D: find(op='get', options.ignoreIncludeErrors=false)
  alt include permission/filtering removes target
    D-->>Q: throws OBJECT_NOT_FOUND
    Q-->>R: propagate error
    R-->>C: 404 OBJECT_NOT_FOUND
  else include targets resolved
    D-->>Q: include records
    Q-->>R: hydrated object
    R-->>C: 200 OK
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title Check ✅ Passed The title clearly and concisely summarizes the primary change by describing the new ignoreIncludeErrors flag and its effect on include target errors during fetch and query operations. It uses straightforward phrasing without unnecessary detail or jargon and aligns directly with the implemented feature. The conventional commit prefix “feat:” appropriately signals a new feature addition.
Description Check ✅ Passed The description follows the repository template by including the Pull Request header, issue linkage with the correct issue URL, a detailed Approach section explaining the feature and control flow changes, and a Tasks checklist reflecting tests added and documentation pending. All required sections are present and appropriately populated, and non-applicable tasks have been removed.
✨ 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.

@parseplatformorg
Copy link
Contributor

parseplatformorg commented Oct 7, 2025

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.

@swittk swittk changed the title Feature: Ignore missing include targets (on fetch & query) with optional ignoreIncludeErrors flag. feature: Ignore missing include targets (on fetch & query) with optional ignoreIncludeErrors flag. Oct 7, 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)
src/RestQuery.js (1)

1116-1119: Clean up the lingering TODO

We’re shipping with a TODO that questions whether the new behavior is correct; please replace it with a concrete explanation (or remove it) so the intent is clear to future readers.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between be362fe and 7e4e987.

📒 Files selected for processing (5)
  • spec/rest.spec.js (1 hunks)
  • src/Adapters/Storage/StorageAdapter.js (1 hunks)
  • src/Controllers/DatabaseController.js (2 hunks)
  • src/RestQuery.js (7 hunks)
  • src/Routers/ClassesRouter.js (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/Routers/ClassesRouter.js (2)
src/PromiseRouter.js (1)
  • body (141-141)
src/Controllers/DatabaseController.js (1)
  • options (1790-1790)
spec/rest.spec.js (2)
src/RestQuery.js (1)
  • schemaController (789-789)
src/rest.js (1)
  • schemaController (71-71)

@swittk swittk changed the title feature: Ignore missing include targets (on fetch & query) with optional ignoreIncludeErrors flag. feat: Ignore missing include targets (on fetch & query) with optional ignoreIncludeErrors flag. Oct 7, 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)
src/RestQuery.js (1)

1116-1119: Clean up the lingering TODO.

This TODO leaves an unresolved question in production code. With preserveMissing we keep the original pointer object, so arrays shouldn’t accrue undefined entries. Please drop the TODO (or replace it with a concrete assertion/test) before merging.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7e4e987 and 1c2b0e2.

📒 Files selected for processing (2)
  • spec/rest.spec.js (1 hunks)
  • src/RestQuery.js (7 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • spec/rest.spec.js

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.

include on Queries can cause root query to fail with 101 when an included pointer is deleted / unreadable, without indicating which parent field failed.
2 participants