Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.10.0 #1457

Merged
merged 57 commits into from Sep 9, 2019

Conversation

@Aschen
Copy link
Contributor

commented Sep 9, 2019

1.10.0 (2019-09-12)

Bug

  • [ #1455 ] Fix init indices containing a dot (benoitvidis)
  • [ #1451 ] Fix document:mGet to return a partial error with missing docs (Aschen)
  • [ #1454 ] Fix a bug that prevents Kuzzle to shutdown (Aschen)
  • [ #1437 ] Fix hydrating a profile with unexisting role (Yoann-Abbes)
  • [ #1433 ] Fix cache roles and profiles (Yoann-Abbes)
  • [ #1400 ] Fix building KuzzleErrors with non KuzzleError for errorsManager (Yoann-Abbes)
  • [ #1407 ] Fix a crash occuring when trying to ping dead sockets (scottinet)
  • [ #1380 ] Fix wrong return value for collection:truncate (Aschen)
  • [ #1375 ] Always set the content length for HTTP responses (scottinet)

New features

Enhancements


Yoann-Abbes and others added 30 commits Aug 2, 2019
Add subcodes to Plugins core service (#1358)
## What does this PR do ?

Jira : [Subtask](https://jira.kaliop.net/browse/KZL-1199) from this [story](https://jira.kaliop.net/browse/KZL-1192)

Add subcodes to Plugins core service

### How should this be manually tested?

unit/functional tests

### Boyscout

80 columns

Add a "@ deprecated" comment for Sandbox and ProxyBroker modules
Add subcodes core embedded entrypoint (#1362)
## What does this PR do ?

Jira : [Subtask](https://jira.kaliop.net/browse/KZL-1200) from this [story](https://jira.kaliop.net/browse/KZL-1192)

### How should this be manually tested?

unit tests

### Boyscout

80 columns
Add subcodes to Protocols (#1361)
What does this PR do ?
Jira : Story

Add subcodes to Protocols

Add/adapt unit test.

How should this be manually tested?
unit/functional tests

Boyscout
80 columns
add tag "deprecated" for IndexCache
Add subcodes to Validation core service (#1357)
What does this PR do ?
Jira : Subtask from this story

Add subcodes to Validation core service
adapt unit test.

How should this be manually tested?
unit/functional tests

Boyscout
80 columns
Make some realtime API actions available to plugins (#1360)
Add availability of some realtime methods in plugins (all instead of subscribe and unsubscribe).
Always set the content length for HTTP responses (#1375)

Before this PR we never set the Content-Length header for HTTP responses. This wasn't a problem, until one of our users made their plugin set one, and when a requesting client asked for a compressed response: the content length set by our user plugin couldn't be the same than the compressed payload, and this resulted in errors with, for instance, the SPDY protocol.

This PR makes Kuzzle always set the Content-Length header, overwritting it if it's already set.
Add subcodes to kuzzle core entrypoints (#1333)
## What does this PR do ?

Jira : [Subtask](https://jira.kaliop.net/browse/KZL-1200) from this [story](https://jira.kaliop.net/browse/KZL-1192)

This PR is to merge into the `KZL-1035-subcode-error` [(here)](#1306) branch, such as the PRs to come.

Add subcodes to : 
`authController`
`adminController`
`bulkController`
`securityController`
`memoryStorage`
`funnelController`
`collectionController`
`indexController`
`documentController`

Add/adapt unit test.

Did not do for `PluginImplementationError`, it will be in another PR (it's another [subtask](https://jira.kaliop.net/browse/KZL-1199))

### How should this be manually tested?

unit tests

### Boyscout

80 columns
Add the fields that triggered update notifications (#1364)
## What does this PR do ?

See the PR title

https://jira.kaliop.net/browse/KZL-1127

### How should this be manually tested?

Execute this script and see the notification:

```
const {
    Kuzzle,
    WebSocket
} = require('kuzzle-sdk');

const kuzzle = new Kuzzle(
    new WebSocket('localhost')
);

function callback (notification) {
    console.log(notification);
}

kuzzle.on('networkError', error => {
    console.error('Network Error:', error);
});

const run = async () => {
    try {
        await kuzzle.connect();
        await kuzzle.document.createOrReplace(
            'nyc-open-data',
            'yellow-taxi',
            'some-id',
            { capacity: 4, members: 5 },
        );
        const filters = { exists: 'capacity' };
        await kuzzle.realtime.subscribe('nyc-open-data', 'yellow-taxi', filters, callback);
        const response = await kuzzle.document.update(
            'nyc-open-data',
            'yellow-taxi',
            'some-id',
            { capacity: 100, members: 50 }
        );
        console.log(response);
    } catch (error) {
        console.error(error.message);
    } finally {
        kuzzle.disconnect();
    }
};
run();
```
Add revokeTokens route to Security Controller (#1374)
Adds a revokeTokens route to the security controller, with tests and documentation page
add subcode for redis service (#1376)
## What does this PR do ?

Jira : [Story](https://jira.kaliop.net/browse/KZL-1188)

Add subcodes to Redis Service

Add/adapt unit test.

### How should this be manually tested?

unit/functional tests

### Boyscout

format code
Add more subcodes to controllers (#1383)
## What does this PR do ?

This PR complete the implementation of error subcodes in the controllers
It also adds them in the `repositories`

### How should this be manually tested?

  - Step 1 :
  - Step 2 :
  - Step 3 :  
  ...

### Other changes

Adds a function who checks if each error code is unique
Add more subcodes error for PluginImplementationError (#1378)
This PR adds more error subcodes, especially for the PluginImplementationError at differents parts of the kuzzle core
Add subcodes to HttpRouter (#1377)
What does this PR do ?
This PR continues to add subcodes to the kuzzle core
Here for the httpRouter

How should this be manually tested?
unit/functionals tests

Other changes
Delete protocols and entrypoints domain
Create a network domain with all protocols and entrypoints subdomain

Boyscout
wrap 80 column
Add test for duplicates errors codes in config files (#1387)
What does this PR do ?
This PR adds a test for errors config files by testing if domains codes are unique.
Same for subdomains, and errors.

How should this be manually tested?
Duplicate a code either for the domain, subdomain or an error, then start Kuzzle.
For instance you can open the api.json file, and give the same code for document and index subdomains
You should have an error
Modifying these json config files doesnt trigger the hot reload

Other changes
Finds duplicate and fix it
Add option to logout to revoke all sessions at once (#1381)
Add option to logout to revoke all sessions at once
Fix wrong return value from collection:truncate (#1380)
Currently collection:truncate returns the list of deleted document IDs.
This PR change the return value to match the documentation with { acknowledged: true }
Add more error subcodes in core components (#1389)
## What does this PR do ?

Adds more error subcodes for internal domain

### How should this be manually tested?

  - Step 1 :
  - Step 2 :
  - Step 3 :  
  ...
Add subcode to ESWrapper (#1390)
What does this PR do ?

Add subcode to ESWrapper
Other changes

    change errorName from domain-subdomain-error to domain.subdomain.error (eg: errorName: 'external.elasticsearch.index_or_collection_does_not_exist')
Improve DRY with Anchors and add missing caches (#1394)
* Improve DRY with Anchors and add missing caches

* Cache node_modules in integration tests builds

* Add cache on Ruby Gems

* Cache doc framework node_modules

* Don't remove node_modules in CI environment

* Add cache on unit tests

* Apply @benoitvidis nitpickings

* Apply @Aschen requested changes

* Remove doc framework node_modules caching
scottinet and others added 22 commits Aug 26, 2019
Fix error codes generation (#1404)
Description

Error codes where improperly generated.

For instance, the following: domain=2, subdomain=8, error=245
gave the following code: 245
instead of the expected (int32) 34078965 (hexadecimal: 0x020800f5, can be verified with Number(34078965).toString(16))
Other changes

Moved config/throw.js unit tests from the test/api/kuzzle.test.js file to a new test/config/throw.test.js one
Add subcodes documentation (#1398)
This PR adds a little script which generate the documentation about every available subcodes

How should this be manually tested?
node lib/util/generate-subcodes-doc
Go to doc/1/api/essentials/errors/subcodes/
[tests] fix always succeeding tests (#1406)
The majority of unit tests on the HTTP router are written in such a way that they can never fail. This PR fixes those tests.

This is an adaptation of some of the changes made #1401
Fix a crash occuring when trying to ping dead sockets (#1407)
Description

Fix a rare crash that might occur within the WebSocket entrypoint, when a socket is closed just before a heartbeat occurs. If that happens at just the "right" time, then a heartbeat can start before that socket "close" event is processed and before that socket is marked as dead.

If that happens, pinging that socket results in an exception being thrown. Since it is not caught, this results in an unhandled exception, trapped by Kuzzle and triggering a graceful shutdown.
Add '--enable-plugins' option to 'start' CLI command (#1409)
Add a new action to kuzzle start CLI command. This new option allow users to load 'on the fly' plugins disabled ('not in plugins/enabled directory) but saved in plugins/available.
Add subcodes error to requestAssertions (#1413)
Add subcodes error to requestAssertions
Add event on new/removed connection (#1417)
## What does this PR do ?

Add two events on new/removed connections:
  - `connection:add`
  - `connection:remove`

The payload is the following:

| Properties   | Type              | Description                    |
| ------------ | ----------------- | ------------------------------ |
| `id`      | <pre>string</pre> | Connection unique ID              |
| `protocol` | <pre>string</pre> | Protocol name (eg: `websocket`, `http`, etc.)      |
| `headers` | <pre>object</pre> | Protocol specific headers                |
| `ips`      | <pre>array</pre> | Array of ips addresses              |
Fix building KuzzleErrors with non KuzzleError for errorsManager (#1400)
## What does this PR do ?

This PR fixes the cases where a non KuzzleError is handled by the errorsManager.
Before it, the stack trace was override.
Now it properly builds the error and retrieves the stack-trace and the message

2-dev PR #1416

### How should this be manually tested?

When you define an error, you just have to name it starting with `derived` so KuzzleError class will handle it in its constructor.
Add ability to use errorsManager in plugins (#1391)
## What does this PR do ?

PR on 2-dev #1421

For now the new `errorsManager` was only exposed in the kuzzle core.
This PR allows users to use it inside their plugins by defining the custom errors in the `manifest.json` file.

For instance, if you want to use it in the `kuzzle-plugin-logger`, you should have an `errors` field in its `manifest.json`. The file should look:
```
{
    "name": "kuzzle-plugin-logger",
    "kuzzleVersion": ">=1.0.0 <2.0.0",
    "privileged": false,
    "errors": {
        "unknown_service": {
            "code": 1,
            "message": "[kuzzle-plugin-logger] Unable to find service %s",
            "class": "InternalError"
        },
        "some_error": {
            "code": 2,
            "message": "Some error occured %s",
            "class": "BadRequestError"
	},
        "some_other_error": {
            "code": 3,
            "message": "Some other error occured %s",
            "class": "ForbiddenError"
	}
    }
}

```
In the `plugins.json` (so the `plugins` domain) will be added a `kuzzle-plugin-logger` subdomain with its `errors` field filled by the one defined in the `manifest.json`.

The code of the subdomain is either `0x00` or defined in the `kuzzlerc`.
For instance, your kuzzlerc would be :

```
{
  "plugins": {
    "my-plugins": {
      "foo": "bar",
      "gordon": "freeman",
      "some": "stuff",
      "codes": {
          "my-plugins": 42
      }
    }
  }
}
```

For officials released plugins, they are now defined in the `default.config` of Kuzzle

### How should this be manually tested?

Guess what: in order to test it you need... a plugin. Yes.

For instance you can test it with the `kuzzle-plugin-logger`.
Go to the root of the plugin, and add an `errors` field in the `manifest.json` like above.

Now, if you want to throw an error, you will have to write

`context.errorsManager.throw(errorName, placeholders)`

[So here](https://github.com/kuzzleio/kuzzle-plugin-logger/blob/master/lib/index.js#L56), you could replace the line by 
`context.errorsManager.throw(unknown_service, serviceName)`

Trigger that error, and you will see the right message with the right error name
Fix cache roles and profiles (#1433)
This PR fixes the way that we store a role and a profile after writing on it.
Before that, what was stored was the content of the request, and so was different from what was stored in ES.
While using getRole and searchRoles : result was different. searchRoles has the expected behavior since it don't load it from the cache.
run codecov only after success (#1440)
What does this PR do?
Just changes .travis.yml to run codecov only after success.
Allow uppercased plugins (#1430)
## What does this PR do ?

This PR allows plugins to use uppercase letters in their names. 
Actually, all checks related to elasticsearch index creation were already in place (handled in the plugin context). The PR only implements dedupe checks on plugin init.
Add cluster plugin to default plugins (#1423)
What does this PR do?
=====================

Add cluster plugin to default plugins but disable it by default

* Add cluster submodule to plugins/available folder.
* Update Docker scripts to also install dependencies for 'available
plugins'.
* Update documentation

Other changes
=============

Add a new environment variable `$KUZZLE_PLUGINS` to enable plugins "on
the fly" when running Kuzzle using Docker & Docker Compose
Add documentation of the errors manager (#1395)
Adds the documentation about the customization of Kuzzle errors with the errors manager recently added to Kuzzle.
Fix hydrating a profile with unexisting role (#1437)
## What does this PR do ?

PR on 2dev #1438

This PR prevents to Update/Create/Replace a profile with a role who doesn't exist.
Before that, we could do it, and the route `searchProfiles` returned an error.
Since the list of the profiles in the admin console works with this route, it didn't display the list anymore.

### How should this be manually tested?

Open the admin console and update a profile with a roleId who does not exist.
Or do it with curl directly.

### Other changes

<!--
  Please describe here all changes not directly linked to the main issue, but made because of it.
  For instance: issues spotted during this PR and fixed on-the-fly, dependencies update, and so on
-->

### Boyscout

<!--
  Describe here minor improvements in the code base and not directly linked to the main changes:
  typos fixes, better/new comments, small code simplification, new debug messages, and so on.
-->
Fix a bug that prevents Kuzzle to shutdown (#1454)
What does this PR do ?

When Kuzzle is running without PM2, it could never be stopped gracefully because of an uncaught exception in the halt() function caused by calling this function without the Kuzzle object.
After the exception, Kuzzle will discard new request but it will not shutdown.
fix init indices containing a dot (#1455)
This PR fixes the case where Kuzzle would crash on start because of some existing elasticsearch indices containing a dot (.) in their name.

@Aschen Aschen added the release label Sep 9, 2019

@codecov

This comment has been minimized.

Copy link

commented Sep 9, 2019

Codecov Report

Merging #1457 into master will decrease coverage by 0.1%.
The diff coverage is 93.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1457      +/-   ##
==========================================
- Coverage   93.94%   93.83%   -0.11%     
==========================================
  Files         106      106              
  Lines        7312     7430     +118     
==========================================
+ Hits         6869     6972     +103     
- Misses        443      458      +15
Impacted Files Coverage Δ
lib/api/core/entrypoints/proxy/index.js 100% <ø> (ø) ⬆️
lib/config/httpRoutes.js 100% <ø> (ø) ⬆️
lib/api/core/indexCache.js 97.64% <ø> (ø) ⬆️
lib/util/shutdown.js 11.42% <0%> (ø) ⬆️
lib/api/controllers/memoryStorageController.js 99.09% <100%> (ø) ⬆️
lib/api/core/models/repositories/repository.js 98.51% <100%> (+0.75%) ⬆️
lib/config/index.js 89.47% <100%> (ø) ⬆️
...entrypoints/embedded/service/httpFormDataStream.js 100% <100%> (ø) ⬆️
lib/api/controllers/indexController.js 100% <100%> (ø) ⬆️
...i/core/entrypoints/embedded/protocols/websocket.js 96.95% <100%> (+0.01%) ⬆️
... and 58 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c2f8abb...f928411. Read the comment docs.

1 similar comment
@codecov

This comment has been minimized.

Copy link

commented Sep 9, 2019

Codecov Report

Merging #1457 into master will decrease coverage by 0.1%.
The diff coverage is 93.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1457      +/-   ##
==========================================
- Coverage   93.94%   93.83%   -0.11%     
==========================================
  Files         106      106              
  Lines        7312     7430     +118     
==========================================
+ Hits         6869     6972     +103     
- Misses        443      458      +15
Impacted Files Coverage Δ
lib/api/core/entrypoints/proxy/index.js 100% <ø> (ø) ⬆️
lib/config/httpRoutes.js 100% <ø> (ø) ⬆️
lib/api/core/indexCache.js 97.64% <ø> (ø) ⬆️
lib/util/shutdown.js 11.42% <0%> (ø) ⬆️
lib/api/controllers/memoryStorageController.js 99.09% <100%> (ø) ⬆️
lib/api/core/models/repositories/repository.js 98.51% <100%> (+0.75%) ⬆️
lib/config/index.js 89.47% <100%> (ø) ⬆️
...entrypoints/embedded/service/httpFormDataStream.js 100% <100%> (ø) ⬆️
lib/api/controllers/indexController.js 100% <100%> (ø) ⬆️
...i/core/entrypoints/embedded/protocols/websocket.js 96.95% <100%> (+0.01%) ⬆️
... and 58 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c2f8abb...f928411. Read the comment docs.

@kuzzle

This comment has been minimized.

Copy link
Contributor

commented Sep 9, 2019

SonarQube analysis reported 2 issues

Note: The following issues were found on lines that were not modified in the pull request. Because these issues can't be reported as line comments, they are summarized here:

  1. INFO pluginsManager.js#L970: Complete the task associated to this TODO comment. rule
  2. INFO index.js#L101: Complete the task associated to this TODO comment. rule

@Aschen Aschen merged commit d6b2142 into master Sep 9, 2019

6 of 9 checks passed

Header rules No header rules processed
Details
Pages changed 481 new files uploaded
Details
Redirect rules No redirect rules processed
Details
LGTM analysis: JavaScript No new or fixed alerts
Details
Mixed content No mixed content detected
Details
codecov/project 93.83% (-0.11%) compared to c2f8abb
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details
sonarqube SonarQube reported 2 issues, no criticals or blockers

@Aschen Aschen deleted the 1.10.0-proposal branch Sep 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants
You can’t perform that action at this time.