parse-community / parse-community/parse-server

Feature `directAccess` without tests

Open
#8,808 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:ci
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

New Issue Checklist
Issue Description

The directAccess feature defaults to being enabled since Parse Server 6. This was a decision made after the feature has been in an experimental state for years (introduced in 2017) and used by developers in production environments. The goal was to make the feature broadly available to mature it faster and fix any bugs reported.

However, it seems that the feature itself is not tested - at all - in our CI. In fact, not a single test runs with directAccess enabled. The test suite does not allow to use the ParseServerRESTController because the test helper always sets the normal REST controller:

https://github.com/parse-community/parse-server/blob/4b3ce20300b05b015b48efeb82d693200159911f/spec/helper.js#L169

This overrides the server config for tests which is deliberately set to enable direct access:

https://github.com/parse-community/parse-server/blob/4b3ce20300b05b015b48efeb82d693200159911f/spec/helper.js#L109

So even if calling await reconfigureServer({ directAccess: true }); in a test, the normal REST controller will be used.

That override was added in https://github.com/parse-community/parse-server/pull/8232. From the past discussions around officially releasing the directAccess feature it seems this was added to make the tests pass, as the refactor would have been to vast to run all the tests once with directAccess enabled and once with directAccess disabled.

The fact that the tests run without directAcess enabled while at the same time directAcess is enabled by default in Parse Server is a contradiction that can easily lead to - especially Cloud Code related - bugs not being discovered by the CI. For example https://github.com/parse-community/parse-server/issues/8806.

Removing the REST controller override to run tests with directAccess: true causes 403 tests to fail, see https://github.com/parse-community/parse-server/pull/8807.

Solution

We should probably run the CI with directAccess enabled and disabled. Running every CI job twice would consume a lot of resources. Instead, depending which of the two the CI should focus on, at least 1 job could run with directAccess enabled and the rest of the jobs with directAccess disabled, or vice-versa.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in spec/helper.js at the directAccess configuration and REST controller override, then inspect src/ParseServerRESTController.js. Reproduce the 403 failures described in pull request 8807 and review issue 8806 for an affected case. Done means CI exercises directAccess-enabled and disabled configurations without masking the selected mode, with the relevant tests passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
api, ci-cd, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.