aserto-dev / topaz

Cloud-native authorization for modern applications and APIs
https://www.topaz.sh
Apache License 2.0
1.08k stars 25 forks source link

Import status #436

Closed gertd closed 2 months ago

gertd commented 2 months ago

This PR adds import status feedback to topaz ds import and topaz ds restore.

The Importer service will return an ImportStatus message when a content or model validation error occurs in the return stream to the import client.

For example:

❯ topaz ds import -i -d ./assets/acmecorp

>>> importing data from ./assets/acmecorp
error     : "object.id" cannot contain any spaces or other whitespace characters - InvalidArgument (3)
error     : "uses": object type not found - NotFound (5)
error     : "user:managers": relation not found - NotFound (5)
error     : "users": object type not found - NotFound (5)
error     : "relation.relation" must be all lowercase, start with a letter, can contain letters, digits, dots, underscores, and dashes, and must end with a letter or digit - InvalidArgument (3)
error     : "relation.object_type" must be all lowercase, start with a letter, can contain letters, digits, dots, underscores, and dashes, and must end with a letter or digit - InvalidArgument (3)
error     : "relation.relation" must be all lowercase, start with a letter, can contain letters, digits, dots, underscores, and dashes, and must end with a letter or digit - InvalidArgument (3)
error     : "relation.subject_type" must be all lowercase, start with a letter, can contain letters, digits, dots, underscores, and dashes, and must end with a letter or digit - InvalidArgument (3)
error     : "groups": object type not found - NotFound (5)
error     : "groups": object type not found - NotFound (5)
error     : "groups": object type not found - NotFound (5)
objects   : 839 (set:837 delete:0 error:2)
relations : 1905 (set:1896 delete:0 error:9)

Content validation errors appear as an InvalidArgument (status code 3) error with a description of the specific failed validation condition.

Model validation errors appear as an NotFound (status code 5) error with a description detailing the object or relation type not found in the manifest.

The ImportStatus message contains the import request instance that caused the error, see: https://buf.build/aserto-dev/directory/docs/v0.31.6:aserto.directory.importer.v3#aserto.directory.importer.v3.ImportStatus

coveralls commented 2 months ago

Pull Request Test Coverage Report for Build 10257160681

Details


Files with Coverage Reduction New Missed Lines %
pkg/cli/cc/ports.go 6 76.27%
<!-- Total: 6 -->
Totals Coverage Status
Change from base Build 10181919497: -0.1%
Covered Lines: 1326
Relevant Lines: 4677

💛 - Coveralls