Aircloak / aircloak

This repository contains the Aircloak Air frontend as well as the code for our Cloak query and anonymization platform
2 stars 0 forks source link

Add notes for queries #4915

Closed edongashi closed 3 years ago

edongashi commented 3 years ago

Adds support for setting and seeing notes on your queries.

I think this is a good point to split up the PR. The page with all queries and filtering will come later.

aircloak-robot commented 3 years ago

air_test job errored 😞

You can see the full build log by running: ci/production.sh build_log pr 4915 air_test

You can restart the build by running: ci/production.sh force_build pr 4915 air_test

You can start the remote console by running: ci/production.sh remote_console pr 4915 air

Log tail:

  String.t(),
  parameters(),
  Air.Service.View.view_map(),
  Air.Service.AnalystTable.analyst_table_map()
) :: :ok | {:error, any()}" but it is undefined or private
  lib/air_web/socket/cloak/main_channel.ex:24: AirWeb.Socket.Cloak.MainChannel.run_query/8

warning: documentation references "([Map.t()]) :: :ok" but it is undefined or private
  lib/air_web/socket/frontend/cloak_stats_channel.ex:9: AirWeb.Socket.Frontend.CloakStatsChannel.broadcast_cloak_stats/1

warning: documentation references "([Map.t()]) :: [Map.t()]" but it is undefined or private
  lib/air_web/views/view_helpers.ex:55: AirWeb.ViewHelpers.order_by_id/1

warning: documentation references "()]) :: [Map.t()" but it is undefined or private
  lib/air_web/views/view_helpers.ex:55: AirWeb.ViewHelpers.order_by_id/1

warning: documentation references file "elixir-lang.org/" but it does not exist
  README.md

warning: documentation references file "../macos_docker.md" but it does not exist
  README.md

View "epub" docs at "doc/air.epub"
=> 10 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_hw2yYCXdShycV-N5LO1WLQ make eslint`
cd assets && yarn lint
yarn run v1.22.5
warning package.json: No license field
$ eslint --max-warnings 0 js test && prettier --version && prettier --no-config -c css/**.css "../*.md" "../priv/**/*.md"
2.1.2
Checking formatting...
All matched files use Prettier code style!
Done in 10.91s.
=> 12 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_hw2yYCXdShycV-N5LO1WLQ make flow`
cd assets && node_modules/.bin/flow check
Error ---------------------------------------------------------------------------------------- js/queries/root.js:269:27

Could not decide which case to select, since case 2 [1] may work but if it doesn't case 3 [2] looks promising too. To
fix add a type annotation to object literal [3]. [speculation-ambiguous]

   js/queries/root.js:269:27
   269|         r.id !== id ? r : { ...r, note: note }
                                  ^^^^^^^^^^^^^^^^^^^^ [3]

References:
   js/queries/result.js:77:5
    77|   | PendingResult
            ^^^^^^^^^^^^^ [1]
   js/queries/result.js:78:5
    78|   | CancelledResult
            ^^^^^^^^^^^^^^^ [2]

Found 1 error
make: *** [Makefile:65: flow] Error 2
=> 75 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_hw2yYCXdShycV-N5LO1WLQ MIX_ENV=test ./check_warnings.sh`

13:13:30.480 [info]  Compiling auto-completions
=> 7 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_hw2yYCXdShycV-N5LO1WLQ MIX_ENV=test mix lint`
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByDef
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByFn
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByCase
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByAssignment
Checking 73 source files (this might take a while) ...

info: some checks were skipped because they're not compatible with
your version of Elixir (1.11.1).

You can deactivate these checks by adding this to the `checks` list in your config:

    {Credo.Check.Refactor.MapInto, false},
    {Credo.Check.Warning.LazyLogging, false},

  Code Readability                                                              
┃ 
┃ [R] ↘ There should be no trailing white-space at the end of a line.
┃       test/controllers/query_controller_test.exs:140:1 #(AirWeb.QueryController.Test)

Please report incorrect results: https://github.com/rrrene/credo/issues

Analysis took 2.5 seconds (0.1s to load, 2.4s running 45 checks on 73 files)
228 mods/funs, found 1 code readability issue.

=> 6 sec

aircloak_ci: error: 
error running `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_hw2yYCXdShycV-N5LO1WLQ make flow`
error running `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_hw2yYCXdShycV-N5LO1WLQ MIX_ENV=test mix lint`
aircloak_ci: result: `error`
aircloak_ci: finished in 2:23 min
aircloak-robot commented 3 years ago

air_test job errored 💔

You can see the full build log by running: ci/production.sh build_log pr 4915 air_test

You can restart the build by running: ci/production.sh force_build pr 4915 air_test

You can start the remote console by running: ci/production.sh remote_console pr 4915 air

Log tail:


warning: documentation references "([Map.t()]) :: [Map.t()]" but it is undefined or private
  lib/air_web/views/view_helpers.ex:55: AirWeb.ViewHelpers.order_by_id/1

warning: documentation references "()]) :: [Map.t()" but it is undefined or private
  lib/air_web/views/view_helpers.ex:55: AirWeb.ViewHelpers.order_by_id/1

warning: documentation references file "elixir-lang.org/" but it does not exist
  README.md

warning: documentation references file "../macos_docker.md" but it does not exist
  README.md

View "epub" docs at "doc/air.epub"
=> 10 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_2HBd6XVLdwhTmYlclb-dkw make eslint`
cd assets && yarn lint
yarn run v1.22.5
warning package.json: No license field
$ eslint --max-warnings 0 js test && prettier --version && prettier --no-config -c css/**.css "../*.md" "../priv/**/*.md"
2.1.2
Checking formatting...
All matched files use Prettier code style!
Done in 11.35s.
=> 13 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_2HBd6XVLdwhTmYlclb-dkw make flow`
cd assets && node_modules/.bin/flow check
Found 0 errors
=> 74 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_2HBd6XVLdwhTmYlclb-dkw mix lint`
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByDef
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByFn
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByCase
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByAssignment
Checking 187 source files (this might take a while) ...

info: some checks were skipped because they're not compatible with
your version of Elixir (1.11.1).

You can deactivate these checks by adding this to the `checks` list in your config:

    {Credo.Check.Refactor.MapInto, false},
    {Credo.Check.Warning.LazyLogging, false},

  Refactoring opportunities                                                     
┃ 
┃ [F] ↗ `with` contains only one <- clause and an `else` branch, use a `case` 
┃       instead
┃       lib/air_web/controllers/query_controller.ex:168 #(AirWeb.QueryController.update_note)

Please report incorrect results: https://github.com/rrrene/credo/issues

Analysis took 6.2 seconds (0.5s to load, 5.7s running 46 checks on 187 files)
1997 mods/funs, found 1 refactoring opportunity.

=> 9 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_2HBd6XVLdwhTmYlclb-dkw MIX_ENV=test ./check_warnings.sh`

13:25:09.090 [info]  Compiling auto-completions
=> 7 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_2HBd6XVLdwhTmYlclb-dkw MIX_ENV=test mix lint`
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByDef
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByFn
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByCase
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByAssignment
Checking 73 source files (this might take a while) ...

info: some checks were skipped because they're not compatible with
your version of Elixir (1.11.1).

You can deactivate these checks by adding this to the `checks` list in your config:

    {Credo.Check.Refactor.MapInto, false},
    {Credo.Check.Warning.LazyLogging, false},

  Code Readability                                                              
┃ 
┃ [R] ↘ There should be no trailing white-space at the end of a line.
┃       test/controllers/query_controller_test.exs:140:1 #(AirWeb.QueryController.Test)

Please report incorrect results: https://github.com/rrrene/credo/issues

Analysis took 2.6 seconds (0.1s to load, 2.4s running 45 checks on 73 files)
228 mods/funs, found 1 code readability issue.

=> 5 sec

aircloak_ci: error: 
error running `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_2HBd6XVLdwhTmYlclb-dkw mix lint`
error running `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_2HBd6XVLdwhTmYlclb-dkw MIX_ENV=test mix lint`
aircloak_ci: result: `error`
aircloak_ci: finished in 2:27 min
aircloak-robot commented 3 years ago

air_test job errored 👿

You can see the full build log by running: ci/production.sh build_log pr 4915 air_test

You can restart the build by running: ci/production.sh force_build pr 4915 air_test

You can start the remote console by running: ci/production.sh remote_console pr 4915 air

Log tail:

warning: documentation references "()]) :: [Map.t()" but it is undefined or private
  lib/air_web/views/view_helpers.ex:55: AirWeb.ViewHelpers.order_by_id/1

warning: documentation references file "elixir-lang.org/" but it does not exist
  README.md

warning: documentation references file "../macos_docker.md" but it does not exist
  README.md

View "epub" docs at "doc/air.epub"
=> 10 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_M5637ydR3Mvzk_ltHs4wJg make eslint`
cd assets && yarn lint
yarn run v1.22.5
warning package.json: No license field
$ eslint --max-warnings 0 js test && prettier --version && prettier --no-config -c css/**.css "../*.md" "../priv/**/*.md"
2.1.2
Checking formatting...
All matched files use Prettier code style!
Done in 10.88s.
=> 11 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_M5637ydR3Mvzk_ltHs4wJg make flow`
cd assets && node_modules/.bin/flow check
Found 0 errors
=> 73 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_M5637ydR3Mvzk_ltHs4wJg mix lint`
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByDef
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByFn
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByCase
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByAssignment
Checking 187 source files (this might take a while) ...

info: some checks were skipped because they're not compatible with
your version of Elixir (1.11.1).

You can deactivate these checks by adding this to the `checks` list in your config:

    {Credo.Check.Refactor.MapInto, false},
    {Credo.Check.Warning.LazyLogging, false},

Please report incorrect results: https://github.com/rrrene/credo/issues

Analysis took 6.6 seconds (0.5s to load, 6.1s running 46 checks on 187 files)
1997 mods/funs, found no issues.

=> 10 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_M5637ydR3Mvzk_ltHs4wJg make check-format`
mix format --check-formatted
** (Mix) mix format failed due to --check-formatted.
The following files are not formatted:

  * test/controllers/query_controller_test.exs

make: *** [Makefile:82: check-format] Error 1
=> 2 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_M5637ydR3Mvzk_ltHs4wJg MIX_ENV=test ./check_warnings.sh`

13:32:58.186 [info]  Compiling auto-completions
=> 6 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_M5637ydR3Mvzk_ltHs4wJg MIX_ENV=test mix lint`
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByDef
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByFn
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByCase
** (config) Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByAssignment
Checking 73 source files (this might take a while) ...

info: some checks were skipped because they're not compatible with
your version of Elixir (1.11.1).

You can deactivate these checks by adding this to the `checks` list in your config:

    {Credo.Check.Refactor.MapInto, false},
    {Credo.Check.Warning.LazyLogging, false},

  Code Readability                                                              
┃ 
┃ [R] ↘ There should be no trailing white-space at the end of a line.
┃       test/controllers/query_controller_test.exs:140:1 #(AirWeb.QueryController.Test)

Please report incorrect results: https://github.com/rrrene/credo/issues

Analysis took 2.6 seconds (0.1s to load, 2.4s running 45 checks on 73 files)
228 mods/funs, found 1 code readability issue.

=> 5 sec

aircloak_ci: error: 
error running `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_M5637ydR3Mvzk_ltHs4wJg make check-format`
error running `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_M5637ydR3Mvzk_ltHs4wJg MIX_ENV=test mix lint`
aircloak_ci: result: `error`
aircloak_ci: finished in 2:25 min
aircloak-robot commented 3 years ago

Standard tests have passed 👍

aircloak-robot commented 3 years ago

air_test job errored 👿

You can see the full build log by running: ci/production.sh build_log pr 4915 air_test

You can restart the build by running: ci/production.sh force_build pr 4915 air_test

You can start the remote console by running: ci/production.sh remote_console pr 4915 air

Log tail:

]" but it is undefined or private
  lib/air/service/explorer.ex:145: Air.Service.Explorer.results_for_datasource/1

warning: documentation references "()) :: {:ok, :eldap.filter()" but it is undefined or private
  lib/air/service/ldap/filter_parser.ex:14: Air.Service.LDAP.FilterParser.parse/1

warning: documentation references "(Map.t()) :: {:ok, Air.Schemas.User.t()} | :error" but it is undefined or private
  lib/air/service/user.ex:465: Air.Service.User.add_preconfigured_user/1

warning: documentation references "() | nil) :: Map.t()" but it is undefined or private
  lib/air/service/user.ex:425: Air.Service.User.number_format_settings/1

warning: documentation references "(), Map.t())" but it is undefined or private
  lib/air/service/user.ex:69: Air.Service.User.reset_password/2

warning: documentation references "(), Air.Service.DataSource.t()) :: [Air.Schemas.View.t()" but it is undefined or private
  lib/air/service/view.ex:46: Air.Service.View.all/2

warning: documentation references "(
  Air.Schemas.User.t(),
  Air.Service.DataSource.t(),
  String.t(),
  String.t(),
  String.t() | nil,
  revalidation_timeout: non_neg_integer(),
  skip_revalidation: boolean()
) :: {:ok, Air.Schemas.View.t()} | {:error, Ecto.Changeset.t()}" but it is undefined or private
  lib/air/service/view.ex:58: Air.Service.View.create/6

warning: documentation references "(nil | Calendar.date_time()) :: String.t()" but it is undefined or private
  lib/air/utils/date_time.ex:6: Air.Utils.DateTime.time_ago/1

warning: documentation references "(
  pid(),
  String.t(),
  String.t(),
  String.t(),
  String.t(),
  parameters(),
  Air.Service.View.view_map(),
  Air.Service.AnalystTable.analyst_table_map()
) :: :ok | {:error, any()}" but it is undefined or private
  lib/air_web/socket/cloak/main_channel.ex:24: AirWeb.Socket.Cloak.MainChannel.run_query/8

warning: documentation references "([Map.t()]) :: :ok" but it is undefined or private
  lib/air_web/socket/frontend/cloak_stats_channel.ex:9: AirWeb.Socket.Frontend.CloakStatsChannel.broadcast_cloak_stats/1

warning: documentation references "([Map.t()]) :: [Map.t()]" but it is undefined or private
  lib/air_web/views/view_helpers.ex:55: AirWeb.ViewHelpers.order_by_id/1

warning: documentation references "()]) :: [Map.t()" but it is undefined or private
  lib/air_web/views/view_helpers.ex:55: AirWeb.ViewHelpers.order_by_id/1

warning: documentation references file "elixir-lang.org/" but it does not exist
  README.md

warning: documentation references file "../macos_docker.md" but it does not exist
  README.md

View "epub" docs at "doc/air.epub"
=> 9 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_xrEVZuhLUT_wN7ekaRV8hA make eslint`
cd assets && yarn lint
yarn run v1.22.5
warning package.json: No license field
$ eslint --max-warnings 0 js test && prettier --version && prettier --no-config -c css/**.css "../*.md" "../priv/**/*.md"
2.1.2
Checking formatting...
All matched files use Prettier code style!
Done in 13.20s.
=> 15 sec

aircloak_ci: `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_xrEVZuhLUT_wN7ekaRV8hA make flow`
cd assets && node_modules/.bin/flow check
Error ----------------------------------------------------------------------------------- js/queries/query_note.js:25:30

Cannot call `updateNote` with `null` bound to `note` because null [1] is incompatible with string [2].
[incompatible-call]

   js/queries/query_note.js:25:30
   25|               updateNote(id, null);
                                    ^^^^ [1]

References:
   js/queries/query_note.js:8:35
    8|   updateNote?: (id: string, note: string) => void,
                                         ^^^^^^ [2]

Found 1 error
make: *** [Makefile:65: flow] Error 2
=> 76 sec

aircloak_ci: error: 
error running `/home/ci/.aircloak_ci/data/cache/builds/pr-4915/src/air/ci/container.sh run_in_container aircloak_ci_xrEVZuhLUT_wN7ekaRV8hA make flow`
aircloak_ci: result: `error`
aircloak_ci: finished in 6:39 min
aircloak-robot commented 3 years ago

Standard tests have passed 😊

edongashi commented 3 years ago

Ready for re-review. Meanwhile I'm prototyping an "all queries" page.

aircloak-robot commented 3 years ago

Pull request can be merged 🎉